Room list fixes (#431)

* Fixes #396 - Avoid duplicates in room list, cleanup logic throughout

* Re-enabled the allRoomsView with a hard 500 room limit and reduced the diffing collection time.

* Fixes #385, #411 - Filter out spaces, invites and tombstoned rooms from the room list

* Various tweaks following code review
This commit is contained in:
Stefan Ceriu
2023-01-10 17:34:42 +02:00
committed by GitHub
parent edc06bf662
commit 3d1266ca25
9 changed files with 151 additions and 107 deletions
@@ -70,8 +70,8 @@ struct HomeScreenViewState: BindableState {
var bindings = HomeScreenViewStateBindings()
var placeholderRooms: [HomeScreenRoom] {
(1...10).map { index in
HomeScreenRoom.placeholder(id: "\(index)")
(1...10).map { _ in
HomeScreenRoom.placeholder()
}
}
}
@@ -83,8 +83,13 @@ struct HomeScreenViewStateBindings {
}
struct HomeScreenRoom: Identifiable, Equatable {
/// The list item identifier can be a real room identifier, a custom one for invalidated entries
/// or a completely unique one for empty items and skeletons
let id: String
/// The real room identifier this item points to
let roomId: String?
let name: String
let hasUnreads: Bool
@@ -93,12 +98,15 @@ struct HomeScreenRoom: Identifiable, Equatable {
var lastMessage: AttributedString?
var avatarURLString: String?
var avatar: UIImage?
var isPlaceholder = false
static func placeholder(id: String) -> HomeScreenRoom {
HomeScreenRoom(id: id,
static func placeholder() -> HomeScreenRoom {
HomeScreenRoom(id: UUID().uuidString,
roomId: nil,
name: "Placeholder room name",
hasUnreads: false,
timestamp: "Now",