New notifications section in settings (#1273)

This commit is contained in:
Nicolas Mauri
2023-07-10 19:26:49 +02:00
committed by GitHub
parent 2cec1858ff
commit 5ae227179c
26 changed files with 639 additions and 14 deletions
@@ -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
}