mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Remove the room list notification count feature flag.
The room list now always shows the unread notification count for highlighted rooms and the app icon badge always uses the SDK's own unread notification count, both in the app and in the NSE. The push payload's unread count is no longer used, so its UNNotificationContent helper and user info key have been removed along with the setting, its developer options toggle and the feature-disabled unit test.
This commit is contained in:
@@ -31,7 +31,6 @@ nonisolated protocol CommonSettingsProtocol: AnyObject, Sendable {
|
||||
var enableOnlySignedDeviceIsolationMode: Bool { get }
|
||||
var threadsEnabled: Bool { get }
|
||||
var hideQuietNotificationAlerts: Bool { get }
|
||||
var roomListNotificationCountEnabled: Bool { get }
|
||||
}
|
||||
|
||||
nonisolated enum AppBuildType {
|
||||
@@ -358,9 +357,6 @@ final nonisolated class AppSettings: @unchecked Sendable {
|
||||
@UserPreference(defaultValue: RoomListActivityVisibility.current)
|
||||
var roomListActivityVisibility: RoomListActivityVisibility
|
||||
|
||||
@UserPreference(defaultValue: false)
|
||||
var roomListNotificationCountEnabled: Bool
|
||||
|
||||
// MARK: - Search Screen
|
||||
|
||||
/// The queries the user searched for and the rooms they opened from the results, most recent first.
|
||||
|
||||
@@ -29,10 +29,6 @@ nonisolated extension UNNotificationContent {
|
||||
@objc var threadRootEventID: String? {
|
||||
userInfo[NotificationConstants.UserInfoKey.threadRootEventIdentifier] as? String
|
||||
}
|
||||
|
||||
var unreadCount: Int? {
|
||||
userInfo[NotificationConstants.UserInfoKey.unreadCount] as? Int
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated extension UNMutableNotificationContent {
|
||||
|
||||
@@ -106,8 +106,6 @@ struct HomeScreenViewState: BindableState {
|
||||
|
||||
var roomListActivityVisibility: RoomListActivityVisibility = .current
|
||||
|
||||
var roomListNotificationCountEnabled = false
|
||||
|
||||
var reportRoomEnabled = false
|
||||
|
||||
var shouldShowSpaceFilters = false
|
||||
|
||||
@@ -120,10 +120,6 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
appSettings.roomListNotificationCountEnabledPublisher
|
||||
.weakAssign(to: \.state.roomListNotificationCountEnabled, on: self)
|
||||
.store(in: &cancellables)
|
||||
|
||||
appSettings.seenInvitesPublisher
|
||||
.removeDuplicates()
|
||||
.sink { [weak self] _ in
|
||||
|
||||
@@ -16,7 +16,6 @@ struct HomeScreenRoomCell: View {
|
||||
|
||||
let room: HomeScreenRoom
|
||||
var roomListActivityVisibility: RoomListActivityVisibility = .current
|
||||
var roomListNotificationCountEnabled = false
|
||||
let isSelected: Bool
|
||||
let mediaProvider: MediaProviderProtocol!
|
||||
let action: (HomeScreenViewAction) -> Void
|
||||
@@ -158,7 +157,7 @@ struct HomeScreenRoomCell: View {
|
||||
}
|
||||
|
||||
if room.badges.isDotShown {
|
||||
if roomListNotificationCountEnabled, room.isHighlighted, room.badges.notificationCount > 0 {
|
||||
if room.isHighlighted, room.badges.notificationCount > 0 {
|
||||
Text(formattedNotificationCount)
|
||||
.font(.compound.bodySMSemibold)
|
||||
.foregroundColor(.compound.textOnSolidPrimary)
|
||||
@@ -255,7 +254,7 @@ struct HomeScreenRoomCell_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
VStack(spacing: 0) {
|
||||
ForEach(notificationsStateRooms) { room in
|
||||
HomeScreenRoomCell(room: room, roomListNotificationCountEnabled: true, isSelected: false, mediaProvider: MediaProviderMock(.init())) { _ in }
|
||||
HomeScreenRoomCell(room: room, isSelected: false, mediaProvider: MediaProviderMock(.init())) { _ in }
|
||||
}
|
||||
}
|
||||
.previewLayout(.sizeThatFits)
|
||||
|
||||
@@ -37,7 +37,6 @@ struct HomeScreenRoomList: View {
|
||||
|
||||
HomeScreenRoomCell(room: room,
|
||||
roomListActivityVisibility: context.viewState.roomListActivityVisibility,
|
||||
roomListNotificationCountEnabled: context.viewState.roomListNotificationCountEnabled,
|
||||
isSelected: isSelected,
|
||||
mediaProvider: context.mediaProvider,
|
||||
action: context.send)
|
||||
|
||||
-1
@@ -58,7 +58,6 @@ protocol DeveloperOptionsProtocol: AnyObject {
|
||||
var focusEventOnNotificationTap: Bool { get set }
|
||||
|
||||
var roomListActivityVisibility: RoomListActivityVisibility { get set }
|
||||
var roomListNotificationCountEnabled: Bool { get set }
|
||||
var elementCallBaseURLOverride: URL? { get set }
|
||||
|
||||
var fuzzyRoomListSearchEnabled: Bool { get set }
|
||||
|
||||
-5
@@ -67,11 +67,6 @@ struct DeveloperOptionsScreen: View {
|
||||
}
|
||||
}
|
||||
|
||||
Toggle(isOn: $context.roomListNotificationCountEnabled) {
|
||||
Text("Show unread notification count")
|
||||
Text("Also makes the app icon badge use the SDK's own unread notification count")
|
||||
}
|
||||
|
||||
Toggle(isOn: $context.fuzzyRoomListSearchEnabled) {
|
||||
Text("Fuzzy searching")
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ final class NotificationManager: NSObject, NotificationManagerProtocol {
|
||||
}
|
||||
|
||||
func updateAppBadgeCount() async {
|
||||
guard let userSession, appSettings.roomListNotificationCountEnabled else { return }
|
||||
guard let userSession else { return }
|
||||
|
||||
let badgeCount = Int(userSession.clientProxy.totalUnreadNotifications)
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ nonisolated enum NotificationConstants {
|
||||
static let roomIdentifier = "room_id"
|
||||
static let eventIdentifier = "event_id"
|
||||
static let threadRootEventIdentifier = "thread_root_event_id"
|
||||
static let unreadCount = "unread_count"
|
||||
static let pusherNotificationClientIdentifier = "pusher_notification_client_identifier"
|
||||
static let receiverIdentifier = "receiver_id"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user