mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Use local room list sorting from Rust. (#2978)
* Switch to the new local room list sorting API * Get rid of the RoomSummary enum, replace it by the inner RoomSummaryDetails * And finally, rename RoomSummaryDetails to RoomSummary * Fix a bunch of warnings * Small tidy up post rebase/review. - Remove unused invalidated property. - Rename some RoomSummary instances to summary instead of details. - Fix tests with missing roomListItem's. * Update snapshots --------- Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
parent
c024702d50
commit
d71c8c4e83
@ -100,6 +100,7 @@
|
||||
1555A7643D85187D4851040C /* TemplateScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4549FCB53F43DB0B278374BC /* TemplateScreen.swift */; };
|
||||
157E5FDDF419C0B2CA7E2C28 /* TimelineItemBubbledStylerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98A2932515EA11D3DD8A3506 /* TimelineItemBubbledStylerView.swift */; };
|
||||
1583E2D766E4485FF91662FC /* PermalinkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA3EB5B1848CF4F64E63C6B7 /* PermalinkTests.swift */; };
|
||||
15913A5B07118C1268A840E4 /* RoomSummaryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 046C0D3F53B0B5EF0A1F5BEA /* RoomSummaryTests.swift */; };
|
||||
167D00CAA13FAFB822298021 /* MediaProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62A81CCC2516D9CF9322DF01 /* MediaProviderTests.swift */; };
|
||||
16CBD087038DE3815CDA512C /* PollMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = D38391154120264910D19528 /* PollMock.swift */; };
|
||||
16E4F1B8B9BFE1367F96DDA7 /* CompletionSuggestionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 989FC684408B31A677F5538B /* CompletionSuggestionView.swift */; };
|
||||
@ -376,6 +377,7 @@
|
||||
5894C2514400A4FBC9327632 /* ServerConfirmationScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03277E40D0E0DE0712021A71 /* ServerConfirmationScreenCoordinator.swift */; };
|
||||
5897A59DDBD3592282092223 /* MediaSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49B9785E3AD7D1C15A29F2F /* MediaSourceProxy.swift */; };
|
||||
5992EF10AA157EBD97D88910 /* AudioRecorderState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6569593FA36B22259E806A67 /* AudioRecorderState.swift */; };
|
||||
59C41313AED7566C3AC51163 /* RoomSummary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29A953B6C0C431DBF4DD00B4 /* RoomSummary.swift */; };
|
||||
59F940FCBE6BC343AECEF75E /* ImageCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E2245243369B99216C7D84E /* ImageCache.swift */; };
|
||||
5AE6404C4FD4848ACCFF9EDC /* SecureBackupLogoutConfirmationScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1573D28C8A9FB6399D0EEFB /* SecureBackupLogoutConfirmationScreenCoordinator.swift */; };
|
||||
5B2D1210B40570D87B11BD3B /* ThreadDecorator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CA3F8E905DF50BF22ECC18F /* ThreadDecorator.swift */; };
|
||||
@ -573,7 +575,6 @@
|
||||
8691186F9B99BCDDB7CACDD8 /* KeychainController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E36CB905A2B9EC2C92A2DA7C /* KeychainController.swift */; };
|
||||
86F9D3028A1F4AE819D75560 /* RoomChangePermissionsScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D879FC4E881E748BB9B34DC /* RoomChangePermissionsScreenCoordinator.swift */; };
|
||||
872A6457DF573AF8CEAE927A /* LoginHomeserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9349F590E35CE514A71E6764 /* LoginHomeserver.swift */; };
|
||||
8739553CDFA5D8ED5FD05CBC /* RoomSummaryDetailsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA520B4F65D162E555C8761 /* RoomSummaryDetailsTests.swift */; };
|
||||
874FEFB9D4A4AF447E0E086E /* AuthenticationStartScreenViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F7CCC4A9D1927223F559D5 /* AuthenticationStartScreenViewModelProtocol.swift */; };
|
||||
878070573C7BF19E735707B4 /* RoomTimelineItemProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DE8D25D6A91030175D52A20 /* RoomTimelineItemProperties.swift */; };
|
||||
87B4E59A4467F8EC75F82372 /* VoiceMessageRoomTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B70A50C41C5871B4DB905E7E /* VoiceMessageRoomTimelineView.swift */; };
|
||||
@ -716,7 +717,6 @@
|
||||
A722F426FD81FC67706BB1E0 /* CustomLayoutLabelStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42236480CF0431535EBE8387 /* CustomLayoutLabelStyle.swift */; };
|
||||
A74438ED16F8683A4B793E6A /* AnalyticsSettingsScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BCE3FAF40932AC7C7639AC4 /* AnalyticsSettingsScreenViewModel.swift */; };
|
||||
A7D48E44D485B143AADDB77D /* Strings+Untranslated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A18F6CE4D694D21E4EA9B25 /* Strings+Untranslated.swift */; };
|
||||
A7FD7B992E6EE6E5A8429197 /* RoomSummaryDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 142808B69851451AC32A2CEA /* RoomSummaryDetails.swift */; };
|
||||
A816F7087C495D85048AC50E /* RoomMemberDetailsScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B6E30BB748F3F480F077969 /* RoomMemberDetailsScreenModels.swift */; };
|
||||
A851635B3255C6DC07034A12 /* RoomScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8108C8F0ACF6A7EB72D0117 /* RoomScreenCoordinator.swift */; };
|
||||
A896998A6784DB6F16E912F4 /* MockMediaLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AB7D7DAAAF662DED9D02379 /* MockMediaLoader.swift */; };
|
||||
@ -1159,6 +1159,7 @@
|
||||
03FABD73FD8086EFAB699F42 /* MediaUploadPreviewScreenViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaUploadPreviewScreenViewModelTests.swift; sourceTree = "<group>"; };
|
||||
044E501B8331B339874D1B96 /* CompoundIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompoundIcon.swift; sourceTree = "<group>"; };
|
||||
045253F9967A535EE5B16691 /* Label.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Label.swift; sourceTree = "<group>"; };
|
||||
046C0D3F53B0B5EF0A1F5BEA /* RoomSummaryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryTests.swift; sourceTree = "<group>"; };
|
||||
048A21188AB19349D026BECD /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
|
||||
04BB8DDE245ED86C489BA983 /* AccessibilityIdentifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessibilityIdentifiers.swift; sourceTree = "<group>"; };
|
||||
04DF593C3F7AF4B2FBAEB05D /* FileManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileManager.swift; sourceTree = "<group>"; };
|
||||
@ -1223,7 +1224,6 @@
|
||||
136F80A613B55BDD071DCEA5 /* JoinRoomScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinRoomScreenModels.swift; sourceTree = "<group>"; };
|
||||
13802897C7AFA360EA74C0B0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
||||
1423AB065857FA546444DB15 /* NotificationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationManager.swift; sourceTree = "<group>"; };
|
||||
142808B69851451AC32A2CEA /* RoomSummaryDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryDetails.swift; sourceTree = "<group>"; };
|
||||
1454CF3AABD242F55C8A2615 /* InviteUsersScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InviteUsersScreenModels.swift; sourceTree = "<group>"; };
|
||||
153726EDCE1ACBB3D466A916 /* ReactionsSummaryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReactionsSummaryView.swift; sourceTree = "<group>"; };
|
||||
1562EAF6231151A675BED7A9 /* RoomDirectorySearchScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDirectorySearchScreenCoordinator.swift; sourceTree = "<group>"; };
|
||||
@ -1323,6 +1323,7 @@
|
||||
287FC98AF2664EAD79C0D902 /* UIDevice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIDevice.swift; sourceTree = "<group>"; };
|
||||
28C19F54A0C4FC9AB7ABD583 /* TextRoomTimelineItemContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextRoomTimelineItemContent.swift; sourceTree = "<group>"; };
|
||||
295E28C3B9EAADF519BF2F44 /* AuthenticationFlowCoordinatorUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationFlowCoordinatorUITests.swift; sourceTree = "<group>"; };
|
||||
29A953B6C0C431DBF4DD00B4 /* RoomSummary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummary.swift; sourceTree = "<group>"; };
|
||||
2A5C6FBF97B6EED3D4FA5EFF /* AttributedStringBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttributedStringBuilder.swift; sourceTree = "<group>"; };
|
||||
2AB2C848BB9A7A9B618B7B89 /* TextBasedRoomTimelineTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextBasedRoomTimelineTests.swift; sourceTree = "<group>"; };
|
||||
2AE807361805463F5AEDD1CA /* VoiceMessagePreviewComposer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceMessagePreviewComposer.swift; sourceTree = "<group>"; };
|
||||
@ -1977,7 +1978,6 @@
|
||||
CD700E035C85738EE4B97129 /* PerformanceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PerformanceTests.swift; sourceTree = "<group>"; };
|
||||
CDB3227C7A74B734924942E9 /* RoomSummaryProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryProvider.swift; sourceTree = "<group>"; };
|
||||
CE47A97726F0675DEE387BF9 /* TypingIndicatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypingIndicatorView.swift; sourceTree = "<group>"; };
|
||||
CEA520B4F65D162E555C8761 /* RoomSummaryDetailsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryDetailsTests.swift; sourceTree = "<group>"; };
|
||||
CEE0E6043EFCF6FD2A341861 /* TimelineReplyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineReplyView.swift; sourceTree = "<group>"; };
|
||||
CEE20623EB4A9B88FB29F2BA /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/SAS.strings; sourceTree = "<group>"; };
|
||||
CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; path = UnitTests.xctestplan; sourceTree = "<group>"; };
|
||||
@ -3531,7 +3531,7 @@
|
||||
children = (
|
||||
B0A307A44F952CD73E63AE31 /* RoomEventStringBuilder.swift */,
|
||||
80E815FF3CC5E5A355E3A25E /* RoomMessageEventStringBuilder.swift */,
|
||||
142808B69851451AC32A2CEA /* RoomSummaryDetails.swift */,
|
||||
29A953B6C0C431DBF4DD00B4 /* RoomSummary.swift */,
|
||||
CDB3227C7A74B734924942E9 /* RoomSummaryProvider.swift */,
|
||||
10CC626F97AD70FF0420C115 /* RoomSummaryProviderProtocol.swift */,
|
||||
);
|
||||
@ -3614,7 +3614,7 @@
|
||||
48FEFF746DB341CDB18D7AAA /* RoomRolesAndPermissionsScreenViewModelTests.swift */,
|
||||
93CF7B19FFCF8EFBE0A8696A /* RoomScreenViewModelTests.swift */,
|
||||
AEEAFB646E583655652C3D04 /* RoomStateEventStringBuilderTests.swift */,
|
||||
CEA520B4F65D162E555C8761 /* RoomSummaryDetailsTests.swift */,
|
||||
046C0D3F53B0B5EF0A1F5BEA /* RoomSummaryTests.swift */,
|
||||
2E88534A39781D76487D59DF /* SecureBackupKeyBackupScreenViewModelTests.swift */,
|
||||
848F69921527D31CAACB93AF /* SecureBackupLogoutConfirmationScreenViewModelTests.swift */,
|
||||
C0FF08D0BD7D0B4B6877AB7D /* SecureBackupRecoveryKeyScreenViewModelTests.swift */,
|
||||
@ -5833,7 +5833,7 @@
|
||||
84C631E734FD2555B39B681C /* RoomRolesAndPermissionsScreenViewModelTests.swift in Sources */,
|
||||
46562110EE202E580A5FFD9C /* RoomScreenViewModelTests.swift in Sources */,
|
||||
CC0D088F505F33A20DC5590F /* RoomStateEventStringBuilderTests.swift in Sources */,
|
||||
8739553CDFA5D8ED5FD05CBC /* RoomSummaryDetailsTests.swift in Sources */,
|
||||
15913A5B07118C1268A840E4 /* RoomSummaryTests.swift in Sources */,
|
||||
7691233E3572A9173FD96CB3 /* SecureBackupKeyBackupScreenViewModelTests.swift in Sources */,
|
||||
EB87DF90CF6F8D5D12404C6E /* SecureBackupLogoutConfirmationScreenViewModelTests.swift in Sources */,
|
||||
06B31F84CE52A7A7C271267C /* SecureBackupRecoveryKeyScreenViewModelTests.swift in Sources */,
|
||||
@ -6427,7 +6427,7 @@
|
||||
7BB31E67648CF32D2AB5E502 /* RoomScreenViewModel.swift in Sources */,
|
||||
617624A97BDBB75ED3DD8156 /* RoomScreenViewModelProtocol.swift in Sources */,
|
||||
6C34237AFB808E38FC8776B9 /* RoomStateEventStringBuilder.swift in Sources */,
|
||||
A7FD7B992E6EE6E5A8429197 /* RoomSummaryDetails.swift in Sources */,
|
||||
59C41313AED7566C3AC51163 /* RoomSummary.swift in Sources */,
|
||||
983896D611ABF52A5C37498D /* RoomSummaryProvider.swift in Sources */,
|
||||
B5899F18AD6C56CE08FE532B /* RoomSummaryProviderMock.swift in Sources */,
|
||||
AA050DF4AEE54A641BA7CA22 /* RoomSummaryProviderProtocol.swift in Sources */,
|
||||
@ -7417,7 +7417,7 @@
|
||||
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
|
||||
requirement = {
|
||||
kind = exactVersion;
|
||||
version = 1.0.21;
|
||||
version = 1.0.22;
|
||||
};
|
||||
};
|
||||
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
||||
|
@ -148,8 +148,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
|
||||
"state" : {
|
||||
"revision" : "e920922314385cbf7a1dc8ad06cd5fd121aa1b59",
|
||||
"version" : "1.0.21"
|
||||
"revision" : "5a8b528c916a46009225517d2ee81296e2eddbfd",
|
||||
"version" : "1.0.22"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -92,14 +92,7 @@ extension ClientProxyMock {
|
||||
return nil
|
||||
}
|
||||
|
||||
let roomID = room.id ?? UUID().uuidString
|
||||
|
||||
switch room {
|
||||
case .empty:
|
||||
return await RoomProxyMock(.init(name: "Empty room"))
|
||||
case .filled(let details), .invalidated(let details):
|
||||
return await RoomProxyMock(.init(id: roomID, name: details.name))
|
||||
}
|
||||
return await RoomProxyMock(.init(id: room.id, name: room.name))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14022,13 +14022,13 @@ open class RoomListSDKMock: MatrixRustSDK.RoomList {
|
||||
open var entriesListenerReceivedListener: RoomListEntriesListener?
|
||||
open var entriesListenerReceivedInvocations: [RoomListEntriesListener] = []
|
||||
|
||||
var entriesListenerUnderlyingReturnValue: RoomListEntriesResult!
|
||||
open var entriesListenerReturnValue: RoomListEntriesResult! {
|
||||
var entriesListenerUnderlyingReturnValue: TaskHandle!
|
||||
open var entriesListenerReturnValue: TaskHandle! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return entriesListenerUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: RoomListEntriesResult? = nil
|
||||
var returnValue: TaskHandle? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = entriesListenerUnderlyingReturnValue
|
||||
}
|
||||
@ -14046,9 +14046,9 @@ open class RoomListSDKMock: MatrixRustSDK.RoomList {
|
||||
}
|
||||
}
|
||||
}
|
||||
open var entriesListenerClosure: ((RoomListEntriesListener) -> RoomListEntriesResult)?
|
||||
open var entriesListenerClosure: ((RoomListEntriesListener) -> TaskHandle)?
|
||||
|
||||
open override func entries(listener: RoomListEntriesListener) -> RoomListEntriesResult {
|
||||
open override func entries(listener: RoomListEntriesListener) -> TaskHandle {
|
||||
entriesListenerCallsCount += 1
|
||||
entriesListenerReceivedListener = listener
|
||||
DispatchQueue.main.async {
|
||||
@ -14436,6 +14436,147 @@ open class RoomListDynamicEntriesControllerSDKMock: MatrixRustSDK.RoomListDynami
|
||||
}
|
||||
}
|
||||
}
|
||||
open class RoomListEntriesWithDynamicAdaptersResultSDKMock: MatrixRustSDK.RoomListEntriesWithDynamicAdaptersResult {
|
||||
init() {
|
||||
super.init(noPointer: .init())
|
||||
}
|
||||
|
||||
public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
||||
fatalError("init(unsafeFromRawPointer:) has not been implemented")
|
||||
}
|
||||
|
||||
fileprivate var pointer: UnsafeMutableRawPointer!
|
||||
|
||||
//MARK: - controller
|
||||
|
||||
var controllerUnderlyingCallsCount = 0
|
||||
open var controllerCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return controllerUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = controllerUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
controllerUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
controllerUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var controllerCalled: Bool {
|
||||
return controllerCallsCount > 0
|
||||
}
|
||||
|
||||
var controllerUnderlyingReturnValue: RoomListDynamicEntriesController!
|
||||
open var controllerReturnValue: RoomListDynamicEntriesController! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return controllerUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: RoomListDynamicEntriesController? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = controllerUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
controllerUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
controllerUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var controllerClosure: (() -> RoomListDynamicEntriesController)?
|
||||
|
||||
open override func controller() -> RoomListDynamicEntriesController {
|
||||
controllerCallsCount += 1
|
||||
if let controllerClosure = controllerClosure {
|
||||
return controllerClosure()
|
||||
} else {
|
||||
return controllerReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - entriesStream
|
||||
|
||||
var entriesStreamUnderlyingCallsCount = 0
|
||||
open var entriesStreamCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return entriesStreamUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = entriesStreamUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
entriesStreamUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
entriesStreamUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var entriesStreamCalled: Bool {
|
||||
return entriesStreamCallsCount > 0
|
||||
}
|
||||
|
||||
var entriesStreamUnderlyingReturnValue: TaskHandle!
|
||||
open var entriesStreamReturnValue: TaskHandle! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return entriesStreamUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: TaskHandle? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = entriesStreamUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
entriesStreamUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
entriesStreamUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var entriesStreamClosure: (() -> TaskHandle)?
|
||||
|
||||
open override func entriesStream() -> TaskHandle {
|
||||
entriesStreamCallsCount += 1
|
||||
if let entriesStreamClosure = entriesStreamClosure {
|
||||
return entriesStreamClosure()
|
||||
} else {
|
||||
return entriesStreamReturnValue
|
||||
}
|
||||
}
|
||||
}
|
||||
open class RoomListItemSDKMock: MatrixRustSDK.RoomListItem {
|
||||
init() {
|
||||
super.init(noPointer: .init())
|
||||
@ -15309,52 +15450,6 @@ open class RoomListServiceSDKMock: MatrixRustSDK.RoomListService {
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - applyInput
|
||||
|
||||
open var applyInputInputThrowableError: Error?
|
||||
var applyInputInputUnderlyingCallsCount = 0
|
||||
open var applyInputInputCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return applyInputInputUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = applyInputInputUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
applyInputInputUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
applyInputInputUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var applyInputInputCalled: Bool {
|
||||
return applyInputInputCallsCount > 0
|
||||
}
|
||||
open var applyInputInputReceivedInput: RoomListInput?
|
||||
open var applyInputInputReceivedInvocations: [RoomListInput] = []
|
||||
open var applyInputInputClosure: ((RoomListInput) async throws -> Void)?
|
||||
|
||||
open override func applyInput(input: RoomListInput) async throws {
|
||||
if let error = applyInputInputThrowableError {
|
||||
throw error
|
||||
}
|
||||
applyInputInputCallsCount += 1
|
||||
applyInputInputReceivedInput = input
|
||||
DispatchQueue.main.async {
|
||||
self.applyInputInputReceivedInvocations.append(input)
|
||||
}
|
||||
try await applyInputInputClosure?(input)
|
||||
}
|
||||
|
||||
//MARK: - room
|
||||
|
||||
open var roomRoomIdThrowableError: Error?
|
||||
|
@ -54,7 +54,7 @@ extension RoomSummaryProviderMock {
|
||||
var rooms = initialRooms
|
||||
|
||||
if !query.isEmpty {
|
||||
rooms = rooms.filter { $0.name?.localizedCaseInsensitiveContains(query) ?? false }
|
||||
rooms = rooms.filter { $0.name.localizedCaseInsensitiveContains(query) }
|
||||
}
|
||||
|
||||
roomListSubject.send(rooms)
|
||||
@ -78,126 +78,132 @@ extension RoomSummaryProviderMock {
|
||||
|
||||
extension Array where Element == RoomSummary {
|
||||
static let mockRooms: [Element] = [
|
||||
.filled(details: RoomSummaryDetails(id: "1",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Foundation 🔭🪐🌌",
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"),
|
||||
lastMessageFormattedTimestamp: "14:56",
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: .allMessages,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "2",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Foundation and Empire",
|
||||
isDirect: false,
|
||||
avatarURL: URL.picturesDirectory,
|
||||
heroes: [],
|
||||
lastMessage: AttributedString("How do you see the Emperor then? You think he keeps office hours?"),
|
||||
lastMessageFormattedTimestamp: "2:56 PM",
|
||||
unreadMessagesCount: 2,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 2,
|
||||
notificationMode: .mute,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "3",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Second Foundation",
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: try? AttributedString(markdown: "He certainly seemed no *mental genius* to me"),
|
||||
lastMessageFormattedTimestamp: "Some time ago",
|
||||
unreadMessagesCount: 3,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: .mentionsAndKeywordsOnly,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "4",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Foundation's Edge",
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: AttributedString("There's an archaic measure of time that's called the month"),
|
||||
lastMessageFormattedTimestamp: "Just now",
|
||||
unreadMessagesCount: 2,
|
||||
unreadMentionsCount: 2,
|
||||
unreadNotificationsCount: 2,
|
||||
notificationMode: .allMessages,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "5",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Foundation and Earth",
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: AttributedString("Clearly, if Earth is powerful enough to do that, it might also be capable of adjusting minds in order to force belief in its radioactivity"),
|
||||
lastMessageFormattedTimestamp: "1986",
|
||||
unreadMessagesCount: 1,
|
||||
unreadMentionsCount: 1,
|
||||
unreadNotificationsCount: 1,
|
||||
notificationMode: .allMessages,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: true,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "6",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Prelude to Foundation",
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: AttributedString("Are you groping for the word 'paranoia'?"),
|
||||
lastMessageFormattedTimestamp: "きょうはじゅういちがつじゅういちにちです",
|
||||
unreadMessagesCount: 6,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: .mute,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: true,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "0",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Unknown",
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)),
|
||||
.empty
|
||||
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||
id: "1",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Foundation 🔭🪐🌌",
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"),
|
||||
lastMessageFormattedTimestamp: "14:56",
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: .allMessages,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false),
|
||||
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||
id: "2",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Foundation and Empire",
|
||||
isDirect: false,
|
||||
avatarURL: URL.picturesDirectory,
|
||||
heroes: [],
|
||||
lastMessage: AttributedString("How do you see the Emperor then? You think he keeps office hours?"),
|
||||
lastMessageFormattedTimestamp: "2:56 PM",
|
||||
unreadMessagesCount: 2,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 2,
|
||||
notificationMode: .mute,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false),
|
||||
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||
id: "3",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Second Foundation",
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: try? AttributedString(markdown: "He certainly seemed no *mental genius* to me"),
|
||||
lastMessageFormattedTimestamp: "Some time ago",
|
||||
unreadMessagesCount: 3,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: .mentionsAndKeywordsOnly,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false),
|
||||
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||
id: "4",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Foundation's Edge",
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: AttributedString("There's an archaic measure of time that's called the month"),
|
||||
lastMessageFormattedTimestamp: "Just now",
|
||||
unreadMessagesCount: 2,
|
||||
unreadMentionsCount: 2,
|
||||
unreadNotificationsCount: 2,
|
||||
notificationMode: .allMessages,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false),
|
||||
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||
id: "5",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Foundation and Earth",
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: AttributedString("Clearly, if Earth is powerful enough to do that, it might also be capable of adjusting minds in order to force belief in its radioactivity"),
|
||||
lastMessageFormattedTimestamp: "1986",
|
||||
unreadMessagesCount: 1,
|
||||
unreadMentionsCount: 1,
|
||||
unreadNotificationsCount: 1,
|
||||
notificationMode: .allMessages,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: true,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false),
|
||||
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||
id: "6",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Prelude to Foundation",
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: AttributedString("Are you groping for the word 'paranoia'?"),
|
||||
lastMessageFormattedTimestamp: "きょうはじゅういちがつじゅういちにちです",
|
||||
unreadMessagesCount: 6,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: .mute,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: true,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false),
|
||||
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||
id: "0",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Unknown",
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)
|
||||
]
|
||||
|
||||
static let mockRoomsWithNotificationsState: [Element] = {
|
||||
@ -213,56 +219,59 @@ extension Array where Element == RoomSummary {
|
||||
for hasUnreadNotifications in [false, true] {
|
||||
// Incrementing id value for each combination
|
||||
let id = result.count + 1
|
||||
|
||||
let room = RoomSummary.filled(details: RoomSummaryDetails(id: "\(id)",
|
||||
settingsMode: mode,
|
||||
hasUnreadMessages: hasUnreadMessages,
|
||||
hasUnreadMentions: hasUnreadMentions,
|
||||
hasUnreadNotifications: hasUnreadNotifications))
|
||||
|
||||
|
||||
let room = RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||
id: "\(id)",
|
||||
settingsMode: mode,
|
||||
hasUnreadMessages: hasUnreadMessages,
|
||||
hasUnreadMentions: hasUnreadMentions,
|
||||
hasUnreadNotifications: hasUnreadNotifications)
|
||||
|
||||
result.append(room)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}()
|
||||
|
||||
static let mockInvites: [Element] = [
|
||||
.filled(details: RoomSummaryDetails(id: "someAwesomeRoomId1",
|
||||
isInvite: false,
|
||||
inviter: RoomMemberProxyMock.mockCharlie,
|
||||
name: "First room",
|
||||
isDirect: false,
|
||||
avatarURL: URL.picturesDirectory,
|
||||
heroes: [],
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: "#footest:somewhere.org",
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "someAwesomeRoomId2",
|
||||
isInvite: false,
|
||||
inviter: RoomMemberProxyMock.mockCharlie,
|
||||
name: "Second room",
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false))
|
||||
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||
id: "someAwesomeRoomId1",
|
||||
isInvite: false,
|
||||
inviter: RoomMemberProxyMock.mockCharlie,
|
||||
name: "First room",
|
||||
isDirect: false,
|
||||
avatarURL: URL.picturesDirectory,
|
||||
heroes: [],
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: "#footest:somewhere.org",
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false),
|
||||
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||
id: "someAwesomeRoomId2",
|
||||
isInvite: false,
|
||||
inviter: RoomMemberProxyMock.mockCharlie,
|
||||
name: "Second room",
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)
|
||||
]
|
||||
}
|
||||
|
@ -74,15 +74,10 @@ class GlobalSearchScreenViewModel: GlobalSearchScreenViewModelType, GlobalSearch
|
||||
|
||||
private func updateRooms(with summaries: [RoomSummary]) {
|
||||
state.rooms = summaries.compactMap { summary in
|
||||
switch summary {
|
||||
case .empty:
|
||||
return nil
|
||||
case .invalidated(let details), .filled(let details):
|
||||
return GlobalSearchRoom(id: details.id,
|
||||
name: details.name,
|
||||
alias: details.canonicalAlias,
|
||||
avatar: details.avatar)
|
||||
}
|
||||
GlobalSearchRoom(id: summary.id,
|
||||
name: summary.name,
|
||||
alias: summary.canonicalAlias,
|
||||
avatar: summary.avatar)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,8 +152,7 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
||||
|
||||
static let placeholderLastMessage = AttributedString("Hidden last message")
|
||||
|
||||
/// 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
|
||||
/// The list item identifier is it's room identifier.
|
||||
let id: String
|
||||
|
||||
/// The real room identifier this item points to
|
||||
@ -205,39 +204,39 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
||||
}
|
||||
|
||||
extension HomeScreenRoom {
|
||||
init(details: RoomSummaryDetails, invalidated: Bool, hideUnreadMessagesBadge: Bool) {
|
||||
let identifier = invalidated ? "invalidated-" + details.id : details.id
|
||||
init(summary: RoomSummary, hideUnreadMessagesBadge: Bool) {
|
||||
let identifier = summary.id
|
||||
|
||||
let hasUnreadMessages = hideUnreadMessagesBadge ? false : details.hasUnreadMessages
|
||||
let hasUnreadMessages = hideUnreadMessagesBadge ? false : summary.hasUnreadMessages
|
||||
|
||||
let isDotShown = hasUnreadMessages || details.hasUnreadMentions || details.hasUnreadNotifications || details.isMarkedUnread
|
||||
let isMentionShown = details.hasUnreadMentions && !details.isMuted
|
||||
let isMuteShown = details.isMuted
|
||||
let isCallShown = details.hasOngoingCall
|
||||
let isHighlighted = details.isMarkedUnread || (!details.isMuted && (details.hasUnreadNotifications || details.hasUnreadMentions))
|
||||
let isDotShown = hasUnreadMessages || summary.hasUnreadMentions || summary.hasUnreadNotifications || summary.isMarkedUnread
|
||||
let isMentionShown = summary.hasUnreadMentions && !summary.isMuted
|
||||
let isMuteShown = summary.isMuted
|
||||
let isCallShown = summary.hasOngoingCall
|
||||
let isHighlighted = summary.isMarkedUnread || (!summary.isMuted && (summary.hasUnreadNotifications || summary.hasUnreadMentions))
|
||||
|
||||
var inviter: InviterDetails?
|
||||
if let roomMemberProxy = details.inviter {
|
||||
if let roomMemberProxy = summary.inviter {
|
||||
inviter = .init(userID: roomMemberProxy.userID,
|
||||
displayName: roomMemberProxy.displayName,
|
||||
avatarURL: roomMemberProxy.avatarURL)
|
||||
}
|
||||
|
||||
self.init(id: identifier,
|
||||
roomID: details.id,
|
||||
type: details.isInvite ? .invite : .room,
|
||||
roomID: summary.id,
|
||||
type: summary.isInvite ? .invite : .room,
|
||||
badges: .init(isDotShown: isDotShown,
|
||||
isMentionShown: isMentionShown,
|
||||
isMuteShown: isMuteShown,
|
||||
isCallShown: isCallShown),
|
||||
name: details.name,
|
||||
isDirect: details.isDirect,
|
||||
name: summary.name,
|
||||
isDirect: summary.isDirect,
|
||||
isHighlighted: isHighlighted,
|
||||
isFavourite: details.isFavourite,
|
||||
timestamp: details.lastMessageFormattedTimestamp,
|
||||
lastMessage: details.lastMessage,
|
||||
avatar: details.avatar,
|
||||
isFavourite: summary.isFavourite,
|
||||
timestamp: summary.lastMessageFormattedTimestamp,
|
||||
lastMessage: summary.lastMessage,
|
||||
avatar: summary.avatar,
|
||||
inviter: inviter,
|
||||
canonicalAlias: details.canonicalAlias)
|
||||
canonicalAlias: summary.canonicalAlias)
|
||||
}
|
||||
}
|
||||
|
@ -348,16 +348,8 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
var rooms = [HomeScreenRoom]()
|
||||
|
||||
for summary in roomSummaryProvider.roomListPublisher.value {
|
||||
switch summary {
|
||||
case .empty:
|
||||
rooms.append(HomeScreenRoom.placeholder())
|
||||
case .filled(let details):
|
||||
let room = HomeScreenRoom(details: details, invalidated: false, hideUnreadMessagesBadge: appSettings.hideUnreadMessagesBadge)
|
||||
rooms.append(room)
|
||||
case .invalidated(let details):
|
||||
let room = HomeScreenRoom(details: details, invalidated: true, hideUnreadMessagesBadge: appSettings.hideUnreadMessagesBadge)
|
||||
rooms.append(room)
|
||||
}
|
||||
let room = HomeScreenRoom(summary: summary, hideUnreadMessagesBadge: appSettings.hideUnreadMessagesBadge)
|
||||
rooms.append(room)
|
||||
}
|
||||
|
||||
state.rooms = rooms
|
||||
|
@ -207,25 +207,26 @@ private extension HomeScreenRoom {
|
||||
inviter.displayName = "Jack"
|
||||
inviter.userID = "@jack:somewhere.com"
|
||||
|
||||
let details = RoomSummaryDetails(id: "@someone:somewhere.com",
|
||||
isInvite: false,
|
||||
inviter: inviter,
|
||||
name: "Some Guy",
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [.init(userID: "@someone:somewhere.com")],
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: "#footest:somewhere.org",
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)
|
||||
let summary = RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||
id: "@someone:somewhere.com",
|
||||
isInvite: false,
|
||||
inviter: inviter,
|
||||
name: "Some Guy",
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [.init(userID: "@someone:somewhere.com")],
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: "#footest:somewhere.org",
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)
|
||||
|
||||
return .init(details: details, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
return .init(summary: summary, hideUnreadMessagesBadge: false)
|
||||
}
|
||||
|
||||
static func roomInvite(alias: String? = nil, avatarURL: URL? = nil) -> HomeScreenRoom {
|
||||
@ -234,24 +235,25 @@ private extension HomeScreenRoom {
|
||||
inviter.userID = "@jack:somewhi.nl"
|
||||
inviter.avatarURL = avatarURL
|
||||
|
||||
let details = RoomSummaryDetails(id: "@someone:somewhere.com",
|
||||
isInvite: false,
|
||||
inviter: inviter,
|
||||
name: "Awesome Room",
|
||||
isDirect: false,
|
||||
avatarURL: avatarURL,
|
||||
heroes: [.init(userID: "@someone:somewhere.com")],
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: alias,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)
|
||||
let summary = RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||
id: "@someone:somewhere.com",
|
||||
isInvite: false,
|
||||
inviter: inviter,
|
||||
name: "Awesome Room",
|
||||
isDirect: false,
|
||||
avatarURL: avatarURL,
|
||||
heroes: [.init(userID: "@someone:somewhere.com")],
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: alias,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)
|
||||
|
||||
return .init(details: details, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
return .init(summary: summary, hideUnreadMessagesBadge: false)
|
||||
}
|
||||
}
|
||||
|
@ -195,14 +195,7 @@ struct HomeScreenRoomCell_Previews: PreviewProvider, TestablePreview {
|
||||
}()
|
||||
|
||||
static func mockRoom(summary: RoomSummary) -> HomeScreenRoom? {
|
||||
switch summary {
|
||||
case .empty:
|
||||
nil
|
||||
case .invalidated(let details):
|
||||
HomeScreenRoom(details: details, invalidated: true, hideUnreadMessagesBadge: false)
|
||||
case .filled(let details):
|
||||
HomeScreenRoom(details: details, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
}
|
||||
HomeScreenRoom(summary: summary, hideUnreadMessagesBadge: false)
|
||||
}
|
||||
|
||||
static var previews: some View {
|
||||
|
@ -84,19 +84,14 @@ class MessageForwardingScreenViewModel: MessageForwardingScreenViewModelType, Me
|
||||
MXLog.verbose("Updating rooms")
|
||||
|
||||
var rooms = [MessageForwardingRoom]()
|
||||
|
||||
|
||||
for summary in roomSummaryProvider.roomListPublisher.value {
|
||||
switch summary {
|
||||
case .empty, .invalidated:
|
||||
if summary.id == forwardingItem.roomID {
|
||||
continue
|
||||
case .filled(let details):
|
||||
if details.id == forwardingItem.roomID {
|
||||
continue
|
||||
}
|
||||
|
||||
let room = MessageForwardingRoom(id: details.id, name: details.name, alias: details.canonicalAlias, avatar: details.avatar)
|
||||
rooms.append(room)
|
||||
}
|
||||
|
||||
let room = MessageForwardingRoom(id: summary.id, name: summary.name, alias: summary.canonicalAlias, avatar: summary.avatar)
|
||||
rooms.append(room)
|
||||
}
|
||||
|
||||
state.rooms = rooms
|
||||
|
@ -138,21 +138,15 @@ class NotificationSettingsEditScreenViewModel: NotificationSettingsEditScreenVie
|
||||
var roomsWithUserDefinedMode: [NotificationSettingsEditScreenRoom] = []
|
||||
|
||||
for roomSummary in filteredRoomsSummary {
|
||||
switch roomSummary {
|
||||
case .empty, .invalidated:
|
||||
guard let roomProxy = await userSession.clientProxy.roomForIdentifier(roomSummary.id) else { continue }
|
||||
// `isOneToOneRoom` here is not the same as `isDirect` on the room. From the point of view of the push rule, a one-to-one room is a room with exactly two active members.
|
||||
let isOneToOneRoom = roomProxy.activeMembersCount == 2
|
||||
// display only the rooms we're interested in
|
||||
switch chatType {
|
||||
case .oneToOneChat where isOneToOneRoom, .groupChat where !isOneToOneRoom:
|
||||
await roomsWithUserDefinedMode.append(buildRoom(with: roomSummary))
|
||||
default:
|
||||
break
|
||||
case .filled(let details):
|
||||
guard let roomProxy = await userSession.clientProxy.roomForIdentifier(details.id) else { continue }
|
||||
// `isOneToOneRoom` here is not the same as `isDirect` on the room. From the point of view of the push rule, a one-to-one room is a room with exactly two active members.
|
||||
let isOneToOneRoom = roomProxy.activeMembersCount == 2
|
||||
// display only the rooms we're interested in
|
||||
switch chatType {
|
||||
case .oneToOneChat where isOneToOneRoom,
|
||||
.groupChat where !isOneToOneRoom:
|
||||
await roomsWithUserDefinedMode.append(buildRoom(with: details))
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,12 +157,12 @@ class NotificationSettingsEditScreenViewModel: NotificationSettingsEditScreenVie
|
||||
}
|
||||
}
|
||||
|
||||
private func buildRoom(with details: RoomSummaryDetails) async -> NotificationSettingsEditScreenRoom {
|
||||
let notificationMode = try? await notificationSettingsProxy.getUserDefinedRoomNotificationMode(roomId: details.id)
|
||||
return NotificationSettingsEditScreenRoom(id: details.id,
|
||||
roomId: details.id,
|
||||
name: details.name,
|
||||
avatar: details.avatar,
|
||||
private func buildRoom(with summary: RoomSummary) async -> NotificationSettingsEditScreenRoom {
|
||||
let notificationMode = try? await notificationSettingsProxy.getUserDefinedRoomNotificationMode(roomId: summary.id)
|
||||
return NotificationSettingsEditScreenRoom(id: summary.id,
|
||||
roomId: summary.id,
|
||||
name: summary.name,
|
||||
avatar: summary.avatar,
|
||||
notificationMode: notificationMode)
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ struct NotificationSettingsEditScreen_Previews: PreviewProvider, TestablePreview
|
||||
let notificationSettingsProxy = NotificationSettingsProxyMock(with: .init())
|
||||
notificationSettingsProxy.getDefaultRoomNotificationModeIsEncryptedIsOneToOneReturnValue = .allMessages
|
||||
|
||||
notificationSettingsProxy.getRoomsWithUserDefinedRulesReturnValue = [RoomSummary].mockRooms.compactMap(\.id)
|
||||
notificationSettingsProxy.getRoomsWithUserDefinedRulesReturnValue = [RoomSummary].mockRooms.map(\.id)
|
||||
let userSession = UserSessionMock(.init(clientProxy: ClientProxyMock(.init(userID: "@alice:example.com",
|
||||
roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))))
|
||||
var viewModel = NotificationSettingsEditScreenViewModel(chatType: .groupChat,
|
||||
@ -113,7 +113,7 @@ struct NotificationSettingsEditScreen_Previews: PreviewProvider, TestablePreview
|
||||
let notificationSettingsProxy = NotificationSettingsProxyMock(with: .init(canPushEncryptedEvents: true))
|
||||
notificationSettingsProxy.getDefaultRoomNotificationModeIsEncryptedIsOneToOneReturnValue = .allMessages
|
||||
|
||||
notificationSettingsProxy.getRoomsWithUserDefinedRulesReturnValue = [RoomSummary].mockRooms.compactMap(\.id)
|
||||
notificationSettingsProxy.getRoomsWithUserDefinedRulesReturnValue = [RoomSummary].mockRooms.map(\.id)
|
||||
let userSession = UserSessionMock(.init(clientProxy: ClientProxyMock(.init(userID: "@alice:example.com",
|
||||
roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))))
|
||||
var viewModel = NotificationSettingsEditScreenViewModel(chatType: .groupChat,
|
||||
|
@ -68,17 +68,12 @@ struct NotificationSettingsEditScreenRoomCell_Previews: PreviewProvider, Testabl
|
||||
notificationSettingsProxy: notificationSettingsProxy)
|
||||
|
||||
let rooms: [NotificationSettingsEditScreenRoom] = summaryProvider.roomListPublisher.value.compactMap { summary -> NotificationSettingsEditScreenRoom? in
|
||||
switch summary {
|
||||
case .empty, .invalidated:
|
||||
return nil
|
||||
case .filled(let details):
|
||||
return NotificationSettingsEditScreenRoom(id: UUID().uuidString,
|
||||
roomId: details.id,
|
||||
name: details.name,
|
||||
avatar: details.avatar)
|
||||
}
|
||||
NotificationSettingsEditScreenRoom(id: UUID().uuidString,
|
||||
roomId: summary.id,
|
||||
name: summary.name,
|
||||
avatar: summary.avatar)
|
||||
}
|
||||
|
||||
|
||||
return VStack(spacing: 0) {
|
||||
ForEach(rooms) { room in
|
||||
NotificationSettingsEditScreenRoomCell(room: room, context: viewModel.context)
|
||||
|
@ -47,7 +47,6 @@ enum ClientProxyError: Error {
|
||||
|
||||
enum SlidingSyncConstants {
|
||||
static let defaultTimelineLimit: UInt = 20
|
||||
static let maximumVisibleRangeSize = 30
|
||||
}
|
||||
|
||||
/// This struct represents the configuration that we are using to register the application through Pusher to Sygnal
|
||||
|
@ -17,7 +17,9 @@
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
|
||||
struct RoomSummaryDetails {
|
||||
struct RoomSummary {
|
||||
let roomListItem: RoomListItem
|
||||
|
||||
let id: String
|
||||
|
||||
let isInvite: Bool
|
||||
@ -46,9 +48,9 @@ struct RoomSummaryDetails {
|
||||
var isMuted: Bool { notificationMode == .mute }
|
||||
}
|
||||
|
||||
extension RoomSummaryDetails: CustomStringConvertible {
|
||||
extension RoomSummary: CustomStringConvertible {
|
||||
var description: String { """
|
||||
RoomSummaryDetails: - id: \(id) \
|
||||
RoomSummary: - id: \(id) \
|
||||
- isDirect: \(isDirect) \
|
||||
- unreadMessagesCount: \(unreadMessagesCount) \
|
||||
- unreadMentionsCount: \(unreadMentionsCount) \
|
||||
@ -58,8 +60,9 @@ extension RoomSummaryDetails: CustomStringConvertible {
|
||||
}
|
||||
}
|
||||
|
||||
extension RoomSummaryDetails {
|
||||
init(id: String, settingsMode: RoomNotificationModeProxy, hasUnreadMessages: Bool, hasUnreadMentions: Bool, hasUnreadNotifications: Bool) {
|
||||
extension RoomSummary {
|
||||
init(roomListItem: RoomListItem, id: String, settingsMode: RoomNotificationModeProxy, hasUnreadMessages: Bool, hasUnreadMentions: Bool, hasUnreadNotifications: Bool) {
|
||||
self.roomListItem = roomListItem
|
||||
self.id = id
|
||||
let string = "\(settingsMode) - messages: \(hasUnreadMessages) - mentions: \(hasUnreadMentions) - notifications: \(hasUnreadNotifications)"
|
||||
name = string
|
@ -35,7 +35,6 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
private var listUpdatesSubscriptionResult: RoomListEntriesWithDynamicAdaptersResult?
|
||||
private var listUpdatesTaskHandle: TaskHandle?
|
||||
private var stateUpdatesTaskHandle: TaskHandle?
|
||||
|
||||
private let roomListSubject = CurrentValueSubject<[RoomSummary], Never>([])
|
||||
@ -85,7 +84,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
}
|
||||
|
||||
func setRoomList(_ roomList: RoomList) {
|
||||
guard listUpdatesTaskHandle == nil, stateUpdatesTaskHandle == nil else {
|
||||
guard stateUpdatesTaskHandle == nil else {
|
||||
return
|
||||
}
|
||||
|
||||
@ -101,8 +100,6 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
// Forces the listener above to be called with the current state
|
||||
setFilter(.all(filters: []))
|
||||
|
||||
listUpdatesTaskHandle = listUpdatesSubscriptionResult?.entriesStream
|
||||
|
||||
let stateUpdatesSubscriptionResult = try roomList.loadingState(listener: RoomListStateObserver { [weak self] state in
|
||||
guard let self else { return }
|
||||
MXLog.info("\(name): Received state update: \(state)")
|
||||
@ -119,48 +116,31 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
|
||||
func updateVisibleRange(_ range: Range<Int>) {
|
||||
if range.upperBound >= rooms.count {
|
||||
listUpdatesSubscriptionResult?.controller.addOnePage()
|
||||
listUpdatesSubscriptionResult?.controller().addOnePage()
|
||||
} else if range.lowerBound == 0 {
|
||||
listUpdatesSubscriptionResult?.controller.resetToOnePage()
|
||||
listUpdatesSubscriptionResult?.controller().resetToOnePage()
|
||||
}
|
||||
|
||||
guard shouldUpdateVisibleRange else {
|
||||
return
|
||||
}
|
||||
|
||||
Task {
|
||||
do {
|
||||
// The scroll view content size based visible range calculations might create large ranges
|
||||
// This is just a safety check to not overload the backend
|
||||
var upperBound = range.upperBound
|
||||
if range.upperBound - range.lowerBound > SlidingSyncConstants.maximumVisibleRangeSize {
|
||||
upperBound = range.lowerBound + SlidingSyncConstants.maximumVisibleRangeSize
|
||||
}
|
||||
|
||||
MXLog.info("\(name): Setting visible range to \(range.lowerBound)...\(upperBound)")
|
||||
|
||||
try await roomListService.applyInput(input: .viewport(ranges: [.init(start: UInt32(range.lowerBound), endInclusive: UInt32(upperBound))]))
|
||||
} catch {
|
||||
MXLog.error("Failed updating visible range with error: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setFilter(_ filter: RoomSummaryProviderFilter) {
|
||||
switch filter {
|
||||
case .excludeAll:
|
||||
_ = listUpdatesSubscriptionResult?.controller.setFilter(kind: .none)
|
||||
_ = listUpdatesSubscriptionResult?.controller().setFilter(kind: .none)
|
||||
case let .search(query):
|
||||
let filters: [RoomListEntriesDynamicFilterKind] = if appSettings.fuzzyRoomListSearchEnabled {
|
||||
[.fuzzyMatchRoomName(pattern: query), .nonLeft]
|
||||
} else {
|
||||
[.normalizedMatchRoomName(pattern: query), .nonLeft]
|
||||
}
|
||||
_ = listUpdatesSubscriptionResult?.controller.setFilter(kind: .all(filters: filters))
|
||||
_ = listUpdatesSubscriptionResult?.controller().setFilter(kind: .all(filters: filters))
|
||||
case let .all(filters):
|
||||
var filters = filters.map(\.rustFilter)
|
||||
filters.append(.nonLeft)
|
||||
_ = listUpdatesSubscriptionResult?.controller.setFilter(kind: .all(filters: filters))
|
||||
_ = listUpdatesSubscriptionResult?.controller().setFilter(kind: .all(filters: filters))
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,13 +155,13 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
|
||||
MXLog.info("Started processing room list diffs")
|
||||
|
||||
MXLog.verbose("\(name): Received \(diffs.count) diffs, current room list \(rooms.compactMap { $0.id ?? "Empty" })")
|
||||
MXLog.verbose("\(name): Received \(diffs.count) diffs, current room list \(rooms.map(\.id))")
|
||||
|
||||
rooms = diffs.reduce(rooms) { currentItems, diff in
|
||||
processDiff(diff, on: currentItems)
|
||||
}
|
||||
|
||||
MXLog.verbose("\(name): Finished applying \(diffs.count) diffs, new room list \(rooms.compactMap { $0.id ?? "Empty" })")
|
||||
MXLog.verbose("\(name): Finished applying \(diffs.count) diffs, new room list \(rooms.map(\.id))")
|
||||
|
||||
MXLog.info("Finished processing room list diffs")
|
||||
}
|
||||
@ -200,18 +180,17 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
return updatedItems
|
||||
}
|
||||
|
||||
private func fetchRoomDetails(roomID: String) -> (roomInfo: RoomInfo?, latestEvent: EventTimelineItem?) {
|
||||
private func fetchRoomDetails(from roomListItem: RoomListItem) -> (roomInfo: RoomInfo?, latestEvent: EventTimelineItem?) {
|
||||
class FetchResult {
|
||||
var roomInfo: RoomInfo?
|
||||
var latestEvent: EventTimelineItem?
|
||||
}
|
||||
|
||||
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
let result = FetchResult()
|
||||
|
||||
|
||||
Task {
|
||||
do {
|
||||
let roomListItem = try roomListService.room(roomId: roomID)
|
||||
result.latestEvent = await roomListItem.latestEvent()
|
||||
result.roomInfo = try await roomListItem.roomInfo()
|
||||
} catch {
|
||||
@ -222,12 +201,12 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
semaphore.wait()
|
||||
return (result.roomInfo, result.latestEvent)
|
||||
}
|
||||
|
||||
private func buildRoomSummaryForIdentifier(_ identifier: String, invalidated: Bool) -> RoomSummary {
|
||||
let roomDetails = fetchRoomDetails(roomID: identifier)
|
||||
|
||||
private func buildRoomSummary(from roomListItem: RoomListItem) -> RoomSummary {
|
||||
let roomDetails = fetchRoomDetails(from: roomListItem)
|
||||
|
||||
guard let roomInfo = roomDetails.roomInfo else {
|
||||
return .empty
|
||||
fatalError("Missing room info for \(roomListItem.id())")
|
||||
}
|
||||
|
||||
var attributedLastMessage: AttributedString?
|
||||
@ -246,47 +225,24 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
|
||||
let notificationMode = roomInfo.userDefinedNotificationMode.flatMap { RoomNotificationModeProxy.from(roomNotificationMode: $0) }
|
||||
|
||||
let details = RoomSummaryDetails(id: roomInfo.id,
|
||||
isInvite: roomInfo.membership == .invited,
|
||||
inviter: inviterProxy,
|
||||
name: roomInfo.displayName ?? roomInfo.id,
|
||||
isDirect: roomInfo.isDirect,
|
||||
avatarURL: roomInfo.avatarUrl.flatMap(URL.init(string:)),
|
||||
heroes: roomInfo.heroes.map(UserProfileProxy.init),
|
||||
lastMessage: attributedLastMessage,
|
||||
lastMessageFormattedTimestamp: lastMessageFormattedTimestamp,
|
||||
unreadMessagesCount: UInt(roomInfo.numUnreadMessages),
|
||||
unreadMentionsCount: UInt(roomInfo.numUnreadMentions),
|
||||
unreadNotificationsCount: UInt(roomInfo.numUnreadNotifications),
|
||||
notificationMode: notificationMode,
|
||||
canonicalAlias: roomInfo.canonicalAlias,
|
||||
hasOngoingCall: roomInfo.hasRoomCall,
|
||||
isMarkedUnread: roomInfo.isMarkedUnread,
|
||||
isFavourite: roomInfo.isFavourite)
|
||||
|
||||
return invalidated ? .invalidated(details: details) : .filled(details: details)
|
||||
}
|
||||
|
||||
private func buildSummaryForRoomListEntry(_ entry: RoomListEntry) -> RoomSummary {
|
||||
switch entry {
|
||||
case .empty:
|
||||
return .empty
|
||||
case .filled(let roomId):
|
||||
return buildRoomSummaryForIdentifier(roomId, invalidated: false)
|
||||
case .invalidated(let roomId):
|
||||
guard let cachedRoom = rooms.first(where: { $0.id == roomId }) else {
|
||||
return buildRoomSummaryForIdentifier(roomId, invalidated: true)
|
||||
}
|
||||
|
||||
switch cachedRoom {
|
||||
case .empty:
|
||||
return .empty
|
||||
case .filled(let details):
|
||||
return .invalidated(details: details)
|
||||
case .invalidated:
|
||||
return cachedRoom
|
||||
}
|
||||
}
|
||||
return RoomSummary(roomListItem: roomListItem,
|
||||
id: roomInfo.id,
|
||||
isInvite: roomInfo.membership == .invited,
|
||||
inviter: inviterProxy,
|
||||
name: roomInfo.displayName ?? roomInfo.id,
|
||||
isDirect: roomInfo.isDirect,
|
||||
avatarURL: roomInfo.avatarUrl.flatMap(URL.init(string:)),
|
||||
heroes: roomInfo.heroes.map(UserProfileProxy.init),
|
||||
lastMessage: attributedLastMessage,
|
||||
lastMessageFormattedTimestamp: lastMessageFormattedTimestamp,
|
||||
unreadMessagesCount: UInt(roomInfo.numUnreadMessages),
|
||||
unreadMentionsCount: UInt(roomInfo.numUnreadMentions),
|
||||
unreadNotificationsCount: UInt(roomInfo.numUnreadNotifications),
|
||||
notificationMode: notificationMode,
|
||||
canonicalAlias: roomInfo.canonicalAlias,
|
||||
hasOngoingCall: roomInfo.hasRoomCall,
|
||||
isMarkedUnread: roomInfo.isMarkedUnread,
|
||||
isFavourite: roomInfo.isFavourite)
|
||||
}
|
||||
|
||||
private func buildDiff(from diff: RoomListEntriesUpdate, on rooms: [RoomSummary]) -> CollectionDifference<RoomSummary>? {
|
||||
@ -294,10 +250,10 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
|
||||
switch diff {
|
||||
case .append(let values):
|
||||
let debugIdentifiers = values.map(\.debugIdentifier)
|
||||
let debugIdentifiers = values.map { $0.id() }
|
||||
MXLog.verbose("\(name): Append \(debugIdentifiers)")
|
||||
for (index, value) in values.enumerated() {
|
||||
let summary = buildSummaryForRoomListEntry(value)
|
||||
let summary = buildRoomSummary(from: value)
|
||||
changes.append(.insert(offset: rooms.count + index, element: summary, associatedWith: nil))
|
||||
}
|
||||
case .clear:
|
||||
@ -306,8 +262,8 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
changes.append(.remove(offset: index, element: value, associatedWith: nil))
|
||||
}
|
||||
case .insert(let index, let value):
|
||||
MXLog.verbose("\(name): Insert at \(value.debugIdentifier) at \(index)")
|
||||
let summary = buildSummaryForRoomListEntry(value)
|
||||
MXLog.verbose("\(name): Insert at \(value.id()) at \(index)")
|
||||
let summary = buildRoomSummary(from: value)
|
||||
changes.append(.insert(offset: Int(index), element: summary, associatedWith: nil))
|
||||
case .popBack:
|
||||
MXLog.verbose("\(name): Pop Back")
|
||||
@ -321,30 +277,30 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
let summary = rooms[0]
|
||||
changes.append(.remove(offset: 0, element: summary, associatedWith: nil))
|
||||
case .pushBack(let value):
|
||||
MXLog.verbose("\(name): Push Back \(value.debugIdentifier)")
|
||||
let summary = buildSummaryForRoomListEntry(value)
|
||||
MXLog.verbose("\(name): Push Back \(value.id())")
|
||||
let summary = buildRoomSummary(from: value)
|
||||
changes.append(.insert(offset: rooms.count, element: summary, associatedWith: nil))
|
||||
case .pushFront(let value):
|
||||
MXLog.verbose("\(name): Push Front \(value.debugIdentifier)")
|
||||
let summary = buildSummaryForRoomListEntry(value)
|
||||
MXLog.verbose("\(name): Push Front \(value.id())")
|
||||
let summary = buildRoomSummary(from: value)
|
||||
changes.append(.insert(offset: 0, element: summary, associatedWith: nil))
|
||||
case .remove(let index):
|
||||
let summary = rooms[Int(index)]
|
||||
MXLog.verbose("\(name): Remove \(summary.id ?? "") from \(index)")
|
||||
MXLog.verbose("\(name): Remove \(summary.id) from \(index)")
|
||||
changes.append(.remove(offset: Int(index), element: summary, associatedWith: nil))
|
||||
case .reset(let values):
|
||||
let debugIdentifiers = values.map(\.debugIdentifier)
|
||||
let debugIdentifiers = values.map { $0.id() }
|
||||
MXLog.verbose("\(name): Replace all items with \(debugIdentifiers)")
|
||||
for (index, summary) in rooms.enumerated() {
|
||||
changes.append(.remove(offset: index, element: summary, associatedWith: nil))
|
||||
}
|
||||
|
||||
for (index, value) in values.enumerated() {
|
||||
changes.append(.insert(offset: index, element: buildSummaryForRoomListEntry(value), associatedWith: nil))
|
||||
changes.append(.insert(offset: index, element: buildRoomSummary(from: value), associatedWith: nil))
|
||||
}
|
||||
case .set(let index, let value):
|
||||
MXLog.verbose("\(name): Update \(value.debugIdentifier) at \(index)")
|
||||
let summary = buildSummaryForRoomListEntry(value)
|
||||
MXLog.verbose("\(name): Update \(value.id()) at \(index)")
|
||||
let summary = buildRoomSummary(from: value)
|
||||
changes.append(.remove(offset: Int(index), element: summary, associatedWith: nil))
|
||||
changes.append(.insert(offset: Int(index), element: summary, associatedWith: nil))
|
||||
case .truncate(let length):
|
||||
@ -384,14 +340,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
MXLog.info("\(name): Rebuilding room summaries for \(rooms.count) rooms")
|
||||
|
||||
rooms = rooms.map {
|
||||
switch $0 {
|
||||
case .empty:
|
||||
return $0
|
||||
case .filled(let details):
|
||||
return self.buildRoomSummaryForIdentifier(details.id, invalidated: false)
|
||||
case .invalidated(let details):
|
||||
return self.buildRoomSummaryForIdentifier(details.id, invalidated: true)
|
||||
}
|
||||
self.buildRoomSummary(from: $0.roomListItem)
|
||||
}
|
||||
|
||||
MXLog.info("\(name): Finished rebuilding room summaries (\(rooms.count) rooms)")
|
||||
@ -409,19 +358,6 @@ extension RoomSummaryProviderState {
|
||||
}
|
||||
}
|
||||
|
||||
extension MatrixRustSDK.RoomListEntry {
|
||||
var debugIdentifier: String {
|
||||
switch self {
|
||||
case .empty:
|
||||
return "Empty"
|
||||
case .invalidated(let roomId):
|
||||
return "Invalidated(\(roomId))"
|
||||
case .filled(let roomId):
|
||||
return "Filled(\(roomId))"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class RoomListEntriesListenerProxy: RoomListEntriesListener {
|
||||
private let onUpdateClosure: ([RoomListEntriesUpdate]) -> Void
|
||||
|
||||
|
@ -41,61 +41,6 @@ enum RoomSummaryProviderState {
|
||||
}
|
||||
}
|
||||
|
||||
enum RoomSummary: CustomStringConvertible, Equatable {
|
||||
case empty
|
||||
case filled(details: RoomSummaryDetails)
|
||||
case invalidated(details: RoomSummaryDetails)
|
||||
|
||||
var id: String? {
|
||||
switch self {
|
||||
case .empty:
|
||||
return nil
|
||||
case .invalidated(let details), .filled(let details):
|
||||
return details.id
|
||||
}
|
||||
}
|
||||
|
||||
var name: String? {
|
||||
switch self {
|
||||
case .empty:
|
||||
return nil
|
||||
case .invalidated(let details), .filled(let details):
|
||||
return details.name
|
||||
}
|
||||
}
|
||||
|
||||
var isDirect: Bool {
|
||||
switch self {
|
||||
case .empty:
|
||||
return false
|
||||
case .invalidated(let details), .filled(let details):
|
||||
return details.isDirect
|
||||
}
|
||||
}
|
||||
|
||||
var description: String {
|
||||
switch self {
|
||||
case .empty:
|
||||
return "\(String(describing: Self.self)): Empty"
|
||||
case .invalidated(let details):
|
||||
return "\(String(describing: Self.self)): Invalidated(\(details.id))"
|
||||
case .filled(let details):
|
||||
return "\(String(describing: Self.self)): Filled(\(details.id))"
|
||||
}
|
||||
}
|
||||
|
||||
static func == (lhs: RoomSummary, rhs: RoomSummary) -> Bool {
|
||||
switch (lhs, rhs) {
|
||||
case (.empty, .empty):
|
||||
return true
|
||||
case (.filled(let lhsDetails), .filled(let rhsDetails)), (.invalidated(let lhsDetails), .invalidated(let rhsDetails)):
|
||||
return lhsDetails.id == rhsDetails.id
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum RoomSummaryProviderFilter: Equatable {
|
||||
/// Filters out everything
|
||||
case excludeAll
|
||||
|
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreen-iPad-en-GB.Loaded.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreen-iPad-en-GB.Loaded.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreen-iPad-pseudo.Loaded.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreen-iPad-pseudo.Loaded.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreen-iPhone-15-en-GB.Loaded.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreen-iPhone-15-en-GB.Loaded.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreen-iPhone-15-pseudo.Loaded.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreen-iPhone-15-pseudo.Loaded.png
(Stored with Git LFS)
Binary file not shown.
@ -21,7 +21,7 @@ import XCTest
|
||||
|
||||
@MainActor
|
||||
class HomeScreenRoomTests: XCTestCase {
|
||||
var roomSummaryDetails: RoomSummaryDetails!
|
||||
var roomSummary: RoomSummary!
|
||||
|
||||
// swiftlint:disable:next function_parameter_count
|
||||
func setupRoomSummary(isMarkedUnread: Bool,
|
||||
@ -30,23 +30,24 @@ class HomeScreenRoomTests: XCTestCase {
|
||||
unreadNotificationsCount: UInt,
|
||||
notificationMode: RoomNotificationModeProxy,
|
||||
hasOngoingCall: Bool) {
|
||||
roomSummaryDetails = RoomSummaryDetails(id: "Test room",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Test room",
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: unreadMessagesCount,
|
||||
unreadMentionsCount: unreadMentionsCount,
|
||||
unreadNotificationsCount: unreadNotificationsCount,
|
||||
notificationMode: notificationMode,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: hasOngoingCall,
|
||||
isMarkedUnread: isMarkedUnread,
|
||||
isFavourite: false)
|
||||
roomSummary = RoomSummary(roomListItem: .init(noPointer: .init()),
|
||||
id: "Test room",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: "Test room",
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
heroes: [],
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: unreadMessagesCount,
|
||||
unreadMentionsCount: unreadMentionsCount,
|
||||
unreadNotificationsCount: unreadNotificationsCount,
|
||||
notificationMode: notificationMode,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: hasOngoingCall,
|
||||
isMarkedUnread: isMarkedUnread,
|
||||
isFavourite: false)
|
||||
}
|
||||
|
||||
func testNoBadge() {
|
||||
@ -57,7 +58,7 @@ class HomeScreenRoomTests: XCTestCase {
|
||||
notificationMode: .allMessages,
|
||||
hasOngoingCall: false)
|
||||
|
||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||
|
||||
XCTAssertFalse(room.isHighlighted)
|
||||
XCTAssertFalse(room.badges.isDotShown)
|
||||
@ -74,7 +75,7 @@ class HomeScreenRoomTests: XCTestCase {
|
||||
notificationMode: .allMessages,
|
||||
hasOngoingCall: true)
|
||||
|
||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||
|
||||
XCTAssertTrue(room.isHighlighted)
|
||||
XCTAssertTrue(room.badges.isDotShown)
|
||||
@ -91,7 +92,7 @@ class HomeScreenRoomTests: XCTestCase {
|
||||
notificationMode: .allMessages,
|
||||
hasOngoingCall: false)
|
||||
|
||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||
|
||||
XCTAssertFalse(room.isHighlighted)
|
||||
XCTAssertTrue(room.badges.isDotShown)
|
||||
@ -108,7 +109,7 @@ class HomeScreenRoomTests: XCTestCase {
|
||||
notificationMode: .allMessages,
|
||||
hasOngoingCall: false)
|
||||
|
||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||
|
||||
XCTAssertTrue(room.isHighlighted)
|
||||
XCTAssertTrue(room.badges.isDotShown)
|
||||
@ -125,7 +126,7 @@ class HomeScreenRoomTests: XCTestCase {
|
||||
notificationMode: .allMessages,
|
||||
hasOngoingCall: false)
|
||||
|
||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||
|
||||
XCTAssertTrue(room.isHighlighted)
|
||||
XCTAssertTrue(room.badges.isDotShown)
|
||||
@ -142,7 +143,7 @@ class HomeScreenRoomTests: XCTestCase {
|
||||
notificationMode: .allMessages,
|
||||
hasOngoingCall: true)
|
||||
|
||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||
|
||||
XCTAssertFalse(room.isHighlighted)
|
||||
XCTAssertFalse(room.badges.isDotShown)
|
||||
@ -159,7 +160,7 @@ class HomeScreenRoomTests: XCTestCase {
|
||||
notificationMode: .mentionsAndKeywordsOnly,
|
||||
hasOngoingCall: false)
|
||||
|
||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||
|
||||
XCTAssertFalse(room.isHighlighted)
|
||||
XCTAssertTrue(room.badges.isDotShown)
|
||||
@ -176,7 +177,7 @@ class HomeScreenRoomTests: XCTestCase {
|
||||
notificationMode: .mentionsAndKeywordsOnly,
|
||||
hasOngoingCall: false)
|
||||
|
||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: true)
|
||||
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: true)
|
||||
|
||||
XCTAssertFalse(room.isHighlighted)
|
||||
XCTAssertFalse(room.badges.isDotShown)
|
||||
@ -195,7 +196,7 @@ class HomeScreenRoomTests: XCTestCase {
|
||||
notificationMode: .allMessages,
|
||||
hasOngoingCall: false)
|
||||
|
||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||
|
||||
XCTAssertTrue(room.isHighlighted)
|
||||
XCTAssertTrue(room.badges.isDotShown)
|
||||
@ -212,7 +213,7 @@ class HomeScreenRoomTests: XCTestCase {
|
||||
notificationMode: .allMessages,
|
||||
hasOngoingCall: false)
|
||||
|
||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||
|
||||
XCTAssertTrue(room.isHighlighted)
|
||||
XCTAssertTrue(room.badges.isDotShown)
|
||||
@ -229,7 +230,7 @@ class HomeScreenRoomTests: XCTestCase {
|
||||
notificationMode: .mute,
|
||||
hasOngoingCall: true)
|
||||
|
||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||
|
||||
XCTAssertTrue(room.isHighlighted)
|
||||
XCTAssertTrue(room.badges.isDotShown)
|
||||
|
@ -81,29 +81,30 @@ class LoggingTests: XCTestCase {
|
||||
|
||||
XCTAssertTrue(logFile.lastPathComponent.contains(target))
|
||||
}
|
||||
|
||||
|
||||
func validateRoomSummaryContentIsRedacted() throws {
|
||||
// Given a room summary that contains sensitive information
|
||||
let roomName = "Private Conversation"
|
||||
let lastMessage = "Secret information"
|
||||
let heroName = "Pseudonym"
|
||||
let roomSummary = RoomSummaryDetails(id: "myroomid",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: roomName,
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [.init(userID: "", displayName: heroName)],
|
||||
lastMessage: AttributedString(lastMessage),
|
||||
lastMessageFormattedTimestamp: "Now",
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)
|
||||
let roomSummary = RoomSummary(roomListItem: .init(noPointer: .init()),
|
||||
id: "myroomid",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: roomName,
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
heroes: [.init(userID: "", displayName: heroName)],
|
||||
lastMessage: AttributedString(lastMessage),
|
||||
lastMessageFormattedTimestamp: "Now",
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)
|
||||
|
||||
// When logging that value
|
||||
MXLog.info(roomSummary)
|
||||
|
@ -18,13 +18,13 @@ import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
class RoomSummaryDetailsTests: XCTestCase {
|
||||
class RoomSummaryTests: XCTestCase {
|
||||
// swiftlint:disable:next large_tuple
|
||||
let roomDetails: (id: String, name: String, avatarURL: URL) = ("room_id", "Room Name", "mxc://hs.tld/room/avatar")
|
||||
let heroes = [UserProfileProxy(userID: "hero_1", displayName: "Hero 1", avatarURL: "mxc://hs.tld/user/avatar")]
|
||||
|
||||
func testRoomAvatar() {
|
||||
let details = makeDetails(isDirect: false, hasRoomAvatar: true)
|
||||
let details = makeSummary(isDirect: false, hasRoomAvatar: true)
|
||||
|
||||
switch details.avatar {
|
||||
case .room(let id, let name, let avatarURL):
|
||||
@ -37,7 +37,7 @@ class RoomSummaryDetailsTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testDMAvatarSet() {
|
||||
let details = makeDetails(isDirect: true, hasRoomAvatar: true)
|
||||
let details = makeSummary(isDirect: true, hasRoomAvatar: true)
|
||||
|
||||
switch details.avatar {
|
||||
case .room(let id, let name, let avatarURL):
|
||||
@ -50,7 +50,7 @@ class RoomSummaryDetailsTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testDMAvatarNotSet() {
|
||||
let details = makeDetails(isDirect: true, hasRoomAvatar: false)
|
||||
let details = makeSummary(isDirect: true, hasRoomAvatar: false)
|
||||
|
||||
switch details.avatar {
|
||||
case .room:
|
||||
@ -62,23 +62,24 @@ class RoomSummaryDetailsTests: XCTestCase {
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
func makeDetails(isDirect: Bool, hasRoomAvatar: Bool) -> RoomSummaryDetails {
|
||||
RoomSummaryDetails(id: roomDetails.id,
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: roomDetails.name,
|
||||
isDirect: isDirect,
|
||||
avatarURL: hasRoomAvatar ? roomDetails.avatarURL : nil,
|
||||
heroes: heroes,
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)
|
||||
func makeSummary(isDirect: Bool, hasRoomAvatar: Bool) -> RoomSummary {
|
||||
RoomSummary(roomListItem: .init(noPointer: .init()),
|
||||
id: roomDetails.id,
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
name: roomDetails.name,
|
||||
isDirect: isDirect,
|
||||
avatarURL: hasRoomAvatar ? roomDetails.avatarURL : nil,
|
||||
heroes: heroes,
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: nil,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)
|
||||
}
|
||||
}
|
@ -60,7 +60,7 @@ packages:
|
||||
# Element/Matrix dependencies
|
||||
MatrixRustSDK:
|
||||
url: https://github.com/element-hq/matrix-rust-components-swift
|
||||
exactVersion: 1.0.21
|
||||
exactVersion: 1.0.22
|
||||
# path: ../matrix-rust-sdk
|
||||
Compound:
|
||||
url: https://github.com/element-hq/compound-ios
|
||||
|
Loading…
x
Reference in New Issue
Block a user