Add a setting to hide unread messages badges. (#2412)

* Add a setting to hide grey unread messages badges.

* Move room badge logic to be built in the view model instead of in the view.

* Move setting into DeveloperOptions.
This commit is contained in:
Doug
2024-02-07 13:00:35 +00:00
committed by GitHub
parent b075ddb047
commit d0c835a9bf
12 changed files with 85 additions and 75 deletions
@@ -51,6 +51,7 @@ protocol DeveloperOptionsProtocol: AnyObject {
var mentionsBadgeEnabled: Bool { get set }
var roomListFiltersEnabled: Bool { get set }
var markAsUnreadEnabled: Bool { get set }
var hideUnreadMessagesBadge: Bool { get set }
var elementCallBaseURL: URL { get set }
}
@@ -59,6 +59,10 @@ struct DeveloperOptionsScreen: View {
Toggle(isOn: $context.markAsUnreadEnabled) {
Text("Mark as unread")
}
Toggle(isOn: $context.hideUnreadMessagesBadge) {
Text("Hide grey dots")
}
}
Section("Element Call") {
@@ -39,7 +39,7 @@ class NotificationSettingsScreenViewModel: NotificationSettingsScreenViewModelTy
let bindings = NotificationSettingsScreenViewStateBindings(enableNotifications: appSettings.enableNotifications)
super.init(initialViewState: NotificationSettingsScreenViewState(bindings: bindings, isModallyPresented: isModallyPresented))
// Listen for changes to AppSettings.enableNotifications
// Listen for changes to AppSettings.
appSettings.$enableNotifications
.weakAssign(to: \.state.bindings.enableNotifications, on: self)
.store(in: &cancellables)
@@ -28,15 +28,20 @@ struct NotificationSettingsScreen: View {
if context.viewState.showSystemNotificationsAlert {
userPermissionSection
}
enableNotificationSection
if context.enableNotifications {
roomsNotificationSection
if context.viewState.settings?.roomMentionsEnabled != nil {
mentionsSection
}
if context.viewState.showCallsSettings, context.viewState.settings?.callsEnabled != nil {
callsSection
}
if context.viewState.settings?.invitationsEnabled != nil {
additionalSettingsSection
}