mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +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:
@@ -100,6 +100,7 @@
|
|||||||
1555A7643D85187D4851040C /* TemplateScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4549FCB53F43DB0B278374BC /* TemplateScreen.swift */; };
|
1555A7643D85187D4851040C /* TemplateScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4549FCB53F43DB0B278374BC /* TemplateScreen.swift */; };
|
||||||
157E5FDDF419C0B2CA7E2C28 /* TimelineItemBubbledStylerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98A2932515EA11D3DD8A3506 /* TimelineItemBubbledStylerView.swift */; };
|
157E5FDDF419C0B2CA7E2C28 /* TimelineItemBubbledStylerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98A2932515EA11D3DD8A3506 /* TimelineItemBubbledStylerView.swift */; };
|
||||||
1583E2D766E4485FF91662FC /* PermalinkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA3EB5B1848CF4F64E63C6B7 /* PermalinkTests.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 */; };
|
167D00CAA13FAFB822298021 /* MediaProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62A81CCC2516D9CF9322DF01 /* MediaProviderTests.swift */; };
|
||||||
16CBD087038DE3815CDA512C /* PollMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = D38391154120264910D19528 /* PollMock.swift */; };
|
16CBD087038DE3815CDA512C /* PollMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = D38391154120264910D19528 /* PollMock.swift */; };
|
||||||
16E4F1B8B9BFE1367F96DDA7 /* CompletionSuggestionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 989FC684408B31A677F5538B /* CompletionSuggestionView.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 */; };
|
5894C2514400A4FBC9327632 /* ServerConfirmationScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03277E40D0E0DE0712021A71 /* ServerConfirmationScreenCoordinator.swift */; };
|
||||||
5897A59DDBD3592282092223 /* MediaSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49B9785E3AD7D1C15A29F2F /* MediaSourceProxy.swift */; };
|
5897A59DDBD3592282092223 /* MediaSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49B9785E3AD7D1C15A29F2F /* MediaSourceProxy.swift */; };
|
||||||
5992EF10AA157EBD97D88910 /* AudioRecorderState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6569593FA36B22259E806A67 /* AudioRecorderState.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 */; };
|
59F940FCBE6BC343AECEF75E /* ImageCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E2245243369B99216C7D84E /* ImageCache.swift */; };
|
||||||
5AE6404C4FD4848ACCFF9EDC /* SecureBackupLogoutConfirmationScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1573D28C8A9FB6399D0EEFB /* SecureBackupLogoutConfirmationScreenCoordinator.swift */; };
|
5AE6404C4FD4848ACCFF9EDC /* SecureBackupLogoutConfirmationScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1573D28C8A9FB6399D0EEFB /* SecureBackupLogoutConfirmationScreenCoordinator.swift */; };
|
||||||
5B2D1210B40570D87B11BD3B /* ThreadDecorator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CA3F8E905DF50BF22ECC18F /* ThreadDecorator.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 */; };
|
8691186F9B99BCDDB7CACDD8 /* KeychainController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E36CB905A2B9EC2C92A2DA7C /* KeychainController.swift */; };
|
||||||
86F9D3028A1F4AE819D75560 /* RoomChangePermissionsScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D879FC4E881E748BB9B34DC /* RoomChangePermissionsScreenCoordinator.swift */; };
|
86F9D3028A1F4AE819D75560 /* RoomChangePermissionsScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D879FC4E881E748BB9B34DC /* RoomChangePermissionsScreenCoordinator.swift */; };
|
||||||
872A6457DF573AF8CEAE927A /* LoginHomeserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9349F590E35CE514A71E6764 /* LoginHomeserver.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 */; };
|
874FEFB9D4A4AF447E0E086E /* AuthenticationStartScreenViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F7CCC4A9D1927223F559D5 /* AuthenticationStartScreenViewModelProtocol.swift */; };
|
||||||
878070573C7BF19E735707B4 /* RoomTimelineItemProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DE8D25D6A91030175D52A20 /* RoomTimelineItemProperties.swift */; };
|
878070573C7BF19E735707B4 /* RoomTimelineItemProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DE8D25D6A91030175D52A20 /* RoomTimelineItemProperties.swift */; };
|
||||||
87B4E59A4467F8EC75F82372 /* VoiceMessageRoomTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B70A50C41C5871B4DB905E7E /* VoiceMessageRoomTimelineView.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 */; };
|
A722F426FD81FC67706BB1E0 /* CustomLayoutLabelStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42236480CF0431535EBE8387 /* CustomLayoutLabelStyle.swift */; };
|
||||||
A74438ED16F8683A4B793E6A /* AnalyticsSettingsScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BCE3FAF40932AC7C7639AC4 /* AnalyticsSettingsScreenViewModel.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 */; };
|
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 */; };
|
A816F7087C495D85048AC50E /* RoomMemberDetailsScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B6E30BB748F3F480F077969 /* RoomMemberDetailsScreenModels.swift */; };
|
||||||
A851635B3255C6DC07034A12 /* RoomScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8108C8F0ACF6A7EB72D0117 /* RoomScreenCoordinator.swift */; };
|
A851635B3255C6DC07034A12 /* RoomScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8108C8F0ACF6A7EB72D0117 /* RoomScreenCoordinator.swift */; };
|
||||||
A896998A6784DB6F16E912F4 /* MockMediaLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AB7D7DAAAF662DED9D02379 /* MockMediaLoader.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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
048A21188AB19349D026BECD /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
|
||||||
04BB8DDE245ED86C489BA983 /* AccessibilityIdentifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessibilityIdentifiers.swift; 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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; path = UnitTests.xctestplan; sourceTree = "<group>"; };
|
||||||
@@ -3531,7 +3531,7 @@
|
|||||||
children = (
|
children = (
|
||||||
B0A307A44F952CD73E63AE31 /* RoomEventStringBuilder.swift */,
|
B0A307A44F952CD73E63AE31 /* RoomEventStringBuilder.swift */,
|
||||||
80E815FF3CC5E5A355E3A25E /* RoomMessageEventStringBuilder.swift */,
|
80E815FF3CC5E5A355E3A25E /* RoomMessageEventStringBuilder.swift */,
|
||||||
142808B69851451AC32A2CEA /* RoomSummaryDetails.swift */,
|
29A953B6C0C431DBF4DD00B4 /* RoomSummary.swift */,
|
||||||
CDB3227C7A74B734924942E9 /* RoomSummaryProvider.swift */,
|
CDB3227C7A74B734924942E9 /* RoomSummaryProvider.swift */,
|
||||||
10CC626F97AD70FF0420C115 /* RoomSummaryProviderProtocol.swift */,
|
10CC626F97AD70FF0420C115 /* RoomSummaryProviderProtocol.swift */,
|
||||||
);
|
);
|
||||||
@@ -3614,7 +3614,7 @@
|
|||||||
48FEFF746DB341CDB18D7AAA /* RoomRolesAndPermissionsScreenViewModelTests.swift */,
|
48FEFF746DB341CDB18D7AAA /* RoomRolesAndPermissionsScreenViewModelTests.swift */,
|
||||||
93CF7B19FFCF8EFBE0A8696A /* RoomScreenViewModelTests.swift */,
|
93CF7B19FFCF8EFBE0A8696A /* RoomScreenViewModelTests.swift */,
|
||||||
AEEAFB646E583655652C3D04 /* RoomStateEventStringBuilderTests.swift */,
|
AEEAFB646E583655652C3D04 /* RoomStateEventStringBuilderTests.swift */,
|
||||||
CEA520B4F65D162E555C8761 /* RoomSummaryDetailsTests.swift */,
|
046C0D3F53B0B5EF0A1F5BEA /* RoomSummaryTests.swift */,
|
||||||
2E88534A39781D76487D59DF /* SecureBackupKeyBackupScreenViewModelTests.swift */,
|
2E88534A39781D76487D59DF /* SecureBackupKeyBackupScreenViewModelTests.swift */,
|
||||||
848F69921527D31CAACB93AF /* SecureBackupLogoutConfirmationScreenViewModelTests.swift */,
|
848F69921527D31CAACB93AF /* SecureBackupLogoutConfirmationScreenViewModelTests.swift */,
|
||||||
C0FF08D0BD7D0B4B6877AB7D /* SecureBackupRecoveryKeyScreenViewModelTests.swift */,
|
C0FF08D0BD7D0B4B6877AB7D /* SecureBackupRecoveryKeyScreenViewModelTests.swift */,
|
||||||
@@ -5833,7 +5833,7 @@
|
|||||||
84C631E734FD2555B39B681C /* RoomRolesAndPermissionsScreenViewModelTests.swift in Sources */,
|
84C631E734FD2555B39B681C /* RoomRolesAndPermissionsScreenViewModelTests.swift in Sources */,
|
||||||
46562110EE202E580A5FFD9C /* RoomScreenViewModelTests.swift in Sources */,
|
46562110EE202E580A5FFD9C /* RoomScreenViewModelTests.swift in Sources */,
|
||||||
CC0D088F505F33A20DC5590F /* RoomStateEventStringBuilderTests.swift in Sources */,
|
CC0D088F505F33A20DC5590F /* RoomStateEventStringBuilderTests.swift in Sources */,
|
||||||
8739553CDFA5D8ED5FD05CBC /* RoomSummaryDetailsTests.swift in Sources */,
|
15913A5B07118C1268A840E4 /* RoomSummaryTests.swift in Sources */,
|
||||||
7691233E3572A9173FD96CB3 /* SecureBackupKeyBackupScreenViewModelTests.swift in Sources */,
|
7691233E3572A9173FD96CB3 /* SecureBackupKeyBackupScreenViewModelTests.swift in Sources */,
|
||||||
EB87DF90CF6F8D5D12404C6E /* SecureBackupLogoutConfirmationScreenViewModelTests.swift in Sources */,
|
EB87DF90CF6F8D5D12404C6E /* SecureBackupLogoutConfirmationScreenViewModelTests.swift in Sources */,
|
||||||
06B31F84CE52A7A7C271267C /* SecureBackupRecoveryKeyScreenViewModelTests.swift in Sources */,
|
06B31F84CE52A7A7C271267C /* SecureBackupRecoveryKeyScreenViewModelTests.swift in Sources */,
|
||||||
@@ -6427,7 +6427,7 @@
|
|||||||
7BB31E67648CF32D2AB5E502 /* RoomScreenViewModel.swift in Sources */,
|
7BB31E67648CF32D2AB5E502 /* RoomScreenViewModel.swift in Sources */,
|
||||||
617624A97BDBB75ED3DD8156 /* RoomScreenViewModelProtocol.swift in Sources */,
|
617624A97BDBB75ED3DD8156 /* RoomScreenViewModelProtocol.swift in Sources */,
|
||||||
6C34237AFB808E38FC8776B9 /* RoomStateEventStringBuilder.swift in Sources */,
|
6C34237AFB808E38FC8776B9 /* RoomStateEventStringBuilder.swift in Sources */,
|
||||||
A7FD7B992E6EE6E5A8429197 /* RoomSummaryDetails.swift in Sources */,
|
59C41313AED7566C3AC51163 /* RoomSummary.swift in Sources */,
|
||||||
983896D611ABF52A5C37498D /* RoomSummaryProvider.swift in Sources */,
|
983896D611ABF52A5C37498D /* RoomSummaryProvider.swift in Sources */,
|
||||||
B5899F18AD6C56CE08FE532B /* RoomSummaryProviderMock.swift in Sources */,
|
B5899F18AD6C56CE08FE532B /* RoomSummaryProviderMock.swift in Sources */,
|
||||||
AA050DF4AEE54A641BA7CA22 /* RoomSummaryProviderProtocol.swift in Sources */,
|
AA050DF4AEE54A641BA7CA22 /* RoomSummaryProviderProtocol.swift in Sources */,
|
||||||
@@ -7417,7 +7417,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 = 1.0.21;
|
version = 1.0.22;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
||||||
|
|||||||
@@ -148,8 +148,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" : "e920922314385cbf7a1dc8ad06cd5fd121aa1b59",
|
"revision" : "5a8b528c916a46009225517d2ee81296e2eddbfd",
|
||||||
"version" : "1.0.21"
|
"version" : "1.0.22"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,14 +92,7 @@ extension ClientProxyMock {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
let roomID = room.id ?? UUID().uuidString
|
return await RoomProxyMock(.init(id: room.id, name: room.name))
|
||||||
|
|
||||||
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))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14022,13 +14022,13 @@ open class RoomListSDKMock: MatrixRustSDK.RoomList {
|
|||||||
open var entriesListenerReceivedListener: RoomListEntriesListener?
|
open var entriesListenerReceivedListener: RoomListEntriesListener?
|
||||||
open var entriesListenerReceivedInvocations: [RoomListEntriesListener] = []
|
open var entriesListenerReceivedInvocations: [RoomListEntriesListener] = []
|
||||||
|
|
||||||
var entriesListenerUnderlyingReturnValue: RoomListEntriesResult!
|
var entriesListenerUnderlyingReturnValue: TaskHandle!
|
||||||
open var entriesListenerReturnValue: RoomListEntriesResult! {
|
open var entriesListenerReturnValue: TaskHandle! {
|
||||||
get {
|
get {
|
||||||
if Thread.isMainThread {
|
if Thread.isMainThread {
|
||||||
return entriesListenerUnderlyingReturnValue
|
return entriesListenerUnderlyingReturnValue
|
||||||
} else {
|
} else {
|
||||||
var returnValue: RoomListEntriesResult? = nil
|
var returnValue: TaskHandle? = nil
|
||||||
DispatchQueue.main.sync {
|
DispatchQueue.main.sync {
|
||||||
returnValue = entriesListenerUnderlyingReturnValue
|
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
|
entriesListenerCallsCount += 1
|
||||||
entriesListenerReceivedListener = listener
|
entriesListenerReceivedListener = listener
|
||||||
DispatchQueue.main.async {
|
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 {
|
open class RoomListItemSDKMock: MatrixRustSDK.RoomListItem {
|
||||||
init() {
|
init() {
|
||||||
super.init(noPointer: .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
|
//MARK: - room
|
||||||
|
|
||||||
open var roomRoomIdThrowableError: Error?
|
open var roomRoomIdThrowableError: Error?
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ extension RoomSummaryProviderMock {
|
|||||||
var rooms = initialRooms
|
var rooms = initialRooms
|
||||||
|
|
||||||
if !query.isEmpty {
|
if !query.isEmpty {
|
||||||
rooms = rooms.filter { $0.name?.localizedCaseInsensitiveContains(query) ?? false }
|
rooms = rooms.filter { $0.name.localizedCaseInsensitiveContains(query) }
|
||||||
}
|
}
|
||||||
|
|
||||||
roomListSubject.send(rooms)
|
roomListSubject.send(rooms)
|
||||||
@@ -78,126 +78,132 @@ extension RoomSummaryProviderMock {
|
|||||||
|
|
||||||
extension Array where Element == RoomSummary {
|
extension Array where Element == RoomSummary {
|
||||||
static let mockRooms: [Element] = [
|
static let mockRooms: [Element] = [
|
||||||
.filled(details: RoomSummaryDetails(id: "1",
|
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||||
isInvite: false,
|
id: "1",
|
||||||
inviter: nil,
|
isInvite: false,
|
||||||
name: "Foundation 🔭🪐🌌",
|
inviter: nil,
|
||||||
isDirect: false,
|
name: "Foundation 🔭🪐🌌",
|
||||||
avatarURL: nil,
|
isDirect: false,
|
||||||
heroes: [],
|
avatarURL: nil,
|
||||||
lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"),
|
heroes: [],
|
||||||
lastMessageFormattedTimestamp: "14:56",
|
lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"),
|
||||||
unreadMessagesCount: 0,
|
lastMessageFormattedTimestamp: "14:56",
|
||||||
unreadMentionsCount: 0,
|
unreadMessagesCount: 0,
|
||||||
unreadNotificationsCount: 0,
|
unreadMentionsCount: 0,
|
||||||
notificationMode: .allMessages,
|
unreadNotificationsCount: 0,
|
||||||
canonicalAlias: nil,
|
notificationMode: .allMessages,
|
||||||
hasOngoingCall: false,
|
canonicalAlias: nil,
|
||||||
isMarkedUnread: false,
|
hasOngoingCall: false,
|
||||||
isFavourite: false)),
|
isMarkedUnread: false,
|
||||||
.filled(details: RoomSummaryDetails(id: "2",
|
isFavourite: false),
|
||||||
isInvite: false,
|
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||||
inviter: nil,
|
id: "2",
|
||||||
name: "Foundation and Empire",
|
isInvite: false,
|
||||||
isDirect: false,
|
inviter: nil,
|
||||||
avatarURL: URL.picturesDirectory,
|
name: "Foundation and Empire",
|
||||||
heroes: [],
|
isDirect: false,
|
||||||
lastMessage: AttributedString("How do you see the Emperor then? You think he keeps office hours?"),
|
avatarURL: URL.picturesDirectory,
|
||||||
lastMessageFormattedTimestamp: "2:56 PM",
|
heroes: [],
|
||||||
unreadMessagesCount: 2,
|
lastMessage: AttributedString("How do you see the Emperor then? You think he keeps office hours?"),
|
||||||
unreadMentionsCount: 0,
|
lastMessageFormattedTimestamp: "2:56 PM",
|
||||||
unreadNotificationsCount: 2,
|
unreadMessagesCount: 2,
|
||||||
notificationMode: .mute,
|
unreadMentionsCount: 0,
|
||||||
canonicalAlias: nil,
|
unreadNotificationsCount: 2,
|
||||||
hasOngoingCall: false,
|
notificationMode: .mute,
|
||||||
isMarkedUnread: false,
|
canonicalAlias: nil,
|
||||||
isFavourite: false)),
|
hasOngoingCall: false,
|
||||||
.filled(details: RoomSummaryDetails(id: "3",
|
isMarkedUnread: false,
|
||||||
isInvite: false,
|
isFavourite: false),
|
||||||
inviter: nil,
|
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||||
name: "Second Foundation",
|
id: "3",
|
||||||
isDirect: false,
|
isInvite: false,
|
||||||
avatarURL: nil,
|
inviter: nil,
|
||||||
heroes: [],
|
name: "Second Foundation",
|
||||||
lastMessage: try? AttributedString(markdown: "He certainly seemed no *mental genius* to me"),
|
isDirect: false,
|
||||||
lastMessageFormattedTimestamp: "Some time ago",
|
avatarURL: nil,
|
||||||
unreadMessagesCount: 3,
|
heroes: [],
|
||||||
unreadMentionsCount: 0,
|
lastMessage: try? AttributedString(markdown: "He certainly seemed no *mental genius* to me"),
|
||||||
unreadNotificationsCount: 0,
|
lastMessageFormattedTimestamp: "Some time ago",
|
||||||
notificationMode: .mentionsAndKeywordsOnly,
|
unreadMessagesCount: 3,
|
||||||
canonicalAlias: nil,
|
unreadMentionsCount: 0,
|
||||||
hasOngoingCall: false,
|
unreadNotificationsCount: 0,
|
||||||
isMarkedUnread: false,
|
notificationMode: .mentionsAndKeywordsOnly,
|
||||||
isFavourite: false)),
|
canonicalAlias: nil,
|
||||||
.filled(details: RoomSummaryDetails(id: "4",
|
hasOngoingCall: false,
|
||||||
isInvite: false,
|
isMarkedUnread: false,
|
||||||
inviter: nil,
|
isFavourite: false),
|
||||||
name: "Foundation's Edge",
|
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||||
isDirect: false,
|
id: "4",
|
||||||
avatarURL: nil,
|
isInvite: false,
|
||||||
heroes: [],
|
inviter: nil,
|
||||||
lastMessage: AttributedString("There's an archaic measure of time that's called the month"),
|
name: "Foundation's Edge",
|
||||||
lastMessageFormattedTimestamp: "Just now",
|
isDirect: false,
|
||||||
unreadMessagesCount: 2,
|
avatarURL: nil,
|
||||||
unreadMentionsCount: 2,
|
heroes: [],
|
||||||
unreadNotificationsCount: 2,
|
lastMessage: AttributedString("There's an archaic measure of time that's called the month"),
|
||||||
notificationMode: .allMessages,
|
lastMessageFormattedTimestamp: "Just now",
|
||||||
canonicalAlias: nil,
|
unreadMessagesCount: 2,
|
||||||
hasOngoingCall: false,
|
unreadMentionsCount: 2,
|
||||||
isMarkedUnread: false,
|
unreadNotificationsCount: 2,
|
||||||
isFavourite: false)),
|
notificationMode: .allMessages,
|
||||||
.filled(details: RoomSummaryDetails(id: "5",
|
canonicalAlias: nil,
|
||||||
isInvite: false,
|
hasOngoingCall: false,
|
||||||
inviter: nil,
|
isMarkedUnread: false,
|
||||||
name: "Foundation and Earth",
|
isFavourite: false),
|
||||||
isDirect: true,
|
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||||
avatarURL: nil,
|
id: "5",
|
||||||
heroes: [],
|
isInvite: false,
|
||||||
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"),
|
inviter: nil,
|
||||||
lastMessageFormattedTimestamp: "1986",
|
name: "Foundation and Earth",
|
||||||
unreadMessagesCount: 1,
|
isDirect: true,
|
||||||
unreadMentionsCount: 1,
|
avatarURL: nil,
|
||||||
unreadNotificationsCount: 1,
|
heroes: [],
|
||||||
notificationMode: .allMessages,
|
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"),
|
||||||
canonicalAlias: nil,
|
lastMessageFormattedTimestamp: "1986",
|
||||||
hasOngoingCall: true,
|
unreadMessagesCount: 1,
|
||||||
isMarkedUnread: false,
|
unreadMentionsCount: 1,
|
||||||
isFavourite: false)),
|
unreadNotificationsCount: 1,
|
||||||
.filled(details: RoomSummaryDetails(id: "6",
|
notificationMode: .allMessages,
|
||||||
isInvite: false,
|
canonicalAlias: nil,
|
||||||
inviter: nil,
|
hasOngoingCall: true,
|
||||||
name: "Prelude to Foundation",
|
isMarkedUnread: false,
|
||||||
isDirect: true,
|
isFavourite: false),
|
||||||
avatarURL: nil,
|
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||||
heroes: [],
|
id: "6",
|
||||||
lastMessage: AttributedString("Are you groping for the word 'paranoia'?"),
|
isInvite: false,
|
||||||
lastMessageFormattedTimestamp: "きょうはじゅういちがつじゅういちにちです",
|
inviter: nil,
|
||||||
unreadMessagesCount: 6,
|
name: "Prelude to Foundation",
|
||||||
unreadMentionsCount: 0,
|
isDirect: true,
|
||||||
unreadNotificationsCount: 0,
|
avatarURL: nil,
|
||||||
notificationMode: .mute,
|
heroes: [],
|
||||||
canonicalAlias: nil,
|
lastMessage: AttributedString("Are you groping for the word 'paranoia'?"),
|
||||||
hasOngoingCall: true,
|
lastMessageFormattedTimestamp: "きょうはじゅういちがつじゅういちにちです",
|
||||||
isMarkedUnread: false,
|
unreadMessagesCount: 6,
|
||||||
isFavourite: false)),
|
unreadMentionsCount: 0,
|
||||||
.filled(details: RoomSummaryDetails(id: "0",
|
unreadNotificationsCount: 0,
|
||||||
isInvite: false,
|
notificationMode: .mute,
|
||||||
inviter: nil,
|
canonicalAlias: nil,
|
||||||
name: "Unknown",
|
hasOngoingCall: true,
|
||||||
isDirect: false,
|
isMarkedUnread: false,
|
||||||
avatarURL: nil,
|
isFavourite: false),
|
||||||
heroes: [],
|
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||||
lastMessage: nil,
|
id: "0",
|
||||||
lastMessageFormattedTimestamp: nil,
|
isInvite: false,
|
||||||
unreadMessagesCount: 0,
|
inviter: nil,
|
||||||
unreadMentionsCount: 0,
|
name: "Unknown",
|
||||||
unreadNotificationsCount: 0,
|
isDirect: false,
|
||||||
notificationMode: nil,
|
avatarURL: nil,
|
||||||
canonicalAlias: nil,
|
heroes: [],
|
||||||
hasOngoingCall: false,
|
lastMessage: nil,
|
||||||
isMarkedUnread: false,
|
lastMessageFormattedTimestamp: nil,
|
||||||
isFavourite: false)),
|
unreadMessagesCount: 0,
|
||||||
.empty
|
unreadMentionsCount: 0,
|
||||||
|
unreadNotificationsCount: 0,
|
||||||
|
notificationMode: nil,
|
||||||
|
canonicalAlias: nil,
|
||||||
|
hasOngoingCall: false,
|
||||||
|
isMarkedUnread: false,
|
||||||
|
isFavourite: false)
|
||||||
]
|
]
|
||||||
|
|
||||||
static let mockRoomsWithNotificationsState: [Element] = {
|
static let mockRoomsWithNotificationsState: [Element] = {
|
||||||
@@ -213,56 +219,59 @@ extension Array where Element == RoomSummary {
|
|||||||
for hasUnreadNotifications in [false, true] {
|
for hasUnreadNotifications in [false, true] {
|
||||||
// Incrementing id value for each combination
|
// Incrementing id value for each combination
|
||||||
let id = result.count + 1
|
let id = result.count + 1
|
||||||
|
|
||||||
let room = RoomSummary.filled(details: RoomSummaryDetails(id: "\(id)",
|
let room = RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||||
settingsMode: mode,
|
id: "\(id)",
|
||||||
hasUnreadMessages: hasUnreadMessages,
|
settingsMode: mode,
|
||||||
hasUnreadMentions: hasUnreadMentions,
|
hasUnreadMessages: hasUnreadMessages,
|
||||||
hasUnreadNotifications: hasUnreadNotifications))
|
hasUnreadMentions: hasUnreadMentions,
|
||||||
|
hasUnreadNotifications: hasUnreadNotifications)
|
||||||
|
|
||||||
result.append(room)
|
result.append(room)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}()
|
}()
|
||||||
|
|
||||||
static let mockInvites: [Element] = [
|
static let mockInvites: [Element] = [
|
||||||
.filled(details: RoomSummaryDetails(id: "someAwesomeRoomId1",
|
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||||
isInvite: false,
|
id: "someAwesomeRoomId1",
|
||||||
inviter: RoomMemberProxyMock.mockCharlie,
|
isInvite: false,
|
||||||
name: "First room",
|
inviter: RoomMemberProxyMock.mockCharlie,
|
||||||
isDirect: false,
|
name: "First room",
|
||||||
avatarURL: URL.picturesDirectory,
|
isDirect: false,
|
||||||
heroes: [],
|
avatarURL: URL.picturesDirectory,
|
||||||
lastMessage: nil,
|
heroes: [],
|
||||||
lastMessageFormattedTimestamp: nil,
|
lastMessage: nil,
|
||||||
unreadMessagesCount: 0,
|
lastMessageFormattedTimestamp: nil,
|
||||||
unreadMentionsCount: 0,
|
unreadMessagesCount: 0,
|
||||||
unreadNotificationsCount: 0,
|
unreadMentionsCount: 0,
|
||||||
notificationMode: nil,
|
unreadNotificationsCount: 0,
|
||||||
canonicalAlias: "#footest:somewhere.org",
|
notificationMode: nil,
|
||||||
hasOngoingCall: false,
|
canonicalAlias: "#footest:somewhere.org",
|
||||||
isMarkedUnread: false,
|
hasOngoingCall: false,
|
||||||
isFavourite: false)),
|
isMarkedUnread: false,
|
||||||
.filled(details: RoomSummaryDetails(id: "someAwesomeRoomId2",
|
isFavourite: false),
|
||||||
isInvite: false,
|
RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||||
inviter: RoomMemberProxyMock.mockCharlie,
|
id: "someAwesomeRoomId2",
|
||||||
name: "Second room",
|
isInvite: false,
|
||||||
isDirect: true,
|
inviter: RoomMemberProxyMock.mockCharlie,
|
||||||
avatarURL: nil,
|
name: "Second room",
|
||||||
heroes: [],
|
isDirect: true,
|
||||||
lastMessage: nil,
|
avatarURL: nil,
|
||||||
lastMessageFormattedTimestamp: nil,
|
heroes: [],
|
||||||
unreadMessagesCount: 0,
|
lastMessage: nil,
|
||||||
unreadMentionsCount: 0,
|
lastMessageFormattedTimestamp: nil,
|
||||||
unreadNotificationsCount: 0,
|
unreadMessagesCount: 0,
|
||||||
notificationMode: nil,
|
unreadMentionsCount: 0,
|
||||||
canonicalAlias: nil,
|
unreadNotificationsCount: 0,
|
||||||
hasOngoingCall: false,
|
notificationMode: nil,
|
||||||
isMarkedUnread: false,
|
canonicalAlias: nil,
|
||||||
isFavourite: false))
|
hasOngoingCall: false,
|
||||||
|
isMarkedUnread: false,
|
||||||
|
isFavourite: false)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,15 +74,10 @@ class GlobalSearchScreenViewModel: GlobalSearchScreenViewModelType, GlobalSearch
|
|||||||
|
|
||||||
private func updateRooms(with summaries: [RoomSummary]) {
|
private func updateRooms(with summaries: [RoomSummary]) {
|
||||||
state.rooms = summaries.compactMap { summary in
|
state.rooms = summaries.compactMap { summary in
|
||||||
switch summary {
|
GlobalSearchRoom(id: summary.id,
|
||||||
case .empty:
|
name: summary.name,
|
||||||
return nil
|
alias: summary.canonicalAlias,
|
||||||
case .invalidated(let details), .filled(let details):
|
avatar: summary.avatar)
|
||||||
return GlobalSearchRoom(id: details.id,
|
|
||||||
name: details.name,
|
|
||||||
alias: details.canonicalAlias,
|
|
||||||
avatar: details.avatar)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,8 +152,7 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
|||||||
|
|
||||||
static let placeholderLastMessage = AttributedString("Hidden last message")
|
static let placeholderLastMessage = AttributedString("Hidden last message")
|
||||||
|
|
||||||
/// The list item identifier can be a real room identifier, a custom one for invalidated entries
|
/// The list item identifier is it's room identifier.
|
||||||
/// or a completely unique one for empty items and skeletons
|
|
||||||
let id: String
|
let id: String
|
||||||
|
|
||||||
/// The real room identifier this item points to
|
/// The real room identifier this item points to
|
||||||
@@ -205,39 +204,39 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension HomeScreenRoom {
|
extension HomeScreenRoom {
|
||||||
init(details: RoomSummaryDetails, invalidated: Bool, hideUnreadMessagesBadge: Bool) {
|
init(summary: RoomSummary, hideUnreadMessagesBadge: Bool) {
|
||||||
let identifier = invalidated ? "invalidated-" + details.id : details.id
|
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 isDotShown = hasUnreadMessages || summary.hasUnreadMentions || summary.hasUnreadNotifications || summary.isMarkedUnread
|
||||||
let isMentionShown = details.hasUnreadMentions && !details.isMuted
|
let isMentionShown = summary.hasUnreadMentions && !summary.isMuted
|
||||||
let isMuteShown = details.isMuted
|
let isMuteShown = summary.isMuted
|
||||||
let isCallShown = details.hasOngoingCall
|
let isCallShown = summary.hasOngoingCall
|
||||||
let isHighlighted = details.isMarkedUnread || (!details.isMuted && (details.hasUnreadNotifications || details.hasUnreadMentions))
|
let isHighlighted = summary.isMarkedUnread || (!summary.isMuted && (summary.hasUnreadNotifications || summary.hasUnreadMentions))
|
||||||
|
|
||||||
var inviter: InviterDetails?
|
var inviter: InviterDetails?
|
||||||
if let roomMemberProxy = details.inviter {
|
if let roomMemberProxy = summary.inviter {
|
||||||
inviter = .init(userID: roomMemberProxy.userID,
|
inviter = .init(userID: roomMemberProxy.userID,
|
||||||
displayName: roomMemberProxy.displayName,
|
displayName: roomMemberProxy.displayName,
|
||||||
avatarURL: roomMemberProxy.avatarURL)
|
avatarURL: roomMemberProxy.avatarURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.init(id: identifier,
|
self.init(id: identifier,
|
||||||
roomID: details.id,
|
roomID: summary.id,
|
||||||
type: details.isInvite ? .invite : .room,
|
type: summary.isInvite ? .invite : .room,
|
||||||
badges: .init(isDotShown: isDotShown,
|
badges: .init(isDotShown: isDotShown,
|
||||||
isMentionShown: isMentionShown,
|
isMentionShown: isMentionShown,
|
||||||
isMuteShown: isMuteShown,
|
isMuteShown: isMuteShown,
|
||||||
isCallShown: isCallShown),
|
isCallShown: isCallShown),
|
||||||
name: details.name,
|
name: summary.name,
|
||||||
isDirect: details.isDirect,
|
isDirect: summary.isDirect,
|
||||||
isHighlighted: isHighlighted,
|
isHighlighted: isHighlighted,
|
||||||
isFavourite: details.isFavourite,
|
isFavourite: summary.isFavourite,
|
||||||
timestamp: details.lastMessageFormattedTimestamp,
|
timestamp: summary.lastMessageFormattedTimestamp,
|
||||||
lastMessage: details.lastMessage,
|
lastMessage: summary.lastMessage,
|
||||||
avatar: details.avatar,
|
avatar: summary.avatar,
|
||||||
inviter: inviter,
|
inviter: inviter,
|
||||||
canonicalAlias: details.canonicalAlias)
|
canonicalAlias: summary.canonicalAlias)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,16 +348,8 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
|||||||
var rooms = [HomeScreenRoom]()
|
var rooms = [HomeScreenRoom]()
|
||||||
|
|
||||||
for summary in roomSummaryProvider.roomListPublisher.value {
|
for summary in roomSummaryProvider.roomListPublisher.value {
|
||||||
switch summary {
|
let room = HomeScreenRoom(summary: summary, hideUnreadMessagesBadge: appSettings.hideUnreadMessagesBadge)
|
||||||
case .empty:
|
rooms.append(room)
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state.rooms = rooms
|
state.rooms = rooms
|
||||||
|
|||||||
@@ -207,25 +207,26 @@ private extension HomeScreenRoom {
|
|||||||
inviter.displayName = "Jack"
|
inviter.displayName = "Jack"
|
||||||
inviter.userID = "@jack:somewhere.com"
|
inviter.userID = "@jack:somewhere.com"
|
||||||
|
|
||||||
let details = RoomSummaryDetails(id: "@someone:somewhere.com",
|
let summary = RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||||
isInvite: false,
|
id: "@someone:somewhere.com",
|
||||||
inviter: inviter,
|
isInvite: false,
|
||||||
name: "Some Guy",
|
inviter: inviter,
|
||||||
isDirect: true,
|
name: "Some Guy",
|
||||||
avatarURL: nil,
|
isDirect: true,
|
||||||
heroes: [.init(userID: "@someone:somewhere.com")],
|
avatarURL: nil,
|
||||||
lastMessage: nil,
|
heroes: [.init(userID: "@someone:somewhere.com")],
|
||||||
lastMessageFormattedTimestamp: nil,
|
lastMessage: nil,
|
||||||
unreadMessagesCount: 0,
|
lastMessageFormattedTimestamp: nil,
|
||||||
unreadMentionsCount: 0,
|
unreadMessagesCount: 0,
|
||||||
unreadNotificationsCount: 0,
|
unreadMentionsCount: 0,
|
||||||
notificationMode: nil,
|
unreadNotificationsCount: 0,
|
||||||
canonicalAlias: "#footest:somewhere.org",
|
notificationMode: nil,
|
||||||
hasOngoingCall: false,
|
canonicalAlias: "#footest:somewhere.org",
|
||||||
isMarkedUnread: false,
|
hasOngoingCall: false,
|
||||||
isFavourite: 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 {
|
static func roomInvite(alias: String? = nil, avatarURL: URL? = nil) -> HomeScreenRoom {
|
||||||
@@ -234,24 +235,25 @@ private extension HomeScreenRoom {
|
|||||||
inviter.userID = "@jack:somewhi.nl"
|
inviter.userID = "@jack:somewhi.nl"
|
||||||
inviter.avatarURL = avatarURL
|
inviter.avatarURL = avatarURL
|
||||||
|
|
||||||
let details = RoomSummaryDetails(id: "@someone:somewhere.com",
|
let summary = RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||||
isInvite: false,
|
id: "@someone:somewhere.com",
|
||||||
inviter: inviter,
|
isInvite: false,
|
||||||
name: "Awesome Room",
|
inviter: inviter,
|
||||||
isDirect: false,
|
name: "Awesome Room",
|
||||||
avatarURL: avatarURL,
|
isDirect: false,
|
||||||
heroes: [.init(userID: "@someone:somewhere.com")],
|
avatarURL: avatarURL,
|
||||||
lastMessage: nil,
|
heroes: [.init(userID: "@someone:somewhere.com")],
|
||||||
lastMessageFormattedTimestamp: nil,
|
lastMessage: nil,
|
||||||
unreadMessagesCount: 0,
|
lastMessageFormattedTimestamp: nil,
|
||||||
unreadMentionsCount: 0,
|
unreadMessagesCount: 0,
|
||||||
unreadNotificationsCount: 0,
|
unreadMentionsCount: 0,
|
||||||
notificationMode: nil,
|
unreadNotificationsCount: 0,
|
||||||
canonicalAlias: alias,
|
notificationMode: nil,
|
||||||
hasOngoingCall: false,
|
canonicalAlias: alias,
|
||||||
isMarkedUnread: false,
|
hasOngoingCall: false,
|
||||||
isFavourite: 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? {
|
static func mockRoom(summary: RoomSummary) -> HomeScreenRoom? {
|
||||||
switch summary {
|
HomeScreenRoom(summary: summary, hideUnreadMessagesBadge: false)
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
|
|||||||
+5
-10
@@ -84,19 +84,14 @@ class MessageForwardingScreenViewModel: MessageForwardingScreenViewModelType, Me
|
|||||||
MXLog.verbose("Updating rooms")
|
MXLog.verbose("Updating rooms")
|
||||||
|
|
||||||
var rooms = [MessageForwardingRoom]()
|
var rooms = [MessageForwardingRoom]()
|
||||||
|
|
||||||
for summary in roomSummaryProvider.roomListPublisher.value {
|
for summary in roomSummaryProvider.roomListPublisher.value {
|
||||||
switch summary {
|
if summary.id == forwardingItem.roomID {
|
||||||
case .empty, .invalidated:
|
|
||||||
continue
|
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
|
state.rooms = rooms
|
||||||
|
|||||||
+14
-20
@@ -138,21 +138,15 @@ class NotificationSettingsEditScreenViewModel: NotificationSettingsEditScreenVie
|
|||||||
var roomsWithUserDefinedMode: [NotificationSettingsEditScreenRoom] = []
|
var roomsWithUserDefinedMode: [NotificationSettingsEditScreenRoom] = []
|
||||||
|
|
||||||
for roomSummary in filteredRoomsSummary {
|
for roomSummary in filteredRoomsSummary {
|
||||||
switch roomSummary {
|
guard let roomProxy = await userSession.clientProxy.roomForIdentifier(roomSummary.id) else { continue }
|
||||||
case .empty, .invalidated:
|
// `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
|
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 {
|
private func buildRoom(with summary: RoomSummary) async -> NotificationSettingsEditScreenRoom {
|
||||||
let notificationMode = try? await notificationSettingsProxy.getUserDefinedRoomNotificationMode(roomId: details.id)
|
let notificationMode = try? await notificationSettingsProxy.getUserDefinedRoomNotificationMode(roomId: summary.id)
|
||||||
return NotificationSettingsEditScreenRoom(id: details.id,
|
return NotificationSettingsEditScreenRoom(id: summary.id,
|
||||||
roomId: details.id,
|
roomId: summary.id,
|
||||||
name: details.name,
|
name: summary.name,
|
||||||
avatar: details.avatar,
|
avatar: summary.avatar,
|
||||||
notificationMode: notificationMode)
|
notificationMode: notificationMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -72,7 +72,7 @@ struct NotificationSettingsEditScreen_Previews: PreviewProvider, TestablePreview
|
|||||||
let notificationSettingsProxy = NotificationSettingsProxyMock(with: .init())
|
let notificationSettingsProxy = NotificationSettingsProxyMock(with: .init())
|
||||||
notificationSettingsProxy.getDefaultRoomNotificationModeIsEncryptedIsOneToOneReturnValue = .allMessages
|
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",
|
let userSession = UserSessionMock(.init(clientProxy: ClientProxyMock(.init(userID: "@alice:example.com",
|
||||||
roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))))
|
roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))))
|
||||||
var viewModel = NotificationSettingsEditScreenViewModel(chatType: .groupChat,
|
var viewModel = NotificationSettingsEditScreenViewModel(chatType: .groupChat,
|
||||||
@@ -113,7 +113,7 @@ struct NotificationSettingsEditScreen_Previews: PreviewProvider, TestablePreview
|
|||||||
let notificationSettingsProxy = NotificationSettingsProxyMock(with: .init(canPushEncryptedEvents: true))
|
let notificationSettingsProxy = NotificationSettingsProxyMock(with: .init(canPushEncryptedEvents: true))
|
||||||
notificationSettingsProxy.getDefaultRoomNotificationModeIsEncryptedIsOneToOneReturnValue = .allMessages
|
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",
|
let userSession = UserSessionMock(.init(clientProxy: ClientProxyMock(.init(userID: "@alice:example.com",
|
||||||
roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))))
|
roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))))
|
||||||
var viewModel = NotificationSettingsEditScreenViewModel(chatType: .groupChat,
|
var viewModel = NotificationSettingsEditScreenViewModel(chatType: .groupChat,
|
||||||
|
|||||||
+5
-10
@@ -68,17 +68,12 @@ struct NotificationSettingsEditScreenRoomCell_Previews: PreviewProvider, Testabl
|
|||||||
notificationSettingsProxy: notificationSettingsProxy)
|
notificationSettingsProxy: notificationSettingsProxy)
|
||||||
|
|
||||||
let rooms: [NotificationSettingsEditScreenRoom] = summaryProvider.roomListPublisher.value.compactMap { summary -> NotificationSettingsEditScreenRoom? in
|
let rooms: [NotificationSettingsEditScreenRoom] = summaryProvider.roomListPublisher.value.compactMap { summary -> NotificationSettingsEditScreenRoom? in
|
||||||
switch summary {
|
NotificationSettingsEditScreenRoom(id: UUID().uuidString,
|
||||||
case .empty, .invalidated:
|
roomId: summary.id,
|
||||||
return nil
|
name: summary.name,
|
||||||
case .filled(let details):
|
avatar: summary.avatar)
|
||||||
return NotificationSettingsEditScreenRoom(id: UUID().uuidString,
|
|
||||||
roomId: details.id,
|
|
||||||
name: details.name,
|
|
||||||
avatar: details.avatar)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return VStack(spacing: 0) {
|
return VStack(spacing: 0) {
|
||||||
ForEach(rooms) { room in
|
ForEach(rooms) { room in
|
||||||
NotificationSettingsEditScreenRoomCell(room: room, context: viewModel.context)
|
NotificationSettingsEditScreenRoomCell(room: room, context: viewModel.context)
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ enum ClientProxyError: Error {
|
|||||||
|
|
||||||
enum SlidingSyncConstants {
|
enum SlidingSyncConstants {
|
||||||
static let defaultTimelineLimit: UInt = 20
|
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
|
/// This struct represents the configuration that we are using to register the application through Pusher to Sygnal
|
||||||
|
|||||||
+8
-5
@@ -17,7 +17,9 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import MatrixRustSDK
|
import MatrixRustSDK
|
||||||
|
|
||||||
struct RoomSummaryDetails {
|
struct RoomSummary {
|
||||||
|
let roomListItem: RoomListItem
|
||||||
|
|
||||||
let id: String
|
let id: String
|
||||||
|
|
||||||
let isInvite: Bool
|
let isInvite: Bool
|
||||||
@@ -46,9 +48,9 @@ struct RoomSummaryDetails {
|
|||||||
var isMuted: Bool { notificationMode == .mute }
|
var isMuted: Bool { notificationMode == .mute }
|
||||||
}
|
}
|
||||||
|
|
||||||
extension RoomSummaryDetails: CustomStringConvertible {
|
extension RoomSummary: CustomStringConvertible {
|
||||||
var description: String { """
|
var description: String { """
|
||||||
RoomSummaryDetails: - id: \(id) \
|
RoomSummary: - id: \(id) \
|
||||||
- isDirect: \(isDirect) \
|
- isDirect: \(isDirect) \
|
||||||
- unreadMessagesCount: \(unreadMessagesCount) \
|
- unreadMessagesCount: \(unreadMessagesCount) \
|
||||||
- unreadMentionsCount: \(unreadMentionsCount) \
|
- unreadMentionsCount: \(unreadMentionsCount) \
|
||||||
@@ -58,8 +60,9 @@ extension RoomSummaryDetails: CustomStringConvertible {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension RoomSummaryDetails {
|
extension RoomSummary {
|
||||||
init(id: String, settingsMode: RoomNotificationModeProxy, hasUnreadMessages: Bool, hasUnreadMentions: Bool, hasUnreadNotifications: Bool) {
|
init(roomListItem: RoomListItem, id: String, settingsMode: RoomNotificationModeProxy, hasUnreadMessages: Bool, hasUnreadMentions: Bool, hasUnreadNotifications: Bool) {
|
||||||
|
self.roomListItem = roomListItem
|
||||||
self.id = id
|
self.id = id
|
||||||
let string = "\(settingsMode) - messages: \(hasUnreadMessages) - mentions: \(hasUnreadMentions) - notifications: \(hasUnreadNotifications)"
|
let string = "\(settingsMode) - messages: \(hasUnreadMessages) - mentions: \(hasUnreadMentions) - notifications: \(hasUnreadNotifications)"
|
||||||
name = string
|
name = string
|
||||||
@@ -35,7 +35,6 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
|
|
||||||
private var cancellables = Set<AnyCancellable>()
|
private var cancellables = Set<AnyCancellable>()
|
||||||
private var listUpdatesSubscriptionResult: RoomListEntriesWithDynamicAdaptersResult?
|
private var listUpdatesSubscriptionResult: RoomListEntriesWithDynamicAdaptersResult?
|
||||||
private var listUpdatesTaskHandle: TaskHandle?
|
|
||||||
private var stateUpdatesTaskHandle: TaskHandle?
|
private var stateUpdatesTaskHandle: TaskHandle?
|
||||||
|
|
||||||
private let roomListSubject = CurrentValueSubject<[RoomSummary], Never>([])
|
private let roomListSubject = CurrentValueSubject<[RoomSummary], Never>([])
|
||||||
@@ -85,7 +84,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setRoomList(_ roomList: RoomList) {
|
func setRoomList(_ roomList: RoomList) {
|
||||||
guard listUpdatesTaskHandle == nil, stateUpdatesTaskHandle == nil else {
|
guard stateUpdatesTaskHandle == nil else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,8 +100,6 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
// Forces the listener above to be called with the current state
|
// Forces the listener above to be called with the current state
|
||||||
setFilter(.all(filters: []))
|
setFilter(.all(filters: []))
|
||||||
|
|
||||||
listUpdatesTaskHandle = listUpdatesSubscriptionResult?.entriesStream
|
|
||||||
|
|
||||||
let stateUpdatesSubscriptionResult = try roomList.loadingState(listener: RoomListStateObserver { [weak self] state in
|
let stateUpdatesSubscriptionResult = try roomList.loadingState(listener: RoomListStateObserver { [weak self] state in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
MXLog.info("\(name): Received state update: \(state)")
|
MXLog.info("\(name): Received state update: \(state)")
|
||||||
@@ -119,48 +116,31 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
|
|
||||||
func updateVisibleRange(_ range: Range<Int>) {
|
func updateVisibleRange(_ range: Range<Int>) {
|
||||||
if range.upperBound >= rooms.count {
|
if range.upperBound >= rooms.count {
|
||||||
listUpdatesSubscriptionResult?.controller.addOnePage()
|
listUpdatesSubscriptionResult?.controller().addOnePage()
|
||||||
} else if range.lowerBound == 0 {
|
} else if range.lowerBound == 0 {
|
||||||
listUpdatesSubscriptionResult?.controller.resetToOnePage()
|
listUpdatesSubscriptionResult?.controller().resetToOnePage()
|
||||||
}
|
}
|
||||||
|
|
||||||
guard shouldUpdateVisibleRange else {
|
guard shouldUpdateVisibleRange else {
|
||||||
return
|
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) {
|
func setFilter(_ filter: RoomSummaryProviderFilter) {
|
||||||
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: [RoomListEntriesDynamicFilterKind] = if appSettings.fuzzyRoomListSearchEnabled {
|
||||||
[.fuzzyMatchRoomName(pattern: query), .nonLeft]
|
[.fuzzyMatchRoomName(pattern: query), .nonLeft]
|
||||||
} else {
|
} else {
|
||||||
[.normalizedMatchRoomName(pattern: query), .nonLeft]
|
[.normalizedMatchRoomName(pattern: query), .nonLeft]
|
||||||
}
|
}
|
||||||
_ = listUpdatesSubscriptionResult?.controller.setFilter(kind: .all(filters: filters))
|
_ = listUpdatesSubscriptionResult?.controller().setFilter(kind: .all(filters: filters))
|
||||||
case let .all(filters):
|
case let .all(filters):
|
||||||
var filters = filters.map(\.rustFilter)
|
var filters = filters.map(\.rustFilter)
|
||||||
filters.append(.nonLeft)
|
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.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
|
rooms = diffs.reduce(rooms) { currentItems, diff in
|
||||||
processDiff(diff, on: currentItems)
|
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")
|
MXLog.info("Finished processing room list diffs")
|
||||||
}
|
}
|
||||||
@@ -200,18 +180,17 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
return updatedItems
|
return updatedItems
|
||||||
}
|
}
|
||||||
|
|
||||||
private func fetchRoomDetails(roomID: String) -> (roomInfo: RoomInfo?, latestEvent: EventTimelineItem?) {
|
private func fetchRoomDetails(from roomListItem: RoomListItem) -> (roomInfo: RoomInfo?, latestEvent: EventTimelineItem?) {
|
||||||
class FetchResult {
|
class FetchResult {
|
||||||
var roomInfo: RoomInfo?
|
var roomInfo: RoomInfo?
|
||||||
var latestEvent: EventTimelineItem?
|
var latestEvent: EventTimelineItem?
|
||||||
}
|
}
|
||||||
|
|
||||||
let semaphore = DispatchSemaphore(value: 0)
|
let semaphore = DispatchSemaphore(value: 0)
|
||||||
let result = FetchResult()
|
let result = FetchResult()
|
||||||
|
|
||||||
Task {
|
Task {
|
||||||
do {
|
do {
|
||||||
let roomListItem = try roomListService.room(roomId: roomID)
|
|
||||||
result.latestEvent = await roomListItem.latestEvent()
|
result.latestEvent = await roomListItem.latestEvent()
|
||||||
result.roomInfo = try await roomListItem.roomInfo()
|
result.roomInfo = try await roomListItem.roomInfo()
|
||||||
} catch {
|
} catch {
|
||||||
@@ -222,12 +201,12 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
semaphore.wait()
|
semaphore.wait()
|
||||||
return (result.roomInfo, result.latestEvent)
|
return (result.roomInfo, result.latestEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func buildRoomSummaryForIdentifier(_ identifier: String, invalidated: Bool) -> RoomSummary {
|
private func buildRoomSummary(from roomListItem: RoomListItem) -> RoomSummary {
|
||||||
let roomDetails = fetchRoomDetails(roomID: identifier)
|
let roomDetails = fetchRoomDetails(from: roomListItem)
|
||||||
|
|
||||||
guard let roomInfo = roomDetails.roomInfo else {
|
guard let roomInfo = roomDetails.roomInfo else {
|
||||||
return .empty
|
fatalError("Missing room info for \(roomListItem.id())")
|
||||||
}
|
}
|
||||||
|
|
||||||
var attributedLastMessage: AttributedString?
|
var attributedLastMessage: AttributedString?
|
||||||
@@ -246,47 +225,24 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
|
|
||||||
let notificationMode = roomInfo.userDefinedNotificationMode.flatMap { RoomNotificationModeProxy.from(roomNotificationMode: $0) }
|
let notificationMode = roomInfo.userDefinedNotificationMode.flatMap { RoomNotificationModeProxy.from(roomNotificationMode: $0) }
|
||||||
|
|
||||||
let details = RoomSummaryDetails(id: roomInfo.id,
|
return RoomSummary(roomListItem: roomListItem,
|
||||||
isInvite: roomInfo.membership == .invited,
|
id: roomInfo.id,
|
||||||
inviter: inviterProxy,
|
isInvite: roomInfo.membership == .invited,
|
||||||
name: roomInfo.displayName ?? roomInfo.id,
|
inviter: inviterProxy,
|
||||||
isDirect: roomInfo.isDirect,
|
name: roomInfo.displayName ?? roomInfo.id,
|
||||||
avatarURL: roomInfo.avatarUrl.flatMap(URL.init(string:)),
|
isDirect: roomInfo.isDirect,
|
||||||
heroes: roomInfo.heroes.map(UserProfileProxy.init),
|
avatarURL: roomInfo.avatarUrl.flatMap(URL.init(string:)),
|
||||||
lastMessage: attributedLastMessage,
|
heroes: roomInfo.heroes.map(UserProfileProxy.init),
|
||||||
lastMessageFormattedTimestamp: lastMessageFormattedTimestamp,
|
lastMessage: attributedLastMessage,
|
||||||
unreadMessagesCount: UInt(roomInfo.numUnreadMessages),
|
lastMessageFormattedTimestamp: lastMessageFormattedTimestamp,
|
||||||
unreadMentionsCount: UInt(roomInfo.numUnreadMentions),
|
unreadMessagesCount: UInt(roomInfo.numUnreadMessages),
|
||||||
unreadNotificationsCount: UInt(roomInfo.numUnreadNotifications),
|
unreadMentionsCount: UInt(roomInfo.numUnreadMentions),
|
||||||
notificationMode: notificationMode,
|
unreadNotificationsCount: UInt(roomInfo.numUnreadNotifications),
|
||||||
canonicalAlias: roomInfo.canonicalAlias,
|
notificationMode: notificationMode,
|
||||||
hasOngoingCall: roomInfo.hasRoomCall,
|
canonicalAlias: roomInfo.canonicalAlias,
|
||||||
isMarkedUnread: roomInfo.isMarkedUnread,
|
hasOngoingCall: roomInfo.hasRoomCall,
|
||||||
isFavourite: roomInfo.isFavourite)
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func buildDiff(from diff: RoomListEntriesUpdate, on rooms: [RoomSummary]) -> CollectionDifference<RoomSummary>? {
|
private func buildDiff(from diff: RoomListEntriesUpdate, on rooms: [RoomSummary]) -> CollectionDifference<RoomSummary>? {
|
||||||
@@ -294,10 +250,10 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
|
|
||||||
switch diff {
|
switch diff {
|
||||||
case .append(let values):
|
case .append(let values):
|
||||||
let debugIdentifiers = values.map(\.debugIdentifier)
|
let debugIdentifiers = values.map { $0.id() }
|
||||||
MXLog.verbose("\(name): Append \(debugIdentifiers)")
|
MXLog.verbose("\(name): Append \(debugIdentifiers)")
|
||||||
for (index, value) in values.enumerated() {
|
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))
|
changes.append(.insert(offset: rooms.count + index, element: summary, associatedWith: nil))
|
||||||
}
|
}
|
||||||
case .clear:
|
case .clear:
|
||||||
@@ -306,8 +262,8 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
changes.append(.remove(offset: index, element: value, associatedWith: nil))
|
changes.append(.remove(offset: index, element: value, associatedWith: nil))
|
||||||
}
|
}
|
||||||
case .insert(let index, let value):
|
case .insert(let index, let value):
|
||||||
MXLog.verbose("\(name): Insert at \(value.debugIdentifier) at \(index)")
|
MXLog.verbose("\(name): Insert at \(value.id()) at \(index)")
|
||||||
let summary = buildSummaryForRoomListEntry(value)
|
let summary = buildRoomSummary(from: value)
|
||||||
changes.append(.insert(offset: Int(index), element: summary, associatedWith: nil))
|
changes.append(.insert(offset: Int(index), element: summary, associatedWith: nil))
|
||||||
case .popBack:
|
case .popBack:
|
||||||
MXLog.verbose("\(name): Pop Back")
|
MXLog.verbose("\(name): Pop Back")
|
||||||
@@ -321,30 +277,30 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
let summary = rooms[0]
|
let summary = rooms[0]
|
||||||
changes.append(.remove(offset: 0, element: summary, associatedWith: nil))
|
changes.append(.remove(offset: 0, element: summary, associatedWith: nil))
|
||||||
case .pushBack(let value):
|
case .pushBack(let value):
|
||||||
MXLog.verbose("\(name): Push Back \(value.debugIdentifier)")
|
MXLog.verbose("\(name): Push Back \(value.id())")
|
||||||
let summary = buildSummaryForRoomListEntry(value)
|
let summary = buildRoomSummary(from: value)
|
||||||
changes.append(.insert(offset: rooms.count, element: summary, associatedWith: nil))
|
changes.append(.insert(offset: rooms.count, element: summary, associatedWith: nil))
|
||||||
case .pushFront(let value):
|
case .pushFront(let value):
|
||||||
MXLog.verbose("\(name): Push Front \(value.debugIdentifier)")
|
MXLog.verbose("\(name): Push Front \(value.id())")
|
||||||
let summary = buildSummaryForRoomListEntry(value)
|
let summary = buildRoomSummary(from: value)
|
||||||
changes.append(.insert(offset: 0, element: summary, associatedWith: nil))
|
changes.append(.insert(offset: 0, element: summary, associatedWith: nil))
|
||||||
case .remove(let index):
|
case .remove(let index):
|
||||||
let summary = rooms[Int(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))
|
changes.append(.remove(offset: Int(index), element: summary, associatedWith: nil))
|
||||||
case .reset(let values):
|
case .reset(let values):
|
||||||
let debugIdentifiers = values.map(\.debugIdentifier)
|
let debugIdentifiers = values.map { $0.id() }
|
||||||
MXLog.verbose("\(name): Replace all items with \(debugIdentifiers)")
|
MXLog.verbose("\(name): Replace all items with \(debugIdentifiers)")
|
||||||
for (index, summary) in rooms.enumerated() {
|
for (index, summary) in rooms.enumerated() {
|
||||||
changes.append(.remove(offset: index, element: summary, associatedWith: nil))
|
changes.append(.remove(offset: index, element: summary, associatedWith: nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
for (index, value) in values.enumerated() {
|
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):
|
case .set(let index, let value):
|
||||||
MXLog.verbose("\(name): Update \(value.debugIdentifier) at \(index)")
|
MXLog.verbose("\(name): Update \(value.id()) at \(index)")
|
||||||
let summary = buildSummaryForRoomListEntry(value)
|
let summary = buildRoomSummary(from: value)
|
||||||
changes.append(.remove(offset: Int(index), element: summary, associatedWith: nil))
|
changes.append(.remove(offset: Int(index), element: summary, associatedWith: nil))
|
||||||
changes.append(.insert(offset: Int(index), element: summary, associatedWith: nil))
|
changes.append(.insert(offset: Int(index), element: summary, associatedWith: nil))
|
||||||
case .truncate(let length):
|
case .truncate(let length):
|
||||||
@@ -384,14 +340,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
MXLog.info("\(name): Rebuilding room summaries for \(rooms.count) rooms")
|
MXLog.info("\(name): Rebuilding room summaries for \(rooms.count) rooms")
|
||||||
|
|
||||||
rooms = rooms.map {
|
rooms = rooms.map {
|
||||||
switch $0 {
|
self.buildRoomSummary(from: $0.roomListItem)
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MXLog.info("\(name): Finished rebuilding room summaries (\(rooms.count) rooms)")
|
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 class RoomListEntriesListenerProxy: RoomListEntriesListener {
|
||||||
private let onUpdateClosure: ([RoomListEntriesUpdate]) -> Void
|
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 {
|
enum RoomSummaryProviderFilter: Equatable {
|
||||||
/// Filters out everything
|
/// Filters out everything
|
||||||
case excludeAll
|
case excludeAll
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:fa2a5bff526bc76d1e1d838668a456a4af77dd626f746fad991ad3eb86f76e14
|
oid sha256:37ab4eca1bd1041bbba509b7ba88da2e4ea06ae6007160753a32b818a53bf772
|
||||||
size 374036
|
size 371965
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:e41b327d5f9406d06df99b0be960d1025bc962ef6d9abaf06f0b6e5343ba00a0
|
oid sha256:9ff87cd68b4b8214c8442531122adb3e5f62d967e8ea6b86eb335b0116fcc7ab
|
||||||
size 387405
|
size 385334
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:010c0fa695f8b1df2a7f7ae77c92c4b2cf145c944bf1f77aeb29a7b93b233bd8
|
oid sha256:353c0d32738f7b82684f3bce03958fcf9a3840ca72a8bf06c96c971d8096614b
|
||||||
size 262649
|
size 262453
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:eb4c57fefc7d673a765594627994c0c5fd43cd150b3ffc62b3dfb1fbba708866
|
oid sha256:9a4db77dce8f643fcf2121a02058a5e35987a93c37edd6bb19b185b6f6314ffe
|
||||||
size 270419
|
size 270223
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import XCTest
|
|||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
class HomeScreenRoomTests: XCTestCase {
|
class HomeScreenRoomTests: XCTestCase {
|
||||||
var roomSummaryDetails: RoomSummaryDetails!
|
var roomSummary: RoomSummary!
|
||||||
|
|
||||||
// swiftlint:disable:next function_parameter_count
|
// swiftlint:disable:next function_parameter_count
|
||||||
func setupRoomSummary(isMarkedUnread: Bool,
|
func setupRoomSummary(isMarkedUnread: Bool,
|
||||||
@@ -30,23 +30,24 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
unreadNotificationsCount: UInt,
|
unreadNotificationsCount: UInt,
|
||||||
notificationMode: RoomNotificationModeProxy,
|
notificationMode: RoomNotificationModeProxy,
|
||||||
hasOngoingCall: Bool) {
|
hasOngoingCall: Bool) {
|
||||||
roomSummaryDetails = RoomSummaryDetails(id: "Test room",
|
roomSummary = RoomSummary(roomListItem: .init(noPointer: .init()),
|
||||||
isInvite: false,
|
id: "Test room",
|
||||||
inviter: nil,
|
isInvite: false,
|
||||||
name: "Test room",
|
inviter: nil,
|
||||||
isDirect: false,
|
name: "Test room",
|
||||||
avatarURL: nil,
|
isDirect: false,
|
||||||
heroes: [],
|
avatarURL: nil,
|
||||||
lastMessage: nil,
|
heroes: [],
|
||||||
lastMessageFormattedTimestamp: nil,
|
lastMessage: nil,
|
||||||
unreadMessagesCount: unreadMessagesCount,
|
lastMessageFormattedTimestamp: nil,
|
||||||
unreadMentionsCount: unreadMentionsCount,
|
unreadMessagesCount: unreadMessagesCount,
|
||||||
unreadNotificationsCount: unreadNotificationsCount,
|
unreadMentionsCount: unreadMentionsCount,
|
||||||
notificationMode: notificationMode,
|
unreadNotificationsCount: unreadNotificationsCount,
|
||||||
canonicalAlias: nil,
|
notificationMode: notificationMode,
|
||||||
hasOngoingCall: hasOngoingCall,
|
canonicalAlias: nil,
|
||||||
isMarkedUnread: isMarkedUnread,
|
hasOngoingCall: hasOngoingCall,
|
||||||
isFavourite: false)
|
isMarkedUnread: isMarkedUnread,
|
||||||
|
isFavourite: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testNoBadge() {
|
func testNoBadge() {
|
||||||
@@ -57,7 +58,7 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
notificationMode: .allMessages,
|
notificationMode: .allMessages,
|
||||||
hasOngoingCall: false)
|
hasOngoingCall: false)
|
||||||
|
|
||||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||||
|
|
||||||
XCTAssertFalse(room.isHighlighted)
|
XCTAssertFalse(room.isHighlighted)
|
||||||
XCTAssertFalse(room.badges.isDotShown)
|
XCTAssertFalse(room.badges.isDotShown)
|
||||||
@@ -74,7 +75,7 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
notificationMode: .allMessages,
|
notificationMode: .allMessages,
|
||||||
hasOngoingCall: true)
|
hasOngoingCall: true)
|
||||||
|
|
||||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||||
|
|
||||||
XCTAssertTrue(room.isHighlighted)
|
XCTAssertTrue(room.isHighlighted)
|
||||||
XCTAssertTrue(room.badges.isDotShown)
|
XCTAssertTrue(room.badges.isDotShown)
|
||||||
@@ -91,7 +92,7 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
notificationMode: .allMessages,
|
notificationMode: .allMessages,
|
||||||
hasOngoingCall: false)
|
hasOngoingCall: false)
|
||||||
|
|
||||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||||
|
|
||||||
XCTAssertFalse(room.isHighlighted)
|
XCTAssertFalse(room.isHighlighted)
|
||||||
XCTAssertTrue(room.badges.isDotShown)
|
XCTAssertTrue(room.badges.isDotShown)
|
||||||
@@ -108,7 +109,7 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
notificationMode: .allMessages,
|
notificationMode: .allMessages,
|
||||||
hasOngoingCall: false)
|
hasOngoingCall: false)
|
||||||
|
|
||||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||||
|
|
||||||
XCTAssertTrue(room.isHighlighted)
|
XCTAssertTrue(room.isHighlighted)
|
||||||
XCTAssertTrue(room.badges.isDotShown)
|
XCTAssertTrue(room.badges.isDotShown)
|
||||||
@@ -125,7 +126,7 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
notificationMode: .allMessages,
|
notificationMode: .allMessages,
|
||||||
hasOngoingCall: false)
|
hasOngoingCall: false)
|
||||||
|
|
||||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||||
|
|
||||||
XCTAssertTrue(room.isHighlighted)
|
XCTAssertTrue(room.isHighlighted)
|
||||||
XCTAssertTrue(room.badges.isDotShown)
|
XCTAssertTrue(room.badges.isDotShown)
|
||||||
@@ -142,7 +143,7 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
notificationMode: .allMessages,
|
notificationMode: .allMessages,
|
||||||
hasOngoingCall: true)
|
hasOngoingCall: true)
|
||||||
|
|
||||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||||
|
|
||||||
XCTAssertFalse(room.isHighlighted)
|
XCTAssertFalse(room.isHighlighted)
|
||||||
XCTAssertFalse(room.badges.isDotShown)
|
XCTAssertFalse(room.badges.isDotShown)
|
||||||
@@ -159,7 +160,7 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
notificationMode: .mentionsAndKeywordsOnly,
|
notificationMode: .mentionsAndKeywordsOnly,
|
||||||
hasOngoingCall: false)
|
hasOngoingCall: false)
|
||||||
|
|
||||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||||
|
|
||||||
XCTAssertFalse(room.isHighlighted)
|
XCTAssertFalse(room.isHighlighted)
|
||||||
XCTAssertTrue(room.badges.isDotShown)
|
XCTAssertTrue(room.badges.isDotShown)
|
||||||
@@ -176,7 +177,7 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
notificationMode: .mentionsAndKeywordsOnly,
|
notificationMode: .mentionsAndKeywordsOnly,
|
||||||
hasOngoingCall: false)
|
hasOngoingCall: false)
|
||||||
|
|
||||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: true)
|
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: true)
|
||||||
|
|
||||||
XCTAssertFalse(room.isHighlighted)
|
XCTAssertFalse(room.isHighlighted)
|
||||||
XCTAssertFalse(room.badges.isDotShown)
|
XCTAssertFalse(room.badges.isDotShown)
|
||||||
@@ -195,7 +196,7 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
notificationMode: .allMessages,
|
notificationMode: .allMessages,
|
||||||
hasOngoingCall: false)
|
hasOngoingCall: false)
|
||||||
|
|
||||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||||
|
|
||||||
XCTAssertTrue(room.isHighlighted)
|
XCTAssertTrue(room.isHighlighted)
|
||||||
XCTAssertTrue(room.badges.isDotShown)
|
XCTAssertTrue(room.badges.isDotShown)
|
||||||
@@ -212,7 +213,7 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
notificationMode: .allMessages,
|
notificationMode: .allMessages,
|
||||||
hasOngoingCall: false)
|
hasOngoingCall: false)
|
||||||
|
|
||||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||||
|
|
||||||
XCTAssertTrue(room.isHighlighted)
|
XCTAssertTrue(room.isHighlighted)
|
||||||
XCTAssertTrue(room.badges.isDotShown)
|
XCTAssertTrue(room.badges.isDotShown)
|
||||||
@@ -229,7 +230,7 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
notificationMode: .mute,
|
notificationMode: .mute,
|
||||||
hasOngoingCall: true)
|
hasOngoingCall: true)
|
||||||
|
|
||||||
let room = HomeScreenRoom(details: roomSummaryDetails, invalidated: false, hideUnreadMessagesBadge: false)
|
let room = HomeScreenRoom(summary: roomSummary, hideUnreadMessagesBadge: false)
|
||||||
|
|
||||||
XCTAssertTrue(room.isHighlighted)
|
XCTAssertTrue(room.isHighlighted)
|
||||||
XCTAssertTrue(room.badges.isDotShown)
|
XCTAssertTrue(room.badges.isDotShown)
|
||||||
|
|||||||
@@ -81,29 +81,30 @@ class LoggingTests: XCTestCase {
|
|||||||
|
|
||||||
XCTAssertTrue(logFile.lastPathComponent.contains(target))
|
XCTAssertTrue(logFile.lastPathComponent.contains(target))
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateRoomSummaryContentIsRedacted() throws {
|
func validateRoomSummaryContentIsRedacted() throws {
|
||||||
// Given a room summary that contains sensitive information
|
// Given a room summary that contains sensitive information
|
||||||
let roomName = "Private Conversation"
|
let roomName = "Private Conversation"
|
||||||
let lastMessage = "Secret information"
|
let lastMessage = "Secret information"
|
||||||
let heroName = "Pseudonym"
|
let heroName = "Pseudonym"
|
||||||
let roomSummary = RoomSummaryDetails(id: "myroomid",
|
let roomSummary = RoomSummary(roomListItem: .init(noPointer: .init()),
|
||||||
isInvite: false,
|
id: "myroomid",
|
||||||
inviter: nil,
|
isInvite: false,
|
||||||
name: roomName,
|
inviter: nil,
|
||||||
isDirect: true,
|
name: roomName,
|
||||||
avatarURL: nil,
|
isDirect: true,
|
||||||
heroes: [.init(userID: "", displayName: heroName)],
|
avatarURL: nil,
|
||||||
lastMessage: AttributedString(lastMessage),
|
heroes: [.init(userID: "", displayName: heroName)],
|
||||||
lastMessageFormattedTimestamp: "Now",
|
lastMessage: AttributedString(lastMessage),
|
||||||
unreadMessagesCount: 0,
|
lastMessageFormattedTimestamp: "Now",
|
||||||
unreadMentionsCount: 0,
|
unreadMessagesCount: 0,
|
||||||
unreadNotificationsCount: 0,
|
unreadMentionsCount: 0,
|
||||||
notificationMode: nil,
|
unreadNotificationsCount: 0,
|
||||||
canonicalAlias: nil,
|
notificationMode: nil,
|
||||||
hasOngoingCall: false,
|
canonicalAlias: nil,
|
||||||
isMarkedUnread: false,
|
hasOngoingCall: false,
|
||||||
isFavourite: false)
|
isMarkedUnread: false,
|
||||||
|
isFavourite: false)
|
||||||
|
|
||||||
// When logging that value
|
// When logging that value
|
||||||
MXLog.info(roomSummary)
|
MXLog.info(roomSummary)
|
||||||
|
|||||||
+23
-22
@@ -18,13 +18,13 @@ import XCTest
|
|||||||
|
|
||||||
@testable import ElementX
|
@testable import ElementX
|
||||||
|
|
||||||
class RoomSummaryDetailsTests: XCTestCase {
|
class RoomSummaryTests: XCTestCase {
|
||||||
// swiftlint:disable:next large_tuple
|
// swiftlint:disable:next large_tuple
|
||||||
let roomDetails: (id: String, name: String, avatarURL: URL) = ("room_id", "Room Name", "mxc://hs.tld/room/avatar")
|
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")]
|
let heroes = [UserProfileProxy(userID: "hero_1", displayName: "Hero 1", avatarURL: "mxc://hs.tld/user/avatar")]
|
||||||
|
|
||||||
func testRoomAvatar() {
|
func testRoomAvatar() {
|
||||||
let details = makeDetails(isDirect: false, hasRoomAvatar: true)
|
let details = makeSummary(isDirect: false, hasRoomAvatar: true)
|
||||||
|
|
||||||
switch details.avatar {
|
switch details.avatar {
|
||||||
case .room(let id, let name, let avatarURL):
|
case .room(let id, let name, let avatarURL):
|
||||||
@@ -37,7 +37,7 @@ class RoomSummaryDetailsTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testDMAvatarSet() {
|
func testDMAvatarSet() {
|
||||||
let details = makeDetails(isDirect: true, hasRoomAvatar: true)
|
let details = makeSummary(isDirect: true, hasRoomAvatar: true)
|
||||||
|
|
||||||
switch details.avatar {
|
switch details.avatar {
|
||||||
case .room(let id, let name, let avatarURL):
|
case .room(let id, let name, let avatarURL):
|
||||||
@@ -50,7 +50,7 @@ class RoomSummaryDetailsTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testDMAvatarNotSet() {
|
func testDMAvatarNotSet() {
|
||||||
let details = makeDetails(isDirect: true, hasRoomAvatar: false)
|
let details = makeSummary(isDirect: true, hasRoomAvatar: false)
|
||||||
|
|
||||||
switch details.avatar {
|
switch details.avatar {
|
||||||
case .room:
|
case .room:
|
||||||
@@ -62,23 +62,24 @@ class RoomSummaryDetailsTests: XCTestCase {
|
|||||||
|
|
||||||
// MARK: - Helpers
|
// MARK: - Helpers
|
||||||
|
|
||||||
func makeDetails(isDirect: Bool, hasRoomAvatar: Bool) -> RoomSummaryDetails {
|
func makeSummary(isDirect: Bool, hasRoomAvatar: Bool) -> RoomSummary {
|
||||||
RoomSummaryDetails(id: roomDetails.id,
|
RoomSummary(roomListItem: .init(noPointer: .init()),
|
||||||
isInvite: false,
|
id: roomDetails.id,
|
||||||
inviter: nil,
|
isInvite: false,
|
||||||
name: roomDetails.name,
|
inviter: nil,
|
||||||
isDirect: isDirect,
|
name: roomDetails.name,
|
||||||
avatarURL: hasRoomAvatar ? roomDetails.avatarURL : nil,
|
isDirect: isDirect,
|
||||||
heroes: heroes,
|
avatarURL: hasRoomAvatar ? roomDetails.avatarURL : nil,
|
||||||
lastMessage: nil,
|
heroes: heroes,
|
||||||
lastMessageFormattedTimestamp: nil,
|
lastMessage: nil,
|
||||||
unreadMessagesCount: 0,
|
lastMessageFormattedTimestamp: nil,
|
||||||
unreadMentionsCount: 0,
|
unreadMessagesCount: 0,
|
||||||
unreadNotificationsCount: 0,
|
unreadMentionsCount: 0,
|
||||||
notificationMode: nil,
|
unreadNotificationsCount: 0,
|
||||||
canonicalAlias: nil,
|
notificationMode: nil,
|
||||||
hasOngoingCall: false,
|
canonicalAlias: nil,
|
||||||
isMarkedUnread: false,
|
hasOngoingCall: false,
|
||||||
isFavourite: false)
|
isMarkedUnread: false,
|
||||||
|
isFavourite: false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -60,7 +60,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: 1.0.21
|
exactVersion: 1.0.22
|
||||||
# path: ../matrix-rust-sdk
|
# path: ../matrix-rust-sdk
|
||||||
Compound:
|
Compound:
|
||||||
url: https://github.com/element-hq/compound-ios
|
url: https://github.com/element-hq/compound-ios
|
||||||
|
|||||||
Reference in New Issue
Block a user