From f87da10a29b073036c056fdd235fa309ed820955 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Fri, 12 Apr 2024 22:54:17 -0400 Subject: [PATCH] Deep link to iOS Settings from Notifications prefs --- .../Notifications/NotificationsPrefsView.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Tusker/Screens/Preferences/Notifications/NotificationsPrefsView.swift b/Tusker/Screens/Preferences/Notifications/NotificationsPrefsView.swift index 3a59987340..9f610585b8 100644 --- a/Tusker/Screens/Preferences/Notifications/NotificationsPrefsView.swift +++ b/Tusker/Screens/Preferences/Notifications/NotificationsPrefsView.swift @@ -24,6 +24,24 @@ struct NotificationsPrefsView: View { } } .appGroupedListRowBackground() + + if #available(iOS 15.4, *) { + Section { + Button { + let str = if #available(iOS 16.0, *) { + UIApplication.openNotificationSettingsURLString + } else { + UIApplicationOpenNotificationSettingsURLString + } + if let url = URL(string: str) { + UIApplication.shared.open(url) + } + } label: { + Text("Open Notification Settingsā€¦") + } + } + .appGroupedListRowBackground() + } } .listStyle(.insetGrouped) .appGroupedListBackground(container: PreferencesNavigationController.self)