Default to open in browser for macOS

This commit is contained in:
Thomas Ricouard 2023-01-19 11:59:12 +01:00
parent 09c09d5ea9
commit 4fd0dddf98
2 changed files with 12 additions and 10 deletions

View File

@ -23,7 +23,7 @@ private struct SafariRouter: ViewModifier {
})
.onAppear {
routerPath.urlHandler = { url in
guard preferences.preferredBrowser == .inAppSafari else { return .systemAction }
guard preferences.preferredBrowser == .inAppSafari, !ProcessInfo.processInfo.isiOSAppOnMac else { return .systemAction }
// SFSafariViewController only supports initial URLs with http:// or https:// schemes.
guard let scheme = url.scheme, ["https", "http"].contains(scheme.lowercased()) else {
return .systemAction

View File

@ -91,17 +91,19 @@ struct SettingsTabs: View {
NavigationLink(destination: remoteLocalTimelinesView) {
Label("Remote Local Timelines", systemImage: "dot.radiowaves.right")
}
Picker(selection: $preferences.preferredBrowser) {
ForEach(PreferredBrowser.allCases, id: \.rawValue) { browser in
switch browser {
case .inAppSafari:
Text("In-App Safari").tag(browser)
case .safari:
Text("System Safari").tag(browser)
if !ProcessInfo.processInfo.isiOSAppOnMac {
Picker(selection: $preferences.preferredBrowser) {
ForEach(PreferredBrowser.allCases, id: \.rawValue) { browser in
switch browser {
case .inAppSafari:
Text("In-App Safari").tag(browser)
case .safari:
Text("System Safari").tag(browser)
}
}
} label: {
Label("Browser", systemImage: "network")
}
} label: {
Label("Browser", systemImage: "network")
}
}
.listRowBackground(theme.primaryBackgroundColor)