From 1fc80df2b28c3983ba5a73485af39e37454be8de Mon Sep 17 00:00:00 2001 From: Jonny Buchanan Date: Sat, 14 Dec 2024 03:54:10 +1000 Subject: [PATCH] Update iOS App-Prefs strings --- safari/Shared (App)/Resources/Script.js | 2 +- safari/Shared (App)/ViewController.swift | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/safari/Shared (App)/Resources/Script.js b/safari/Shared (App)/Resources/Script.js index 19480d5..24a7ac8 100644 --- a/safari/Shared (App)/Resources/Script.js +++ b/safari/Shared (App)/Resources/Script.js @@ -17,7 +17,7 @@ function show(platform, enabled, useSettingsInsteadOfPreferences) { } if (platform === 'ios') { - document.querySelector('.open-preferences').innerText = 'Open Safari Extensions Preferencesā€¦' + document.querySelector('.open-preferences').innerText = 'Open Safari Settingsā€¦' } } diff --git a/safari/Shared (App)/ViewController.swift b/safari/Shared (App)/ViewController.swift index 43aa115..c235556 100644 --- a/safari/Shared (App)/ViewController.swift +++ b/safari/Shared (App)/ViewController.swift @@ -62,11 +62,19 @@ class ViewController: PlatformViewController, WKNavigationDelegate, WKScriptMess return } #if os(iOS) - let url = URL(string: "App-Prefs:Safari&path=WEB_EXTENSIONS")! - guard UIApplication.shared.canOpenURL(url) else { - return + if #available(iOS 18.0, *) { + let url = URL(string: "App-Prefs:com.apple.mobilesafari")! + guard UIApplication.shared.canOpenURL(url) else { + return + } + UIApplication.shared.open(url) + } else { + let url = URL(string: "App-Prefs:Safari&path=WEB_EXTENSIONS")! + guard UIApplication.shared.canOpenURL(url) else { + return + } + UIApplication.shared.open(url) } - UIApplication.shared.open(url) #elseif os(macOS) SFSafariApplication.showPreferencesForExtension(withIdentifier: extensionBundleIdentifier) { error in guard error == nil else {