From 4fd0dddf98772327d038dd7a74671a130075cf56 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Thu, 19 Jan 2023 11:59:12 +0100 Subject: [PATCH] Default to open in browser for macOS --- IceCubesApp/App/SafariRouteur.swift | 2 +- .../App/Tabs/Settings/SettingsTab.swift | 20 ++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/IceCubesApp/App/SafariRouteur.swift b/IceCubesApp/App/SafariRouteur.swift index 82a5503c..b47b404a 100644 --- a/IceCubesApp/App/SafariRouteur.swift +++ b/IceCubesApp/App/SafariRouteur.swift @@ -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 diff --git a/IceCubesApp/App/Tabs/Settings/SettingsTab.swift b/IceCubesApp/App/Tabs/Settings/SettingsTab.swift index 5d6e397a..d4dbe2e2 100644 --- a/IceCubesApp/App/Tabs/Settings/SettingsTab.swift +++ b/IceCubesApp/App/Tabs/Settings/SettingsTab.swift @@ -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)