Skip to content

Commit

Permalink
Update iOS App-Prefs strings
Browse files Browse the repository at this point in the history
  • Loading branch information
insin committed Dec 13, 2024
1 parent ca43fdf commit 1fc80df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion safari/Shared (App)/Resources/Script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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…'
}
}

Expand Down
16 changes: 12 additions & 4 deletions safari/Shared (App)/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1fc80df

Please sign in to comment.