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,6 +91,7 @@ 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")
} }
if !ProcessInfo.processInfo.isiOSAppOnMac {
Picker(selection: $preferences.preferredBrowser) { Picker(selection: $preferences.preferredBrowser) {
ForEach(PreferredBrowser.allCases, id: \.rawValue) { browser in ForEach(PreferredBrowser.allCases, id: \.rawValue) { browser in
switch browser { switch browser {
@ -104,6 +105,7 @@ struct SettingsTabs: View {
Label("Browser", systemImage: "network") Label("Browser", systemImage: "network")
} }
} }
}
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
} }