mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
New notifications section in settings (#1273)
This commit is contained in:
@@ -133,12 +133,14 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate,
|
||||
|
||||
// MARK: - NotificationManagerDelegate
|
||||
|
||||
func authorizationStatusUpdated(_ service: NotificationManagerProtocol, granted: Bool) {
|
||||
if granted {
|
||||
UIApplication.shared.registerForRemoteNotifications()
|
||||
}
|
||||
func registerForRemoteNotifications() {
|
||||
UIApplication.shared.registerForRemoteNotifications()
|
||||
}
|
||||
|
||||
func unregisterForRemoteNotifications() {
|
||||
UIApplication.shared.unregisterForRemoteNotifications()
|
||||
}
|
||||
|
||||
func shouldDisplayInAppNotification(_ service: NotificationManagerProtocol, content: UNNotificationContent) -> Bool {
|
||||
guard let roomId = content.roomID else {
|
||||
return true
|
||||
|
||||
@@ -26,6 +26,7 @@ final class AppSettings {
|
||||
case migratedAccounts
|
||||
case timelineStyle
|
||||
case analyticsConsentState
|
||||
case enableNotifications
|
||||
case enableInAppNotifications
|
||||
case pusherProfileTag
|
||||
case shouldCollapseRoomStateEvents
|
||||
@@ -34,6 +35,7 @@ final class AppSettings {
|
||||
case locationEventsEnabled
|
||||
case shareLocationEnabled
|
||||
case hasShownWelcomeScreen
|
||||
case notificationSettingsEnabled
|
||||
}
|
||||
|
||||
private static var suiteName: String = InfoPlistReader.main.appGroupIdentifier
|
||||
@@ -178,6 +180,9 @@ final class AppSettings {
|
||||
|
||||
// MARK: - Notifications
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.enableNotifications, defaultValue: true, storageType: .userDefaults(store))
|
||||
var enableNotifications
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.enableInAppNotifications, defaultValue: true, storageType: .userDefaults(store))
|
||||
var enableInAppNotifications
|
||||
|
||||
@@ -218,4 +223,7 @@ final class AppSettings {
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.shareLocationEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||
var shareLocationEnabled
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.notificationSettingsEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||
var notificationSettingsEnabled
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user