Fixes #1342 - Remove custom last message for rooms that don't have one

This commit is contained in:
Stefan Ceriu
2023-09-13 12:06:50 +03:00
committed by Stefan Ceriu
parent da29c7efde
commit 9fbf70282e
3 changed files with 11 additions and 36 deletions
@@ -105,23 +105,7 @@ struct HomeScreenViewStateBindings {
struct HomeScreenRoom: Identifiable, Equatable {
static let placeholderLastMessage = AttributedString("Hidden last message")
enum LastMessage: Equatable {
case loaded(AttributedString)
case loading
case unknown
init(attributedString: AttributedString?, isLoading: Bool) {
if let message = attributedString, !message.characters.isEmpty {
self = .loaded(message)
} else if isLoading {
self = .loading
} else {
self = .unknown
}
}
}
/// 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
@@ -135,7 +119,7 @@ struct HomeScreenRoom: Identifiable, Equatable {
var timestamp: String?
var lastMessage: LastMessage
var lastMessage: AttributedString?
var avatarURL: URL?
@@ -155,7 +139,7 @@ struct HomeScreenRoom: Identifiable, Equatable {
name: "Placeholder room name",
hasUnreads: false,
timestamp: "Now",
lastMessage: .loading,
lastMessage: placeholderLastMessage,
isPlaceholder: true)
}
}