diff --git a/apps/ios/Shared/AppDelegate.swift b/apps/ios/Shared/AppDelegate.swift index 95e21a2513..b3cf044614 100644 --- a/apps/ios/Shared/AppDelegate.swift +++ b/apps/ios/Shared/AppDelegate.swift @@ -21,17 +21,16 @@ class AppDelegate: NSObject, UIApplicationDelegate { logger.debug("AppDelegate: didRegisterForRemoteNotificationsWithDeviceToken \(token)") let m = ChatModel.shared m.deviceToken = token - UserDefaults.standard.set(false, forKey: DEFAULT_USE_NOTIFICATIONS) -// let useNotifications = UserDefaults.standard.bool(forKey: "useNotifications") -// if useNotifications { -// Task { -// do { -// m.tokenStatus = try await apiRegisterToken(token: token) -// } catch { -// logger.error("apiRegisterToken error: \(responseError(error))") -// } -// } -// } + let useNotifications = UserDefaults.standard.bool(forKey: "useNotifications") + if useNotifications { + Task { + do { + m.tokenStatus = try await apiRegisterToken(token: token) + } catch { + logger.error("apiRegisterToken error: \(responseError(error))") + } + } + } } func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { diff --git a/apps/ios/Shared/Views/UserSettings/SettingsView.swift b/apps/ios/Shared/Views/UserSettings/SettingsView.swift index f531634c26..0e5f46aeda 100644 --- a/apps/ios/Shared/Views/UserSettings/SettingsView.swift +++ b/apps/ios/Shared/Views/UserSettings/SettingsView.swift @@ -150,12 +150,12 @@ struct SettingsView: View { } label: { settingsRow("gauge") { Text("Experimental features") } } -// if let token = chatModel.deviceToken { -// HStack { -// notificationsIcon() -// notificationsToggle(token) -// } -// } + if let token = chatModel.deviceToken { + HStack { + notificationsIcon() + notificationsToggle(token) + } + } Text("v\(appVersion ?? "?") (\(appBuild ?? "?"))") } }