mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-06 04:18:31 +00:00
Show space invites in the room list. (#4545)
This commit is contained in:
@@ -9364,7 +9364,7 @@
|
|||||||
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
|
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = exactVersion;
|
kind = exactVersion;
|
||||||
version = "25.09.19-2";
|
version = 25.09.26;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
||||||
|
|||||||
@@ -150,8 +150,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
|
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "6da13e26194148a51ff21024df5946e1641be209",
|
"revision" : "c79dc9374e580b74084535ebe09925764939058b",
|
||||||
"version" : "25.9.19-2"
|
"version" : "25.9.26"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Generated using Sourcery 2.2.7 — https://github.com/krzysztofzablocki/Sourcery
|
// Generated using Sourcery 2.3.0 — https://github.com/krzysztofzablocki/Sourcery
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
|
|
||||||
// swiftlint:disable all
|
// swiftlint:disable all
|
||||||
@@ -8149,6 +8149,75 @@ open class EncryptionSDKMock: MatrixRustSDK.Encryption, @unchecked Sendable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//MARK: - hasDevicesToVerifyAgainst
|
||||||
|
|
||||||
|
open var hasDevicesToVerifyAgainstThrowableError: Error?
|
||||||
|
var hasDevicesToVerifyAgainstUnderlyingCallsCount = 0
|
||||||
|
open var hasDevicesToVerifyAgainstCallsCount: Int {
|
||||||
|
get {
|
||||||
|
if Thread.isMainThread {
|
||||||
|
return hasDevicesToVerifyAgainstUnderlyingCallsCount
|
||||||
|
} else {
|
||||||
|
var returnValue: Int? = nil
|
||||||
|
DispatchQueue.main.sync {
|
||||||
|
returnValue = hasDevicesToVerifyAgainstUnderlyingCallsCount
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnValue!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if Thread.isMainThread {
|
||||||
|
hasDevicesToVerifyAgainstUnderlyingCallsCount = newValue
|
||||||
|
} else {
|
||||||
|
DispatchQueue.main.sync {
|
||||||
|
hasDevicesToVerifyAgainstUnderlyingCallsCount = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
open var hasDevicesToVerifyAgainstCalled: Bool {
|
||||||
|
return hasDevicesToVerifyAgainstCallsCount > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var hasDevicesToVerifyAgainstUnderlyingReturnValue: Bool!
|
||||||
|
open var hasDevicesToVerifyAgainstReturnValue: Bool! {
|
||||||
|
get {
|
||||||
|
if Thread.isMainThread {
|
||||||
|
return hasDevicesToVerifyAgainstUnderlyingReturnValue
|
||||||
|
} else {
|
||||||
|
var returnValue: Bool? = nil
|
||||||
|
DispatchQueue.main.sync {
|
||||||
|
returnValue = hasDevicesToVerifyAgainstUnderlyingReturnValue
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnValue!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if Thread.isMainThread {
|
||||||
|
hasDevicesToVerifyAgainstUnderlyingReturnValue = newValue
|
||||||
|
} else {
|
||||||
|
DispatchQueue.main.sync {
|
||||||
|
hasDevicesToVerifyAgainstUnderlyingReturnValue = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
open var hasDevicesToVerifyAgainstClosure: (() async throws -> Bool)?
|
||||||
|
|
||||||
|
open override func hasDevicesToVerifyAgainst() async throws -> Bool {
|
||||||
|
if let error = hasDevicesToVerifyAgainstThrowableError {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
hasDevicesToVerifyAgainstCallsCount += 1
|
||||||
|
if let hasDevicesToVerifyAgainstClosure = hasDevicesToVerifyAgainstClosure {
|
||||||
|
return try await hasDevicesToVerifyAgainstClosure()
|
||||||
|
} else {
|
||||||
|
return hasDevicesToVerifyAgainstReturnValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//MARK: - isLastDevice
|
//MARK: - isLastDevice
|
||||||
|
|
||||||
open var isLastDeviceThrowableError: Error?
|
open var isLastDeviceThrowableError: Error?
|
||||||
@@ -14289,6 +14358,81 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//MARK: - loadOrFetchEvent
|
||||||
|
|
||||||
|
open var loadOrFetchEventEventIdThrowableError: Error?
|
||||||
|
var loadOrFetchEventEventIdUnderlyingCallsCount = 0
|
||||||
|
open var loadOrFetchEventEventIdCallsCount: Int {
|
||||||
|
get {
|
||||||
|
if Thread.isMainThread {
|
||||||
|
return loadOrFetchEventEventIdUnderlyingCallsCount
|
||||||
|
} else {
|
||||||
|
var returnValue: Int? = nil
|
||||||
|
DispatchQueue.main.sync {
|
||||||
|
returnValue = loadOrFetchEventEventIdUnderlyingCallsCount
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnValue!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if Thread.isMainThread {
|
||||||
|
loadOrFetchEventEventIdUnderlyingCallsCount = newValue
|
||||||
|
} else {
|
||||||
|
DispatchQueue.main.sync {
|
||||||
|
loadOrFetchEventEventIdUnderlyingCallsCount = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
open var loadOrFetchEventEventIdCalled: Bool {
|
||||||
|
return loadOrFetchEventEventIdCallsCount > 0
|
||||||
|
}
|
||||||
|
open var loadOrFetchEventEventIdReceivedEventId: String?
|
||||||
|
open var loadOrFetchEventEventIdReceivedInvocations: [String] = []
|
||||||
|
|
||||||
|
var loadOrFetchEventEventIdUnderlyingReturnValue: TimelineEvent!
|
||||||
|
open var loadOrFetchEventEventIdReturnValue: TimelineEvent! {
|
||||||
|
get {
|
||||||
|
if Thread.isMainThread {
|
||||||
|
return loadOrFetchEventEventIdUnderlyingReturnValue
|
||||||
|
} else {
|
||||||
|
var returnValue: TimelineEvent? = nil
|
||||||
|
DispatchQueue.main.sync {
|
||||||
|
returnValue = loadOrFetchEventEventIdUnderlyingReturnValue
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnValue!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if Thread.isMainThread {
|
||||||
|
loadOrFetchEventEventIdUnderlyingReturnValue = newValue
|
||||||
|
} else {
|
||||||
|
DispatchQueue.main.sync {
|
||||||
|
loadOrFetchEventEventIdUnderlyingReturnValue = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
open var loadOrFetchEventEventIdClosure: ((String) async throws -> TimelineEvent)?
|
||||||
|
|
||||||
|
open override func loadOrFetchEvent(eventId: String) async throws -> TimelineEvent {
|
||||||
|
if let error = loadOrFetchEventEventIdThrowableError {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
loadOrFetchEventEventIdCallsCount += 1
|
||||||
|
loadOrFetchEventEventIdReceivedEventId = eventId
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.loadOrFetchEventEventIdReceivedInvocations.append(eventId)
|
||||||
|
}
|
||||||
|
if let loadOrFetchEventEventIdClosure = loadOrFetchEventEventIdClosure {
|
||||||
|
return try await loadOrFetchEventEventIdClosure(eventId)
|
||||||
|
} else {
|
||||||
|
return loadOrFetchEventEventIdReturnValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//MARK: - markAsRead
|
//MARK: - markAsRead
|
||||||
|
|
||||||
open var markAsReadReceiptTypeThrowableError: Error?
|
open var markAsReadReceiptTypeThrowableError: Error?
|
||||||
@@ -25317,6 +25461,71 @@ open class TimelineEventSDKMock: MatrixRustSDK.TimelineEvent, @unchecked Sendabl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//MARK: - threadRootEventId
|
||||||
|
|
||||||
|
var threadRootEventIdUnderlyingCallsCount = 0
|
||||||
|
open var threadRootEventIdCallsCount: Int {
|
||||||
|
get {
|
||||||
|
if Thread.isMainThread {
|
||||||
|
return threadRootEventIdUnderlyingCallsCount
|
||||||
|
} else {
|
||||||
|
var returnValue: Int? = nil
|
||||||
|
DispatchQueue.main.sync {
|
||||||
|
returnValue = threadRootEventIdUnderlyingCallsCount
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnValue!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if Thread.isMainThread {
|
||||||
|
threadRootEventIdUnderlyingCallsCount = newValue
|
||||||
|
} else {
|
||||||
|
DispatchQueue.main.sync {
|
||||||
|
threadRootEventIdUnderlyingCallsCount = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
open var threadRootEventIdCalled: Bool {
|
||||||
|
return threadRootEventIdCallsCount > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var threadRootEventIdUnderlyingReturnValue: String?
|
||||||
|
open var threadRootEventIdReturnValue: String? {
|
||||||
|
get {
|
||||||
|
if Thread.isMainThread {
|
||||||
|
return threadRootEventIdUnderlyingReturnValue
|
||||||
|
} else {
|
||||||
|
var returnValue: String?? = nil
|
||||||
|
DispatchQueue.main.sync {
|
||||||
|
returnValue = threadRootEventIdUnderlyingReturnValue
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnValue!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if Thread.isMainThread {
|
||||||
|
threadRootEventIdUnderlyingReturnValue = newValue
|
||||||
|
} else {
|
||||||
|
DispatchQueue.main.sync {
|
||||||
|
threadRootEventIdUnderlyingReturnValue = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
open var threadRootEventIdClosure: (() -> String?)?
|
||||||
|
|
||||||
|
open override func threadRootEventId() -> String? {
|
||||||
|
threadRootEventIdCallsCount += 1
|
||||||
|
if let threadRootEventIdClosure = threadRootEventIdClosure {
|
||||||
|
return threadRootEventIdClosure()
|
||||||
|
} else {
|
||||||
|
return threadRootEventIdReturnValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//MARK: - timestamp
|
//MARK: - timestamp
|
||||||
|
|
||||||
var timestampUnderlyingCallsCount = 0
|
var timestampUnderlyingCallsCount = 0
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ extension RoomSummary {
|
|||||||
joinRequestType: nil,
|
joinRequestType: nil,
|
||||||
name: name,
|
name: name,
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
heroes: [],
|
heroes: [],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
@@ -101,6 +102,7 @@ extension Array where Element == RoomSummary {
|
|||||||
joinRequestType: nil,
|
joinRequestType: nil,
|
||||||
name: "Foundation 🔭🪐🌌",
|
name: "Foundation 🔭🪐🌌",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
heroes: [],
|
heroes: [],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
@@ -121,6 +123,7 @@ extension Array where Element == RoomSummary {
|
|||||||
joinRequestType: nil,
|
joinRequestType: nil,
|
||||||
name: "Foundation and Empire",
|
name: "Foundation and Empire",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: .mockMXCAvatar,
|
avatarURL: .mockMXCAvatar,
|
||||||
heroes: [],
|
heroes: [],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
@@ -141,6 +144,7 @@ extension Array where Element == RoomSummary {
|
|||||||
joinRequestType: nil,
|
joinRequestType: nil,
|
||||||
name: "Second Foundation",
|
name: "Second Foundation",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
heroes: [],
|
heroes: [],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
@@ -161,6 +165,7 @@ extension Array where Element == RoomSummary {
|
|||||||
joinRequestType: nil,
|
joinRequestType: nil,
|
||||||
name: "Foundation's Edge",
|
name: "Foundation's Edge",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
heroes: [],
|
heroes: [],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
@@ -181,6 +186,7 @@ extension Array where Element == RoomSummary {
|
|||||||
joinRequestType: nil,
|
joinRequestType: nil,
|
||||||
name: "Foundation and Earth",
|
name: "Foundation and Earth",
|
||||||
isDirect: true,
|
isDirect: true,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
heroes: [],
|
heroes: [],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
@@ -201,6 +207,7 @@ extension Array where Element == RoomSummary {
|
|||||||
joinRequestType: nil,
|
joinRequestType: nil,
|
||||||
name: "Prelude to Foundation",
|
name: "Prelude to Foundation",
|
||||||
isDirect: true,
|
isDirect: true,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
heroes: [],
|
heroes: [],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
@@ -221,6 +228,7 @@ extension Array where Element == RoomSummary {
|
|||||||
joinRequestType: nil,
|
joinRequestType: nil,
|
||||||
name: "Tombstoned",
|
name: "Tombstoned",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
heroes: [],
|
heroes: [],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
@@ -241,6 +249,7 @@ extension Array where Element == RoomSummary {
|
|||||||
joinRequestType: nil,
|
joinRequestType: nil,
|
||||||
name: "Unknown",
|
name: "Unknown",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
heroes: [],
|
heroes: [],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
@@ -294,6 +303,7 @@ extension Array where Element == RoomSummary {
|
|||||||
joinRequestType: .invite(inviter: RoomMemberProxyMock.mockCharlie),
|
joinRequestType: .invite(inviter: RoomMemberProxyMock.mockCharlie),
|
||||||
name: "First room",
|
name: "First room",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: .mockMXCAvatar,
|
avatarURL: .mockMXCAvatar,
|
||||||
heroes: [],
|
heroes: [],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
@@ -314,6 +324,7 @@ extension Array where Element == RoomSummary {
|
|||||||
joinRequestType: .invite(inviter: RoomMemberProxyMock.mockCharlie),
|
joinRequestType: .invite(inviter: RoomMemberProxyMock.mockCharlie),
|
||||||
name: "Second room",
|
name: "Second room",
|
||||||
isDirect: true,
|
isDirect: true,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
heroes: [],
|
heroes: [],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
|
|||||||
@@ -155,23 +155,34 @@ struct HomeScreenInviteCell_Previews: PreviewProvider, TestablePreview {
|
|||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
HomeScreenInviteCell(room: .dmInvite,
|
HomeScreenInviteCell(room: .dmInvite,
|
||||||
context: makeViewModel().context, hideInviteAvatars: false)
|
context: makeViewModel().context,
|
||||||
|
hideInviteAvatars: false)
|
||||||
|
|
||||||
HomeScreenInviteCell(room: .dmInvite,
|
HomeScreenInviteCell(room: .invite(),
|
||||||
context: makeViewModel().context, hideInviteAvatars: false)
|
context: makeViewModel().context,
|
||||||
|
hideInviteAvatars: false)
|
||||||
|
|
||||||
HomeScreenInviteCell(room: .roomInvite(),
|
HomeScreenInviteCell(room: .invite(alias: "#footest:somewhere.org",
|
||||||
context: makeViewModel().context, hideInviteAvatars: false)
|
avatarURL: .mockMXCAvatar),
|
||||||
|
context: makeViewModel().context,
|
||||||
|
hideInviteAvatars: false)
|
||||||
|
|
||||||
HomeScreenInviteCell(room: .roomInvite(),
|
// Not the final design, may get its own cell type entirely.
|
||||||
context: makeViewModel().context, hideInviteAvatars: false)
|
HomeScreenInviteCell(room: .invite(name: "Awesome Space",
|
||||||
|
isSpace: true,
|
||||||
|
alias: "#footest:somewhere.org",
|
||||||
|
avatarURL: .mockMXCAvatar),
|
||||||
|
context: makeViewModel().context,
|
||||||
|
hideInviteAvatars: false)
|
||||||
|
|
||||||
HomeScreenInviteCell(room: .roomInvite(alias: "#footest:somewhere.org", avatarURL: .mockMXCAvatar),
|
HomeScreenInviteCell(room: .invite(name: "Hidden Avatars",
|
||||||
context: makeViewModel().context, hideInviteAvatars: false)
|
avatarURL: .mockMXCAvatar),
|
||||||
HomeScreenInviteCell(room: .roomInvite(alias: "#footest-hidden-avatars:somewhere.org", avatarURL: .mockMXCAvatar),
|
context: makeViewModel().context,
|
||||||
context: makeViewModel().context, hideInviteAvatars: true)
|
hideInviteAvatars: true)
|
||||||
HomeScreenInviteCell(room: .roomInvite(alias: "#footest:somewhere.org"),
|
|
||||||
context: makeViewModel().context, hideInviteAvatars: false)
|
HomeScreenInviteCell(room: .invite(alias: "#footest:somewhere.org"),
|
||||||
|
context: makeViewModel().context,
|
||||||
|
hideInviteAvatars: false)
|
||||||
.dynamicTypeSize(.accessibility1)
|
.dynamicTypeSize(.accessibility1)
|
||||||
.previewDisplayName("Aliased room (AX1)")
|
.previewDisplayName("Aliased room (AX1)")
|
||||||
}
|
}
|
||||||
@@ -204,6 +215,7 @@ private extension HomeScreenRoom {
|
|||||||
joinRequestType: .invite(inviter: inviter),
|
joinRequestType: .invite(inviter: inviter),
|
||||||
name: "Some Guy",
|
name: "Some Guy",
|
||||||
isDirect: true,
|
isDirect: true,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
heroes: [.init(userID: "@someone:somewhere.com")],
|
heroes: [.init(userID: "@someone:somewhere.com")],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
@@ -223,7 +235,10 @@ private extension HomeScreenRoom {
|
|||||||
return .init(summary: summary, hideUnreadMessagesBadge: false)
|
return .init(summary: summary, hideUnreadMessagesBadge: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
static func roomInvite(alias: String? = nil, avatarURL: URL? = nil) -> HomeScreenRoom {
|
static func invite(name: String = "Awesome Room",
|
||||||
|
isSpace: Bool = false,
|
||||||
|
alias: String? = nil,
|
||||||
|
avatarURL: URL? = nil) -> HomeScreenRoom {
|
||||||
let inviter = RoomMemberProxyMock()
|
let inviter = RoomMemberProxyMock()
|
||||||
inviter.displayName = "Luca"
|
inviter.displayName = "Luca"
|
||||||
inviter.userID = "@jack:somewhi.nl"
|
inviter.userID = "@jack:somewhi.nl"
|
||||||
@@ -232,8 +247,9 @@ private extension HomeScreenRoom {
|
|||||||
let summary = RoomSummary(room: RoomSDKMock(),
|
let summary = RoomSummary(room: RoomSDKMock(),
|
||||||
id: "@someone:somewhere.com",
|
id: "@someone:somewhere.com",
|
||||||
joinRequestType: .invite(inviter: inviter),
|
joinRequestType: .invite(inviter: inviter),
|
||||||
name: "Awesome Room",
|
name: name,
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
|
isSpace: isSpace,
|
||||||
avatarURL: avatarURL,
|
avatarURL: avatarURL,
|
||||||
heroes: [.init(userID: "@someone:somewhere.com")],
|
heroes: [.init(userID: "@someone:somewhere.com")],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ private extension HomeScreenRoom {
|
|||||||
joinRequestType: .invite(inviter: inviter),
|
joinRequestType: .invite(inviter: inviter),
|
||||||
name: "Some Guy",
|
name: "Some Guy",
|
||||||
isDirect: true,
|
isDirect: true,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
heroes: [.init(userID: "@someone:somewhere.com")],
|
heroes: [.init(userID: "@someone:somewhere.com")],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
@@ -179,6 +180,7 @@ private extension HomeScreenRoom {
|
|||||||
joinRequestType: .invite(inviter: inviter),
|
joinRequestType: .invite(inviter: inviter),
|
||||||
name: "Awesome Room",
|
name: "Awesome Room",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: avatarURL,
|
avatarURL: avatarURL,
|
||||||
heroes: [.init(userID: "@someone:somewhere.com")],
|
heroes: [.init(userID: "@someone:somewhere.com")],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ struct RoomEventStringBuilder {
|
|||||||
default: L10n.commonWaitingForDecryptionKey
|
default: L10n.commonWaitingForDecryptionKey
|
||||||
}
|
}
|
||||||
return prefix(errorMessage, with: displayName, isOutgoing: isOutgoing)
|
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:
|
case .failedToParseMessageLike, .failedToParseState:
|
||||||
return prefix(L10n.commonUnsupportedEvent, with: displayName, isOutgoing: isOutgoing)
|
return prefix(L10n.commonUnsupportedEvent, with: displayName, isOutgoing: isOutgoing)
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ struct RoomSummary {
|
|||||||
|
|
||||||
let name: String
|
let name: String
|
||||||
let isDirect: Bool
|
let isDirect: Bool
|
||||||
|
let isSpace: Bool
|
||||||
let avatarURL: URL?
|
let avatarURL: URL?
|
||||||
|
|
||||||
let heroes: [UserProfileProxy]
|
let heroes: [UserProfileProxy]
|
||||||
@@ -107,6 +108,7 @@ extension RoomSummary {
|
|||||||
let string = "\(settingsMode) - messages: \(hasUnreadMessages) - mentions: \(hasUnreadMentions) - notifications: \(hasUnreadNotifications)"
|
let string = "\(settingsMode) - messages: \(hasUnreadMessages) - mentions: \(hasUnreadMentions) - notifications: \(hasUnreadNotifications)"
|
||||||
name = string
|
name = string
|
||||||
isDirect = true
|
isDirect = true
|
||||||
|
isSpace = false
|
||||||
avatarURL = nil
|
avatarURL = nil
|
||||||
|
|
||||||
heroes = []
|
heroes = []
|
||||||
@@ -134,12 +136,9 @@ extension RoomSummary {
|
|||||||
return .tombstoned
|
return .tombstoned
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: The check for isSpace isn't implemented yet, waiting to see
|
if isSpace {
|
||||||
// whether we end up with a different type for spaces in the room list.
|
return .space(id: id, name: name, avatarURL: avatarURL)
|
||||||
//
|
} else if isDirect, avatarURL == nil, heroes.count == 1 {
|
||||||
// Don't forget to add a test when you remove this comment 😄
|
|
||||||
|
|
||||||
if isDirect, avatarURL == nil, heroes.count == 1 {
|
|
||||||
return .heroes(heroes)
|
return .heroes(heroes)
|
||||||
} else {
|
} else {
|
||||||
return .room(id: id, name: name, avatarURL: avatarURL)
|
return .room(id: id, name: name, avatarURL: avatarURL)
|
||||||
|
|||||||
@@ -118,19 +118,26 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setFilter(_ filter: RoomSummaryProviderFilter) {
|
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 {
|
switch filter {
|
||||||
case .excludeAll:
|
case .excludeAll:
|
||||||
_ = listUpdatesSubscriptionResult?.controller().setFilter(kind: .none)
|
_ = listUpdatesSubscriptionResult?.controller().setFilter(kind: .none)
|
||||||
case let .search(query):
|
case let .search(query):
|
||||||
let filters: [RoomListEntriesDynamicFilterKind] = if appSettings.fuzzyRoomListSearchEnabled {
|
let filters = if appSettings.fuzzyRoomListSearchEnabled {
|
||||||
[.fuzzyMatchRoomName(pattern: query), .nonLeft, .nonSpace, .deduplicateVersions]
|
[.fuzzyMatchRoomName(pattern: query)] + baseFilter
|
||||||
} else {
|
} else {
|
||||||
[.normalizedMatchRoomName(pattern: query), .nonLeft, .nonSpace, .deduplicateVersions]
|
[.normalizedMatchRoomName(pattern: query)] + baseFilter
|
||||||
}
|
}
|
||||||
_ = listUpdatesSubscriptionResult?.controller().setFilter(kind: .all(filters: filters))
|
_ = listUpdatesSubscriptionResult?.controller().setFilter(kind: .all(filters: filters))
|
||||||
case let .all(filters):
|
case let .all(filters):
|
||||||
var rustFilters = filters.map(\.rustFilter)
|
var rustFilters = filters.map(\.rustFilter) + baseFilter
|
||||||
rustFilters.append(contentsOf: [.nonLeft, .nonSpace, .deduplicateVersions])
|
|
||||||
|
|
||||||
if !filters.contains(.lowPriority), appSettings.lowPriorityFilterEnabled {
|
if !filters.contains(.lowPriority), appSettings.lowPriorityFilterEnabled {
|
||||||
rustFilters.append(.nonLowPriority)
|
rustFilters.append(.nonLowPriority)
|
||||||
@@ -277,6 +284,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
joinRequestType: joinRequestType,
|
joinRequestType: joinRequestType,
|
||||||
name: roomInfo.displayName ?? roomInfo.id,
|
name: roomInfo.displayName ?? roomInfo.id,
|
||||||
isDirect: roomInfo.isDirect,
|
isDirect: roomInfo.isDirect,
|
||||||
|
isSpace: roomInfo.isSpace,
|
||||||
avatarURL: roomInfo.avatarUrl.flatMap(URL.init(string:)),
|
avatarURL: roomInfo.avatarUrl.flatMap(URL.init(string:)),
|
||||||
heroes: roomInfo.heroes.map(UserProfileProxy.init),
|
heroes: roomInfo.heroes.map(UserProfileProxy.init),
|
||||||
activeMembersCount: UInt(roomInfo.activeMembersCount),
|
activeMembersCount: UInt(roomInfo.activeMembersCount),
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
|||||||
return buildRedactedTimelineItem(eventItemProxy, messageLikeContent, isOutgoing)
|
return buildRedactedTimelineItem(eventItemProxy, messageLikeContent, isOutgoing)
|
||||||
case .unableToDecrypt(let encryptedMessage):
|
case .unableToDecrypt(let encryptedMessage):
|
||||||
return buildEncryptedTimelineItem(eventItemProxy, messageLikeContent, encryptedMessage, isOutgoing)
|
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):
|
case .failedToParseMessageLike(let eventType, let error):
|
||||||
return buildUnsupportedTimelineItem(eventItemProxy, eventType, error, isOutgoing)
|
return buildUnsupportedTimelineItem(eventItemProxy, eventType, error, isOutgoing)
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:7f1ccbe7325a061b9e4172023ad488e3bc84d1bc78258332cef1d001fe0c981d
|
oid sha256:47434bcec59bcd4dac1b9ed7263ea235b7dd99f190124b738f2ddc87c9f098fc
|
||||||
size 285976
|
size 280431
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:14e84577293fa0d99fa5e47e64f56abdb35ddcb078dc36c4003afc38e35d268c
|
oid sha256:a60f98dcc98f0ac79dcdc87fc11f05094c34445181b8f01559b4f5b28ac6e78c
|
||||||
size 305735
|
size 299297
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:6a06af6bc07ecafee0421eeff23e5b094bf5adbfd6cf2690dfc8c34ccad916c7
|
oid sha256:7a1a22b19ce5bb8077a65937ca34d590dd5997b1d0f2ad15481e1c9ca6563d7f
|
||||||
size 230104
|
size 232650
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:9e25479532f86cb78dbf03fc8f48429a6e090614728bb87c6a40edf521660803
|
oid sha256:d9794b3f11c6c35102a184b2cfb1c849a6741412da784059e27b7818a071936d
|
||||||
size 314381
|
size 309996
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
joinRequestType: nil,
|
joinRequestType: nil,
|
||||||
name: "Test room",
|
name: "Test room",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
heroes: [],
|
heroes: [],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class LoggingTests: XCTestCase {
|
|||||||
joinRequestType: nil,
|
joinRequestType: nil,
|
||||||
name: roomName,
|
name: roomName,
|
||||||
isDirect: true,
|
isDirect: true,
|
||||||
|
isSpace: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
heroes: [.init(userID: "", displayName: heroName)],
|
heroes: [.init(userID: "", displayName: heroName)],
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class RoomSummaryTests: XCTestCase {
|
|||||||
let heroes = [UserProfileProxy(userID: "hero_1", displayName: "Hero 1", avatarURL: "mxc://hs.tld/user/avatar")]
|
let heroes = [UserProfileProxy(userID: "hero_1", displayName: "Hero 1", avatarURL: "mxc://hs.tld/user/avatar")]
|
||||||
|
|
||||||
func testRoomAvatar() {
|
func testRoomAvatar() {
|
||||||
let details = makeSummary(isDirect: false, hasRoomAvatar: true, isTombstoned: false)
|
let details = makeSummary(isDirect: false, isSpace: false, hasRoomAvatar: true, isTombstoned: false)
|
||||||
|
|
||||||
switch details.avatar {
|
switch details.avatar {
|
||||||
case .room(let id, let name, let avatarURL):
|
case .room(let id, let name, let avatarURL):
|
||||||
@@ -32,7 +32,7 @@ class RoomSummaryTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testDMAvatarSet() {
|
func testDMAvatarSet() {
|
||||||
let details = makeSummary(isDirect: true, hasRoomAvatar: true, isTombstoned: false)
|
let details = makeSummary(isDirect: true, isSpace: false, hasRoomAvatar: true, isTombstoned: false)
|
||||||
|
|
||||||
switch details.avatar {
|
switch details.avatar {
|
||||||
case .room(let id, let name, let avatarURL):
|
case .room(let id, let name, let avatarURL):
|
||||||
@@ -49,7 +49,7 @@ class RoomSummaryTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testDMAvatarNotSet() {
|
func testDMAvatarNotSet() {
|
||||||
let details = makeSummary(isDirect: true, hasRoomAvatar: false, isTombstoned: false)
|
let details = makeSummary(isDirect: true, isSpace: false, hasRoomAvatar: false, isTombstoned: false)
|
||||||
|
|
||||||
switch details.avatar {
|
switch details.avatar {
|
||||||
case .room:
|
case .room:
|
||||||
@@ -63,20 +63,38 @@ class RoomSummaryTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testSpaceAvatar() {
|
||||||
|
let details = makeSummary(isDirect: false, isSpace: true, hasRoomAvatar: true, isTombstoned: false)
|
||||||
|
|
||||||
|
switch details.avatar {
|
||||||
|
case .room:
|
||||||
|
XCTFail("A space shouldn't use a room avatar.")
|
||||||
|
case .heroes:
|
||||||
|
XCTFail("A room shouldn't use the heroes for its avatar.")
|
||||||
|
case .space(let id, let name, let avatarURL):
|
||||||
|
XCTAssertEqual(id, roomDetails.id)
|
||||||
|
XCTAssertEqual(name, roomDetails.name)
|
||||||
|
XCTAssertEqual(avatarURL, roomDetails.avatarURL)
|
||||||
|
case .tombstoned:
|
||||||
|
XCTFail("A room shouldn't use the tombstone for its avatar.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func testTombstonedAvatar() {
|
func testTombstonedAvatar() {
|
||||||
let details = makeSummary(isDirect: false, hasRoomAvatar: true, isTombstoned: true)
|
let details = makeSummary(isDirect: false, isSpace: false, hasRoomAvatar: true, isTombstoned: true)
|
||||||
|
|
||||||
XCTAssertEqual(details.avatar, .tombstoned)
|
XCTAssertEqual(details.avatar, .tombstoned)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Helpers
|
// MARK: - Helpers
|
||||||
|
|
||||||
func makeSummary(isDirect: Bool, hasRoomAvatar: Bool, isTombstoned: Bool) -> RoomSummary {
|
func makeSummary(isDirect: Bool, isSpace: Bool, hasRoomAvatar: Bool, isTombstoned: Bool) -> RoomSummary {
|
||||||
RoomSummary(room: .init(noPointer: .init()),
|
RoomSummary(room: .init(noPointer: .init()),
|
||||||
id: roomDetails.id,
|
id: roomDetails.id,
|
||||||
joinRequestType: nil,
|
joinRequestType: nil,
|
||||||
name: roomDetails.name,
|
name: roomDetails.name,
|
||||||
isDirect: isDirect,
|
isDirect: isDirect,
|
||||||
|
isSpace: isSpace,
|
||||||
avatarURL: hasRoomAvatar ? roomDetails.avatarURL : nil,
|
avatarURL: hasRoomAvatar ? roomDetails.avatarURL : nil,
|
||||||
heroes: heroes,
|
heroes: heroes,
|
||||||
activeMembersCount: 0,
|
activeMembersCount: 0,
|
||||||
|
|||||||
+1
-1
@@ -68,7 +68,7 @@ packages:
|
|||||||
# Element/Matrix dependencies
|
# Element/Matrix dependencies
|
||||||
MatrixRustSDK:
|
MatrixRustSDK:
|
||||||
url: https://github.com/element-hq/matrix-rust-components-swift
|
url: https://github.com/element-hq/matrix-rust-components-swift
|
||||||
exactVersion: 25.09.19-2
|
exactVersion: 25.09.26
|
||||||
# path: ../matrix-rust-sdk
|
# path: ../matrix-rust-sdk
|
||||||
Compound:
|
Compound:
|
||||||
path: compound-ios
|
path: compound-ios
|
||||||
|
|||||||
Reference in New Issue
Block a user