mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
Add a developer option that hides notification alerts when a sound wouldn't be played.
Enabling this makes isNoisy behave like iMessage's Hide Alerts option.
This commit is contained in:
@@ -19,6 +19,7 @@ protocol CommonSettingsProtocol {
|
|||||||
var enableOnlySignedDeviceIsolationMode: Bool { get }
|
var enableOnlySignedDeviceIsolationMode: Bool { get }
|
||||||
var hideInviteAvatars: Bool { get }
|
var hideInviteAvatars: Bool { get }
|
||||||
var timelineMediaVisibility: TimelineMediaVisibility { get }
|
var timelineMediaVisibility: TimelineMediaVisibility { get }
|
||||||
|
var hideQuietNotificationAlerts: Bool { get }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Store Element specific app settings.
|
/// Store Element specific app settings.
|
||||||
@@ -45,7 +46,6 @@ final class AppSettings {
|
|||||||
case optimizeMediaUploads
|
case optimizeMediaUploads
|
||||||
case appAppearance
|
case appAppearance
|
||||||
case sharePresence
|
case sharePresence
|
||||||
case hideUnreadMessagesBadge
|
|
||||||
case hideInviteAvatars
|
case hideInviteAvatars
|
||||||
case timelineMediaVisibility
|
case timelineMediaVisibility
|
||||||
case isNewBloomEnabled
|
case isNewBloomEnabled
|
||||||
@@ -59,6 +59,10 @@ final class AppSettings {
|
|||||||
case knockingEnabled
|
case knockingEnabled
|
||||||
case threadsEnabled
|
case threadsEnabled
|
||||||
case developerOptionsEnabled
|
case developerOptionsEnabled
|
||||||
|
|
||||||
|
// Doug's tweaks 🔧
|
||||||
|
case hideUnreadMessagesBadge
|
||||||
|
case hideQuietNotificationAlerts
|
||||||
}
|
}
|
||||||
|
|
||||||
private static var suiteName: String = InfoPlistReader.main.appGroupIdentifier
|
private static var suiteName: String = InfoPlistReader.main.appGroupIdentifier
|
||||||
@@ -346,6 +350,9 @@ final class AppSettings {
|
|||||||
@UserPreference(key: UserDefaultsKeys.threadsEnabled, defaultValue: isDevelopmentBuild, storageType: .userDefaults(store))
|
@UserPreference(key: UserDefaultsKeys.threadsEnabled, defaultValue: isDevelopmentBuild, storageType: .userDefaults(store))
|
||||||
var developerOptionsEnabled
|
var developerOptionsEnabled
|
||||||
|
|
||||||
|
@UserPreference(key: UserDefaultsKeys.isNewBloomEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||||
|
var isNewBloomEnabled
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// MARK: - Shared
|
// MARK: - Shared
|
||||||
@@ -366,8 +373,8 @@ final class AppSettings {
|
|||||||
@UserPreference(key: UserDefaultsKeys.timelineMediaVisibility, defaultValue: TimelineMediaVisibility.always, storageType: .userDefaults(store))
|
@UserPreference(key: UserDefaultsKeys.timelineMediaVisibility, defaultValue: TimelineMediaVisibility.always, storageType: .userDefaults(store))
|
||||||
var timelineMediaVisibility
|
var timelineMediaVisibility
|
||||||
|
|
||||||
@UserPreference(key: UserDefaultsKeys.isNewBloomEnabled, defaultValue: false, storageType: .userDefaults(store))
|
@UserPreference(key: UserDefaultsKeys.hideQuietNotificationAlerts, defaultValue: false, storageType: .userDefaults(store))
|
||||||
var isNewBloomEnabled
|
var hideQuietNotificationAlerts
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AppSettings: CommonSettingsProtocol { }
|
extension AppSettings: CommonSettingsProtocol { }
|
||||||
|
|||||||
+1
@@ -46,6 +46,7 @@ protocol DeveloperOptionsProtocol: AnyObject {
|
|||||||
var knockingEnabled: Bool { get set }
|
var knockingEnabled: Bool { get set }
|
||||||
var threadsEnabled: Bool { get set }
|
var threadsEnabled: Bool { get set }
|
||||||
var isNewBloomEnabled: Bool { get set }
|
var isNewBloomEnabled: Bool { get set }
|
||||||
|
var hideQuietNotificationAlerts: Bool { get set }
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AppSettings: DeveloperOptionsProtocol { }
|
extension AppSettings: DeveloperOptionsProtocol { }
|
||||||
|
|||||||
+7
@@ -92,6 +92,13 @@ struct DeveloperOptionsScreen: View {
|
|||||||
Text("Element Call remote URL override")
|
Text("Element Call remote URL override")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Section("Notifications") {
|
||||||
|
Toggle(isOn: $context.hideQuietNotificationAlerts) {
|
||||||
|
Text("Hide quiet alerts")
|
||||||
|
Text("The badge count will still be updated")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
Button {
|
Button {
|
||||||
showConfetti = true
|
showConfetti = true
|
||||||
|
|||||||
@@ -87,6 +87,10 @@ class NotificationHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func preprocessNotification(_ itemProxy: NotificationItemProxyProtocol) async -> NotificationProcessingResult {
|
private func preprocessNotification(_ itemProxy: NotificationItemProxyProtocol) async -> NotificationProcessingResult {
|
||||||
|
if settings.hideQuietNotificationAlerts, !itemProxy.isNoisy {
|
||||||
|
return .processedShouldDiscard
|
||||||
|
}
|
||||||
|
|
||||||
guard case let .timeline(event) = itemProxy.event else {
|
guard case let .timeline(event) = itemProxy.event else {
|
||||||
return .shouldDisplay
|
return .shouldDisplay
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user