mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Add a Mentions room list filter (#5885)
* Add a Mentions room list filter Adds a new filter chip to the room list that shows only rooms with unread mentions, using the new mentions room list filter from the Rust SDK (matrix-org/matrix-rust-sdk branch matthew/mentions-filter). The SDK version needs bumping to a release that includes the new filter kind before this can build against the released components. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Order the room list filters by expected usage Move Favourites ahead of People and Rooms so the more commonly used filters (Unreads, Mentions, Favourites) sit first in the chip row — Rooms and Invites are used rarely enough that it's fine for them to wrap off the side. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uk8aPxHn3BHCe52L226jdG * update the SDK and use the appropriate rust filter types * preview tests + app settings flag for mentions --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Mauro Romito <mauro.romito@element.io>
This commit is contained in:
@@ -407,6 +407,9 @@ final nonisolated class AppSettings: @unchecked Sendable {
|
||||
@UserPreference(defaultValue: false)
|
||||
var lowPriorityFilterEnabled: Bool
|
||||
|
||||
@UserPreference(defaultValue: false)
|
||||
var mentionsFilterEnabled: Bool
|
||||
|
||||
/// Configuration to enable only signed device isolation mode for crypto. In this mode only devices signed by their owner will be considered in e2ee rooms.
|
||||
@UserPreference(defaultValue: false)
|
||||
var enableOnlySignedDeviceIsolationMode: Bool
|
||||
|
||||
@@ -3339,6 +3339,10 @@ internal nonisolated enum L10n {
|
||||
internal static var screenRoomlistFilterLowPriority: String { return L10n.tr("Localizable", "screen_roomlist_filter_low_priority") }
|
||||
/// You don’t have any low priority chats yet
|
||||
internal static var screenRoomlistFilterLowPriorityEmptyStateTitle: String { return L10n.tr("Localizable", "screen_roomlist_filter_low_priority_empty_state_title") }
|
||||
/// Mention
|
||||
internal static var screenRoomlistFilterMention: String { return L10n.tr("Localizable", "screen_roomlist_filter_mention") }
|
||||
/// You don’t have any unread mentions
|
||||
internal static var screenRoomlistFilterMentionEmptyStateTitle: String { return L10n.tr("Localizable", "screen_roomlist_filter_mention_empty_state_title") }
|
||||
/// You can deselect filters in order to see your other chats
|
||||
internal static var screenRoomlistFilterMixedEmptyStateSubtitle: String { return L10n.tr("Localizable", "screen_roomlist_filter_mixed_empty_state_subtitle") }
|
||||
/// You don’t have chats for this selection
|
||||
|
||||
@@ -17,9 +17,10 @@ enum RoomListFilter: Int, CaseIterable, Identifiable {
|
||||
}
|
||||
|
||||
case unreads
|
||||
case mentions
|
||||
case favourites
|
||||
case people
|
||||
case rooms
|
||||
case favourites
|
||||
case invites
|
||||
case lowPriority
|
||||
|
||||
@@ -35,6 +36,8 @@ enum RoomListFilter: Int, CaseIterable, Identifiable {
|
||||
return L10n.screenRoomlistFilterRooms
|
||||
case .unreads:
|
||||
return L10n.screenRoomlistFilterUnreads
|
||||
case .mentions:
|
||||
return L10n.screenRoomlistFilterMention
|
||||
case .favourites:
|
||||
return L10n.screenRoomlistFilterFavourites
|
||||
case .invites:
|
||||
@@ -52,10 +55,12 @@ enum RoomListFilter: Int, CaseIterable, Identifiable {
|
||||
return [.people, .invites]
|
||||
case .unreads:
|
||||
return [.invites]
|
||||
case .mentions:
|
||||
return [.invites]
|
||||
case .favourites:
|
||||
return [.invites, .lowPriority]
|
||||
case .invites:
|
||||
return [.rooms, .people, .unreads, .favourites, .lowPriority]
|
||||
return [.rooms, .people, .unreads, .mentions, .favourites, .lowPriority]
|
||||
case .lowPriority:
|
||||
return [.favourites, .invites]
|
||||
}
|
||||
@@ -68,7 +73,9 @@ enum RoomListFilter: Int, CaseIterable, Identifiable {
|
||||
case .rooms:
|
||||
return .all(filters: [.category(expect: .group), .joined])
|
||||
case .unreads:
|
||||
return .all(filters: [.unread, .joined])
|
||||
return .all(filters: [.readReceipts(expect: .notifications), .joined])
|
||||
case .mentions:
|
||||
return .all(filters: [.readReceipts(expect: .mentions), .joined])
|
||||
case .favourites:
|
||||
return .all(filters: [.favourite, .joined])
|
||||
case .invites:
|
||||
@@ -96,6 +103,10 @@ struct RoomListFiltersState {
|
||||
availableFilters.remove(.lowPriority)
|
||||
}
|
||||
|
||||
if !appSettings.mentionsFilterEnabled {
|
||||
availableFilters.remove(.mentions)
|
||||
}
|
||||
|
||||
for filter in activeFilters {
|
||||
availableFilters.remove(filter)
|
||||
filter.incompatibleFilters.forEach { availableFilters.remove($0) }
|
||||
|
||||
@@ -16,6 +16,8 @@ struct RoomListFiltersEmptyStateView: View {
|
||||
switch state.activeFilters[0] {
|
||||
case .unreads:
|
||||
return L10n.screenRoomlistFilterUnreadsEmptyStateTitle
|
||||
case .mentions:
|
||||
return L10n.screenRoomlistFilterMentionEmptyStateTitle
|
||||
case .people:
|
||||
return L10n.screenRoomlistFilterPeopleEmptyStateTitle
|
||||
case .rooms:
|
||||
|
||||
+1
@@ -63,6 +63,7 @@ protocol DeveloperOptionsProtocol: AnyObject {
|
||||
|
||||
var fuzzyRoomListSearchEnabled: Bool { get set }
|
||||
var lowPriorityFilterEnabled: Bool { get set }
|
||||
var mentionsFilterEnabled: Bool { get set }
|
||||
var knockingEnabled: Bool { get set }
|
||||
|
||||
var linkPreviewsEnabled: Bool { get set }
|
||||
|
||||
+4
@@ -75,6 +75,10 @@ struct DeveloperOptionsScreen: View {
|
||||
Text("Low priority filter")
|
||||
}
|
||||
|
||||
Toggle(isOn: $context.mentionsFilterEnabled) {
|
||||
Text("Mentions filter")
|
||||
}
|
||||
|
||||
Toggle(isOn: $context.automaticBackPaginationEnabled) {
|
||||
Text("Automatic back pagination")
|
||||
Text("Requires app reboot")
|
||||
|
||||
@@ -26,6 +26,7 @@ nonisolated struct ClientFactory: ClientFactoryProtocol {
|
||||
appHooks: appHooks,
|
||||
enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode,
|
||||
threadsEnabled: appSettings.threadsEnabled)
|
||||
.enableAutomaticBackPagination(enableAutomaticBackPagination: appSettings.automaticBackPaginationEnabled)
|
||||
.sqliteStore(config: .init(dataPath: sessionDirectories.dataPath, cachePath: sessionDirectories.cachePath)
|
||||
.passphrase(passphrase: passphrase))
|
||||
.serverNameOrHomeserverUrl(serverNameOrUrl: homeserverAddress)
|
||||
@@ -63,6 +64,7 @@ nonisolated struct ClientFactory: ClientFactoryProtocol {
|
||||
appHooks: appHooks,
|
||||
enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode,
|
||||
threadsEnabled: appSettings.threadsEnabled)
|
||||
.enableAutomaticBackPagination(enableAutomaticBackPagination: appSettings.automaticBackPaginationEnabled)
|
||||
.sqliteStore(config: .init(dataPath: credentials.restorationToken.sessionDirectories.dataPath,
|
||||
cachePath: credentials.restorationToken.sessionDirectories.cachePath)
|
||||
.passphrase(passphrase: credentials.restorationToken.passphrase))
|
||||
|
||||
@@ -214,11 +214,6 @@ class ClientProxy: ClientProxyProtocol {
|
||||
|
||||
userProfileSubject = .init(UserProfile(userID: (try? client.userId()) ?? ""))
|
||||
|
||||
if appSettings.automaticBackPaginationEnabled {
|
||||
// Must be called before creating the sync service, timelines etc.
|
||||
client.enableAutomaticBackpagination()
|
||||
}
|
||||
|
||||
mediaLoader = MediaLoader(client: client)
|
||||
|
||||
// Route media downloads through a content scanner when one has been configured for the server,
|
||||
|
||||
@@ -114,7 +114,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
||||
subscribedForUpdates = true
|
||||
|
||||
do {
|
||||
try await roomListService.subscribeToRooms(roomIds: [id])
|
||||
try await roomListService.setRoomSubscriptions(roomIds: [id])
|
||||
} catch {
|
||||
MXLog.error("Failed subscribing to room with error: \(error)")
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
|
||||
Task { [weak self] in
|
||||
do {
|
||||
try await self?.roomListService.subscribeToRooms(roomIds: roomIDs)
|
||||
try await self?.roomListService.setRoomSubscriptions(roomIds: roomIDs)
|
||||
} catch {
|
||||
MXLog.error("Failed subscribing to rooms with error: \(error)")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user