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 { .onAppear {
routerPath.urlHandler = { url in 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. // SFSafariViewController only supports initial URLs with http:// or https:// schemes.
guard let scheme = url.scheme, ["https", "http"].contains(scheme.lowercased()) else { guard let scheme = url.scheme, ["https", "http"].contains(scheme.lowercased()) else {
return .systemAction return .systemAction

View File

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