Skip to content

Commit 225ed91

Browse files
committed
feat: deb notice
Signed-off-by: 82Flex <82flex@gmail.com>
1 parent 9dc382f commit 225ed91

File tree

6 files changed

+90
-3
lines changed

6 files changed

+90
-3
lines changed

TrollFools/AuxiliaryExecute.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class AuxiliaryExecute {
5353
// no need to setup binary table
5454
// we will make call to it when you call the shell api
5555
// if you only use the spawn api
56-
// we don't need to setup the hole table cause it‘s time-heavy-task
56+
// we do not need to setup the hole table cause it is a time-heavy-task
5757
}
5858

5959
/// Execution Error, do the localization your self

TrollFools/OptionView.swift

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ struct OptionView: View {
1313
@State var isImporterPresented = false
1414
@State var isImporterSelected = false
1515

16+
@State var isWarningPresented = false
17+
@State var temporaryResult: Result<[URL], any Error>?
18+
1619
@State var isSettingsPresented = false
1720

1821
@State var importerResult: Result<[URL], any Error>?
@@ -22,6 +25,36 @@ struct OptionView: View {
2225
}
2326

2427
var body: some View {
28+
if #available(iOS 15, *) {
29+
content
30+
.alert(
31+
NSLocalizedString("Notice", comment: ""),
32+
isPresented: $isWarningPresented,
33+
presenting: temporaryResult
34+
) { result in
35+
Button(role: .destructive) {
36+
importerResult = result
37+
isImporterSelected = true
38+
} label: {
39+
Text(NSLocalizedString("Continue", comment: ""))
40+
}
41+
Button(role: .cancel) {
42+
temporaryResult = nil
43+
isWarningPresented = false
44+
} label: {
45+
Text(NSLocalizedString("Cancel", comment: ""))
46+
}
47+
} message: {
48+
if case .success(let urls) = $0 {
49+
Text(warningMessage(urls))
50+
}
51+
}
52+
} else {
53+
content
54+
}
55+
}
56+
57+
var content: some View {
2558
VStack(spacing: 80) {
2659
HStack {
2760
Spacer()
@@ -83,8 +116,19 @@ struct OptionView: View {
83116
allowsMultipleSelection: true
84117
) {
85118
result in
86-
importerResult = result
87-
isImporterSelected = true
119+
switch result {
120+
case .success(let theSuccess):
121+
if theSuccess.contains(where: { $0.pathExtension.lowercased() == "deb" }) {
122+
temporaryResult = result
123+
isWarningPresented = true
124+
} else {
125+
importerResult = result
126+
isImporterSelected = true
127+
}
128+
case .failure:
129+
importerResult = result
130+
isImporterSelected = true
131+
}
88132
}
89133
.sheet(isPresented: $isSettingsPresented) {
90134
if #available(iOS 16, *) {
@@ -95,4 +139,11 @@ struct OptionView: View {
95139
}
96140
}
97141
}
142+
143+
private func warningMessage(_ urls: [URL]) -> String {
144+
guard let firstDylibName = urls.first(where: { $0.pathExtension.lowercased() == "deb" })?.lastPathComponent else {
145+
fatalError("No debian package found.")
146+
}
147+
return String(format: NSLocalizedString("You’ve selected at least one Debian Package “%@”. We’re here to remind you that it will not work as it was in a jailbroken environment. Please make sure you know what you’re doing.", comment: ""), firstDylibName)
148+
}
98149
}

TrollFools/en.lproj/Localizable.strings

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
/* StripedTextTableViewController */
3535
"Confirm" = "Confirm";
3636

37+
/* No comment provided by engineer. */
38+
"Continue" = "Continue";
39+
3740
/* StripedTextTableViewController */
3841
"Copy" = "Copy";
3942

@@ -139,6 +142,9 @@
139142
/* No comment provided by engineer. */
140143
"No valid plug-ins found." = "No valid plug-ins found.";
141144

145+
/* No comment provided by engineer. */
146+
"Notice" = "Notice";
147+
142148
/* No comment provided by engineer. */
143149
"Only removable system applications are eligible and listed." = "Only removable system applications are eligible and listed.";
144150

@@ -228,3 +234,6 @@
228234

229235
/* No comment provided by engineer. */
230236
"You need to rebuild the icon cache in TrollStore to apply changes." = "You need to rebuild the icon cache in TrollStore to apply changes.";
237+
238+
/* No comment provided by engineer. */
239+
"You’ve selected at least one Debian Package “%@”. We’re here to remind you that it will not work as it was in a jailbroken environment. Please make sure you know what you’re doing." = "You’ve selected at least one Debian Package “%@”. We’re here to remind you that it will not work as it was in a jailbroken environment. Please make sure you know what you’re doing.";

TrollFools/it.lproj/Localizable.strings

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
/* StripedTextTableViewController */
3535
"Confirm" = "Conferma";
3636

37+
/* TODO */
38+
"Continue" = "Continue";
39+
3740
/* StripedTextTableViewController */
3841
"Copy" = "Copia";
3942

@@ -139,6 +142,9 @@
139142
/* No comment provided by engineer. */
140143
"No valid plug-ins found." = "Nessun plug-in valido trovato.";
141144

145+
/* TODO */
146+
"Notice" = "Notice";
147+
142148
/* No comment provided by engineer. */
143149
"Only removable system applications are eligible and listed." = "Solo le applicazioni di sistema removibili sono eleggibili e nella lista.";
144150

@@ -228,3 +234,6 @@
228234

229235
/* No comment provided by engineer. */
230236
"You need to rebuild the icon cache in TrollStore to apply changes." = "Devi ricostruire la cache delle icone in TrollStore per applicare le modifiche.";
237+
238+
/* TODO */
239+
"You’ve selected at least one Debian Package “%@”. We’re here to remind you that it will not work as it was in a jailbroken environment. Please make sure you know what you’re doing." = "You’ve selected at least one Debian Package “%@”. We’re here to remind you that it will not work as it was in a jailbroken environment. Please make sure you know what you’re doing.";

TrollFools/vi.lproj/Localizable.strings

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
/* No comment provided by engineer. */
3535
"Confirm" = "Xác nhận";
3636

37+
/* TODO */
38+
"Continue" = "Continue";
39+
3740
/* No comment provided by engineer. */
3841
"Copy" = "Sao chép";
3942

@@ -139,6 +142,9 @@
139142
/* No comment provided by engineer. */
140143
"No valid plug-ins found." = "Không tìm thấy plug-in hợp lệ.";
141144

145+
/* TODO */
146+
"Notice" = "Notice";
147+
142148
/* No comment provided by engineer. */
143149
"Only removable system applications are eligible and listed." = "Chỉ các ứng dụng hệ thống có thể gỡ bỏ và đủ điều kiện tiêm mới được liệt kê.";
144150

@@ -228,3 +234,6 @@
228234

229235
/* No comment provided by engineer. */
230236
"You need to rebuild the icon cache in TrollStore to apply changes." = "Bạn cần làm mới bộ nhớ đệm biểu tượng trong TrollStore để áp dụng các thay đổi.";
237+
238+
/* TODO */
239+
"You’ve selected at least one Debian Package “%@”. We’re here to remind you that it will not work as it was in a jailbroken environment. Please make sure you know what you’re doing." = "You’ve selected at least one Debian Package “%@”. We’re here to remind you that it will not work as it was in a jailbroken environment. Please make sure you know what you’re doing.";

TrollFools/zh-Hans.lproj/Localizable.strings

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
/* StripedTextTableViewController */
3535
"Confirm" = "确认";
3636

37+
/* No comment provided by engineer. */
38+
"Continue" = "继续";
39+
3740
/* StripedTextTableViewController */
3841
"Copy" = "拷贝";
3942

@@ -139,6 +142,9 @@
139142
/* No comment provided by engineer. */
140143
"No valid plug-ins found." = "没有找到有效的插件。";
141144

145+
/* No comment provided by engineer. */
146+
"Notice" = "提示";
147+
142148
/* No comment provided by engineer. */
143149
"Only removable system applications are eligible and listed." = "仅列出可移除的系统应用,其他系统应用不支持注入。";
144150

@@ -228,3 +234,6 @@
228234

229235
/* No comment provided by engineer. */
230236
"You need to rebuild the icon cache in TrollStore to apply changes." = "你需要在 TrollStore 中重建图标缓存以应用更改。";
237+
238+
/* No comment provided by engineer. */
239+
"You’ve selected at least one Debian Package “%@”. We’re here to remind you that it will not work as it was in a jailbroken environment. Please make sure you know what you’re doing." = "你至少选择了一个 Debian 软件包 “%@”。请留意,它通常不会像在越狱环境当中那样工作,甚至完全不起作用。请确保你知道自己在做些什么。";

0 commit comments

Comments
 (0)