forked from shadowfacts/Tusker
visionOS: Disable in-app Safari
This commit is contained in:
parent
0f6492a051
commit
f122383d0b
|
@ -57,12 +57,14 @@ struct BehaviorPrefsView: View {
|
|||
Toggle(isOn: $preferences.openLinksInApps) {
|
||||
Text("Open Links in Apps")
|
||||
}
|
||||
#if !os(visionOS)
|
||||
Toggle(isOn: $preferences.useInAppSafari) {
|
||||
Text("Use In-App Safari")
|
||||
}
|
||||
Toggle(isOn: $preferences.inAppSafariAutomaticReaderMode) {
|
||||
Text("Always Use Reader Mode in In-App Safari")
|
||||
}.disabled(!preferences.useInAppSafari)
|
||||
#endif
|
||||
}
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
|
|
@ -46,14 +46,15 @@ extension TuskerNavigationDelegate {
|
|||
|
||||
func selected(url: URL, allowResolveStatuses: Bool = true, allowUniversalLinks: Bool = true) {
|
||||
func openSafari() {
|
||||
#if os(visionOS)
|
||||
UIApplication.shared.open(url)
|
||||
#else
|
||||
if Preferences.shared.useInAppSafari,
|
||||
url.scheme == "https" || url.scheme == "http" {
|
||||
let config = SFSafariViewController.Configuration()
|
||||
config.entersReaderIfAvailable = Preferences.shared.inAppSafariAutomaticReaderMode
|
||||
let vc = SFSafariViewController(url: url, configuration: config)
|
||||
#if !os(visionOS)
|
||||
vc.preferredControlTintColor = Preferences.shared.accentColor.color
|
||||
#endif
|
||||
present(vc, animated: true)
|
||||
} else if UIApplication.shared.canOpenURL(url) {
|
||||
UIApplication.shared.open(url, options: [:])
|
||||
|
@ -66,6 +67,7 @@ extension TuskerNavigationDelegate {
|
|||
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
|
||||
present(alert, animated: true)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if allowResolveStatuses,
|
||||
|
|
Loading…
Reference in New Issue