Fix issue with the notifications toggle not holding the users preference

This commit is contained in:
Jackson Harper
2024-03-29 10:51:35 +08:00
parent c70c4107f6
commit e5b495e0e1

View File

@ -25,7 +25,8 @@
func checkPushNotificationsStatus() {
UNUserNotificationCenter.current().getNotificationSettings { settings in
DispatchQueue.main.async {
self.desiredNotificationsEnabled = settings.alertSetting == UNNotificationSetting.enabled
let desired = UserDefaults.standard.bool(forKey: UserDefaultKey.notificationsEnabled.rawValue)
self.desiredNotificationsEnabled = desired && settings.alertSetting == UNNotificationSetting.enabled
}
}
}