From fc8ee9d93d7cf6a4362576b164e2323a920e5111 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Fri, 25 Sep 2026 13:36:33 +0300 Subject: [PATCH] Room list notifications tweaks (#6106) We decided against changing how unread activity is rendered in the room list, so the experiment and its developer option are no longer needed. we have also added a notification settings entry for hiding the room list gray dots. --- ElementX.xcodeproj/project.pbxproj | 8 ------ .../en-US.lproj/Localizable.strings | 1 + .../en.lproj/Localizable.strings | 1 + .../en.lproj/Untranslated.strings | 1 + .../Application/Settings/AppSettings.swift | 4 +-- .../Settings/RoomListActivityVisibility.swift | 15 ----------- .../Generated/Strings+Untranslated.swift | 2 ++ ElementX/Sources/Generated/Strings.swift | 2 ++ .../Screens/HomeScreen/HomeScreenModels.swift | 12 +++------ .../HomeScreen/HomeScreenViewModel.swift | 8 +++--- .../HomeScreen/View/HomeScreenRoomCell.swift | 27 ++----------------- .../HomeScreen/View/HomeScreenRoomList.swift | 1 - .../DeveloperOptionsScreenModels.swift | 1 - .../View/DeveloperOptionsScreen.swift | 7 ----- .../NotificationSettingsScreenModels.swift | 2 ++ .../NotificationSettingsScreenViewModel.swift | 5 +++- .../View/NotificationSettingsScreen.swift | 16 ++++++++++- ...otificationSettingsScreen.iPad-en-GB-0.png | 4 +-- ...tificationSettingsScreen.iPad-pseudo-0.png | 4 +-- ...ificationSettingsScreen.iPhone-en-GB-0.png | 4 +-- ...ficationSettingsScreen.iPhone-pseudo-0.png | 4 +-- UnitTests/Sources/HomeScreenRoomTests.swift | 4 +-- 22 files changed, 49 insertions(+), 84 deletions(-) delete mode 100644 ElementX/Sources/Application/Settings/RoomListActivityVisibility.swift diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index aa3f8c272..1f68e2081 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -491,7 +491,6 @@ 4DEEFB73181C3B023DB42686 /* NetworkMonitorProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1575947B7A6FE08C57FE5EE4 /* NetworkMonitorProtocol.swift */; }; 4E0D9E09B52CEC4C0E6211A8 /* MediaPickerScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64F49FB9EE2913234F06CE68 /* MediaPickerScreenCoordinator.swift */; }; 4E36A66E0EDA74BF3A036FD0 /* RoomChangeRolesScreenViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AAD8C633AA57948B34EDCF7 /* RoomChangeRolesScreenViewModelProtocol.swift */; }; - 4E3F4623592BFEF0D644CEAD /* RoomListActivityVisibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5DA892E8643240C7BC41900 /* RoomListActivityVisibility.swift */; }; 4E4EF97B9F9CEFAC726BA72F /* TimelineProviderMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62EACAFB3F3E017060F9F1C5 /* TimelineProviderMock.swift */; }; 4E8A2A2CFEB212F14E49E1A1 /* AppLockSetupSettingsScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5484457C81B325660901B161 /* AppLockSetupSettingsScreen.swift */; }; 4E945AD6862C403F74E57755 /* RoomTimelineItemFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 105B2A8426404EF66F00CFDB /* RoomTimelineItemFactory.swift */; }; @@ -588,7 +587,6 @@ 5DFC2A889D3B39DD47AC63A8 /* PillUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C537DE821FED94D23467B6C4 /* PillUtilities.swift */; }; 5E597B9959BDAE7A67DBD5B2 /* LinkMetadataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C78111573987B1D79ED0868 /* LinkMetadataProvider.swift */; }; 5E67990F98AF11563EA50080 /* SettingsScreenUserStatusPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06775BFC4D00C62B7E1353A8 /* SettingsScreenUserStatusPickerView.swift */; }; - 5E73893669BB56307A44AAAD /* RoomListActivityVisibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5DA892E8643240C7BC41900 /* RoomListActivityVisibility.swift */; }; 5EB116B58533C9A0EBA22717 /* ThreadTimelineScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC2E7CEE6E9314FD69FE0ED9 /* ThreadTimelineScreen.swift */; }; 5EDBDE802761B5ECB54E6787 /* LogLevel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2711E5996016ABD6EAAEB58A /* LogLevel.swift */; }; 5F06AD3C66884CE793AE6119 /* FileManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04DF593C3F7AF4B2FBAEB05D /* FileManager.swift */; }; @@ -657,7 +655,6 @@ 681FA9A37E82A14EDFB22D56 /* ContentScanningView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8794B3D86D7D444B9B6FF7B /* ContentScanningView.swift */; }; 6832733838C57A7D3FE8FEB5 /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = 50009897F60FAE7D63EF5E5B /* Kingfisher */; }; 6851B077B4C913CC12DB6E77 /* AppLockFlowCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCE93F0CBF0D96B77111C413 /* AppLockFlowCoordinator.swift */; }; - 6885C3D26FC1026E07408D3C /* RoomListActivityVisibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5DA892E8643240C7BC41900 /* RoomListActivityVisibility.swift */; }; 68B2DD307C57ECFABBB05323 /* DeclineAndBlockScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 127D1947BA9C6CA62E3D03EC /* DeclineAndBlockScreen.swift */; }; 68B7308BA24EC3DC5FD87B61 /* OAuthPresenterHook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04CAC77224E949D8E758E2E3 /* OAuthPresenterHook.swift */; }; 68C3AF257678F6E7BB238C3F /* AppAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0FD22AEFFA20065494ED2333 /* AppAppearance.swift */; }; @@ -2739,7 +2736,6 @@ A54AAF72E821B4084B7E4298 /* PinnedEventsTimelineFlowCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinnedEventsTimelineFlowCoordinator.swift; sourceTree = ""; }; A566F8F2C27B99E1FB80C69B /* JoinRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinRule.swift; sourceTree = ""; }; A5C45578F406698388B97C07 /* AuthenticationClassicAppAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationClassicAppAccountView.swift; sourceTree = ""; }; - A5DA892E8643240C7BC41900 /* RoomListActivityVisibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomListActivityVisibility.swift; sourceTree = ""; }; A67BCEFE35F8D00CADF108C9 /* AccountProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountProvider.swift; sourceTree = ""; }; A6B19D10B102956066AF117B /* PollOptionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PollOptionView.swift; sourceTree = ""; }; A6B891A6DA826E2461DBB40F /* PHGPostHogConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PHGPostHogConfiguration.swift; sourceTree = ""; }; @@ -6892,7 +6888,6 @@ 002DE5E9625122F37DE5F020 /* OAuthConfiguration.swift */, 8FC598338E7CF41107293AB5 /* RageshakeConfiguration.swift */, 69A05E85E4872C3221C5C287 /* RemotePreference.swift */, - A5DA892E8643240C7BC41900 /* RoomListActivityVisibility.swift */, 095B8ED0CA87F4A0A4858719 /* SearchBreadcrumb.swift */, 10D751743B20B314D84D79FE /* TrackedUserDefaults.swift */, 0CCA4547BE58E17899E95CDE /* UserDefaultsProtocol.swift */, @@ -8290,7 +8285,6 @@ 3CB9EC9B670C90618B839D1B /* RemotePreference.swift in Sources */, F65F3909769E7C48B3309D9D /* RemoteSettingsHook.swift in Sources */, 414F50CFCFEEE2611127DCFB /* RestorationToken.swift in Sources */, - 5E73893669BB56307A44AAAD /* RoomListActivityVisibility.swift in Sources */, 17BC15DA08A52587466698C5 /* RoomMessageEventStringBuilder.swift in Sources */, 06D17F7813AA931FF18FD5D0 /* SDKListener.swift in Sources */, 4EF76B21E1128FA18F8FB7A9 /* SearchBreadcrumb.swift in Sources */, @@ -8544,7 +8538,6 @@ 24C32D7EF94ECF9081638DF6 /* RemotePreference.swift in Sources */, 6F76F34F4CAD400F5015EC5C /* RemoteSettingsHook.swift in Sources */, 1C4CB9009E50E6535883D5B2 /* RestorationToken.swift in Sources */, - 6885C3D26FC1026E07408D3C /* RoomListActivityVisibility.swift in Sources */, 3BB19AB9CDA3034AE39C039A /* SearchBreadcrumb.swift in Sources */, 9097C3B61181B731CACEE28B /* Secrets.swift in Sources */, B6B62437B92B6CA4083AA899 /* SessionDirectories.swift in Sources */, @@ -9291,7 +9284,6 @@ 5C8804B4F25903516E2DAB81 /* RoomInfoProxy.swift in Sources */, 432EA37BDC97CEDBAB7B23A6 /* RoomInfoProxyProtocol.swift in Sources */, 8A83D715940378B9BA9F739E /* RoomInviterLabel.swift in Sources */, - 4E3F4623592BFEF0D644CEAD /* RoomListActivityVisibility.swift in Sources */, F4996C82A4B3A5FF0C8EDD03 /* RoomListFilterModels.swift in Sources */, 4A9CEEE612D6D8B3DDBD28BA /* RoomListFilterView.swift in Sources */, BD0BE20DBCE31253AE4490A1 /* RoomListFiltersEmptyStateView.swift in Sources */, diff --git a/ElementX/Resources/Localizations/en-US.lproj/Localizable.strings b/ElementX/Resources/Localizations/en-US.lproj/Localizable.strings index 732167559..4f4ccf2d9 100644 --- a/ElementX/Resources/Localizations/en-US.lproj/Localizable.strings +++ b/ElementX/Resources/Localizations/en-US.lproj/Localizable.strings @@ -1087,6 +1087,7 @@ "screen_notification_settings_mode_mentions" = "Mentions"; "screen_notification_settings_notification_section_title" = "Notify me for"; "screen_notification_settings_room_mention_label" = "Mentions of @room"; +"screen_notification_settings_show_all_activity" = "Show all activity in the room list (dots or number of unread messages)"; "screen_notification_settings_sound_custom_fallback" = "Custom"; "screen_notification_settings_sound_custom_sound_button_title" = "Custom sound..."; "screen_notification_settings_sound_delete_sound_error_title" = "Error deleting file"; diff --git a/ElementX/Resources/Localizations/en.lproj/Localizable.strings b/ElementX/Resources/Localizations/en.lproj/Localizable.strings index 26abfa650..d5a3a5b8e 100644 --- a/ElementX/Resources/Localizations/en.lproj/Localizable.strings +++ b/ElementX/Resources/Localizations/en.lproj/Localizable.strings @@ -1087,6 +1087,7 @@ "screen_notification_settings_mode_mentions" = "Mentions"; "screen_notification_settings_notification_section_title" = "Notify me for"; "screen_notification_settings_room_mention_label" = "Mentions of @room"; +"screen_notification_settings_show_all_activity" = "Show all activity in the room list (dots or number of unread messages)"; "screen_notification_settings_sound_custom_fallback" = "Custom"; "screen_notification_settings_sound_custom_sound_button_title" = "Custom sound..."; "screen_notification_settings_sound_delete_sound_error_title" = "Error deleting file"; diff --git a/ElementX/Resources/Localizations/en.lproj/Untranslated.strings b/ElementX/Resources/Localizations/en.lproj/Untranslated.strings index 695beb6dd..c892490f7 100644 --- a/ElementX/Resources/Localizations/en.lproj/Untranslated.strings +++ b/ElementX/Resources/Localizations/en.lproj/Untranslated.strings @@ -1,4 +1,5 @@ "screen_home_tab_search" = "Search"; +"screen_notification_settings_show_all_room_list_activity" = "Show all activity in the room list (dots or number of unread messages)"; "screen_search_empty_state_message" = "Search for chats and messages"; "screen_search_empty_state_title" = "Start searching..."; "screen_search_no_results_message" = "There are no results for “%1$@.” Try a new search term."; diff --git a/ElementX/Sources/Application/Settings/AppSettings.swift b/ElementX/Sources/Application/Settings/AppSettings.swift index 62b9cdfad..bc5ba52bf 100644 --- a/ElementX/Sources/Application/Settings/AppSettings.swift +++ b/ElementX/Sources/Application/Settings/AppSettings.swift @@ -354,8 +354,8 @@ final nonisolated class AppSettings: @unchecked Sendable { // MARK: - Home Screen - @UserPreference(defaultValue: RoomListActivityVisibility.current) - var roomListActivityVisibility: RoomListActivityVisibility + @UserPreference(defaultValue: true) + var showAllRoomListActivity: Bool // MARK: - Search Screen diff --git a/ElementX/Sources/Application/Settings/RoomListActivityVisibility.swift b/ElementX/Sources/Application/Settings/RoomListActivityVisibility.swift deleted file mode 100644 index d74cbdd75..000000000 --- a/ElementX/Sources/Application/Settings/RoomListActivityVisibility.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// Copyright 2026 Element Creations Ltd. -// -// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. -// Please see LICENSE files in the repository root for full details. -// - -nonisolated enum RoomListActivityVisibility: String, CaseIterable, Codable { - /// Show unread badges for all unread messages (the default). - case current - /// Don't show badges but bold unread room names and their latest message - case show - /// Don't show badges and don't bold room names and messages - case hide -} diff --git a/ElementX/Sources/Generated/Strings+Untranslated.swift b/ElementX/Sources/Generated/Strings+Untranslated.swift index c4d09c595..7f712878d 100644 --- a/ElementX/Sources/Generated/Strings+Untranslated.swift +++ b/ElementX/Sources/Generated/Strings+Untranslated.swift @@ -12,6 +12,8 @@ import Foundation internal nonisolated enum UntranslatedL10n { /// Search internal static var screenHomeTabSearch: String { return UntranslatedL10n.tr("Untranslated", "screen_home_tab_search") } + /// Show all activity in the room list (dots or number of unread messages) + internal static var screenNotificationSettingsShowAllRoomListActivity: String { return UntranslatedL10n.tr("Untranslated", "screen_notification_settings_show_all_room_list_activity") } /// Search for chats and messages internal static var screenSearchEmptyStateMessage: String { return UntranslatedL10n.tr("Untranslated", "screen_search_empty_state_message") } /// Start searching... diff --git a/ElementX/Sources/Generated/Strings.swift b/ElementX/Sources/Generated/Strings.swift index a50efd7a2..757f4365f 100644 --- a/ElementX/Sources/Generated/Strings.swift +++ b/ElementX/Sources/Generated/Strings.swift @@ -2544,6 +2544,8 @@ internal nonisolated enum L10n { internal static var screenNotificationSettingsNotificationSectionTitle: String { return L10n.tr("Localizable", "screen_notification_settings_notification_section_title") } /// Mentions of @room internal static var screenNotificationSettingsRoomMentionLabel: String { return L10n.tr("Localizable", "screen_notification_settings_room_mention_label") } + /// Show all activity in the room list (dots or number of unread messages) + internal static var screenNotificationSettingsShowAllActivity: String { return L10n.tr("Localizable", "screen_notification_settings_show_all_activity") } /// Custom internal static var screenNotificationSettingsSoundCustomFallback: String { return L10n.tr("Localizable", "screen_notification_settings_sound_custom_fallback") } /// Custom sound... diff --git a/ElementX/Sources/Screens/HomeScreen/HomeScreenModels.swift b/ElementX/Sources/Screens/HomeScreen/HomeScreenModels.swift index 374a5b49c..b367705ed 100644 --- a/ElementX/Sources/Screens/HomeScreen/HomeScreenModels.swift +++ b/ElementX/Sources/Screens/HomeScreen/HomeScreenModels.swift @@ -104,8 +104,6 @@ struct HomeScreenViewState: BindableState { var hideInviteAvatars = false - var roomListActivityVisibility: RoomListActivityVisibility = .current - var reportRoomEnabled = false var shouldShowSpaceFilters = false @@ -199,8 +197,6 @@ struct HomeScreenRoom: Identifiable, Equatable { let callBadgeType: CallBadgeType } - var hasUnreads = false - let name: String let isDirect: Bool @@ -255,16 +251,15 @@ struct HomeScreenRoom: Identifiable, Equatable { extension HomeScreenRoom { init(summary: RoomSummary, - roomListActivityVisibility: RoomListActivityVisibility = .current, + showAllActivity: Bool = true, seenInvites: Set = []) { let roomID = summary.id let isUnseenInvite = summary.joinRequestType?.isInvite == true && !seenInvites.contains(roomID) - let isDotShown = switch roomListActivityVisibility { - case .current: + let isDotShown = if showAllActivity { summary.hasUnreadMessages || summary.hasUnreadMentions || summary.hasUnreadNotifications || summary.isMarkedUnread || isUnseenInvite - case .hide, .show: + } else { (!summary.isMuted && (summary.hasUnreadNotifications || summary.hasUnreadMentions)) || summary.isMarkedUnread || isUnseenInvite } @@ -292,7 +287,6 @@ extension HomeScreenRoom { isMentionShown: isMentionShown, isMuteShown: isMuteShown, callBadgeType: callBadge), - hasUnreads: summary.hasUnreadMessages, name: summary.name, isDirect: summary.isDirect, isHighlighted: isHighlighted, diff --git a/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift b/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift index d4e323aff..d97321eed 100644 --- a/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift +++ b/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift @@ -113,9 +113,9 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol .weakAssign(to: \.state.selectedRoomID, on: self) .store(in: &cancellables) - appSettings.roomListActivityVisibilityPublisher - .sink { [weak self] value in - self?.state.roomListActivityVisibility = value + appSettings.showAllRoomListActivityPublisher + .removeDuplicates() + .sink { [weak self] _ in self?.updateRooms() } .store(in: &cancellables) @@ -376,7 +376,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol for summary in roomSummaryProvider.roomListPublisher.value { let room = HomeScreenRoom(summary: summary, - roomListActivityVisibility: appSettings.roomListActivityVisibility, + showAllActivity: appSettings.showAllRoomListActivity, seenInvites: seenInvites) rooms.append(room) } diff --git a/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift b/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift index 77126a5bd..01c1d8066 100644 --- a/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift +++ b/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift @@ -15,7 +15,6 @@ struct HomeScreenRoomCell: View { @Environment(\.redactionReasons) private var redactionReasons let room: HomeScreenRoom - var roomListActivityVisibility: RoomListActivityVisibility = .current let isSelected: Bool let mediaProvider: MediaProviderProtocol! let action: (HomeScreenViewAction) -> Void @@ -82,7 +81,7 @@ struct HomeScreenRoomCell: View { Text(String(statusEmoji)) } } - .font(headerFont) + .font(.compound.bodyLGSemibold) .foregroundColor(.compound.textPrimary) .frame(maxWidth: .infinity, alignment: .leading) @@ -94,17 +93,6 @@ struct HomeScreenRoomCell: View { } } - private var headerFont: Font { - switch roomListActivityVisibility { - case .current: - .compound.bodyLGSemibold - case .show: - room.hasUnreads ? .compound.bodyLGSemibold : .compound.bodyLG - case .hide: - room.isHighlighted ? .compound.bodyLGSemibold : .compound.bodyLG - } - } - private var footer: some View { HStack(alignment: .firstTextBaseline, spacing: 0) { ZStack(alignment: .topLeading) { @@ -190,21 +178,10 @@ struct HomeScreenRoomCell: View { private var lastMessage: some View { if let displayedLastMessage = room.displayedLastMessage { Text(displayedLastMessage) - .font(lastMessageFont) + .font(.compound.bodyMD) .lastMessageFormatting(hasFailed: room.lastMessageState == .failed) } } - - private var lastMessageFont: Font { - switch roomListActivityVisibility { - case .current: - .compound.bodyMD - case .show: - room.hasUnreads ? .compound.bodyMDSemibold : .compound.bodyMD - case .hide: - room.isHighlighted ? .compound.bodyMDSemibold : .compound.bodyMD - } - } } struct HomeScreenRoomCellButtonStyle: ButtonStyle { diff --git a/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomList.swift b/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomList.swift index e95e97b1b..6345704c5 100644 --- a/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomList.swift +++ b/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomList.swift @@ -36,7 +36,6 @@ struct HomeScreenRoomList: View { let isSelected = context.viewState.selectedRoomID == room.id HomeScreenRoomCell(room: room, - roomListActivityVisibility: context.viewState.roomListActivityVisibility, isSelected: isSelected, mediaProvider: context.mediaProvider, action: context.send) diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift index 90750f8fe..8c93bfd4a 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift @@ -57,7 +57,6 @@ protocol DeveloperOptionsProtocol: AnyObject { var hideQuietNotificationAlerts: Bool { get set } var focusEventOnNotificationTap: Bool { get set } - var roomListActivityVisibility: RoomListActivityVisibility { get set } var elementCallBaseURLOverride: URL? { get set } var fuzzyRoomListSearchEnabled: Bool { get set } diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift index a1d2ec538..6779f0e9e 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift @@ -60,13 +60,6 @@ struct DeveloperOptionsScreen: View { } Section("Room List") { - Picker("Room list activity visibility", selection: $context.roomListActivityVisibility) { - ForEach(RoomListActivityVisibility.allCases, id: \.self) { visibility in - Text(visibility.rawValue.capitalized) - .tag(visibility) - } - } - Toggle(isOn: $context.fuzzyRoomListSearchEnabled) { Text("Fuzzy searching") } diff --git a/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenModels.swift b/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenModels.swift index 272424092..e41bb7be9 100644 --- a/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenModels.swift @@ -40,6 +40,7 @@ struct NotificationSettingsScreenViewStateBindings { var roomMentionsEnabled = false var callsEnabled = false var invitationsEnabled = false + var showAllRoomListActivity = true var alertInfo: AlertInfo? var shouldShowAlertSounds = false var shouldShowCustomAlertTonePicker = false @@ -93,6 +94,7 @@ enum NotificationSettingsScreenViewAction { case roomMentionChanged case callsChanged case invitationsChanged + case showAllRoomListActivityChanged case close case fixConfigurationMismatchTapped case selectAlertTone(NotificationTone) diff --git a/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenViewModel.swift b/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenViewModel.swift index 3a3622c7e..8482f6a52 100644 --- a/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenViewModel.swift +++ b/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenViewModel.swift @@ -38,7 +38,8 @@ class NotificationSettingsScreenViewModel: NotificationSettingsScreenViewModelTy notificationTonePreviewer = AudioPlayer() self.notificationToneManager = notificationToneManager - let bindings = NotificationSettingsScreenViewStateBindings(enableNotifications: appSettings.enableNotifications) + let bindings = NotificationSettingsScreenViewStateBindings(enableNotifications: appSettings.enableNotifications, + showAllRoomListActivity: appSettings.showAllRoomListActivity) super.init(initialViewState: NotificationSettingsScreenViewState(bindings: bindings, isModallyPresented: isModallyPresented, selectedAlertTone: appSettings.selectedNotificationTone ?? NotificationToneManager.defaultElementXMessageTone, @@ -102,6 +103,8 @@ class NotificationSettingsScreenViewModel: NotificationSettingsScreenViewModelTy return } Task { await enableInvitations(state.bindings.invitationsEnabled) } + case .showAllRoomListActivityChanged: + appSettings.showAllRoomListActivity = state.bindings.showAllRoomListActivity case .close: actionsSubject.send(.close) case .fixConfigurationMismatchTapped: diff --git a/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/View/NotificationSettingsScreen.swift b/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/View/NotificationSettingsScreen.swift index 415d7e4c8..b3d3c7160 100644 --- a/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/View/NotificationSettingsScreen.swift +++ b/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/View/NotificationSettingsScreen.swift @@ -26,7 +26,11 @@ struct NotificationSettingsScreen: View { if context.enableNotifications { roomsNotificationSection - + } + + roomListActivitySection + + if context.enableNotifications { if context.viewState.showCallsSettings, context.viewState.settings?.callsEnabled != nil { callsSection } @@ -139,6 +143,16 @@ struct NotificationSettingsScreen: View { } } + private var roomListActivitySection: some View { + Section { + ListRow(label: .plain(title: L10n.screenNotificationSettingsShowAllActivity), + kind: .toggle($context.showAllRoomListActivity)) + .onChange(of: context.showAllRoomListActivity) { + context.send(viewAction: .showAllRoomListActivityChanged) + } + } + } + private var callsSection: some View { Section { ListRow(label: .plain(title: L10n.screenNotificationSettingsCallsLabel), diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPad-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPad-en-GB-0.png index 09b4fcd9f..9e427a79a 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPad-en-GB-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPad-en-GB-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d3508ea754a5efc09e5a9351b786ee3273f9ffe0b89236e7c6258d57f9237225 -size 140045 +oid sha256:4f06be36ba536a007404509d4201b4a48e441665e01fc332c0300d536f0d12f2 +size 154491 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPad-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPad-pseudo-0.png index cf7f4c241..ccf17954d 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPad-pseudo-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPad-pseudo-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6c5e166aaf2c10bc2c5c186700025e580319d7ee9e99fc314b310b2972106b92 -size 158148 +oid sha256:dc27058fe392cfe5dcfe9d936d46a05c9eb16b07b175312d5f5463239d0d2c14 +size 181061 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPhone-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPhone-en-GB-0.png index 68cdfe343..f5fb01430 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPhone-en-GB-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPhone-en-GB-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1dd7cc85d17efed4a7460dbd63ba93614461062e2d49f24b9084418266091b2e -size 89349 +oid sha256:df7e2cd46b4a26d0ba7e8a79d4de3b9e6ee2509b84e4fbe989b1cfce5f335711 +size 106031 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPhone-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPhone-pseudo-0.png index eb2d45fe1..764b9cca4 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPhone-pseudo-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/notificationSettingsScreen.iPhone-pseudo-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51702e69725052c626c60aa6d374df00fa8169df82616bf38528796bcaeb6ae0 -size 126429 +oid sha256:37128e985922b4c85a86e6b857a8a1768b0d1cf7d43a396538ab89fd749e7a9e +size 155008 diff --git a/UnitTests/Sources/HomeScreenRoomTests.swift b/UnitTests/Sources/HomeScreenRoomTests.swift index 84cf06100..08db9eafb 100644 --- a/UnitTests/Sources/HomeScreenRoomTests.swift +++ b/UnitTests/Sources/HomeScreenRoomTests.swift @@ -194,7 +194,7 @@ struct HomeScreenRoomTests { } @Test - mutating func mentionAndKeywordsUnhighlightedDotHidden() { + mutating func mentionAndKeywordsUnhighlightedDotHiddenWhenNotShowingAllActivity() { setupRoomSummary(isMarkedUnread: false, unreadMessagesCount: 10, unreadMentionsCount: 0, @@ -202,7 +202,7 @@ struct HomeScreenRoomTests { notificationMode: .mentionsAndKeywordsOnly, hasOngoingCall: false) - let room = HomeScreenRoom(summary: roomSummary, roomListActivityVisibility: .show) + let room = HomeScreenRoom(summary: roomSummary, showAllActivity: false) #expect(!room.isHighlighted) #expect(!room.badges.isDotShown)