mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Suggest recently visited rooms when forwarding messages (#6251)
* Suggest recently visited rooms when forwarding messages The Forward to screen now shows up to 5 recently visited rooms in a Suggestions section, above a Chats section that lists every room. The suggestions are never searched: while searching, only the Chats section is shown and filtered. The source room, invites, spaces and upgraded rooms are never suggested, and the section is hidden when there is nothing to suggest. The suggestions are resolved from the room summaries rather than room proxies, so they show up without holding back the list, and they are re-resolved as the room list loads after a cold start. ClientProxy now exposes the recently visited room IDs for this. The recently visited rooms filter is now async, so callers choose its isolation instead of asserting it at runtime. * Apply review suggestions to the forwarding suggestions Rooms: - Each room is listed once. Suggested rooms are left out of Chats unless searching, where Chats lists every result. This also removes the duplicated row whose selection changed without the tapped row's animation. - The Chats header is hidden when the section has no rooms. Suggestions: - Resolve them once when the screen opens instead of on every room list update.
This commit is contained in:
+5
-8
@@ -48,14 +48,11 @@ class SpaceAddRoomsScreenViewModel: SpaceAddRoomsScreenViewModelType, SpaceAddRo
|
||||
Task {
|
||||
let existingRooms = spaceRoomListProxy.spaceRoomsPublisher.value
|
||||
suggestedRooms = await userSession.clientProxy
|
||||
.recentlyVisitedRooms { roomProxy in
|
||||
// The filter is Sendable for the mock's sake but the client proxy always calls it on the main actor.
|
||||
MainActor.assumeIsolated {
|
||||
!roomProxy.infoPublisher.value.isDirect
|
||||
&& !roomProxy.infoPublisher.value.isSpace
|
||||
&& roomProxy.infoPublisher.value.membership == .joined
|
||||
&& !existingRooms.contains { $0.id == roomProxy.id }
|
||||
}
|
||||
.recentlyVisitedRooms { @MainActor roomProxy in
|
||||
!roomProxy.infoPublisher.value.isDirect
|
||||
&& !roomProxy.infoPublisher.value.isSpace
|
||||
&& roomProxy.infoPublisher.value.membership == .joined
|
||||
&& !existingRooms.contains { $0.id == roomProxy.id }
|
||||
}
|
||||
.map { .init(roomProxy: $0) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user