mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Show space invites in the room list. (#4545)
This commit is contained in:
@@ -55,6 +55,8 @@ struct RoomEventStringBuilder {
|
||||
default: L10n.commonWaitingForDecryptionKey
|
||||
}
|
||||
return prefix(errorMessage, with: displayName, isOutgoing: isOutgoing)
|
||||
case .other(eventType: let eventType):
|
||||
return nil // We shouldn't receive these without asking for custom event types.
|
||||
}
|
||||
case .failedToParseMessageLike, .failedToParseState:
|
||||
return prefix(L10n.commonUnsupportedEvent, with: displayName, isOutgoing: isOutgoing)
|
||||
|
||||
@@ -37,6 +37,7 @@ struct RoomSummary {
|
||||
|
||||
let name: String
|
||||
let isDirect: Bool
|
||||
let isSpace: Bool
|
||||
let avatarURL: URL?
|
||||
|
||||
let heroes: [UserProfileProxy]
|
||||
@@ -107,6 +108,7 @@ extension RoomSummary {
|
||||
let string = "\(settingsMode) - messages: \(hasUnreadMessages) - mentions: \(hasUnreadMentions) - notifications: \(hasUnreadNotifications)"
|
||||
name = string
|
||||
isDirect = true
|
||||
isSpace = false
|
||||
avatarURL = nil
|
||||
|
||||
heroes = []
|
||||
@@ -134,12 +136,9 @@ extension RoomSummary {
|
||||
return .tombstoned
|
||||
}
|
||||
|
||||
// NOTE: The check for isSpace isn't implemented yet, waiting to see
|
||||
// whether we end up with a different type for spaces in the room list.
|
||||
//
|
||||
// Don't forget to add a test when you remove this comment 😄
|
||||
|
||||
if isDirect, avatarURL == nil, heroes.count == 1 {
|
||||
if isSpace {
|
||||
return .space(id: id, name: name, avatarURL: avatarURL)
|
||||
} else if isDirect, avatarURL == nil, heroes.count == 1 {
|
||||
return .heroes(heroes)
|
||||
} else {
|
||||
return .room(id: id, name: name, avatarURL: avatarURL)
|
||||
|
||||
@@ -118,19 +118,26 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
}
|
||||
|
||||
func setFilter(_ filter: RoomSummaryProviderFilter) {
|
||||
let baseFilter: [RoomListEntriesDynamicFilterKind] = if appSettings.spacesEnabled {
|
||||
[.any(filters: [.all(filters: [.nonSpace, .nonLeft]),
|
||||
.all(filters: [.space, .invite])]),
|
||||
.deduplicateVersions]
|
||||
} else {
|
||||
[.nonLeft, .nonSpace, .deduplicateVersions]
|
||||
}
|
||||
|
||||
switch filter {
|
||||
case .excludeAll:
|
||||
_ = listUpdatesSubscriptionResult?.controller().setFilter(kind: .none)
|
||||
case let .search(query):
|
||||
let filters: [RoomListEntriesDynamicFilterKind] = if appSettings.fuzzyRoomListSearchEnabled {
|
||||
[.fuzzyMatchRoomName(pattern: query), .nonLeft, .nonSpace, .deduplicateVersions]
|
||||
let filters = if appSettings.fuzzyRoomListSearchEnabled {
|
||||
[.fuzzyMatchRoomName(pattern: query)] + baseFilter
|
||||
} else {
|
||||
[.normalizedMatchRoomName(pattern: query), .nonLeft, .nonSpace, .deduplicateVersions]
|
||||
[.normalizedMatchRoomName(pattern: query)] + baseFilter
|
||||
}
|
||||
_ = listUpdatesSubscriptionResult?.controller().setFilter(kind: .all(filters: filters))
|
||||
case let .all(filters):
|
||||
var rustFilters = filters.map(\.rustFilter)
|
||||
rustFilters.append(contentsOf: [.nonLeft, .nonSpace, .deduplicateVersions])
|
||||
var rustFilters = filters.map(\.rustFilter) + baseFilter
|
||||
|
||||
if !filters.contains(.lowPriority), appSettings.lowPriorityFilterEnabled {
|
||||
rustFilters.append(.nonLowPriority)
|
||||
@@ -277,6 +284,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
joinRequestType: joinRequestType,
|
||||
name: roomInfo.displayName ?? roomInfo.id,
|
||||
isDirect: roomInfo.isDirect,
|
||||
isSpace: roomInfo.isSpace,
|
||||
avatarURL: roomInfo.avatarUrl.flatMap(URL.init(string:)),
|
||||
heroes: roomInfo.heroes.map(UserProfileProxy.init),
|
||||
activeMembersCount: UInt(roomInfo.activeMembersCount),
|
||||
|
||||
@@ -40,6 +40,8 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
return buildRedactedTimelineItem(eventItemProxy, messageLikeContent, isOutgoing)
|
||||
case .unableToDecrypt(let encryptedMessage):
|
||||
return buildEncryptedTimelineItem(eventItemProxy, messageLikeContent, encryptedMessage, isOutgoing)
|
||||
case .other(eventType: let eventType):
|
||||
return nil // We shouldn't receive these without asking for custom event types.
|
||||
}
|
||||
case .failedToParseMessageLike(let eventType, let error):
|
||||
return buildUnsupportedTimelineItem(eventItemProxy, eventType, error, isOutgoing)
|
||||
|
||||
Reference in New Issue
Block a user