SPB Git forge

spb/admin-ka-ios

Public
5commits 1branches 0releases
204.0 KBsize
maindefault branch
1 mo agolast push
Swift 100%

fix bypass iOS : panneaux JS natifs (alert/confirm/prompt) via WKUIDelegate — confirm() fonctionnait pas → bypass mort. Build 1.0.0(2)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Simon-Pierre Boucher committed 1 mo ago (Aug 21, 2026) parent 6a53e8c

4 changed files +38 −5

modified AdminKa.xcodeproj/project.pbxproj +2 −2
@@ -195,7 +195,7 @@
195 195 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
196 196 CODE_SIGN_STYLE = Automatic;
197 197 COPY_PHASE_STRIP = NO;
198 CURRENT_PROJECT_VERSION = 1;
198 + CURRENT_PROJECT_VERSION = 2;
199 199 DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
200 200 DEVELOPMENT_TEAM = 3YM54G49SN;
201 201 ENABLE_NS_ASSERTIONS = NO;
@@ -272,7 +272,7 @@
272 272 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
273 273 CODE_SIGN_STYLE = Automatic;
274 274 COPY_PHASE_STRIP = NO;
275 CURRENT_PROJECT_VERSION = 1;
275 + CURRENT_PROJECT_VERSION = 2;
276 276 DEBUG_INFORMATION_FORMAT = dwarf;
277 277 DEVELOPMENT_TEAM = 3YM54G49SN;
278 278 ENABLE_STRICT_OBJC_MSGSEND = YES;
modified Sources/Info.plist +1 −1
@@ -19,7 +19,7 @@
19 19 <key>CFBundleShortVersionString</key>
20 20 <string>1.0.0</string>
21 21 <key>CFBundleVersion</key>
22 <string>1</string>
22 + <string>2</string>
23 23 <key>NSAppTransportSecurity</key>
24 24 <dict>
25 25 <key>NSAllowsArbitraryLoads</key>
modified Sources/WebView.swift +33 −0
@@ -96,6 +96,39 @@ struct WebView: UIViewRepresentable {
96 96 if let url = navigationAction.request.url { UIApplication.shared.open(url) }
97 97 return nil
98 98 }
99 +
100 + // --- Panneaux JavaScript natifs (indispensables : sans eux confirm()
101 + // --- ne s'affiche pas → le mode BYPASS et les confirmations restent morts) ---
102 + private func topVC(_ webView: WKWebView) -> UIViewController? {
103 + var vc = webView.window?.rootViewController
104 + while let p = vc?.presentedViewController { vc = p }
105 + return vc
106 + }
107 + func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String,
108 + initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) {
109 + let a = UIAlertController(title: nil, message: message, preferredStyle: .alert)
110 + a.addAction(UIAlertAction(title: "OK", style: .default) { _ in completionHandler() })
111 + guard let vc = topVC(webView) else { completionHandler(); return }
112 + vc.present(a, animated: true)
113 + }
114 + func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String,
115 + initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) {
116 + let a = UIAlertController(title: nil, message: message, preferredStyle: .alert)
117 + a.addAction(UIAlertAction(title: "Annuler", style: .cancel) { _ in completionHandler(false) })
118 + a.addAction(UIAlertAction(title: "OK", style: .default) { _ in completionHandler(true) })
119 + guard let vc = topVC(webView) else { completionHandler(false); return }
120 + vc.present(a, animated: true)
121 + }
122 + func webView(_ webView: WKWebView, runJavaScriptTextInputPanelWithPrompt prompt: String,
123 + defaultText: String?, initiatedByFrame frame: WKFrameInfo,
124 + completionHandler: @escaping (String?) -> Void) {
125 + let a = UIAlertController(title: nil, message: prompt, preferredStyle: .alert)
126 + a.addTextField { $0.text = defaultText }
127 + a.addAction(UIAlertAction(title: "Annuler", style: .cancel) { _ in completionHandler(nil) })
128 + a.addAction(UIAlertAction(title: "OK", style: .default) { _ in completionHandler(a.textFields?.first?.text) })
129 + guard let vc = topVC(webView) else { completionHandler(nil); return }
130 + vc.present(a, animated: true)
131 + }
99 132 func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction,
100 133 decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
101 134 if let url = navigationAction.request.url, let host = url.host,
modified project.yml +2 −2
@@ -7,7 +7,7 @@ options:
7 7 settings:
8 8 base:
9 9 MARKETING_VERSION: "1.0.0"
10 CURRENT_PROJECT_VERSION: "1"
10 + CURRENT_PROJECT_VERSION: "2"
11 11 DEVELOPMENT_TEAM: "3YM54G49SN"
12 12 CODE_SIGN_STYLE: Automatic
13 13 SWIFT_VERSION: "5.0"
@@ -23,7 +23,7 @@ targets:
23 23 properties:
24 24 CFBundleDisplayName: Admin-Ka
25 25 CFBundleShortVersionString: "1.0.0"
26 CFBundleVersion: "1"
26 + CFBundleVersion: "2"
27 27 UILaunchScreen:
28 28 UIColorName: LaunchBackground
29 29 UISupportedInterfaceOrientations:
30 30