From 7bbc1dfc5190df8bbc3f61a1189e6c9d175e8260 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Mon, 22 Jan 2024 15:51:37 +0100 Subject: [PATCH 1/5] bump sdk + mention badge fix --- ElementX.xcodeproj/project.pbxproj | 42 +++++++++++-------- .../xcshareddata/swiftpm/Package.resolved | 4 +- .../Mocks/Generated/GeneratedMocks.swift | 30 ++++++------- ElementX/Sources/Mocks/RoomProxyMock.swift | 2 +- .../HomeScreen/HomeScreenViewModel.swift | 2 +- .../HomeScreen/View/HomeScreenRoomCell.swift | 2 +- .../View/InvitesScreenCell.swift | 4 +- .../RoomScreenInteractionHandler.swift | 10 ++--- .../Sources/Services/Client/ClientProxy.swift | 9 ++-- .../Sources/Services/Room/RoomProxy.swift | 4 +- .../Services/Room/RoomProxyProtocol.swift | 2 +- .../RoomSummary/MockRoomSummaryProvider.swift | 42 +++++++++---------- .../Room/RoomSummary/RoomSummaryDetails.swift | 10 ++--- .../RoomSummary/RoomSummaryProvider.swift | 7 +++- UnitTests/Sources/LoggingTests.swift | 2 +- project.yml | 2 +- 16 files changed, 94 insertions(+), 80 deletions(-) diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index 1ac8e832a8..93d5c84d28 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 56; + objectVersion = 54; objects = { /* Begin PBXAggregateTarget section */ @@ -657,7 +657,6 @@ A722F426FD81FC67706BB1E0 /* CustomLayoutLabelStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42236480CF0431535EBE8387 /* CustomLayoutLabelStyle.swift */; }; A743841F91B62B0E56217B04 /* SecureBackupKeyBackupScreenUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58DCB219D7B7B0299358FF81 /* SecureBackupKeyBackupScreenUITests.swift */; }; A74438ED16F8683A4B793E6A /* AnalyticsSettingsScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BCE3FAF40932AC7C7639AC4 /* AnalyticsSettingsScreenViewModel.swift */; }; - A7A6452C2B5946940037ABFE /* OrientationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7A6452B2B5946940037ABFE /* OrientationManager.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 */; }; @@ -830,6 +829,7 @@ D1E29F345F1220E1AF1BE9DF /* ReadReceiptsSummaryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB0A77874B29D79DDFC051AC /* ReadReceiptsSummaryView.swift */; }; D1EEF0CB0F5D9C15E224E670 /* landscape_test_video.mov in Resources */ = {isa = PBXBuildFile; fileRef = 9A2AC7BE17C05CF7D2A22338 /* landscape_test_video.mov */; }; D2048FD56760BDABA3DB5FC2 /* AppLockServiceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAAB54C6CE91D64B69A9F8 /* AppLockServiceProtocol.swift */; }; + D24A751C2E0E210CA6D551E4 /* OrientationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2C68A1C3D46D8BDA743968E /* OrientationManager.swift */; }; D2A15D03F81342A09340BD56 /* AnalyticsScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEFEEE93B82937B2E86F92EB /* AnalyticsScreen.swift */; }; D2D70B5DB1A5E4AF0CD88330 /* target.yml in Resources */ = {isa = PBXBuildFile; fileRef = 033DB41C51865A2E83174E87 /* target.yml */; }; D33AC79A50DFC26D2498DD28 /* FileRoomTimelineItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5098DA7799946A61E34A2373 /* FileRoomTimelineItem.swift */; }; @@ -1063,7 +1063,7 @@ 033DB41C51865A2E83174E87 /* target.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = target.yml; sourceTree = ""; }; 035177BCD8E8308B098AC3C2 /* WindowManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowManager.swift; sourceTree = ""; }; 0376C429FAB1687C3D905F3E /* MockCoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockCoder.swift; sourceTree = ""; }; - 0392E3FDE372C9B56FEEED8B /* test_voice_message.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = test_voice_message.m4a; sourceTree = ""; }; + 0392E3FDE372C9B56FEEED8B /* test_voice_message.m4a */ = {isa = PBXFileReference; path = test_voice_message.m4a; sourceTree = ""; }; 03DD998E523D4EC93C7ED703 /* RoomNotificationSettingsScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomNotificationSettingsScreenViewModelProtocol.swift; sourceTree = ""; }; 03FABD73FD8086EFAB699F42 /* MediaUploadPreviewScreenViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaUploadPreviewScreenViewModelTests.swift; sourceTree = ""; }; 044E501B8331B339874D1B96 /* CompoundIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompoundIcon.swift; sourceTree = ""; }; @@ -1123,7 +1123,7 @@ 127C8472672A5BA09EF1ACF8 /* CurrentValuePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrentValuePublisher.swift; sourceTree = ""; }; 12EDAFB64FA5F6812D54F39A /* MigrationScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrationScreenViewModel.swift; sourceTree = ""; }; 12F1E7F9C2BE8BB751037826 /* WaitlistScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WaitlistScreenCoordinator.swift; sourceTree = ""; }; - 1304D9191300873EADA52D6E /* IntegrationTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = IntegrationTests.xctestplan; sourceTree = ""; }; + 1304D9191300873EADA52D6E /* IntegrationTests.xctestplan */ = {isa = PBXFileReference; path = IntegrationTests.xctestplan; sourceTree = ""; }; 130ED565A078F7E0B59D9D25 /* UNTextInputNotificationResponse+Creator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UNTextInputNotificationResponse+Creator.swift"; sourceTree = ""; }; 13802897C7AFA360EA74C0B0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = ""; }; 1423AB065857FA546444DB15 /* NotificationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationManager.swift; sourceTree = ""; }; @@ -1554,7 +1554,7 @@ 8D55702474F279D910D2D162 /* RoomStateEventStringBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomStateEventStringBuilder.swift; sourceTree = ""; }; 8D8169443E5AC5FF71BFB3DB /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Localizable.strings; sourceTree = ""; }; 8DC2C9E0E15C79BBDA80F0A2 /* TimelineStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineStyle.swift; sourceTree = ""; }; - 8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UITests.xctestplan; sourceTree = ""; }; + 8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; path = UITests.xctestplan; sourceTree = ""; }; 8E1BBA73B611EDEEA6E20E05 /* InvitesScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvitesScreenModels.swift; sourceTree = ""; }; 8EC57A32ABC80D774CC663DB /* SettingsScreenUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsScreenUITests.swift; sourceTree = ""; }; 8F21ED7205048668BEB44A38 /* AppActivityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppActivityView.swift; sourceTree = ""; }; @@ -1634,7 +1634,6 @@ A6B891A6DA826E2461DBB40F /* PHGPostHogConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PHGPostHogConfiguration.swift; sourceTree = ""; }; A6C11AD9813045E44F950410 /* ElementCallWidgetDriverProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementCallWidgetDriverProtocol.swift; sourceTree = ""; }; A73A07BAEDD74C48795A996A /* AsyncSequence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsyncSequence.swift; sourceTree = ""; }; - A7A6452B2B5946940037ABFE /* OrientationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrientationManager.swift; sourceTree = ""; }; A7C4EA55DA62F9D0F984A2AE /* CollapsibleTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollapsibleTimelineItem.swift; sourceTree = ""; }; A861DA5932B128FE1DCB5CE2 /* InviteUsersScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InviteUsersScreenCoordinator.swift; sourceTree = ""; }; A8903A9F615BBD0E6D7CD133 /* ApplicationProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationProtocol.swift; sourceTree = ""; }; @@ -1680,6 +1679,7 @@ B1E227F34BE43B08E098796E /* TestablePreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestablePreview.swift; sourceTree = ""; }; B251F5B4511D1CA0BA8361FE /* CoordinatorProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoordinatorProtocol.swift; sourceTree = ""; }; B2B5EDCD05D50BA9B815C66C /* ImageRoomTimelineItemContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageRoomTimelineItemContent.swift; sourceTree = ""; }; + B2C68A1C3D46D8BDA743968E /* OrientationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrientationManager.swift; sourceTree = ""; }; B2E7C987AE5DC9087BB19F7D /* MediaUploadPreviewScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaUploadPreviewScreenModels.swift; sourceTree = ""; }; B3005886F00029F058DB62BE /* StartChatScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartChatScreenCoordinator.swift; sourceTree = ""; }; B383DCD3DCB19E00FD478A5F /* ConfirmationDialog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmationDialog.swift; sourceTree = ""; }; @@ -1693,7 +1693,7 @@ B50F03079F6B5EF9CA005F14 /* TimelineProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineProxyProtocol.swift; sourceTree = ""; }; B590BD4507D4F0A377FDE01A /* LoadableAvatarImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadableAvatarImage.swift; sourceTree = ""; }; B5B243E7818E5E9F6A4EDC7A /* NoticeRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeRoomTimelineView.swift; sourceTree = ""; }; - B61C339A2FDDBD067FF6635C /* ConfettiScene.scn */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; path = ConfettiScene.scn; sourceTree = ""; }; + B61C339A2FDDBD067FF6635C /* ConfettiScene.scn */ = {isa = PBXFileReference; path = ConfettiScene.scn; sourceTree = ""; }; B6311F21F911E23BE4DF51B4 /* ReadMarkerRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadMarkerRoomTimelineView.swift; sourceTree = ""; }; B63B69F9A2BC74DD40DC75C8 /* AdvancedSettingsScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvancedSettingsScreenViewModel.swift; sourceTree = ""; }; B697816AF93DA06EC58C5D70 /* WaitlistScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WaitlistScreenViewModelProtocol.swift; sourceTree = ""; }; @@ -1797,7 +1797,7 @@ CD95B3714F806AC9CF9A557B /* ComposerToolbarViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposerToolbarViewModel.swift; sourceTree = ""; }; CDB3227C7A74B734924942E9 /* RoomSummaryProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryProvider.swift; sourceTree = ""; }; CEE0E6043EFCF6FD2A341861 /* TimelineReplyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineReplyView.swift; sourceTree = ""; }; - CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UnitTests.xctestplan; sourceTree = ""; }; + CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; path = UnitTests.xctestplan; sourceTree = ""; }; CF48AF076424DBC1615C74AD /* AuthenticationServiceProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationServiceProxy.swift; sourceTree = ""; }; D0140615D2232612C813FD6C /* EncryptedHistoryRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncryptedHistoryRoomTimelineItem.swift; sourceTree = ""; }; D071F86CD47582B9196C9D16 /* UserDiscoverySection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDiscoverySection.swift; sourceTree = ""; }; @@ -1904,7 +1904,7 @@ ECF79FB25E2D4BD6F50CE7C9 /* RoomMembersListScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMembersListScreenViewModel.swift; sourceTree = ""; }; ED044D00F2176681CC02CD54 /* HomeScreenRoomCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenRoomCell.swift; sourceTree = ""; }; ED1D792EB82506A19A72C8DE /* RoomTimelineItemProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTimelineItemProtocol.swift; sourceTree = ""; }; - ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = message.caf; sourceTree = ""; }; + ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; path = message.caf; sourceTree = ""; }; ED983D4DCA5AFA6E1ED96099 /* StateRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateRoomTimelineView.swift; sourceTree = ""; }; EDAA4472821985BF868CC21C /* ServerSelectionViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSelectionViewModelTests.swift; sourceTree = ""; }; EE378083653EF0C9B5E9D580 /* EmoteRoomTimelineItemContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmoteRoomTimelineItemContent.swift; sourceTree = ""; }; @@ -1921,7 +1921,7 @@ F174A5627CDB3CAF280D1880 /* EmojiPickerScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPickerScreenModels.swift; sourceTree = ""; }; F17EFA1D3D09FC2F9C5E1CB2 /* MediaProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaProvider.swift; sourceTree = ""; }; F1B8500C152BC59445647DA8 /* UnsupportedRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnsupportedRoomTimelineItem.swift; sourceTree = ""; }; - F2D513D2477B57F90E98EEC0 /* portrait_test_video.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = portrait_test_video.mp4; sourceTree = ""; }; + F2D513D2477B57F90E98EEC0 /* portrait_test_video.mp4 */ = {isa = PBXFileReference; path = portrait_test_video.mp4; sourceTree = ""; }; F31F59030205A6F65B057E1A /* MatrixEntityRegexTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MatrixEntityRegexTests.swift; sourceTree = ""; }; F348B5F2C12F9D4F4B4D3884 /* VideoRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoRoomTimelineItem.swift; sourceTree = ""; }; F36C0A6D59717193F49EA986 /* UserSessionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSessionTests.swift; sourceTree = ""; }; @@ -3187,10 +3187,10 @@ 703929219780FFABAC6380AA /* Windowing */ = { isa = PBXGroup; children = ( + B2C68A1C3D46D8BDA743968E /* OrientationManager.swift */, 5A37E2FACFD041CE466223CD /* SceneDelegate.swift */, 035177BCD8E8308B098AC3C2 /* WindowManager.swift */, 06F27F588F9059128E17C669 /* WindowManagerProtocol.swift */, - A7A6452B2B5946940037ABFE /* OrientationManager.swift */, ); path = Windowing; sourceTree = ""; @@ -5661,6 +5661,7 @@ 3A5BD701D1AC916AC534F52C /* OnboardingScreenModels.swift in Sources */, A5C5C18671EDD2747AC16D2D /* OnboardingScreenViewModel.swift in Sources */, 4714991754A08B58B4D7ED85 /* OnboardingScreenViewModelProtocol.swift in Sources */, + D24A751C2E0E210CA6D551E4 /* OrientationManager.swift in Sources */, 804C15D8ADE0EA7A5268F58A /* OverridableAvatarImage.swift in Sources */, CD6A72B65D3B6076F4045C30 /* PHGPostHogConfiguration.swift in Sources */, 847DE3A7EB9FCA2C429C6E85 /* PINTextField.swift in Sources */, @@ -5834,7 +5835,6 @@ 94A65DD8A353DF112EBEF67A /* SessionVerificationControllerProxyProtocol.swift in Sources */, 7A0A0929556792FB19B812C5 /* SessionVerificationScreen.swift in Sources */, E9F148072F9513EC2272AA21 /* SessionVerificationScreenCoordinator.swift in Sources */, - A7A6452C2B5946940037ABFE /* OrientationManager.swift in Sources */, 5770C4906668C6D3008A2AC9 /* SessionVerificationScreenModels.swift in Sources */, B27D3190784F85916DA1C394 /* SessionVerificationScreenStateMachine.swift in Sources */, F4433EF57B4BB3C077F8B00E /* SessionVerificationScreenViewModel.swift in Sources */, @@ -6182,7 +6182,9 @@ "@executable_path/../../Frameworks", ); MARKETING_VERSION = "$(MARKETING_VERSION)"; - OTHER_SWIFT_FLAGS = "-DIS_NSE"; + OTHER_SWIFT_FLAGS = ( + "-DIS_NSE", + ); PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.nse"; PRODUCT_DISPLAY_NAME = "$(APP_DISPLAY_NAME)"; PRODUCT_NAME = NSE; @@ -6213,7 +6215,9 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = "$(MARKETING_VERSION)"; - OTHER_SWIFT_FLAGS = "-DIS_MAIN_APP"; + OTHER_SWIFT_FLAGS = ( + "-DIS_MAIN_APP", + ); PILLS_UT_TYPE_IDENTIFIER = "$(BASE_BUNDLE_IDENTIFIER).pills"; PRODUCT_BUNDLE_IDENTIFIER = "$(BASE_BUNDLE_IDENTIFIER)"; PRODUCT_NAME = "$(APP_NAME)"; @@ -6239,7 +6243,9 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = "$(MARKETING_VERSION)"; - OTHER_SWIFT_FLAGS = "-DIS_MAIN_APP"; + OTHER_SWIFT_FLAGS = ( + "-DIS_MAIN_APP", + ); PILLS_UT_TYPE_IDENTIFIER = "$(BASE_BUNDLE_IDENTIFIER).pills"; PRODUCT_BUNDLE_IDENTIFIER = "$(BASE_BUNDLE_IDENTIFIER)"; PRODUCT_NAME = "$(APP_NAME)"; @@ -6482,7 +6488,9 @@ "@executable_path/../../Frameworks", ); MARKETING_VERSION = "$(MARKETING_VERSION)"; - OTHER_SWIFT_FLAGS = "-DIS_NSE"; + OTHER_SWIFT_FLAGS = ( + "-DIS_NSE", + ); PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.nse"; PRODUCT_DISPLAY_NAME = "$(APP_DISPLAY_NAME)"; PRODUCT_NAME = NSE; @@ -6664,7 +6672,7 @@ repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift"; requirement = { kind = exactVersion; - version = 1.1.32; + version = 1.1.34; }; }; 821C67C9A7F8CC3FD41B28B4 /* XCRemoteSwiftPackageReference "emojibase-bindings" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 2ef7e4b4fb..1d44f8d5f2 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -130,8 +130,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/matrix-org/matrix-rust-components-swift", "state" : { - "revision" : "07556e1b475291ec4794e22e9348a5a7db137595", - "version" : "1.1.32" + "revision" : "0a882b25a6998c4bff74c3fa47fdf99cf2118e13", + "version" : "1.1.34" } }, { diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index ecd246de5a..0a2a73cd8d 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -2159,25 +2159,25 @@ class RoomProxyMock: RoomProxyProtocol { return uploadAvatarMediaReturnValue } } - //MARK: - canUserRedact + //MARK: - canUserRedactOther - var canUserRedactUserIDCallsCount = 0 - var canUserRedactUserIDCalled: Bool { - return canUserRedactUserIDCallsCount > 0 + var canUserRedactOtherUserIDCallsCount = 0 + var canUserRedactOtherUserIDCalled: Bool { + return canUserRedactOtherUserIDCallsCount > 0 } - var canUserRedactUserIDReceivedUserID: String? - var canUserRedactUserIDReceivedInvocations: [String] = [] - var canUserRedactUserIDReturnValue: Result! - var canUserRedactUserIDClosure: ((String) async -> Result)? + var canUserRedactOtherUserIDReceivedUserID: String? + var canUserRedactOtherUserIDReceivedInvocations: [String] = [] + var canUserRedactOtherUserIDReturnValue: Result! + var canUserRedactOtherUserIDClosure: ((String) async -> Result)? - func canUserRedact(userID: String) async -> Result { - canUserRedactUserIDCallsCount += 1 - canUserRedactUserIDReceivedUserID = userID - canUserRedactUserIDReceivedInvocations.append(userID) - if let canUserRedactUserIDClosure = canUserRedactUserIDClosure { - return await canUserRedactUserIDClosure(userID) + func canUserRedactOther(userID: String) async -> Result { + canUserRedactOtherUserIDCallsCount += 1 + canUserRedactOtherUserIDReceivedUserID = userID + canUserRedactOtherUserIDReceivedInvocations.append(userID) + if let canUserRedactOtherUserIDClosure = canUserRedactOtherUserIDClosure { + return await canUserRedactOtherUserIDClosure(userID) } else { - return canUserRedactUserIDReturnValue + return canUserRedactOtherUserIDReturnValue } } //MARK: - canUserTriggerRoomNotification diff --git a/ElementX/Sources/Mocks/RoomProxyMock.swift b/ElementX/Sources/Mocks/RoomProxyMock.swift index cec5f32098..344ffd2e44 100644 --- a/ElementX/Sources/Mocks/RoomProxyMock.swift +++ b/ElementX/Sources/Mocks/RoomProxyMock.swift @@ -84,7 +84,7 @@ extension RoomProxyMock { setNameClosure = { _ in .success(()) } setTopicClosure = { _ in .success(()) } getMemberUserIDReturnValue = .success(configuration.memberForID) - canUserRedactUserIDReturnValue = .success(false) + canUserRedactOtherUserIDReturnValue = .success(false) canUserTriggerRoomNotificationUserIDReturnValue = .success(configuration.canUserTriggerRoomNotification) canUserJoinCallUserIDReturnValue = .success(configuration.canUserJoinCall) } diff --git a/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift b/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift index 61b2ffe3b0..d0ad99ce91 100644 --- a/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift +++ b/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift @@ -292,7 +292,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol return HomeScreenRoom(id: identifier, roomId: details.id, name: details.name, - hasUnreads: details.unreadMessagesCount > 0, + hasUnreads: details.unreadNotificationsCount > 0, hasMentions: hasMentions, hasOngoingCall: details.hasOngoingCall, timestamp: details.lastMessageFormattedTimestamp, diff --git a/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift b/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift index 9def8d4e96..1dcf2bc26f 100644 --- a/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift +++ b/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift @@ -225,7 +225,7 @@ struct HomeScreenRoomCell_Previews: PreviewProvider, TestablePreview { return HomeScreenRoom(id: UUID().uuidString, roomId: details.id, name: details.name, - hasUnreads: details.unreadMessagesCount > 0, hasMentions: details.unreadMentionsCount > 0, + hasUnreads: details.unreadNotificationsCount > 0, hasMentions: details.unreadMentionsCount > 0, hasOngoingCall: details.hasOngoingCall, timestamp: Date(timeIntervalSinceReferenceDate: 0).formattedMinimal(), lastMessage: details.lastMessage, diff --git a/ElementX/Sources/Screens/InvitesScreen/View/InvitesScreenCell.swift b/ElementX/Sources/Screens/InvitesScreen/View/InvitesScreenCell.swift index 2ad1991596..bb11035413 100644 --- a/ElementX/Sources/Screens/InvitesScreen/View/InvitesScreenCell.swift +++ b/ElementX/Sources/Screens/InvitesScreen/View/InvitesScreenCell.swift @@ -186,7 +186,7 @@ private extension InvitesScreenRoomDetails { avatarURL: nil, lastMessage: nil, lastMessageFormattedTimestamp: nil, - unreadMessagesCount: 0, + unreadNotificationsCount: 0, unreadMentionsCount: 0, notificationMode: nil, canonicalAlias: "#footest:somewhere.org", @@ -207,7 +207,7 @@ private extension InvitesScreenRoomDetails { avatarURL: avatarURL, lastMessage: nil, lastMessageFormattedTimestamp: nil, - unreadMessagesCount: 0, + unreadNotificationsCount: 0, unreadMentionsCount: 0, notificationMode: nil, canonicalAlias: alias, diff --git a/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift b/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift index 60b9787fab..0889cd0949 100644 --- a/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift +++ b/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift @@ -51,7 +51,7 @@ class RoomScreenInteractionHandler { } private var voiceMessageRecorderObserver: AnyCancellable? - private var canCurrentUserRedact = false + private var canCurrentUserRedactOthers = false private var resumeVoiceMessagePlaybackAfterScrubbing = false init(roomProxy: RoomProxyProtocol, @@ -81,10 +81,10 @@ class RoomScreenInteractionHandler { func showTimelineItemActionMenu(for itemID: TimelineItemIdentifier) { Task { - if case let .success(value) = await roomProxy.canUserRedact(userID: roomProxy.ownUserID) { - canCurrentUserRedact = value + if case let .success(value) = await roomProxy.canUserRedactOther(userID: roomProxy.ownUserID) { + canCurrentUserRedactOthers = value } else { - canCurrentUserRedact = false + canCurrentUserRedactOthers = false } guard let timelineItem = timelineController.timelineItems.firstUsingStableID(itemID), @@ -604,7 +604,7 @@ class RoomScreenInteractionHandler { // MARK: - Private private func canRedactItem(_ item: EventBasedTimelineItemProtocol) -> Bool { - item.isOutgoing || (canCurrentUserRedact && !roomProxy.isDirect) + item.isOutgoing || (canCurrentUserRedactOthers && !roomProxy.isDirect) } private func buildReplyInfo(for item: EventBasedTimelineItemProtocol) -> ReplyInfo { diff --git a/ElementX/Sources/Services/Client/ClientProxy.swift b/ElementX/Sources/Services/Client/ClientProxy.swift index 2a3ad7e3fb..4e14268bf9 100644 --- a/ElementX/Sources/Services/Client/ClientProxy.swift +++ b/ElementX/Sources/Services/Client/ClientProxy.swift @@ -510,21 +510,24 @@ class ClientProxy: ClientProxyProtocol { name: "AllRooms", shouldUpdateVisibleRange: true, notificationSettings: notificationSettings, - backgroundTaskService: backgroundTaskService) + backgroundTaskService: backgroundTaskService, + appSettings: appSettings) try await roomSummaryProvider?.setRoomList(roomListService.allRooms()) messageForwardingRoomSummaryProvider = RoomSummaryProvider(roomListService: roomListService, eventStringBuilder: eventStringBuilder, name: "MessageForwarding", notificationSettings: notificationSettings, - backgroundTaskService: backgroundTaskService) + backgroundTaskService: backgroundTaskService, + appSettings: appSettings) try await messageForwardingRoomSummaryProvider?.setRoomList(roomListService.allRooms()) inviteSummaryProvider = RoomSummaryProvider(roomListService: roomListService, eventStringBuilder: eventStringBuilder, name: "Invites", notificationSettings: notificationSettings, - backgroundTaskService: backgroundTaskService) + backgroundTaskService: backgroundTaskService, + appSettings: appSettings) try await inviteSummaryProvider?.setRoomList(roomListService.invites()) self.syncService = syncService diff --git a/ElementX/Sources/Services/Room/RoomProxy.swift b/ElementX/Sources/Services/Room/RoomProxy.swift index 19c15afca6..f2e3fa2f32 100644 --- a/ElementX/Sources/Services/Room/RoomProxy.swift +++ b/ElementX/Sources/Services/Room/RoomProxy.swift @@ -328,9 +328,9 @@ class RoomProxy: RoomProxyProtocol { } } - func canUserRedact(userID: String) async -> Result { + func canUserRedactOther(userID: String) async -> Result { do { - return try await .success(room.canUserRedact(userId: userID)) + return try await .success(room.canUserRedactOther(userId: userID)) } catch { MXLog.error("Failed checking if the user can redact with error: \(error)") return .failure(.failedCheckingPermission) diff --git a/ElementX/Sources/Services/Room/RoomProxyProtocol.swift b/ElementX/Sources/Services/Room/RoomProxyProtocol.swift index 5497bfc61e..2c68b7cf46 100644 --- a/ElementX/Sources/Services/Room/RoomProxyProtocol.swift +++ b/ElementX/Sources/Services/Room/RoomProxyProtocol.swift @@ -97,7 +97,7 @@ protocol RoomProxyProtocol { func uploadAvatar(media: MediaInfo) async -> Result - func canUserRedact(userID: String) async -> Result + func canUserRedactOther(userID: String) async -> Result func canUserTriggerRoomNotification(userID: String) async -> Result diff --git a/ElementX/Sources/Services/Room/RoomSummary/MockRoomSummaryProvider.swift b/ElementX/Sources/Services/Room/RoomSummary/MockRoomSummaryProvider.swift index eb136c708b..59c1dd4e67 100644 --- a/ElementX/Sources/Services/Room/RoomSummary/MockRoomSummaryProvider.swift +++ b/ElementX/Sources/Services/Room/RoomSummary/MockRoomSummaryProvider.swift @@ -83,7 +83,7 @@ extension Array where Element == RoomSummary { avatarURL: nil, lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"), lastMessageFormattedTimestamp: "14:56", - unreadMessagesCount: 0, + unreadNotificationsCount: 0, unreadMentionsCount: 0, notificationMode: .allMessages, canonicalAlias: nil, @@ -95,7 +95,7 @@ extension Array where Element == RoomSummary { avatarURL: URL.picturesDirectory, lastMessage: AttributedString("How do you see the Emperor then? You think he keeps office hours?"), lastMessageFormattedTimestamp: "2:56 PM", - unreadMessagesCount: 2, + unreadNotificationsCount: 2, unreadMentionsCount: 0, notificationMode: .mute, canonicalAlias: nil, @@ -107,7 +107,7 @@ extension Array where Element == RoomSummary { avatarURL: nil, lastMessage: try? AttributedString(markdown: "He certainly seemed no *mental genius* to me"), lastMessageFormattedTimestamp: "Some time ago", - unreadMessagesCount: 3, + unreadNotificationsCount: 3, unreadMentionsCount: 0, notificationMode: .mentionsAndKeywordsOnly, canonicalAlias: nil, @@ -119,7 +119,7 @@ extension Array where Element == RoomSummary { avatarURL: nil, lastMessage: AttributedString("There's an archaic measure of time that's called the month"), lastMessageFormattedTimestamp: "Just now", - unreadMessagesCount: 2, + unreadNotificationsCount: 2, unreadMentionsCount: 2, notificationMode: .allMessages, canonicalAlias: nil, @@ -131,7 +131,7 @@ extension Array where Element == RoomSummary { avatarURL: nil, lastMessage: AttributedString("Clearly, if Earth is powerful enough to do that, it might also be capable of adjusting minds in order to force belief in its radioactivity"), lastMessageFormattedTimestamp: "1986", - unreadMessagesCount: 1, + unreadNotificationsCount: 1, unreadMentionsCount: 1, notificationMode: .allMessages, canonicalAlias: nil, @@ -143,7 +143,7 @@ extension Array where Element == RoomSummary { avatarURL: nil, lastMessage: AttributedString("Are you groping for the word 'paranoia'?"), lastMessageFormattedTimestamp: "きょうはじゅういちがつじゅういちにちです", - unreadMessagesCount: 6, + unreadNotificationsCount: 6, unreadMentionsCount: 0, notificationMode: .mute, canonicalAlias: nil, @@ -155,7 +155,7 @@ extension Array where Element == RoomSummary { avatarURL: nil, lastMessage: nil, lastMessageFormattedTimestamp: nil, - unreadMessagesCount: 0, + unreadNotificationsCount: 0, unreadMentionsCount: 0, notificationMode: nil, canonicalAlias: nil, @@ -167,51 +167,51 @@ extension Array where Element == RoomSummary { static let mockRoomsWithNotificationsState: [Element] = [ .filled(details: RoomSummaryDetails(id: "1", settingsMode: .allMessages, - hasUnreadMessages: false, + hasUnreadNotifications: false, hasUnreadMentions: false)), .filled(details: RoomSummaryDetails(id: "2", settingsMode: .allMessages, - hasUnreadMessages: true, + hasUnreadNotifications: true, hasUnreadMentions: false)), .filled(details: RoomSummaryDetails(id: "3", settingsMode: .allMessages, - hasUnreadMessages: true, + hasUnreadNotifications: true, hasUnreadMentions: true)), .filled(details: RoomSummaryDetails(id: "4", settingsMode: .allMessages, - hasUnreadMessages: false, + hasUnreadNotifications: false, hasUnreadMentions: true)), .filled(details: RoomSummaryDetails(id: "5", settingsMode: .mentionsAndKeywordsOnly, - hasUnreadMessages: false, + hasUnreadNotifications: false, hasUnreadMentions: false)), .filled(details: RoomSummaryDetails(id: "6", settingsMode: .mentionsAndKeywordsOnly, - hasUnreadMessages: true, + hasUnreadNotifications: true, hasUnreadMentions: false)), .filled(details: RoomSummaryDetails(id: "7", settingsMode: .mentionsAndKeywordsOnly, - hasUnreadMessages: true, + hasUnreadNotifications: true, hasUnreadMentions: true)), .filled(details: RoomSummaryDetails(id: "8", settingsMode: .mentionsAndKeywordsOnly, - hasUnreadMessages: false, + hasUnreadNotifications: false, hasUnreadMentions: true)), .filled(details: RoomSummaryDetails(id: "9", settingsMode: .mute, - hasUnreadMessages: false, + hasUnreadNotifications: false, hasUnreadMentions: false)), .filled(details: RoomSummaryDetails(id: "10", settingsMode: .mute, - hasUnreadMessages: true, + hasUnreadNotifications: true, hasUnreadMentions: false)), .filled(details: RoomSummaryDetails(id: "11", settingsMode: .mute, - hasUnreadMessages: true, + hasUnreadNotifications: true, hasUnreadMentions: true)), .filled(details: RoomSummaryDetails(id: "12", settingsMode: .mute, - hasUnreadMessages: false, + hasUnreadNotifications: false, hasUnreadMentions: true)) ] @@ -221,7 +221,7 @@ extension Array where Element == RoomSummary { avatarURL: URL.picturesDirectory, lastMessage: nil, lastMessageFormattedTimestamp: nil, - unreadMessagesCount: 0, + unreadNotificationsCount: 0, unreadMentionsCount: 0, notificationMode: nil, canonicalAlias: "#footest:somewhere.org", @@ -233,7 +233,7 @@ extension Array where Element == RoomSummary { avatarURL: nil, lastMessage: nil, lastMessageFormattedTimestamp: nil, - unreadMessagesCount: 0, + unreadNotificationsCount: 0, unreadMentionsCount: 0, notificationMode: nil, canonicalAlias: nil, diff --git a/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryDetails.swift b/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryDetails.swift index 7857677f12..f566a4bbb1 100644 --- a/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryDetails.swift +++ b/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryDetails.swift @@ -24,7 +24,7 @@ struct RoomSummaryDetails { let avatarURL: URL? let lastMessage: AttributedString? let lastMessageFormattedTimestamp: String? - let unreadMessagesCount: UInt + let unreadNotificationsCount: UInt let unreadMentionsCount: UInt let notificationMode: RoomNotificationModeProxy? let canonicalAlias: String? @@ -34,20 +34,20 @@ struct RoomSummaryDetails { extension RoomSummaryDetails: CustomStringConvertible { var description: String { - "RoomSummaryDetails: - id: \(id) - isDirect: \(isDirect) - unreadMessagesCount: \(unreadMessagesCount) - unreadMentionsCount: \(unreadMentionsCount) - notificationMode: \(notificationMode?.rawValue ?? "nil")" + "RoomSummaryDetails: - id: \(id) - isDirect: \(isDirect) - unreadNotificationsCount: \(unreadNotificationsCount) - unreadMentionsCount: \(unreadMentionsCount) - notificationMode: \(notificationMode?.rawValue ?? "nil")" } } extension RoomSummaryDetails { - init(id: String, settingsMode: RoomNotificationModeProxy, hasUnreadMessages: Bool, hasUnreadMentions: Bool) { + init(id: String, settingsMode: RoomNotificationModeProxy, hasUnreadNotifications: Bool, hasUnreadMentions: Bool) { self.id = id - let string = "\(settingsMode) - hasUnreadMessages: \(hasUnreadMessages) - hasUnreadMentions: \(hasUnreadMentions)" + let string = "\(settingsMode) - hasUnreadNotifications: \(hasUnreadNotifications) - hasUnreadMentions: \(hasUnreadMentions)" name = string isDirect = true avatarURL = nil lastMessage = AttributedString(string) lastMessageFormattedTimestamp = "Now" - unreadMessagesCount = hasUnreadMessages ? 1 : 0 + unreadNotificationsCount = hasUnreadNotifications ? 1 : 0 unreadMentionsCount = hasUnreadMentions ? 1 : 0 notificationMode = settingsMode canonicalAlias = nil diff --git a/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift b/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift index 175dcd00e4..1547fffd3d 100644 --- a/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift +++ b/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift @@ -25,6 +25,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol { private let shouldUpdateVisibleRange: Bool private let notificationSettings: NotificationSettingsProxyProtocol private let backgroundTaskService: BackgroundTaskServiceProtocol + private let appSettings: AppSettings private let roomListPageSize = 200 @@ -67,7 +68,8 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol { name: String, shouldUpdateVisibleRange: Bool = false, notificationSettings: NotificationSettingsProxyProtocol, - backgroundTaskService: BackgroundTaskServiceProtocol) { + backgroundTaskService: BackgroundTaskServiceProtocol, + appSettings: AppSettings) { self.roomListService = roomListService serialDispatchQueue = DispatchQueue(label: "io.element.elementx.roomsummaryprovider", qos: .default) self.eventStringBuilder = eventStringBuilder @@ -75,6 +77,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol { self.shouldUpdateVisibleRange = shouldUpdateVisibleRange self.notificationSettings = notificationSettings self.backgroundTaskService = backgroundTaskService + self.appSettings = appSettings diffsPublisher .receive(on: serialDispatchQueue) @@ -245,7 +248,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol { avatarURL: roomInfo.avatarUrl.flatMap(URL.init(string:)), lastMessage: attributedLastMessage, lastMessageFormattedTimestamp: lastMessageFormattedTimestamp, - unreadMessagesCount: UInt(roomInfo.notificationCount), + unreadNotificationsCount: appSettings.mentionsBadgeEnabled ? UInt(roomInfo.numUnreadNotifications) : UInt(roomInfo.notificationCount), unreadMentionsCount: UInt(roomInfo.numUnreadMentions), notificationMode: notificationMode, canonicalAlias: roomInfo.canonicalAlias, diff --git a/UnitTests/Sources/LoggingTests.swift b/UnitTests/Sources/LoggingTests.swift index 3a8f2d6997..93024897d6 100644 --- a/UnitTests/Sources/LoggingTests.swift +++ b/UnitTests/Sources/LoggingTests.swift @@ -229,7 +229,7 @@ class LoggingTests: XCTestCase { avatarURL: nil, lastMessage: AttributedString(lastMessage), lastMessageFormattedTimestamp: "Now", - unreadMessagesCount: 0, + unreadNotificationsCount: 0, unreadMentionsCount: 0, notificationMode: nil, canonicalAlias: nil, diff --git a/project.yml b/project.yml index 9d93232bed..491a932e81 100644 --- a/project.yml +++ b/project.yml @@ -47,7 +47,7 @@ packages: # Element/Matrix dependencies MatrixRustSDK: url: https://github.com/matrix-org/matrix-rust-components-swift - exactVersion: 1.1.32 + exactVersion: 1.1.34 # path: ../matrix-rust-sdk Compound: url: https://github.com/element-hq/compound-ios From 3619f905f62ab29a67c73fdcf62c2f784cf80276 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Mon, 22 Jan 2024 16:04:16 +0100 Subject: [PATCH 2/5] defaulted to true --- ElementX/Sources/Application/AppSettings.swift | 2 +- .../__Snapshots__/PreviewTests/test_homeScreen.Loaded.png | 4 ++-- .../test_homeScreenRoomCell.Notifications-State.png | 4 ++-- changelog.d/pr-2367.bugfix | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 changelog.d/pr-2367.bugfix diff --git a/ElementX/Sources/Application/AppSettings.swift b/ElementX/Sources/Application/AppSettings.swift index 1022e33f35..9a097feadb 100644 --- a/ElementX/Sources/Application/AppSettings.swift +++ b/ElementX/Sources/Application/AppSettings.swift @@ -269,7 +269,7 @@ final class AppSettings { @UserPreference(key: UserDefaultsKeys.swiftUITimelineEnabled, defaultValue: false, storageType: .volatile) var swiftUITimelineEnabled - @UserPreference(key: UserDefaultsKeys.mentionsBadgeEnabled, defaultValue: false, storageType: .userDefaults(store)) + @UserPreference(key: UserDefaultsKeys.mentionsBadgeEnabled, defaultValue: true, storageType: .userDefaults(store)) var mentionsBadgeEnabled #endif diff --git a/UnitTests/__Snapshots__/PreviewTests/test_homeScreen.Loaded.png b/UnitTests/__Snapshots__/PreviewTests/test_homeScreen.Loaded.png index 110f535f32..219fd843ec 100644 --- a/UnitTests/__Snapshots__/PreviewTests/test_homeScreen.Loaded.png +++ b/UnitTests/__Snapshots__/PreviewTests/test_homeScreen.Loaded.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8a5f5fcf811ce8ed53b9556f4ac19f3d269273f5b36a5b473fc081a382481d27 -size 293688 +oid sha256:0e9cc69f6a7d59b4b39ff0f0e1d610425f6d26d8582e6fcda4c6773c8bc9f426 +size 294065 diff --git a/UnitTests/__Snapshots__/PreviewTests/test_homeScreenRoomCell.Notifications-State.png b/UnitTests/__Snapshots__/PreviewTests/test_homeScreenRoomCell.Notifications-State.png index 2cc7925302..01a5bdadbc 100644 --- a/UnitTests/__Snapshots__/PreviewTests/test_homeScreenRoomCell.Notifications-State.png +++ b/UnitTests/__Snapshots__/PreviewTests/test_homeScreenRoomCell.Notifications-State.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:280155439f431f4f3694c9482807857e053088a6afd904da0027ec06b39fdb66 -size 421031 +oid sha256:0701f80353a05af1c99196feb5480525dd9106052bb5c0b096d581344b8ba6af +size 427934 diff --git a/changelog.d/pr-2367.bugfix b/changelog.d/pr-2367.bugfix new file mode 100644 index 0000000000..f53cdf3824 --- /dev/null +++ b/changelog.d/pr-2367.bugfix @@ -0,0 +1 @@ +Bugfix for the mention badge not being unset properly when opening the room. \ No newline at end of file From ac8bce4afa60418da99984dec1cac4905b6208df Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Mon, 22 Jan 2024 16:05:21 +0100 Subject: [PATCH 3/5] better changelog --- changelog.d/pr-2367.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/pr-2367.bugfix b/changelog.d/pr-2367.bugfix index f53cdf3824..be94a1a2f3 100644 --- a/changelog.d/pr-2367.bugfix +++ b/changelog.d/pr-2367.bugfix @@ -1 +1 @@ -Bugfix for the mention badge not being unset properly when opening the room. \ No newline at end of file +Bugfix for the mention badge not being unset properly when opening the room. Also the mention badge is enabled by default. \ No newline at end of file From 5c39b8180c4436da3532fb0f602344da60cc4913 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Mon, 22 Jan 2024 16:18:26 +0100 Subject: [PATCH 4/5] better logs --- .../Mocks/Generated/GeneratedMocks.swift | 21 +++++++++++++++++++ .../RoomScreenInteractionHandler.swift | 9 +++++++- .../Sources/Services/Room/RoomProxy.swift | 11 +++++++++- .../Services/Room/RoomProxyProtocol.swift | 2 ++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index 0a2a73cd8d..9a81861ddd 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -2180,6 +2180,27 @@ class RoomProxyMock: RoomProxyProtocol { return canUserRedactOtherUserIDReturnValue } } + //MARK: - canUserRedactOwn + + var canUserRedactOwnUserIDCallsCount = 0 + var canUserRedactOwnUserIDCalled: Bool { + return canUserRedactOwnUserIDCallsCount > 0 + } + var canUserRedactOwnUserIDReceivedUserID: String? + var canUserRedactOwnUserIDReceivedInvocations: [String] = [] + var canUserRedactOwnUserIDReturnValue: Result! + var canUserRedactOwnUserIDClosure: ((String) async -> Result)? + + func canUserRedactOwn(userID: String) async -> Result { + canUserRedactOwnUserIDCallsCount += 1 + canUserRedactOwnUserIDReceivedUserID = userID + canUserRedactOwnUserIDReceivedInvocations.append(userID) + if let canUserRedactOwnUserIDClosure = canUserRedactOwnUserIDClosure { + return await canUserRedactOwnUserIDClosure(userID) + } else { + return canUserRedactOwnUserIDReturnValue + } + } //MARK: - canUserTriggerRoomNotification var canUserTriggerRoomNotificationUserIDCallsCount = 0 diff --git a/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift b/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift index 0889cd0949..024d05011f 100644 --- a/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift +++ b/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift @@ -52,6 +52,7 @@ class RoomScreenInteractionHandler { private var voiceMessageRecorderObserver: AnyCancellable? private var canCurrentUserRedactOthers = false + private var canCurrentUserRedactSelf = false private var resumeVoiceMessagePlaybackAfterScrubbing = false init(roomProxy: RoomProxyProtocol, @@ -86,6 +87,12 @@ class RoomScreenInteractionHandler { } else { canCurrentUserRedactOthers = false } + + if case let .success(value) = await roomProxy.canUserRedactOwn(userID: roomProxy.ownUserID) { + canCurrentUserRedactSelf = value + } else { + canCurrentUserRedactSelf = false + } guard let timelineItem = timelineController.timelineItems.firstUsingStableID(itemID), let eventTimelineItem = timelineItem as? EventBasedTimelineItemProtocol else { @@ -604,7 +611,7 @@ class RoomScreenInteractionHandler { // MARK: - Private private func canRedactItem(_ item: EventBasedTimelineItemProtocol) -> Bool { - item.isOutgoing || (canCurrentUserRedactOthers && !roomProxy.isDirect) + item.isOutgoing ? canCurrentUserRedactSelf : canCurrentUserRedactOthers && !roomProxy.isDirect } private func buildReplyInfo(for item: EventBasedTimelineItemProtocol) -> ReplyInfo { diff --git a/ElementX/Sources/Services/Room/RoomProxy.swift b/ElementX/Sources/Services/Room/RoomProxy.swift index f2e3fa2f32..e73c9b66d9 100644 --- a/ElementX/Sources/Services/Room/RoomProxy.swift +++ b/ElementX/Sources/Services/Room/RoomProxy.swift @@ -332,7 +332,16 @@ class RoomProxy: RoomProxyProtocol { do { return try await .success(room.canUserRedactOther(userId: userID)) } catch { - MXLog.error("Failed checking if the user can redact with error: \(error)") + MXLog.error("Failed checking if the user can redact others with error: \(error)") + return .failure(.failedCheckingPermission) + } + } + + func canUserRedactOwn(userID: String) async -> Result { + do { + return try await .success(room.canUserRedactOwn(userId: userID)) + } catch { + MXLog.error("Failed checking if the user can redact self with error: \(error)") return .failure(.failedCheckingPermission) } } diff --git a/ElementX/Sources/Services/Room/RoomProxyProtocol.swift b/ElementX/Sources/Services/Room/RoomProxyProtocol.swift index 2c68b7cf46..c91b38c918 100644 --- a/ElementX/Sources/Services/Room/RoomProxyProtocol.swift +++ b/ElementX/Sources/Services/Room/RoomProxyProtocol.swift @@ -99,6 +99,8 @@ protocol RoomProxyProtocol { func canUserRedactOther(userID: String) async -> Result + func canUserRedactOwn(userID: String) async -> Result + func canUserTriggerRoomNotification(userID: String) async -> Result func canUserJoinCall(userID: String) async -> Result From 656a15d4eee4052549c5ad89eb56659e040d50b2 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Mon, 22 Jan 2024 16:21:17 +0100 Subject: [PATCH 5/5] changelog --- changelog.d/pr-2368.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/pr-2368.bugfix diff --git a/changelog.d/pr-2368.bugfix b/changelog.d/pr-2368.bugfix new file mode 100644 index 0000000000..1d51ab9b6d --- /dev/null +++ b/changelog.d/pr-2368.bugfix @@ -0,0 +1 @@ +You can't redact a message of your own if the room does not allow it. \ No newline at end of file