diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index bac2e2287..63f825d66 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 63; objects = { /* Begin PBXAggregateTarget section */ @@ -145,6 +145,9 @@ 1801F1467ABCEA080419E150 /* preview_avatar_user.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 87FC42213E86E8182CFD3A49 /* preview_avatar_user.jpg */; }; 182D532B736178A1DED9F76E /* ReportRoomScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11FCAE847556719BBE7A0882 /* ReportRoomScreenModels.swift */; }; 18386B777FDA74E4B3282D4F /* TimelineItemThreadSummary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98C6A082F2B2A15E1B9BE280 /* TimelineItemThreadSummary.swift */; }; + 183CFD912E054B3400995797 /* RoomPowerLevelsProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 183CFD902E054B2F00995797 /* RoomPowerLevelsProxy.swift */; }; + 183CFD952E055C0400995797 /* RoomPowerLevelProxyProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 183CFD942E055BFF00995797 /* RoomPowerLevelProxyProtocol.swift */; }; + 183CFD972E055C5600995797 /* RoomPowerLevelsProxyMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 183CFD962E055C5100995797 /* RoomPowerLevelsProxyMock.swift */; }; 18867F4F1C8991EEC56EA932 /* UTType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 897DF5E9A70CE05A632FC8AF /* UTType.swift */; }; 18978C9438206828C1D5AF2A /* test_animated_image.gif in Resources */ = {isa = PBXBuildFile; fileRef = 53FD6D3D38F556CEAA280C58 /* test_animated_image.gif */; }; 18E3786918486D4C9726BC84 /* FormButtonStyles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89FBFC09F9DAFF1E4BA97849 /* FormButtonStyles.swift */; }; @@ -1401,7 +1404,7 @@ 044E501B8331B339874D1B96 /* CompoundIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompoundIcon.swift; sourceTree = ""; }; 045253F9967A535EE5B16691 /* Label.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Label.swift; sourceTree = ""; }; 046C0D3F53B0B5EF0A1F5BEA /* RoomSummaryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryTests.swift; sourceTree = ""; }; - 048A21188AB19349D026BECD /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; + 048A21188AB19349D026BECD /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 04BB8DDE245ED86C489BA983 /* AccessibilityIdentifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessibilityIdentifiers.swift; sourceTree = ""; }; 04DF593C3F7AF4B2FBAEB05D /* FileManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileManager.swift; sourceTree = ""; }; 0516C69708D5CBDE1A8E77EC /* RoomDirectorySearchProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDirectorySearchProxyProtocol.swift; sourceTree = ""; }; @@ -1475,7 +1478,7 @@ 128501375217576AF0FE3E92 /* RoomAttachmentPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomAttachmentPicker.swift; sourceTree = ""; }; 12B09A94C519227264A41208 /* RoomMembershipDetailsProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMembershipDetailsProxy.swift; sourceTree = ""; }; 12FD5280AF55AB7F50F8E47D /* preview_avatar_room.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = preview_avatar_room.jpg; sourceTree = ""; }; - 1304D9191300873EADA52D6E /* IntegrationTests.xctestplan */ = {isa = PBXFileReference; path = IntegrationTests.xctestplan; sourceTree = ""; }; + 1304D9191300873EADA52D6E /* IntegrationTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = IntegrationTests.xctestplan; sourceTree = ""; }; 130ED565A078F7E0B59D9D25 /* UNTextInputNotificationResponse+Creator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UNTextInputNotificationResponse+Creator.swift"; sourceTree = ""; }; 136F80A613B55BDD071DCEA5 /* JoinRoomScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinRoomScreenModels.swift; sourceTree = ""; }; 13802897C7AFA360EA74C0B0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = ""; }; @@ -1496,6 +1499,9 @@ 1715E3D7F53C0748AA50C91C /* PostHogAnalyticsClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogAnalyticsClient.swift; sourceTree = ""; }; 17A8AA0DFA06012A9DAB951E /* TimelineProxyMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineProxyMock.swift; sourceTree = ""; }; 17BAE25A0E9E9F2F1BBA8930 /* DeactivateAccountScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeactivateAccountScreenViewModel.swift; sourceTree = ""; }; + 183CFD902E054B2F00995797 /* RoomPowerLevelsProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomPowerLevelsProxy.swift; sourceTree = ""; }; + 183CFD942E055BFF00995797 /* RoomPowerLevelProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomPowerLevelProxyProtocol.swift; sourceTree = ""; }; + 183CFD962E055C5100995797 /* RoomPowerLevelsProxyMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomPowerLevelsProxyMock.swift; sourceTree = ""; }; 18486B87745B1811E7FBD3D2 /* AnalyticsPromptScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsPromptScreenModels.swift; sourceTree = ""; }; 184CF8C196BE143AE226628D /* DecorationTimelineItemProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DecorationTimelineItemProtocol.swift; sourceTree = ""; }; 18F2958E6D247AE2516BEEE8 /* ClientProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientProxy.swift; sourceTree = ""; }; @@ -1578,7 +1584,7 @@ 25F7FE40EF7490A7E09D7BE6 /* NotificationItemProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationItemProxy.swift; sourceTree = ""; }; 25F8664F1FB95AF3C4202478 /* PollFormScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PollFormScreenCoordinator.swift; sourceTree = ""; }; 260004737C573A56FA01E86E /* Encodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Encodable.swift; sourceTree = ""; }; - 267BB1D5B08A9511F894CB57 /* PreviewTests.xctestplan */ = {isa = PBXFileReference; path = PreviewTests.xctestplan; sourceTree = ""; }; + 267BB1D5B08A9511F894CB57 /* PreviewTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = PreviewTests.xctestplan; sourceTree = ""; }; 26B0A96B8FE4849227945067 /* VoiceMessageRecorder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceMessageRecorder.swift; sourceTree = ""; }; 26EAAB54C6CE91D64B69A9F8 /* AppLockServiceProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockServiceProtocol.swift; sourceTree = ""; }; 2711E5996016ABD6EAAEB58A /* LogLevel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogLevel.swift; sourceTree = ""; }; @@ -1655,7 +1661,7 @@ 3558A15CFB934F9229301527 /* RestorationToken.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RestorationToken.swift; sourceTree = ""; }; 35AFCF4C05DEED04E3DB1A16 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; 35FA991289149D31F4286747 /* UserPreference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserPreference.swift; sourceTree = ""; }; - 36DA824791172B9821EACBED /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; + 36DA824791172B9821EACBED /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 36FD673E24FBFCFDF398716A /* RoomMemberProxyMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMemberProxyMock.swift; sourceTree = ""; }; 37A63A59BFDDC494B1C20119 /* CallScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallScreenViewModel.swift; sourceTree = ""; }; 37CA26F55123E36B50DB0B3A /* AttributedStringTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttributedStringTests.swift; sourceTree = ""; }; @@ -2070,7 +2076,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 = ""; }; 8DA1E8F287680C8ED25EDBAC /* NetworkMonitorMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkMonitorMock.swift; sourceTree = ""; }; - 8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; path = UITests.xctestplan; sourceTree = ""; }; + 8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UITests.xctestplan; sourceTree = ""; }; 8E1584F8BCF407BB94F48F04 /* EncryptionResetPasswordScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncryptionResetPasswordScreen.swift; sourceTree = ""; }; 8EAF4A49F3ACD8BB8B0D2371 /* ClientSDKMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientSDKMock.swift; sourceTree = ""; }; 8F062DD2CCD95DC33528A16F /* KnockRequestProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KnockRequestProxy.swift; sourceTree = ""; }; @@ -2278,7 +2284,7 @@ B53AC78E49A297AC1D72A7CF /* AppMediator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppMediator.swift; sourceTree = ""; }; B590BD4507D4F0A377FDE01A /* LoadableAvatarImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadableAvatarImage.swift; sourceTree = ""; }; B5D829FD8958376614504B18 /* TargetConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TargetConfiguration.swift; sourceTree = ""; }; - B61C339A2FDDBD067FF6635C /* ConfettiScene.scn */ = {isa = PBXFileReference; path = ConfettiScene.scn; sourceTree = ""; }; + B61C339A2FDDBD067FF6635C /* ConfettiScene.scn */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; path = ConfettiScene.scn; sourceTree = ""; }; B6404166CBF5CC88673FF9E2 /* RoomDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDetails.swift; sourceTree = ""; }; B655A536341D2695158C6664 /* AuthenticationClientBuilderFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationClientBuilderFactory.swift; sourceTree = ""; }; B65DDCF8E41759890355ACBC /* AuthenticationStartScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationStartScreenViewModelProtocol.swift; sourceTree = ""; }; @@ -2306,7 +2312,7 @@ BA40B98B098B6F0371B750B3 /* TemplateScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateScreenModels.swift; sourceTree = ""; }; BA919F521E9F0EE3638AFC85 /* BugReportScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BugReportScreen.swift; sourceTree = ""; }; BB284643AF7AB131E307DCE0 /* AudioSessionProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioSessionProtocol.swift; sourceTree = ""; }; - BB576F4118C35E6B5124FA22 /* test_apple_image.heic */ = {isa = PBXFileReference; path = test_apple_image.heic; sourceTree = ""; }; + BB576F4118C35E6B5124FA22 /* test_apple_image.heic */ = {isa = PBXFileReference; lastKnownFileType = file; path = test_apple_image.heic; sourceTree = ""; }; BB5B00A014307CE37B2812CD /* TimelineViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineViewModelProtocol.swift; sourceTree = ""; }; BB6ED50FE104992419310EEB /* NotificationHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationHandler.swift; sourceTree = ""; }; BB8BC4C791D0E88CFCF4E5DF /* ServerSelectionScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSelectionScreenCoordinator.swift; sourceTree = ""; }; @@ -2404,7 +2410,7 @@ CDB3227C7A74B734924942E9 /* RoomSummaryProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryProvider.swift; sourceTree = ""; }; CDE3F3911FF7CC639BDE5844 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = ""; }; CEE20623EB4A9B88FB29F2BA /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/SAS.strings; sourceTree = ""; }; - CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; path = UnitTests.xctestplan; sourceTree = ""; }; + CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UnitTests.xctestplan; sourceTree = ""; }; D01FD1171FF40E34D707FD00 /* BigIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigIcon.swift; sourceTree = ""; }; D03D7ECAC68C2FFB8CF01BCB /* DeactivateAccountScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeactivateAccountScreen.swift; sourceTree = ""; }; D046ABB22E680F7C5054441B /* SecurityAndPrivacyScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecurityAndPrivacyScreenViewModelProtocol.swift; sourceTree = ""; }; @@ -2466,7 +2472,7 @@ DC0AEA686E425F86F6BA0404 /* UNNotification+Creator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UNNotification+Creator.swift"; sourceTree = ""; }; DC10CCC8D68B863E20660DBC /* MessageForwardingScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageForwardingScreenViewModelProtocol.swift; sourceTree = ""; }; DC528B3764E3CF7FCFEF40E7 /* PollInteractionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PollInteractionHandler.swift; sourceTree = ""; }; - DCA2D836BD10303F37FAAEED /* test_voice_message.m4a */ = {isa = PBXFileReference; path = test_voice_message.m4a; sourceTree = ""; }; + DCA2D836BD10303F37FAAEED /* test_voice_message.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = test_voice_message.m4a; sourceTree = ""; }; DCAC01A97A43BE07B9E94E43 /* ShareExtensionModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareExtensionModels.swift; sourceTree = ""; }; DCDAB580109C09A6AA97AF7E /* PollFormScreenTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PollFormScreenTests.swift; sourceTree = ""; }; DCF239C619971FDE48132550 /* SecureBackupLogoutConfirmationScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackupLogoutConfirmationScreenModels.swift; sourceTree = ""; }; @@ -2509,7 +2515,7 @@ E5272BC4A60B6AD7553BACA1 /* BlurHashDecode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlurHashDecode.swift; sourceTree = ""; }; E53BFB7E4F329621C844E8C3 /* AnalyticsPromptScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsPromptScreen.swift; sourceTree = ""; }; E55B5EA766E89FF1F87C3ACB /* RoomNotificationSettingsProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomNotificationSettingsProxyProtocol.swift; sourceTree = ""; }; - E5E7D4EE7CA295E5039FDA21 /* portrait_test_video.mp4 */ = {isa = PBXFileReference; path = portrait_test_video.mp4; sourceTree = ""; }; + E5E7D4EE7CA295E5039FDA21 /* portrait_test_video.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = portrait_test_video.mp4; sourceTree = ""; }; E5E94DCFEE803E5ABAE8ACCE /* KeychainControllerProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainControllerProtocol.swift; sourceTree = ""; }; E5F2B6443D1ED8602F328539 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ru; path = ru.lproj/Localizable.stringsdict; sourceTree = ""; }; E5FDFAA04174CC99FB66391C /* EditRoomAddressScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditRoomAddressScreenViewModel.swift; sourceTree = ""; }; @@ -2551,7 +2557,7 @@ ED0CBEAB5F796BEFBAF7BB6A /* VideoRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoRoomTimelineView.swift; sourceTree = ""; }; ED1D792EB82506A19A72C8DE /* RoomTimelineItemProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTimelineItemProtocol.swift; sourceTree = ""; }; ED33988DA4FD4FC666800106 /* SessionVerificationScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionVerificationScreenViewModel.swift; sourceTree = ""; }; - ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; path = message.caf; sourceTree = ""; }; + ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = message.caf; sourceTree = ""; }; ED49073BB1C1FC649DAC2CCD /* LocationRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationRoomTimelineView.swift; sourceTree = ""; }; ED60E4D2CD678E1EBF16F77A /* BlockedUsersScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlockedUsersScreen.swift; sourceTree = ""; }; EE378083653EF0C9B5E9D580 /* EmoteRoomTimelineItemContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmoteRoomTimelineItemContent.swift; sourceTree = ""; }; @@ -3286,6 +3292,7 @@ 31CE4DA53232AA534057F912 /* Mocks */ = { isa = PBXGroup; children = ( + 183CFD962E055C5100995797 /* RoomPowerLevelsProxyMock.swift */, 69CB8242D69B7E4D0B32E18D /* AggregatedReactionMock.swift */, 3BAC027034248429A438886B /* AppMediatorMock.swift */, 0554FEA301486A8CFA475D5A /* AuthenticationClientBuilderFactoryMock.swift */, @@ -3634,6 +3641,8 @@ 40E6246F03D1FE377BC5D963 /* Room */ = { isa = PBXGroup; children = ( + 183CFD902E054B2F00995797 /* RoomPowerLevelsProxy.swift */, + 183CFD942E055BFF00995797 /* RoomPowerLevelProxyProtocol.swift */, C30F45308428A4D9FFDB2FB8 /* BannedRoomProxy.swift */, 0E95B3BDB80531C85CD50AE6 /* InvitedRoomProxy.swift */, 07C6B0B087FE6601C3F77816 /* JoinedRoomProxy.swift */, @@ -6486,7 +6495,6 @@ EC6D0C817B1C21D9D096505A /* XCRemoteSwiftPackageReference "Version" */, EE40B0E16A55BD23ECBFFD22 /* XCRemoteSwiftPackageReference "matrix-rich-text-editor-swift" */, ); - preferredProjectObjectVersion = 54; projectDirPath = ""; projectRoot = ""; targets = ( @@ -7112,6 +7120,7 @@ BB6BF528BC7F5B87E08C4F18 /* CameraPicker.swift in Sources */, E14E469CD97550D0FC58F3CA /* CancellableTask.swift in Sources */, DF8F1211F2B0B56F0FCCA5C2 /* CertificateValidatorHook.swift in Sources */, + 183CFD952E055C0400995797 /* RoomPowerLevelProxyProtocol.swift in Sources */, D885B783B95AD7832D4EF5DD /* CharacterSet.swift in Sources */, C80E06ED97CE52704A46C148 /* ClientBuilder.swift in Sources */, 87CEA3E07B602705BC2D2A20 /* ClientBuilderHook.swift in Sources */, @@ -7415,6 +7424,7 @@ 53A59720F4729D9BBFFB7CAB /* NotificationSettingsEditScreenCoordinator.swift in Sources */, 4EA1CE0E88EA68E862FF0EA2 /* NotificationSettingsEditScreenModels.swift in Sources */, 119AE9A3FC6E0606C1146528 /* NotificationSettingsEditScreenRoomCell.swift in Sources */, + 183CFD912E054B3400995797 /* RoomPowerLevelsProxy.swift in Sources */, D5FE90A6AF5FD5AE91BD37C7 /* NotificationSettingsEditScreenViewModel.swift in Sources */, 2F623DA1122140A987B34D08 /* NotificationSettingsEditScreenViewModelProtocol.swift in Sources */, B93FA0DA1504B301CAEE141B /* NotificationSettingsProxy.swift in Sources */, @@ -7687,6 +7697,7 @@ 91D1A46A733EC24C081DD353 /* SessionVerificationRequestDetailsView.swift in Sources */, 707E49BE07E8EB8A13C0EB1E /* SessionVerificationScreen.swift in Sources */, D02DEB36D32A72A1B365E452 /* SessionVerificationScreenCoordinator.swift in Sources */, + 183CFD972E055C5600995797 /* RoomPowerLevelsProxyMock.swift in Sources */, 5710AAB27D5D866292C1FE06 /* SessionVerificationScreenModels.swift in Sources */, 601AB75BD52B0B4276CEB84A /* SessionVerificationScreenStateMachine.swift in Sources */, 4A8287E5281B44A8754BE509 /* SessionVerificationScreenViewModel.swift in Sources */, @@ -8148,9 +8159,7 @@ "@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; @@ -8199,9 +8208,7 @@ "@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)"; @@ -8227,9 +8234,7 @@ "@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)"; @@ -8454,9 +8459,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - OTHER_SWIFT_FLAGS = ( - "-DDEBUG", - ); + OTHER_SWIFT_FLAGS = "-DDEBUG"; PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.ui.tests"; PRODUCT_NAME = UITests; SDKROOT = iphoneos; @@ -8475,9 +8478,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - OTHER_SWIFT_FLAGS = ( - "-DRELEASE", - ); + OTHER_SWIFT_FLAGS = "-DRELEASE"; PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.ui.tests"; PRODUCT_NAME = UITests; SDKROOT = iphoneos; @@ -8499,9 +8500,7 @@ "@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; @@ -8732,7 +8731,7 @@ repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift"; requirement = { kind = exactVersion; - version = 25.06.18; + version = 25.06.20; }; }; 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 292fe44a7..2edf465b6 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -158,8 +158,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/matrix-rust-components-swift", "state" : { - "revision" : "6f6885adeb33f67fabeb9f732e8781b4f72e8955", - "version" : "25.6.18" + "revision" : "68abbf0622825f008e2e9f70678b2433006e38ef", + "version" : "25.6.20" } }, { diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index 129e53c50..48c17dd06 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -8633,13 +8633,13 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Sendable { return powerLevelsCallsCount > 0 } - var powerLevelsUnderlyingReturnValue: Result! - var powerLevelsReturnValue: Result! { + var powerLevelsUnderlyingReturnValue: Result! + var powerLevelsReturnValue: Result! { get { if Thread.isMainThread { return powerLevelsUnderlyingReturnValue } else { - var returnValue: Result? = nil + var returnValue: Result? = nil DispatchQueue.main.sync { returnValue = powerLevelsUnderlyingReturnValue } @@ -8657,9 +8657,9 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Sendable { } } } - var powerLevelsClosure: (() async -> Result)? + var powerLevelsClosure: (() async -> Result)? - func powerLevels() async -> Result { + func powerLevels() async -> Result { powerLevelsCallsCount += 1 if let powerLevelsClosure = powerLevelsClosure { return await powerLevelsClosure() @@ -8767,13 +8767,13 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Sendable { return resetPowerLevelsCallsCount > 0 } - var resetPowerLevelsUnderlyingReturnValue: Result! - var resetPowerLevelsReturnValue: Result! { + var resetPowerLevelsUnderlyingReturnValue: Result! + var resetPowerLevelsReturnValue: Result! { get { if Thread.isMainThread { return resetPowerLevelsUnderlyingReturnValue } else { - var returnValue: Result? = nil + var returnValue: Result? = nil DispatchQueue.main.sync { returnValue = resetPowerLevelsUnderlyingReturnValue } @@ -8791,9 +8791,9 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Sendable { } } } - var resetPowerLevelsClosure: (() async -> Result)? + var resetPowerLevelsClosure: (() async -> Result)? - func resetPowerLevels() async -> Result { + func resetPowerLevels() async -> Result { resetPowerLevelsCallsCount += 1 if let resetPowerLevelsClosure = resetPowerLevelsClosure { return await resetPowerLevelsClosure() @@ -8941,636 +8941,6 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Sendable { return updatePowerLevelsForUsersReturnValue } } - //MARK: - canUser - - var canUserUserIDSendMessageUnderlyingCallsCount = 0 - var canUserUserIDSendMessageCallsCount: Int { - get { - if Thread.isMainThread { - return canUserUserIDSendMessageUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserUserIDSendMessageUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserUserIDSendMessageUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserUserIDSendMessageUnderlyingCallsCount = newValue - } - } - } - } - var canUserUserIDSendMessageCalled: Bool { - return canUserUserIDSendMessageCallsCount > 0 - } - var canUserUserIDSendMessageReceivedArguments: (userID: String, messageType: MessageLikeEventType)? - var canUserUserIDSendMessageReceivedInvocations: [(userID: String, messageType: MessageLikeEventType)] = [] - - var canUserUserIDSendMessageUnderlyingReturnValue: Result! - var canUserUserIDSendMessageReturnValue: Result! { - get { - if Thread.isMainThread { - return canUserUserIDSendMessageUnderlyingReturnValue - } else { - var returnValue: Result? = nil - DispatchQueue.main.sync { - returnValue = canUserUserIDSendMessageUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserUserIDSendMessageUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserUserIDSendMessageUnderlyingReturnValue = newValue - } - } - } - } - var canUserUserIDSendMessageClosure: ((String, MessageLikeEventType) async -> Result)? - - func canUser(userID: String, sendMessage messageType: MessageLikeEventType) async -> Result { - canUserUserIDSendMessageCallsCount += 1 - canUserUserIDSendMessageReceivedArguments = (userID: userID, messageType: messageType) - DispatchQueue.main.async { - self.canUserUserIDSendMessageReceivedInvocations.append((userID: userID, messageType: messageType)) - } - if let canUserUserIDSendMessageClosure = canUserUserIDSendMessageClosure { - return await canUserUserIDSendMessageClosure(userID, messageType) - } else { - return canUserUserIDSendMessageReturnValue - } - } - //MARK: - canUser - - var canUserUserIDSendStateEventUnderlyingCallsCount = 0 - var canUserUserIDSendStateEventCallsCount: Int { - get { - if Thread.isMainThread { - return canUserUserIDSendStateEventUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserUserIDSendStateEventUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserUserIDSendStateEventUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserUserIDSendStateEventUnderlyingCallsCount = newValue - } - } - } - } - var canUserUserIDSendStateEventCalled: Bool { - return canUserUserIDSendStateEventCallsCount > 0 - } - var canUserUserIDSendStateEventReceivedArguments: (userID: String, event: StateEventType)? - var canUserUserIDSendStateEventReceivedInvocations: [(userID: String, event: StateEventType)] = [] - - var canUserUserIDSendStateEventUnderlyingReturnValue: Result! - var canUserUserIDSendStateEventReturnValue: Result! { - get { - if Thread.isMainThread { - return canUserUserIDSendStateEventUnderlyingReturnValue - } else { - var returnValue: Result? = nil - DispatchQueue.main.sync { - returnValue = canUserUserIDSendStateEventUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserUserIDSendStateEventUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserUserIDSendStateEventUnderlyingReturnValue = newValue - } - } - } - } - var canUserUserIDSendStateEventClosure: ((String, StateEventType) async -> Result)? - - func canUser(userID: String, sendStateEvent event: StateEventType) async -> Result { - canUserUserIDSendStateEventCallsCount += 1 - canUserUserIDSendStateEventReceivedArguments = (userID: userID, event: event) - DispatchQueue.main.async { - self.canUserUserIDSendStateEventReceivedInvocations.append((userID: userID, event: event)) - } - if let canUserUserIDSendStateEventClosure = canUserUserIDSendStateEventClosure { - return await canUserUserIDSendStateEventClosure(userID, event) - } else { - return canUserUserIDSendStateEventReturnValue - } - } - //MARK: - canUserInvite - - var canUserInviteUserIDUnderlyingCallsCount = 0 - var canUserInviteUserIDCallsCount: Int { - get { - if Thread.isMainThread { - return canUserInviteUserIDUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserInviteUserIDUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserInviteUserIDUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserInviteUserIDUnderlyingCallsCount = newValue - } - } - } - } - var canUserInviteUserIDCalled: Bool { - return canUserInviteUserIDCallsCount > 0 - } - var canUserInviteUserIDReceivedUserID: String? - var canUserInviteUserIDReceivedInvocations: [String] = [] - - var canUserInviteUserIDUnderlyingReturnValue: Result! - var canUserInviteUserIDReturnValue: Result! { - get { - if Thread.isMainThread { - return canUserInviteUserIDUnderlyingReturnValue - } else { - var returnValue: Result? = nil - DispatchQueue.main.sync { - returnValue = canUserInviteUserIDUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserInviteUserIDUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserInviteUserIDUnderlyingReturnValue = newValue - } - } - } - } - var canUserInviteUserIDClosure: ((String) async -> Result)? - - func canUserInvite(userID: String) async -> Result { - canUserInviteUserIDCallsCount += 1 - canUserInviteUserIDReceivedUserID = userID - DispatchQueue.main.async { - self.canUserInviteUserIDReceivedInvocations.append(userID) - } - if let canUserInviteUserIDClosure = canUserInviteUserIDClosure { - return await canUserInviteUserIDClosure(userID) - } else { - return canUserInviteUserIDReturnValue - } - } - //MARK: - canUserRedactOther - - var canUserRedactOtherUserIDUnderlyingCallsCount = 0 - var canUserRedactOtherUserIDCallsCount: Int { - get { - if Thread.isMainThread { - return canUserRedactOtherUserIDUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserRedactOtherUserIDUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserRedactOtherUserIDUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserRedactOtherUserIDUnderlyingCallsCount = newValue - } - } - } - } - var canUserRedactOtherUserIDCalled: Bool { - return canUserRedactOtherUserIDCallsCount > 0 - } - var canUserRedactOtherUserIDReceivedUserID: String? - var canUserRedactOtherUserIDReceivedInvocations: [String] = [] - - var canUserRedactOtherUserIDUnderlyingReturnValue: Result! - var canUserRedactOtherUserIDReturnValue: Result! { - get { - if Thread.isMainThread { - return canUserRedactOtherUserIDUnderlyingReturnValue - } else { - var returnValue: Result? = nil - DispatchQueue.main.sync { - returnValue = canUserRedactOtherUserIDUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserRedactOtherUserIDUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserRedactOtherUserIDUnderlyingReturnValue = newValue - } - } - } - } - var canUserRedactOtherUserIDClosure: ((String) async -> Result)? - - func canUserRedactOther(userID: String) async -> Result { - canUserRedactOtherUserIDCallsCount += 1 - canUserRedactOtherUserIDReceivedUserID = userID - DispatchQueue.main.async { - self.canUserRedactOtherUserIDReceivedInvocations.append(userID) - } - if let canUserRedactOtherUserIDClosure = canUserRedactOtherUserIDClosure { - return await canUserRedactOtherUserIDClosure(userID) - } else { - return canUserRedactOtherUserIDReturnValue - } - } - //MARK: - canUserRedactOwn - - var canUserRedactOwnUserIDUnderlyingCallsCount = 0 - var canUserRedactOwnUserIDCallsCount: Int { - get { - if Thread.isMainThread { - return canUserRedactOwnUserIDUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserRedactOwnUserIDUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserRedactOwnUserIDUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserRedactOwnUserIDUnderlyingCallsCount = newValue - } - } - } - } - var canUserRedactOwnUserIDCalled: Bool { - return canUserRedactOwnUserIDCallsCount > 0 - } - var canUserRedactOwnUserIDReceivedUserID: String? - var canUserRedactOwnUserIDReceivedInvocations: [String] = [] - - var canUserRedactOwnUserIDUnderlyingReturnValue: Result! - var canUserRedactOwnUserIDReturnValue: Result! { - get { - if Thread.isMainThread { - return canUserRedactOwnUserIDUnderlyingReturnValue - } else { - var returnValue: Result? = nil - DispatchQueue.main.sync { - returnValue = canUserRedactOwnUserIDUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserRedactOwnUserIDUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserRedactOwnUserIDUnderlyingReturnValue = newValue - } - } - } - } - var canUserRedactOwnUserIDClosure: ((String) async -> Result)? - - func canUserRedactOwn(userID: String) async -> Result { - canUserRedactOwnUserIDCallsCount += 1 - canUserRedactOwnUserIDReceivedUserID = userID - DispatchQueue.main.async { - self.canUserRedactOwnUserIDReceivedInvocations.append(userID) - } - if let canUserRedactOwnUserIDClosure = canUserRedactOwnUserIDClosure { - return await canUserRedactOwnUserIDClosure(userID) - } else { - return canUserRedactOwnUserIDReturnValue - } - } - //MARK: - canUserKick - - var canUserKickUserIDUnderlyingCallsCount = 0 - var canUserKickUserIDCallsCount: Int { - get { - if Thread.isMainThread { - return canUserKickUserIDUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserKickUserIDUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserKickUserIDUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserKickUserIDUnderlyingCallsCount = newValue - } - } - } - } - var canUserKickUserIDCalled: Bool { - return canUserKickUserIDCallsCount > 0 - } - var canUserKickUserIDReceivedUserID: String? - var canUserKickUserIDReceivedInvocations: [String] = [] - - var canUserKickUserIDUnderlyingReturnValue: Result! - var canUserKickUserIDReturnValue: Result! { - get { - if Thread.isMainThread { - return canUserKickUserIDUnderlyingReturnValue - } else { - var returnValue: Result? = nil - DispatchQueue.main.sync { - returnValue = canUserKickUserIDUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserKickUserIDUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserKickUserIDUnderlyingReturnValue = newValue - } - } - } - } - var canUserKickUserIDClosure: ((String) async -> Result)? - - func canUserKick(userID: String) async -> Result { - canUserKickUserIDCallsCount += 1 - canUserKickUserIDReceivedUserID = userID - DispatchQueue.main.async { - self.canUserKickUserIDReceivedInvocations.append(userID) - } - if let canUserKickUserIDClosure = canUserKickUserIDClosure { - return await canUserKickUserIDClosure(userID) - } else { - return canUserKickUserIDReturnValue - } - } - //MARK: - canUserBan - - var canUserBanUserIDUnderlyingCallsCount = 0 - var canUserBanUserIDCallsCount: Int { - get { - if Thread.isMainThread { - return canUserBanUserIDUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserBanUserIDUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserBanUserIDUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserBanUserIDUnderlyingCallsCount = newValue - } - } - } - } - var canUserBanUserIDCalled: Bool { - return canUserBanUserIDCallsCount > 0 - } - var canUserBanUserIDReceivedUserID: String? - var canUserBanUserIDReceivedInvocations: [String] = [] - - var canUserBanUserIDUnderlyingReturnValue: Result! - var canUserBanUserIDReturnValue: Result! { - get { - if Thread.isMainThread { - return canUserBanUserIDUnderlyingReturnValue - } else { - var returnValue: Result? = nil - DispatchQueue.main.sync { - returnValue = canUserBanUserIDUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserBanUserIDUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserBanUserIDUnderlyingReturnValue = newValue - } - } - } - } - var canUserBanUserIDClosure: ((String) async -> Result)? - - func canUserBan(userID: String) async -> Result { - canUserBanUserIDCallsCount += 1 - canUserBanUserIDReceivedUserID = userID - DispatchQueue.main.async { - self.canUserBanUserIDReceivedInvocations.append(userID) - } - if let canUserBanUserIDClosure = canUserBanUserIDClosure { - return await canUserBanUserIDClosure(userID) - } else { - return canUserBanUserIDReturnValue - } - } - //MARK: - canUserTriggerRoomNotification - - var canUserTriggerRoomNotificationUserIDUnderlyingCallsCount = 0 - var canUserTriggerRoomNotificationUserIDCallsCount: Int { - get { - if Thread.isMainThread { - return canUserTriggerRoomNotificationUserIDUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserTriggerRoomNotificationUserIDUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserTriggerRoomNotificationUserIDUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserTriggerRoomNotificationUserIDUnderlyingCallsCount = newValue - } - } - } - } - var canUserTriggerRoomNotificationUserIDCalled: Bool { - return canUserTriggerRoomNotificationUserIDCallsCount > 0 - } - var canUserTriggerRoomNotificationUserIDReceivedUserID: String? - var canUserTriggerRoomNotificationUserIDReceivedInvocations: [String] = [] - - var canUserTriggerRoomNotificationUserIDUnderlyingReturnValue: Result! - var canUserTriggerRoomNotificationUserIDReturnValue: Result! { - get { - if Thread.isMainThread { - return canUserTriggerRoomNotificationUserIDUnderlyingReturnValue - } else { - var returnValue: Result? = nil - DispatchQueue.main.sync { - returnValue = canUserTriggerRoomNotificationUserIDUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserTriggerRoomNotificationUserIDUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserTriggerRoomNotificationUserIDUnderlyingReturnValue = newValue - } - } - } - } - var canUserTriggerRoomNotificationUserIDClosure: ((String) async -> Result)? - - func canUserTriggerRoomNotification(userID: String) async -> Result { - canUserTriggerRoomNotificationUserIDCallsCount += 1 - canUserTriggerRoomNotificationUserIDReceivedUserID = userID - DispatchQueue.main.async { - self.canUserTriggerRoomNotificationUserIDReceivedInvocations.append(userID) - } - if let canUserTriggerRoomNotificationUserIDClosure = canUserTriggerRoomNotificationUserIDClosure { - return await canUserTriggerRoomNotificationUserIDClosure(userID) - } else { - return canUserTriggerRoomNotificationUserIDReturnValue - } - } - //MARK: - canUserPinOrUnpin - - var canUserPinOrUnpinUserIDUnderlyingCallsCount = 0 - var canUserPinOrUnpinUserIDCallsCount: Int { - get { - if Thread.isMainThread { - return canUserPinOrUnpinUserIDUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserPinOrUnpinUserIDUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserPinOrUnpinUserIDUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserPinOrUnpinUserIDUnderlyingCallsCount = newValue - } - } - } - } - var canUserPinOrUnpinUserIDCalled: Bool { - return canUserPinOrUnpinUserIDCallsCount > 0 - } - var canUserPinOrUnpinUserIDReceivedUserID: String? - var canUserPinOrUnpinUserIDReceivedInvocations: [String] = [] - - var canUserPinOrUnpinUserIDUnderlyingReturnValue: Result! - var canUserPinOrUnpinUserIDReturnValue: Result! { - get { - if Thread.isMainThread { - return canUserPinOrUnpinUserIDUnderlyingReturnValue - } else { - var returnValue: Result? = nil - DispatchQueue.main.sync { - returnValue = canUserPinOrUnpinUserIDUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserPinOrUnpinUserIDUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserPinOrUnpinUserIDUnderlyingReturnValue = newValue - } - } - } - } - var canUserPinOrUnpinUserIDClosure: ((String) async -> Result)? - - func canUserPinOrUnpin(userID: String) async -> Result { - canUserPinOrUnpinUserIDCallsCount += 1 - canUserPinOrUnpinUserIDReceivedUserID = userID - DispatchQueue.main.async { - self.canUserPinOrUnpinUserIDReceivedInvocations.append(userID) - } - if let canUserPinOrUnpinUserIDClosure = canUserPinOrUnpinUserIDClosure { - return await canUserPinOrUnpinUserIDClosure(userID) - } else { - return canUserPinOrUnpinUserIDReturnValue - } - } //MARK: - kickUser var kickUserReasonUnderlyingCallsCount = 0 @@ -9781,76 +9151,6 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Sendable { return unbanUserReturnValue } } - //MARK: - canUserJoinCall - - var canUserJoinCallUserIDUnderlyingCallsCount = 0 - var canUserJoinCallUserIDCallsCount: Int { - get { - if Thread.isMainThread { - return canUserJoinCallUserIDUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserJoinCallUserIDUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserJoinCallUserIDUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserJoinCallUserIDUnderlyingCallsCount = newValue - } - } - } - } - var canUserJoinCallUserIDCalled: Bool { - return canUserJoinCallUserIDCallsCount > 0 - } - var canUserJoinCallUserIDReceivedUserID: String? - var canUserJoinCallUserIDReceivedInvocations: [String] = [] - - var canUserJoinCallUserIDUnderlyingReturnValue: Result! - var canUserJoinCallUserIDReturnValue: Result! { - get { - if Thread.isMainThread { - return canUserJoinCallUserIDUnderlyingReturnValue - } else { - var returnValue: Result? = nil - DispatchQueue.main.sync { - returnValue = canUserJoinCallUserIDUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserJoinCallUserIDUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserJoinCallUserIDUnderlyingReturnValue = newValue - } - } - } - } - var canUserJoinCallUserIDClosure: ((String) async -> Result)? - - func canUserJoinCall(userID: String) async -> Result { - canUserJoinCallUserIDCallsCount += 1 - canUserJoinCallUserIDReceivedUserID = userID - DispatchQueue.main.async { - self.canUserJoinCallUserIDReceivedInvocations.append(userID) - } - if let canUserJoinCallUserIDClosure = canUserJoinCallUserIDClosure { - return await canUserJoinCallUserIDClosure(userID) - } else { - return canUserJoinCallUserIDReturnValue - } - } //MARK: - elementCallWidgetDriver var elementCallWidgetDriverDeviceIDUnderlyingCallsCount = 0 @@ -14142,6 +13442,714 @@ class RoomNotificationSettingsProxyMock: RoomNotificationSettingsProxyProtocol, var underlyingIsDefault: Bool! } +class RoomPowerLevelsProxyMock: RoomPowerLevelsProxyProtocol, @unchecked Sendable { + var values: RoomPowerLevelsValues { + get { return underlyingValues } + set(value) { underlyingValues = value } + } + var underlyingValues: RoomPowerLevelsValues! + + //MARK: - canUser + + var canUserUserIDSendMessageUnderlyingCallsCount = 0 + var canUserUserIDSendMessageCallsCount: Int { + get { + if Thread.isMainThread { + return canUserUserIDSendMessageUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserUserIDSendMessageUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserUserIDSendMessageUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserUserIDSendMessageUnderlyingCallsCount = newValue + } + } + } + } + var canUserUserIDSendMessageCalled: Bool { + return canUserUserIDSendMessageCallsCount > 0 + } + var canUserUserIDSendMessageReceivedArguments: (userID: String, messageType: MessageLikeEventType)? + var canUserUserIDSendMessageReceivedInvocations: [(userID: String, messageType: MessageLikeEventType)] = [] + + var canUserUserIDSendMessageUnderlyingReturnValue: Result! + var canUserUserIDSendMessageReturnValue: Result! { + get { + if Thread.isMainThread { + return canUserUserIDSendMessageUnderlyingReturnValue + } else { + var returnValue: Result? = nil + DispatchQueue.main.sync { + returnValue = canUserUserIDSendMessageUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserUserIDSendMessageUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserUserIDSendMessageUnderlyingReturnValue = newValue + } + } + } + } + var canUserUserIDSendMessageClosure: ((String, MessageLikeEventType) -> Result)? + + func canUser(userID: String, sendMessage messageType: MessageLikeEventType) -> Result { + canUserUserIDSendMessageCallsCount += 1 + canUserUserIDSendMessageReceivedArguments = (userID: userID, messageType: messageType) + DispatchQueue.main.async { + self.canUserUserIDSendMessageReceivedInvocations.append((userID: userID, messageType: messageType)) + } + if let canUserUserIDSendMessageClosure = canUserUserIDSendMessageClosure { + return canUserUserIDSendMessageClosure(userID, messageType) + } else { + return canUserUserIDSendMessageReturnValue + } + } + //MARK: - canUser + + var canUserUserIDSendStateEventUnderlyingCallsCount = 0 + var canUserUserIDSendStateEventCallsCount: Int { + get { + if Thread.isMainThread { + return canUserUserIDSendStateEventUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserUserIDSendStateEventUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserUserIDSendStateEventUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserUserIDSendStateEventUnderlyingCallsCount = newValue + } + } + } + } + var canUserUserIDSendStateEventCalled: Bool { + return canUserUserIDSendStateEventCallsCount > 0 + } + var canUserUserIDSendStateEventReceivedArguments: (userID: String, event: StateEventType)? + var canUserUserIDSendStateEventReceivedInvocations: [(userID: String, event: StateEventType)] = [] + + var canUserUserIDSendStateEventUnderlyingReturnValue: Result! + var canUserUserIDSendStateEventReturnValue: Result! { + get { + if Thread.isMainThread { + return canUserUserIDSendStateEventUnderlyingReturnValue + } else { + var returnValue: Result? = nil + DispatchQueue.main.sync { + returnValue = canUserUserIDSendStateEventUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserUserIDSendStateEventUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserUserIDSendStateEventUnderlyingReturnValue = newValue + } + } + } + } + var canUserUserIDSendStateEventClosure: ((String, StateEventType) -> Result)? + + func canUser(userID: String, sendStateEvent event: StateEventType) -> Result { + canUserUserIDSendStateEventCallsCount += 1 + canUserUserIDSendStateEventReceivedArguments = (userID: userID, event: event) + DispatchQueue.main.async { + self.canUserUserIDSendStateEventReceivedInvocations.append((userID: userID, event: event)) + } + if let canUserUserIDSendStateEventClosure = canUserUserIDSendStateEventClosure { + return canUserUserIDSendStateEventClosure(userID, event) + } else { + return canUserUserIDSendStateEventReturnValue + } + } + //MARK: - canUserInvite + + var canUserInviteUserIDUnderlyingCallsCount = 0 + var canUserInviteUserIDCallsCount: Int { + get { + if Thread.isMainThread { + return canUserInviteUserIDUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserInviteUserIDUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserInviteUserIDUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserInviteUserIDUnderlyingCallsCount = newValue + } + } + } + } + var canUserInviteUserIDCalled: Bool { + return canUserInviteUserIDCallsCount > 0 + } + var canUserInviteUserIDReceivedUserID: String? + var canUserInviteUserIDReceivedInvocations: [String] = [] + + var canUserInviteUserIDUnderlyingReturnValue: Result! + var canUserInviteUserIDReturnValue: Result! { + get { + if Thread.isMainThread { + return canUserInviteUserIDUnderlyingReturnValue + } else { + var returnValue: Result? = nil + DispatchQueue.main.sync { + returnValue = canUserInviteUserIDUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserInviteUserIDUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserInviteUserIDUnderlyingReturnValue = newValue + } + } + } + } + var canUserInviteUserIDClosure: ((String) -> Result)? + + func canUserInvite(userID: String) -> Result { + canUserInviteUserIDCallsCount += 1 + canUserInviteUserIDReceivedUserID = userID + DispatchQueue.main.async { + self.canUserInviteUserIDReceivedInvocations.append(userID) + } + if let canUserInviteUserIDClosure = canUserInviteUserIDClosure { + return canUserInviteUserIDClosure(userID) + } else { + return canUserInviteUserIDReturnValue + } + } + //MARK: - canUserRedactOther + + var canUserRedactOtherUserIDUnderlyingCallsCount = 0 + var canUserRedactOtherUserIDCallsCount: Int { + get { + if Thread.isMainThread { + return canUserRedactOtherUserIDUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserRedactOtherUserIDUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserRedactOtherUserIDUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserRedactOtherUserIDUnderlyingCallsCount = newValue + } + } + } + } + var canUserRedactOtherUserIDCalled: Bool { + return canUserRedactOtherUserIDCallsCount > 0 + } + var canUserRedactOtherUserIDReceivedUserID: String? + var canUserRedactOtherUserIDReceivedInvocations: [String] = [] + + var canUserRedactOtherUserIDUnderlyingReturnValue: Result! + var canUserRedactOtherUserIDReturnValue: Result! { + get { + if Thread.isMainThread { + return canUserRedactOtherUserIDUnderlyingReturnValue + } else { + var returnValue: Result? = nil + DispatchQueue.main.sync { + returnValue = canUserRedactOtherUserIDUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserRedactOtherUserIDUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserRedactOtherUserIDUnderlyingReturnValue = newValue + } + } + } + } + var canUserRedactOtherUserIDClosure: ((String) -> Result)? + + func canUserRedactOther(userID: String) -> Result { + canUserRedactOtherUserIDCallsCount += 1 + canUserRedactOtherUserIDReceivedUserID = userID + DispatchQueue.main.async { + self.canUserRedactOtherUserIDReceivedInvocations.append(userID) + } + if let canUserRedactOtherUserIDClosure = canUserRedactOtherUserIDClosure { + return canUserRedactOtherUserIDClosure(userID) + } else { + return canUserRedactOtherUserIDReturnValue + } + } + //MARK: - canUserRedactOwn + + var canUserRedactOwnUserIDUnderlyingCallsCount = 0 + var canUserRedactOwnUserIDCallsCount: Int { + get { + if Thread.isMainThread { + return canUserRedactOwnUserIDUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserRedactOwnUserIDUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserRedactOwnUserIDUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserRedactOwnUserIDUnderlyingCallsCount = newValue + } + } + } + } + var canUserRedactOwnUserIDCalled: Bool { + return canUserRedactOwnUserIDCallsCount > 0 + } + var canUserRedactOwnUserIDReceivedUserID: String? + var canUserRedactOwnUserIDReceivedInvocations: [String] = [] + + var canUserRedactOwnUserIDUnderlyingReturnValue: Result! + var canUserRedactOwnUserIDReturnValue: Result! { + get { + if Thread.isMainThread { + return canUserRedactOwnUserIDUnderlyingReturnValue + } else { + var returnValue: Result? = nil + DispatchQueue.main.sync { + returnValue = canUserRedactOwnUserIDUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserRedactOwnUserIDUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserRedactOwnUserIDUnderlyingReturnValue = newValue + } + } + } + } + var canUserRedactOwnUserIDClosure: ((String) -> Result)? + + func canUserRedactOwn(userID: String) -> Result { + canUserRedactOwnUserIDCallsCount += 1 + canUserRedactOwnUserIDReceivedUserID = userID + DispatchQueue.main.async { + self.canUserRedactOwnUserIDReceivedInvocations.append(userID) + } + if let canUserRedactOwnUserIDClosure = canUserRedactOwnUserIDClosure { + return canUserRedactOwnUserIDClosure(userID) + } else { + return canUserRedactOwnUserIDReturnValue + } + } + //MARK: - canUserKick + + var canUserKickUserIDUnderlyingCallsCount = 0 + var canUserKickUserIDCallsCount: Int { + get { + if Thread.isMainThread { + return canUserKickUserIDUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserKickUserIDUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserKickUserIDUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserKickUserIDUnderlyingCallsCount = newValue + } + } + } + } + var canUserKickUserIDCalled: Bool { + return canUserKickUserIDCallsCount > 0 + } + var canUserKickUserIDReceivedUserID: String? + var canUserKickUserIDReceivedInvocations: [String] = [] + + var canUserKickUserIDUnderlyingReturnValue: Result! + var canUserKickUserIDReturnValue: Result! { + get { + if Thread.isMainThread { + return canUserKickUserIDUnderlyingReturnValue + } else { + var returnValue: Result? = nil + DispatchQueue.main.sync { + returnValue = canUserKickUserIDUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserKickUserIDUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserKickUserIDUnderlyingReturnValue = newValue + } + } + } + } + var canUserKickUserIDClosure: ((String) -> Result)? + + func canUserKick(userID: String) -> Result { + canUserKickUserIDCallsCount += 1 + canUserKickUserIDReceivedUserID = userID + DispatchQueue.main.async { + self.canUserKickUserIDReceivedInvocations.append(userID) + } + if let canUserKickUserIDClosure = canUserKickUserIDClosure { + return canUserKickUserIDClosure(userID) + } else { + return canUserKickUserIDReturnValue + } + } + //MARK: - canUserBan + + var canUserBanUserIDUnderlyingCallsCount = 0 + var canUserBanUserIDCallsCount: Int { + get { + if Thread.isMainThread { + return canUserBanUserIDUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserBanUserIDUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserBanUserIDUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserBanUserIDUnderlyingCallsCount = newValue + } + } + } + } + var canUserBanUserIDCalled: Bool { + return canUserBanUserIDCallsCount > 0 + } + var canUserBanUserIDReceivedUserID: String? + var canUserBanUserIDReceivedInvocations: [String] = [] + + var canUserBanUserIDUnderlyingReturnValue: Result! + var canUserBanUserIDReturnValue: Result! { + get { + if Thread.isMainThread { + return canUserBanUserIDUnderlyingReturnValue + } else { + var returnValue: Result? = nil + DispatchQueue.main.sync { + returnValue = canUserBanUserIDUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserBanUserIDUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserBanUserIDUnderlyingReturnValue = newValue + } + } + } + } + var canUserBanUserIDClosure: ((String) -> Result)? + + func canUserBan(userID: String) -> Result { + canUserBanUserIDCallsCount += 1 + canUserBanUserIDReceivedUserID = userID + DispatchQueue.main.async { + self.canUserBanUserIDReceivedInvocations.append(userID) + } + if let canUserBanUserIDClosure = canUserBanUserIDClosure { + return canUserBanUserIDClosure(userID) + } else { + return canUserBanUserIDReturnValue + } + } + //MARK: - canUserTriggerRoomNotification + + var canUserTriggerRoomNotificationUserIDUnderlyingCallsCount = 0 + var canUserTriggerRoomNotificationUserIDCallsCount: Int { + get { + if Thread.isMainThread { + return canUserTriggerRoomNotificationUserIDUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserTriggerRoomNotificationUserIDUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserTriggerRoomNotificationUserIDUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserTriggerRoomNotificationUserIDUnderlyingCallsCount = newValue + } + } + } + } + var canUserTriggerRoomNotificationUserIDCalled: Bool { + return canUserTriggerRoomNotificationUserIDCallsCount > 0 + } + var canUserTriggerRoomNotificationUserIDReceivedUserID: String? + var canUserTriggerRoomNotificationUserIDReceivedInvocations: [String] = [] + + var canUserTriggerRoomNotificationUserIDUnderlyingReturnValue: Result! + var canUserTriggerRoomNotificationUserIDReturnValue: Result! { + get { + if Thread.isMainThread { + return canUserTriggerRoomNotificationUserIDUnderlyingReturnValue + } else { + var returnValue: Result? = nil + DispatchQueue.main.sync { + returnValue = canUserTriggerRoomNotificationUserIDUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserTriggerRoomNotificationUserIDUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserTriggerRoomNotificationUserIDUnderlyingReturnValue = newValue + } + } + } + } + var canUserTriggerRoomNotificationUserIDClosure: ((String) -> Result)? + + func canUserTriggerRoomNotification(userID: String) -> Result { + canUserTriggerRoomNotificationUserIDCallsCount += 1 + canUserTriggerRoomNotificationUserIDReceivedUserID = userID + DispatchQueue.main.async { + self.canUserTriggerRoomNotificationUserIDReceivedInvocations.append(userID) + } + if let canUserTriggerRoomNotificationUserIDClosure = canUserTriggerRoomNotificationUserIDClosure { + return canUserTriggerRoomNotificationUserIDClosure(userID) + } else { + return canUserTriggerRoomNotificationUserIDReturnValue + } + } + //MARK: - canUserPinOrUnpin + + var canUserPinOrUnpinUserIDUnderlyingCallsCount = 0 + var canUserPinOrUnpinUserIDCallsCount: Int { + get { + if Thread.isMainThread { + return canUserPinOrUnpinUserIDUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserPinOrUnpinUserIDUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserPinOrUnpinUserIDUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserPinOrUnpinUserIDUnderlyingCallsCount = newValue + } + } + } + } + var canUserPinOrUnpinUserIDCalled: Bool { + return canUserPinOrUnpinUserIDCallsCount > 0 + } + var canUserPinOrUnpinUserIDReceivedUserID: String? + var canUserPinOrUnpinUserIDReceivedInvocations: [String] = [] + + var canUserPinOrUnpinUserIDUnderlyingReturnValue: Result! + var canUserPinOrUnpinUserIDReturnValue: Result! { + get { + if Thread.isMainThread { + return canUserPinOrUnpinUserIDUnderlyingReturnValue + } else { + var returnValue: Result? = nil + DispatchQueue.main.sync { + returnValue = canUserPinOrUnpinUserIDUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserPinOrUnpinUserIDUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserPinOrUnpinUserIDUnderlyingReturnValue = newValue + } + } + } + } + var canUserPinOrUnpinUserIDClosure: ((String) -> Result)? + + func canUserPinOrUnpin(userID: String) -> Result { + canUserPinOrUnpinUserIDCallsCount += 1 + canUserPinOrUnpinUserIDReceivedUserID = userID + DispatchQueue.main.async { + self.canUserPinOrUnpinUserIDReceivedInvocations.append(userID) + } + if let canUserPinOrUnpinUserIDClosure = canUserPinOrUnpinUserIDClosure { + return canUserPinOrUnpinUserIDClosure(userID) + } else { + return canUserPinOrUnpinUserIDReturnValue + } + } + //MARK: - canUserJoinCall + + var canUserJoinCallUserIDUnderlyingCallsCount = 0 + var canUserJoinCallUserIDCallsCount: Int { + get { + if Thread.isMainThread { + return canUserJoinCallUserIDUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserJoinCallUserIDUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserJoinCallUserIDUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserJoinCallUserIDUnderlyingCallsCount = newValue + } + } + } + } + var canUserJoinCallUserIDCalled: Bool { + return canUserJoinCallUserIDCallsCount > 0 + } + var canUserJoinCallUserIDReceivedUserID: String? + var canUserJoinCallUserIDReceivedInvocations: [String] = [] + + var canUserJoinCallUserIDUnderlyingReturnValue: Result! + var canUserJoinCallUserIDReturnValue: Result! { + get { + if Thread.isMainThread { + return canUserJoinCallUserIDUnderlyingReturnValue + } else { + var returnValue: Result? = nil + DispatchQueue.main.sync { + returnValue = canUserJoinCallUserIDUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserJoinCallUserIDUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserJoinCallUserIDUnderlyingReturnValue = newValue + } + } + } + } + var canUserJoinCallUserIDClosure: ((String) -> Result)? + + func canUserJoinCall(userID: String) -> Result { + canUserJoinCallUserIDCallsCount += 1 + canUserJoinCallUserIDReceivedUserID = userID + DispatchQueue.main.async { + self.canUserJoinCallUserIDReceivedInvocations.append(userID) + } + if let canUserJoinCallUserIDClosure = canUserJoinCallUserIDClosure { + return canUserJoinCallUserIDClosure(userID) + } else { + return canUserJoinCallUserIDReturnValue + } + } +} class RoomPreviewProxyMock: RoomPreviewProxyProtocol, @unchecked Sendable { var info: RoomPreviewInfoProxy { get { return underlyingInfo } diff --git a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift index d866b4bb7..8d82a3852 100644 --- a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift @@ -2449,6 +2449,75 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable { } } + //MARK: - isLivekitRtcSupported + + open var isLivekitRtcSupportedThrowableError: Error? + var isLivekitRtcSupportedUnderlyingCallsCount = 0 + open var isLivekitRtcSupportedCallsCount: Int { + get { + if Thread.isMainThread { + return isLivekitRtcSupportedUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = isLivekitRtcSupportedUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + isLivekitRtcSupportedUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + isLivekitRtcSupportedUnderlyingCallsCount = newValue + } + } + } + } + open var isLivekitRtcSupportedCalled: Bool { + return isLivekitRtcSupportedCallsCount > 0 + } + + var isLivekitRtcSupportedUnderlyingReturnValue: Bool! + open var isLivekitRtcSupportedReturnValue: Bool! { + get { + if Thread.isMainThread { + return isLivekitRtcSupportedUnderlyingReturnValue + } else { + var returnValue: Bool? = nil + DispatchQueue.main.sync { + returnValue = isLivekitRtcSupportedUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + isLivekitRtcSupportedUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + isLivekitRtcSupportedUnderlyingReturnValue = newValue + } + } + } + } + open var isLivekitRtcSupportedClosure: (() async throws -> Bool)? + + open override func isLivekitRtcSupported() async throws -> Bool { + if let error = isLivekitRtcSupportedThrowableError { + throw error + } + isLivekitRtcSupportedCallsCount += 1 + if let isLivekitRtcSupportedClosure = isLivekitRtcSupportedClosure { + return try await isLivekitRtcSupportedClosure() + } else { + return isLivekitRtcSupportedReturnValue + } + } + //MARK: - isReportRoomApiSupported open var isReportRoomApiSupportedThrowableError: Error? @@ -3257,18 +3326,18 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable { try await removeAvatarClosure?() } - //MARK: - resetServerCapabilities + //MARK: - resetServerInfo - open var resetServerCapabilitiesThrowableError: Error? - var resetServerCapabilitiesUnderlyingCallsCount = 0 - open var resetServerCapabilitiesCallsCount: Int { + open var resetServerInfoThrowableError: Error? + var resetServerInfoUnderlyingCallsCount = 0 + open var resetServerInfoCallsCount: Int { get { if Thread.isMainThread { - return resetServerCapabilitiesUnderlyingCallsCount + return resetServerInfoUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = resetServerCapabilitiesUnderlyingCallsCount + returnValue = resetServerInfoUnderlyingCallsCount } return returnValue! @@ -3276,25 +3345,25 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable { } set { if Thread.isMainThread { - resetServerCapabilitiesUnderlyingCallsCount = newValue + resetServerInfoUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - resetServerCapabilitiesUnderlyingCallsCount = newValue + resetServerInfoUnderlyingCallsCount = newValue } } } } - open var resetServerCapabilitiesCalled: Bool { - return resetServerCapabilitiesCallsCount > 0 + open var resetServerInfoCalled: Bool { + return resetServerInfoCallsCount > 0 } - open var resetServerCapabilitiesClosure: (() async throws -> Void)? + open var resetServerInfoClosure: (() async throws -> Void)? - open override func resetServerCapabilities() async throws { - if let error = resetServerCapabilitiesThrowableError { + open override func resetServerInfo() async throws { + if let error = resetServerInfoThrowableError { throw error } - resetServerCapabilitiesCallsCount += 1 - try await resetServerCapabilitiesClosure?() + resetServerInfoCallsCount += 1 + try await resetServerInfoClosure?() } //MARK: - resolveRoomAlias @@ -11876,681 +11945,6 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable { try await banUserUserIdReasonClosure?(userId, reason) } - //MARK: - canUserBan - - open var canUserBanUserIdThrowableError: Error? - var canUserBanUserIdUnderlyingCallsCount = 0 - open var canUserBanUserIdCallsCount: Int { - get { - if Thread.isMainThread { - return canUserBanUserIdUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserBanUserIdUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserBanUserIdUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserBanUserIdUnderlyingCallsCount = newValue - } - } - } - } - open var canUserBanUserIdCalled: Bool { - return canUserBanUserIdCallsCount > 0 - } - open var canUserBanUserIdReceivedUserId: String? - open var canUserBanUserIdReceivedInvocations: [String] = [] - - var canUserBanUserIdUnderlyingReturnValue: Bool! - open var canUserBanUserIdReturnValue: Bool! { - get { - if Thread.isMainThread { - return canUserBanUserIdUnderlyingReturnValue - } else { - var returnValue: Bool? = nil - DispatchQueue.main.sync { - returnValue = canUserBanUserIdUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserBanUserIdUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserBanUserIdUnderlyingReturnValue = newValue - } - } - } - } - open var canUserBanUserIdClosure: ((String) async throws -> Bool)? - - open override func canUserBan(userId: String) async throws -> Bool { - if let error = canUserBanUserIdThrowableError { - throw error - } - canUserBanUserIdCallsCount += 1 - canUserBanUserIdReceivedUserId = userId - DispatchQueue.main.async { - self.canUserBanUserIdReceivedInvocations.append(userId) - } - if let canUserBanUserIdClosure = canUserBanUserIdClosure { - return try await canUserBanUserIdClosure(userId) - } else { - return canUserBanUserIdReturnValue - } - } - - //MARK: - canUserInvite - - open var canUserInviteUserIdThrowableError: Error? - var canUserInviteUserIdUnderlyingCallsCount = 0 - open var canUserInviteUserIdCallsCount: Int { - get { - if Thread.isMainThread { - return canUserInviteUserIdUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserInviteUserIdUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserInviteUserIdUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserInviteUserIdUnderlyingCallsCount = newValue - } - } - } - } - open var canUserInviteUserIdCalled: Bool { - return canUserInviteUserIdCallsCount > 0 - } - open var canUserInviteUserIdReceivedUserId: String? - open var canUserInviteUserIdReceivedInvocations: [String] = [] - - var canUserInviteUserIdUnderlyingReturnValue: Bool! - open var canUserInviteUserIdReturnValue: Bool! { - get { - if Thread.isMainThread { - return canUserInviteUserIdUnderlyingReturnValue - } else { - var returnValue: Bool? = nil - DispatchQueue.main.sync { - returnValue = canUserInviteUserIdUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserInviteUserIdUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserInviteUserIdUnderlyingReturnValue = newValue - } - } - } - } - open var canUserInviteUserIdClosure: ((String) async throws -> Bool)? - - open override func canUserInvite(userId: String) async throws -> Bool { - if let error = canUserInviteUserIdThrowableError { - throw error - } - canUserInviteUserIdCallsCount += 1 - canUserInviteUserIdReceivedUserId = userId - DispatchQueue.main.async { - self.canUserInviteUserIdReceivedInvocations.append(userId) - } - if let canUserInviteUserIdClosure = canUserInviteUserIdClosure { - return try await canUserInviteUserIdClosure(userId) - } else { - return canUserInviteUserIdReturnValue - } - } - - //MARK: - canUserKick - - open var canUserKickUserIdThrowableError: Error? - var canUserKickUserIdUnderlyingCallsCount = 0 - open var canUserKickUserIdCallsCount: Int { - get { - if Thread.isMainThread { - return canUserKickUserIdUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserKickUserIdUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserKickUserIdUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserKickUserIdUnderlyingCallsCount = newValue - } - } - } - } - open var canUserKickUserIdCalled: Bool { - return canUserKickUserIdCallsCount > 0 - } - open var canUserKickUserIdReceivedUserId: String? - open var canUserKickUserIdReceivedInvocations: [String] = [] - - var canUserKickUserIdUnderlyingReturnValue: Bool! - open var canUserKickUserIdReturnValue: Bool! { - get { - if Thread.isMainThread { - return canUserKickUserIdUnderlyingReturnValue - } else { - var returnValue: Bool? = nil - DispatchQueue.main.sync { - returnValue = canUserKickUserIdUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserKickUserIdUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserKickUserIdUnderlyingReturnValue = newValue - } - } - } - } - open var canUserKickUserIdClosure: ((String) async throws -> Bool)? - - open override func canUserKick(userId: String) async throws -> Bool { - if let error = canUserKickUserIdThrowableError { - throw error - } - canUserKickUserIdCallsCount += 1 - canUserKickUserIdReceivedUserId = userId - DispatchQueue.main.async { - self.canUserKickUserIdReceivedInvocations.append(userId) - } - if let canUserKickUserIdClosure = canUserKickUserIdClosure { - return try await canUserKickUserIdClosure(userId) - } else { - return canUserKickUserIdReturnValue - } - } - - //MARK: - canUserPinUnpin - - open var canUserPinUnpinUserIdThrowableError: Error? - var canUserPinUnpinUserIdUnderlyingCallsCount = 0 - open var canUserPinUnpinUserIdCallsCount: Int { - get { - if Thread.isMainThread { - return canUserPinUnpinUserIdUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserPinUnpinUserIdUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserPinUnpinUserIdUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserPinUnpinUserIdUnderlyingCallsCount = newValue - } - } - } - } - open var canUserPinUnpinUserIdCalled: Bool { - return canUserPinUnpinUserIdCallsCount > 0 - } - open var canUserPinUnpinUserIdReceivedUserId: String? - open var canUserPinUnpinUserIdReceivedInvocations: [String] = [] - - var canUserPinUnpinUserIdUnderlyingReturnValue: Bool! - open var canUserPinUnpinUserIdReturnValue: Bool! { - get { - if Thread.isMainThread { - return canUserPinUnpinUserIdUnderlyingReturnValue - } else { - var returnValue: Bool? = nil - DispatchQueue.main.sync { - returnValue = canUserPinUnpinUserIdUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserPinUnpinUserIdUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserPinUnpinUserIdUnderlyingReturnValue = newValue - } - } - } - } - open var canUserPinUnpinUserIdClosure: ((String) async throws -> Bool)? - - open override func canUserPinUnpin(userId: String) async throws -> Bool { - if let error = canUserPinUnpinUserIdThrowableError { - throw error - } - canUserPinUnpinUserIdCallsCount += 1 - canUserPinUnpinUserIdReceivedUserId = userId - DispatchQueue.main.async { - self.canUserPinUnpinUserIdReceivedInvocations.append(userId) - } - if let canUserPinUnpinUserIdClosure = canUserPinUnpinUserIdClosure { - return try await canUserPinUnpinUserIdClosure(userId) - } else { - return canUserPinUnpinUserIdReturnValue - } - } - - //MARK: - canUserRedactOther - - open var canUserRedactOtherUserIdThrowableError: Error? - var canUserRedactOtherUserIdUnderlyingCallsCount = 0 - open var canUserRedactOtherUserIdCallsCount: Int { - get { - if Thread.isMainThread { - return canUserRedactOtherUserIdUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserRedactOtherUserIdUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserRedactOtherUserIdUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserRedactOtherUserIdUnderlyingCallsCount = newValue - } - } - } - } - open var canUserRedactOtherUserIdCalled: Bool { - return canUserRedactOtherUserIdCallsCount > 0 - } - open var canUserRedactOtherUserIdReceivedUserId: String? - open var canUserRedactOtherUserIdReceivedInvocations: [String] = [] - - var canUserRedactOtherUserIdUnderlyingReturnValue: Bool! - open var canUserRedactOtherUserIdReturnValue: Bool! { - get { - if Thread.isMainThread { - return canUserRedactOtherUserIdUnderlyingReturnValue - } else { - var returnValue: Bool? = nil - DispatchQueue.main.sync { - returnValue = canUserRedactOtherUserIdUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserRedactOtherUserIdUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserRedactOtherUserIdUnderlyingReturnValue = newValue - } - } - } - } - open var canUserRedactOtherUserIdClosure: ((String) async throws -> Bool)? - - open override func canUserRedactOther(userId: String) async throws -> Bool { - if let error = canUserRedactOtherUserIdThrowableError { - throw error - } - canUserRedactOtherUserIdCallsCount += 1 - canUserRedactOtherUserIdReceivedUserId = userId - DispatchQueue.main.async { - self.canUserRedactOtherUserIdReceivedInvocations.append(userId) - } - if let canUserRedactOtherUserIdClosure = canUserRedactOtherUserIdClosure { - return try await canUserRedactOtherUserIdClosure(userId) - } else { - return canUserRedactOtherUserIdReturnValue - } - } - - //MARK: - canUserRedactOwn - - open var canUserRedactOwnUserIdThrowableError: Error? - var canUserRedactOwnUserIdUnderlyingCallsCount = 0 - open var canUserRedactOwnUserIdCallsCount: Int { - get { - if Thread.isMainThread { - return canUserRedactOwnUserIdUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserRedactOwnUserIdUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserRedactOwnUserIdUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserRedactOwnUserIdUnderlyingCallsCount = newValue - } - } - } - } - open var canUserRedactOwnUserIdCalled: Bool { - return canUserRedactOwnUserIdCallsCount > 0 - } - open var canUserRedactOwnUserIdReceivedUserId: String? - open var canUserRedactOwnUserIdReceivedInvocations: [String] = [] - - var canUserRedactOwnUserIdUnderlyingReturnValue: Bool! - open var canUserRedactOwnUserIdReturnValue: Bool! { - get { - if Thread.isMainThread { - return canUserRedactOwnUserIdUnderlyingReturnValue - } else { - var returnValue: Bool? = nil - DispatchQueue.main.sync { - returnValue = canUserRedactOwnUserIdUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserRedactOwnUserIdUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserRedactOwnUserIdUnderlyingReturnValue = newValue - } - } - } - } - open var canUserRedactOwnUserIdClosure: ((String) async throws -> Bool)? - - open override func canUserRedactOwn(userId: String) async throws -> Bool { - if let error = canUserRedactOwnUserIdThrowableError { - throw error - } - canUserRedactOwnUserIdCallsCount += 1 - canUserRedactOwnUserIdReceivedUserId = userId - DispatchQueue.main.async { - self.canUserRedactOwnUserIdReceivedInvocations.append(userId) - } - if let canUserRedactOwnUserIdClosure = canUserRedactOwnUserIdClosure { - return try await canUserRedactOwnUserIdClosure(userId) - } else { - return canUserRedactOwnUserIdReturnValue - } - } - - //MARK: - canUserSendMessage - - open var canUserSendMessageUserIdMessageThrowableError: Error? - var canUserSendMessageUserIdMessageUnderlyingCallsCount = 0 - open var canUserSendMessageUserIdMessageCallsCount: Int { - get { - if Thread.isMainThread { - return canUserSendMessageUserIdMessageUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserSendMessageUserIdMessageUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserSendMessageUserIdMessageUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserSendMessageUserIdMessageUnderlyingCallsCount = newValue - } - } - } - } - open var canUserSendMessageUserIdMessageCalled: Bool { - return canUserSendMessageUserIdMessageCallsCount > 0 - } - open var canUserSendMessageUserIdMessageReceivedArguments: (userId: String, message: MessageLikeEventType)? - open var canUserSendMessageUserIdMessageReceivedInvocations: [(userId: String, message: MessageLikeEventType)] = [] - - var canUserSendMessageUserIdMessageUnderlyingReturnValue: Bool! - open var canUserSendMessageUserIdMessageReturnValue: Bool! { - get { - if Thread.isMainThread { - return canUserSendMessageUserIdMessageUnderlyingReturnValue - } else { - var returnValue: Bool? = nil - DispatchQueue.main.sync { - returnValue = canUserSendMessageUserIdMessageUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserSendMessageUserIdMessageUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserSendMessageUserIdMessageUnderlyingReturnValue = newValue - } - } - } - } - open var canUserSendMessageUserIdMessageClosure: ((String, MessageLikeEventType) async throws -> Bool)? - - open override func canUserSendMessage(userId: String, message: MessageLikeEventType) async throws -> Bool { - if let error = canUserSendMessageUserIdMessageThrowableError { - throw error - } - canUserSendMessageUserIdMessageCallsCount += 1 - canUserSendMessageUserIdMessageReceivedArguments = (userId: userId, message: message) - DispatchQueue.main.async { - self.canUserSendMessageUserIdMessageReceivedInvocations.append((userId: userId, message: message)) - } - if let canUserSendMessageUserIdMessageClosure = canUserSendMessageUserIdMessageClosure { - return try await canUserSendMessageUserIdMessageClosure(userId, message) - } else { - return canUserSendMessageUserIdMessageReturnValue - } - } - - //MARK: - canUserSendState - - open var canUserSendStateUserIdStateEventThrowableError: Error? - var canUserSendStateUserIdStateEventUnderlyingCallsCount = 0 - open var canUserSendStateUserIdStateEventCallsCount: Int { - get { - if Thread.isMainThread { - return canUserSendStateUserIdStateEventUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserSendStateUserIdStateEventUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserSendStateUserIdStateEventUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserSendStateUserIdStateEventUnderlyingCallsCount = newValue - } - } - } - } - open var canUserSendStateUserIdStateEventCalled: Bool { - return canUserSendStateUserIdStateEventCallsCount > 0 - } - open var canUserSendStateUserIdStateEventReceivedArguments: (userId: String, stateEvent: StateEventType)? - open var canUserSendStateUserIdStateEventReceivedInvocations: [(userId: String, stateEvent: StateEventType)] = [] - - var canUserSendStateUserIdStateEventUnderlyingReturnValue: Bool! - open var canUserSendStateUserIdStateEventReturnValue: Bool! { - get { - if Thread.isMainThread { - return canUserSendStateUserIdStateEventUnderlyingReturnValue - } else { - var returnValue: Bool? = nil - DispatchQueue.main.sync { - returnValue = canUserSendStateUserIdStateEventUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserSendStateUserIdStateEventUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserSendStateUserIdStateEventUnderlyingReturnValue = newValue - } - } - } - } - open var canUserSendStateUserIdStateEventClosure: ((String, StateEventType) async throws -> Bool)? - - open override func canUserSendState(userId: String, stateEvent: StateEventType) async throws -> Bool { - if let error = canUserSendStateUserIdStateEventThrowableError { - throw error - } - canUserSendStateUserIdStateEventCallsCount += 1 - canUserSendStateUserIdStateEventReceivedArguments = (userId: userId, stateEvent: stateEvent) - DispatchQueue.main.async { - self.canUserSendStateUserIdStateEventReceivedInvocations.append((userId: userId, stateEvent: stateEvent)) - } - if let canUserSendStateUserIdStateEventClosure = canUserSendStateUserIdStateEventClosure { - return try await canUserSendStateUserIdStateEventClosure(userId, stateEvent) - } else { - return canUserSendStateUserIdStateEventReturnValue - } - } - - //MARK: - canUserTriggerRoomNotification - - open var canUserTriggerRoomNotificationUserIdThrowableError: Error? - var canUserTriggerRoomNotificationUserIdUnderlyingCallsCount = 0 - open var canUserTriggerRoomNotificationUserIdCallsCount: Int { - get { - if Thread.isMainThread { - return canUserTriggerRoomNotificationUserIdUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = canUserTriggerRoomNotificationUserIdUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserTriggerRoomNotificationUserIdUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - canUserTriggerRoomNotificationUserIdUnderlyingCallsCount = newValue - } - } - } - } - open var canUserTriggerRoomNotificationUserIdCalled: Bool { - return canUserTriggerRoomNotificationUserIdCallsCount > 0 - } - open var canUserTriggerRoomNotificationUserIdReceivedUserId: String? - open var canUserTriggerRoomNotificationUserIdReceivedInvocations: [String] = [] - - var canUserTriggerRoomNotificationUserIdUnderlyingReturnValue: Bool! - open var canUserTriggerRoomNotificationUserIdReturnValue: Bool! { - get { - if Thread.isMainThread { - return canUserTriggerRoomNotificationUserIdUnderlyingReturnValue - } else { - var returnValue: Bool? = nil - DispatchQueue.main.sync { - returnValue = canUserTriggerRoomNotificationUserIdUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - canUserTriggerRoomNotificationUserIdUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - canUserTriggerRoomNotificationUserIdUnderlyingReturnValue = newValue - } - } - } - } - open var canUserTriggerRoomNotificationUserIdClosure: ((String) async throws -> Bool)? - - open override func canUserTriggerRoomNotification(userId: String) async throws -> Bool { - if let error = canUserTriggerRoomNotificationUserIdThrowableError { - throw error - } - canUserTriggerRoomNotificationUserIdCallsCount += 1 - canUserTriggerRoomNotificationUserIdReceivedUserId = userId - DispatchQueue.main.async { - self.canUserTriggerRoomNotificationUserIdReceivedInvocations.append(userId) - } - if let canUserTriggerRoomNotificationUserIdClosure = canUserTriggerRoomNotificationUserIdClosure { - return try await canUserTriggerRoomNotificationUserIdClosure(userId) - } else { - return canUserTriggerRoomNotificationUserIdReturnValue - } - } - //MARK: - canonicalAlias var canonicalAliasUnderlyingCallsCount = 0 @@ -18968,6 +18362,757 @@ open class RoomMessageEventContentWithoutRelationSDKMock: MatrixRustSDK.RoomMess } } } +open class RoomPowerLevelsSDKMock: MatrixRustSDK.RoomPowerLevels, @unchecked Sendable { + init() { + super.init(noPointer: .init()) + } + + public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + fatalError("init(unsafeFromRawPointer:) has not been implemented") + } + + fileprivate var pointer: UnsafeMutableRawPointer! + + //MARK: - canUserBan + + open var canUserBanUserIdThrowableError: Error? + var canUserBanUserIdUnderlyingCallsCount = 0 + open var canUserBanUserIdCallsCount: Int { + get { + if Thread.isMainThread { + return canUserBanUserIdUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserBanUserIdUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserBanUserIdUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserBanUserIdUnderlyingCallsCount = newValue + } + } + } + } + open var canUserBanUserIdCalled: Bool { + return canUserBanUserIdCallsCount > 0 + } + open var canUserBanUserIdReceivedUserId: String? + open var canUserBanUserIdReceivedInvocations: [String] = [] + + var canUserBanUserIdUnderlyingReturnValue: Bool! + open var canUserBanUserIdReturnValue: Bool! { + get { + if Thread.isMainThread { + return canUserBanUserIdUnderlyingReturnValue + } else { + var returnValue: Bool? = nil + DispatchQueue.main.sync { + returnValue = canUserBanUserIdUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserBanUserIdUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserBanUserIdUnderlyingReturnValue = newValue + } + } + } + } + open var canUserBanUserIdClosure: ((String) throws -> Bool)? + + open override func canUserBan(userId: String) throws -> Bool { + if let error = canUserBanUserIdThrowableError { + throw error + } + canUserBanUserIdCallsCount += 1 + canUserBanUserIdReceivedUserId = userId + DispatchQueue.main.async { + self.canUserBanUserIdReceivedInvocations.append(userId) + } + if let canUserBanUserIdClosure = canUserBanUserIdClosure { + return try canUserBanUserIdClosure(userId) + } else { + return canUserBanUserIdReturnValue + } + } + + //MARK: - canUserInvite + + open var canUserInviteUserIdThrowableError: Error? + var canUserInviteUserIdUnderlyingCallsCount = 0 + open var canUserInviteUserIdCallsCount: Int { + get { + if Thread.isMainThread { + return canUserInviteUserIdUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserInviteUserIdUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserInviteUserIdUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserInviteUserIdUnderlyingCallsCount = newValue + } + } + } + } + open var canUserInviteUserIdCalled: Bool { + return canUserInviteUserIdCallsCount > 0 + } + open var canUserInviteUserIdReceivedUserId: String? + open var canUserInviteUserIdReceivedInvocations: [String] = [] + + var canUserInviteUserIdUnderlyingReturnValue: Bool! + open var canUserInviteUserIdReturnValue: Bool! { + get { + if Thread.isMainThread { + return canUserInviteUserIdUnderlyingReturnValue + } else { + var returnValue: Bool? = nil + DispatchQueue.main.sync { + returnValue = canUserInviteUserIdUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserInviteUserIdUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserInviteUserIdUnderlyingReturnValue = newValue + } + } + } + } + open var canUserInviteUserIdClosure: ((String) throws -> Bool)? + + open override func canUserInvite(userId: String) throws -> Bool { + if let error = canUserInviteUserIdThrowableError { + throw error + } + canUserInviteUserIdCallsCount += 1 + canUserInviteUserIdReceivedUserId = userId + DispatchQueue.main.async { + self.canUserInviteUserIdReceivedInvocations.append(userId) + } + if let canUserInviteUserIdClosure = canUserInviteUserIdClosure { + return try canUserInviteUserIdClosure(userId) + } else { + return canUserInviteUserIdReturnValue + } + } + + //MARK: - canUserKick + + open var canUserKickUserIdThrowableError: Error? + var canUserKickUserIdUnderlyingCallsCount = 0 + open var canUserKickUserIdCallsCount: Int { + get { + if Thread.isMainThread { + return canUserKickUserIdUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserKickUserIdUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserKickUserIdUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserKickUserIdUnderlyingCallsCount = newValue + } + } + } + } + open var canUserKickUserIdCalled: Bool { + return canUserKickUserIdCallsCount > 0 + } + open var canUserKickUserIdReceivedUserId: String? + open var canUserKickUserIdReceivedInvocations: [String] = [] + + var canUserKickUserIdUnderlyingReturnValue: Bool! + open var canUserKickUserIdReturnValue: Bool! { + get { + if Thread.isMainThread { + return canUserKickUserIdUnderlyingReturnValue + } else { + var returnValue: Bool? = nil + DispatchQueue.main.sync { + returnValue = canUserKickUserIdUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserKickUserIdUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserKickUserIdUnderlyingReturnValue = newValue + } + } + } + } + open var canUserKickUserIdClosure: ((String) throws -> Bool)? + + open override func canUserKick(userId: String) throws -> Bool { + if let error = canUserKickUserIdThrowableError { + throw error + } + canUserKickUserIdCallsCount += 1 + canUserKickUserIdReceivedUserId = userId + DispatchQueue.main.async { + self.canUserKickUserIdReceivedInvocations.append(userId) + } + if let canUserKickUserIdClosure = canUserKickUserIdClosure { + return try canUserKickUserIdClosure(userId) + } else { + return canUserKickUserIdReturnValue + } + } + + //MARK: - canUserPinUnpin + + open var canUserPinUnpinUserIdThrowableError: Error? + var canUserPinUnpinUserIdUnderlyingCallsCount = 0 + open var canUserPinUnpinUserIdCallsCount: Int { + get { + if Thread.isMainThread { + return canUserPinUnpinUserIdUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserPinUnpinUserIdUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserPinUnpinUserIdUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserPinUnpinUserIdUnderlyingCallsCount = newValue + } + } + } + } + open var canUserPinUnpinUserIdCalled: Bool { + return canUserPinUnpinUserIdCallsCount > 0 + } + open var canUserPinUnpinUserIdReceivedUserId: String? + open var canUserPinUnpinUserIdReceivedInvocations: [String] = [] + + var canUserPinUnpinUserIdUnderlyingReturnValue: Bool! + open var canUserPinUnpinUserIdReturnValue: Bool! { + get { + if Thread.isMainThread { + return canUserPinUnpinUserIdUnderlyingReturnValue + } else { + var returnValue: Bool? = nil + DispatchQueue.main.sync { + returnValue = canUserPinUnpinUserIdUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserPinUnpinUserIdUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserPinUnpinUserIdUnderlyingReturnValue = newValue + } + } + } + } + open var canUserPinUnpinUserIdClosure: ((String) throws -> Bool)? + + open override func canUserPinUnpin(userId: String) throws -> Bool { + if let error = canUserPinUnpinUserIdThrowableError { + throw error + } + canUserPinUnpinUserIdCallsCount += 1 + canUserPinUnpinUserIdReceivedUserId = userId + DispatchQueue.main.async { + self.canUserPinUnpinUserIdReceivedInvocations.append(userId) + } + if let canUserPinUnpinUserIdClosure = canUserPinUnpinUserIdClosure { + return try canUserPinUnpinUserIdClosure(userId) + } else { + return canUserPinUnpinUserIdReturnValue + } + } + + //MARK: - canUserRedactOther + + open var canUserRedactOtherUserIdThrowableError: Error? + var canUserRedactOtherUserIdUnderlyingCallsCount = 0 + open var canUserRedactOtherUserIdCallsCount: Int { + get { + if Thread.isMainThread { + return canUserRedactOtherUserIdUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserRedactOtherUserIdUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserRedactOtherUserIdUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserRedactOtherUserIdUnderlyingCallsCount = newValue + } + } + } + } + open var canUserRedactOtherUserIdCalled: Bool { + return canUserRedactOtherUserIdCallsCount > 0 + } + open var canUserRedactOtherUserIdReceivedUserId: String? + open var canUserRedactOtherUserIdReceivedInvocations: [String] = [] + + var canUserRedactOtherUserIdUnderlyingReturnValue: Bool! + open var canUserRedactOtherUserIdReturnValue: Bool! { + get { + if Thread.isMainThread { + return canUserRedactOtherUserIdUnderlyingReturnValue + } else { + var returnValue: Bool? = nil + DispatchQueue.main.sync { + returnValue = canUserRedactOtherUserIdUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserRedactOtherUserIdUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserRedactOtherUserIdUnderlyingReturnValue = newValue + } + } + } + } + open var canUserRedactOtherUserIdClosure: ((String) throws -> Bool)? + + open override func canUserRedactOther(userId: String) throws -> Bool { + if let error = canUserRedactOtherUserIdThrowableError { + throw error + } + canUserRedactOtherUserIdCallsCount += 1 + canUserRedactOtherUserIdReceivedUserId = userId + DispatchQueue.main.async { + self.canUserRedactOtherUserIdReceivedInvocations.append(userId) + } + if let canUserRedactOtherUserIdClosure = canUserRedactOtherUserIdClosure { + return try canUserRedactOtherUserIdClosure(userId) + } else { + return canUserRedactOtherUserIdReturnValue + } + } + + //MARK: - canUserRedactOwn + + open var canUserRedactOwnUserIdThrowableError: Error? + var canUserRedactOwnUserIdUnderlyingCallsCount = 0 + open var canUserRedactOwnUserIdCallsCount: Int { + get { + if Thread.isMainThread { + return canUserRedactOwnUserIdUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserRedactOwnUserIdUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserRedactOwnUserIdUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserRedactOwnUserIdUnderlyingCallsCount = newValue + } + } + } + } + open var canUserRedactOwnUserIdCalled: Bool { + return canUserRedactOwnUserIdCallsCount > 0 + } + open var canUserRedactOwnUserIdReceivedUserId: String? + open var canUserRedactOwnUserIdReceivedInvocations: [String] = [] + + var canUserRedactOwnUserIdUnderlyingReturnValue: Bool! + open var canUserRedactOwnUserIdReturnValue: Bool! { + get { + if Thread.isMainThread { + return canUserRedactOwnUserIdUnderlyingReturnValue + } else { + var returnValue: Bool? = nil + DispatchQueue.main.sync { + returnValue = canUserRedactOwnUserIdUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserRedactOwnUserIdUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserRedactOwnUserIdUnderlyingReturnValue = newValue + } + } + } + } + open var canUserRedactOwnUserIdClosure: ((String) throws -> Bool)? + + open override func canUserRedactOwn(userId: String) throws -> Bool { + if let error = canUserRedactOwnUserIdThrowableError { + throw error + } + canUserRedactOwnUserIdCallsCount += 1 + canUserRedactOwnUserIdReceivedUserId = userId + DispatchQueue.main.async { + self.canUserRedactOwnUserIdReceivedInvocations.append(userId) + } + if let canUserRedactOwnUserIdClosure = canUserRedactOwnUserIdClosure { + return try canUserRedactOwnUserIdClosure(userId) + } else { + return canUserRedactOwnUserIdReturnValue + } + } + + //MARK: - canUserSendMessage + + open var canUserSendMessageUserIdMessageThrowableError: Error? + var canUserSendMessageUserIdMessageUnderlyingCallsCount = 0 + open var canUserSendMessageUserIdMessageCallsCount: Int { + get { + if Thread.isMainThread { + return canUserSendMessageUserIdMessageUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserSendMessageUserIdMessageUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserSendMessageUserIdMessageUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserSendMessageUserIdMessageUnderlyingCallsCount = newValue + } + } + } + } + open var canUserSendMessageUserIdMessageCalled: Bool { + return canUserSendMessageUserIdMessageCallsCount > 0 + } + open var canUserSendMessageUserIdMessageReceivedArguments: (userId: String, message: MessageLikeEventType)? + open var canUserSendMessageUserIdMessageReceivedInvocations: [(userId: String, message: MessageLikeEventType)] = [] + + var canUserSendMessageUserIdMessageUnderlyingReturnValue: Bool! + open var canUserSendMessageUserIdMessageReturnValue: Bool! { + get { + if Thread.isMainThread { + return canUserSendMessageUserIdMessageUnderlyingReturnValue + } else { + var returnValue: Bool? = nil + DispatchQueue.main.sync { + returnValue = canUserSendMessageUserIdMessageUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserSendMessageUserIdMessageUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserSendMessageUserIdMessageUnderlyingReturnValue = newValue + } + } + } + } + open var canUserSendMessageUserIdMessageClosure: ((String, MessageLikeEventType) throws -> Bool)? + + open override func canUserSendMessage(userId: String, message: MessageLikeEventType) throws -> Bool { + if let error = canUserSendMessageUserIdMessageThrowableError { + throw error + } + canUserSendMessageUserIdMessageCallsCount += 1 + canUserSendMessageUserIdMessageReceivedArguments = (userId: userId, message: message) + DispatchQueue.main.async { + self.canUserSendMessageUserIdMessageReceivedInvocations.append((userId: userId, message: message)) + } + if let canUserSendMessageUserIdMessageClosure = canUserSendMessageUserIdMessageClosure { + return try canUserSendMessageUserIdMessageClosure(userId, message) + } else { + return canUserSendMessageUserIdMessageReturnValue + } + } + + //MARK: - canUserSendState + + open var canUserSendStateUserIdStateEventThrowableError: Error? + var canUserSendStateUserIdStateEventUnderlyingCallsCount = 0 + open var canUserSendStateUserIdStateEventCallsCount: Int { + get { + if Thread.isMainThread { + return canUserSendStateUserIdStateEventUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserSendStateUserIdStateEventUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserSendStateUserIdStateEventUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserSendStateUserIdStateEventUnderlyingCallsCount = newValue + } + } + } + } + open var canUserSendStateUserIdStateEventCalled: Bool { + return canUserSendStateUserIdStateEventCallsCount > 0 + } + open var canUserSendStateUserIdStateEventReceivedArguments: (userId: String, stateEvent: StateEventType)? + open var canUserSendStateUserIdStateEventReceivedInvocations: [(userId: String, stateEvent: StateEventType)] = [] + + var canUserSendStateUserIdStateEventUnderlyingReturnValue: Bool! + open var canUserSendStateUserIdStateEventReturnValue: Bool! { + get { + if Thread.isMainThread { + return canUserSendStateUserIdStateEventUnderlyingReturnValue + } else { + var returnValue: Bool? = nil + DispatchQueue.main.sync { + returnValue = canUserSendStateUserIdStateEventUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserSendStateUserIdStateEventUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserSendStateUserIdStateEventUnderlyingReturnValue = newValue + } + } + } + } + open var canUserSendStateUserIdStateEventClosure: ((String, StateEventType) throws -> Bool)? + + open override func canUserSendState(userId: String, stateEvent: StateEventType) throws -> Bool { + if let error = canUserSendStateUserIdStateEventThrowableError { + throw error + } + canUserSendStateUserIdStateEventCallsCount += 1 + canUserSendStateUserIdStateEventReceivedArguments = (userId: userId, stateEvent: stateEvent) + DispatchQueue.main.async { + self.canUserSendStateUserIdStateEventReceivedInvocations.append((userId: userId, stateEvent: stateEvent)) + } + if let canUserSendStateUserIdStateEventClosure = canUserSendStateUserIdStateEventClosure { + return try canUserSendStateUserIdStateEventClosure(userId, stateEvent) + } else { + return canUserSendStateUserIdStateEventReturnValue + } + } + + //MARK: - canUserTriggerRoomNotification + + open var canUserTriggerRoomNotificationUserIdThrowableError: Error? + var canUserTriggerRoomNotificationUserIdUnderlyingCallsCount = 0 + open var canUserTriggerRoomNotificationUserIdCallsCount: Int { + get { + if Thread.isMainThread { + return canUserTriggerRoomNotificationUserIdUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = canUserTriggerRoomNotificationUserIdUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserTriggerRoomNotificationUserIdUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + canUserTriggerRoomNotificationUserIdUnderlyingCallsCount = newValue + } + } + } + } + open var canUserTriggerRoomNotificationUserIdCalled: Bool { + return canUserTriggerRoomNotificationUserIdCallsCount > 0 + } + open var canUserTriggerRoomNotificationUserIdReceivedUserId: String? + open var canUserTriggerRoomNotificationUserIdReceivedInvocations: [String] = [] + + var canUserTriggerRoomNotificationUserIdUnderlyingReturnValue: Bool! + open var canUserTriggerRoomNotificationUserIdReturnValue: Bool! { + get { + if Thread.isMainThread { + return canUserTriggerRoomNotificationUserIdUnderlyingReturnValue + } else { + var returnValue: Bool? = nil + DispatchQueue.main.sync { + returnValue = canUserTriggerRoomNotificationUserIdUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + canUserTriggerRoomNotificationUserIdUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + canUserTriggerRoomNotificationUserIdUnderlyingReturnValue = newValue + } + } + } + } + open var canUserTriggerRoomNotificationUserIdClosure: ((String) throws -> Bool)? + + open override func canUserTriggerRoomNotification(userId: String) throws -> Bool { + if let error = canUserTriggerRoomNotificationUserIdThrowableError { + throw error + } + canUserTriggerRoomNotificationUserIdCallsCount += 1 + canUserTriggerRoomNotificationUserIdReceivedUserId = userId + DispatchQueue.main.async { + self.canUserTriggerRoomNotificationUserIdReceivedInvocations.append(userId) + } + if let canUserTriggerRoomNotificationUserIdClosure = canUserTriggerRoomNotificationUserIdClosure { + return try canUserTriggerRoomNotificationUserIdClosure(userId) + } else { + return canUserTriggerRoomNotificationUserIdReturnValue + } + } + + //MARK: - values + + var valuesUnderlyingCallsCount = 0 + open var valuesCallsCount: Int { + get { + if Thread.isMainThread { + return valuesUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = valuesUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + valuesUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + valuesUnderlyingCallsCount = newValue + } + } + } + } + open var valuesCalled: Bool { + return valuesCallsCount > 0 + } + + var valuesUnderlyingReturnValue: RoomPowerLevelsValues! + open var valuesReturnValue: RoomPowerLevelsValues! { + get { + if Thread.isMainThread { + return valuesUnderlyingReturnValue + } else { + var returnValue: RoomPowerLevelsValues? = nil + DispatchQueue.main.sync { + returnValue = valuesUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + valuesUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + valuesUnderlyingReturnValue = newValue + } + } + } + } + open var valuesClosure: (() -> RoomPowerLevelsValues)? + + open override func values() -> RoomPowerLevelsValues { + valuesCallsCount += 1 + if let valuesClosure = valuesClosure { + return valuesClosure() + } else { + return valuesReturnValue + } + } +} open class RoomPreviewSDKMock: MatrixRustSDK.RoomPreview, @unchecked Sendable { init() { super.init(noPointer: .init()) diff --git a/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift b/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift index 56cea19c4..d145975e6 100644 --- a/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift +++ b/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift @@ -89,9 +89,8 @@ extension JoinedRoomProxyMock { markAsReadReceiptTypeReturnValue = .success(()) flagAsFavouriteReturnValue = .success(()) - powerLevelsReturnValue = .success(.mock) applyPowerLevelChangesReturnValue = .success(()) - resetPowerLevelsReturnValue = .success(.mock) + resetPowerLevelsReturnValue = .success(()) suggestedRoleForClosure = { [weak self] userID in guard case .success(let member) = await self?.getMember(userID: userID) else { return .failure(.sdkError(RoomProxyMockError.generic)) @@ -99,22 +98,27 @@ extension JoinedRoomProxyMock { return .success(member.role) } updatePowerLevelsForUsersReturnValue = .success(()) - canUserUserIDSendMessageReturnValue = .success(configuration.canUserSendMessage) - canUserUserIDSendStateEventClosure = { [weak self] userID, _ in + + let powerLevelsProxyMock = RoomPowerLevelsProxyMock(configuration: .init()) + + powerLevelsProxyMock.canUserUserIDSendMessageReturnValue = .success(configuration.canUserSendMessage) + powerLevelsProxyMock.canUserUserIDSendStateEventClosure = { [weak self] userID, _ in .success(self?.membersPublisher.value.first { $0.userID == userID }?.role ?? .user != .user) } - canUserInviteUserIDReturnValue = .success(configuration.canUserInvite) - canUserRedactOtherUserIDReturnValue = .success(false) - canUserRedactOwnUserIDReturnValue = .success(true) - canUserKickUserIDClosure = { [weak self] userID in + powerLevelsProxyMock.canUserInviteUserIDReturnValue = .success(configuration.canUserInvite) + powerLevelsProxyMock.canUserRedactOtherUserIDReturnValue = .success(false) + powerLevelsProxyMock.canUserRedactOwnUserIDReturnValue = .success(true) + powerLevelsProxyMock.canUserKickUserIDClosure = { [weak self] userID in .success(self?.membersPublisher.value.first { $0.userID == userID }?.role ?? .user != .user) } - canUserBanUserIDClosure = { [weak self] userID in + powerLevelsProxyMock.canUserBanUserIDClosure = { [weak self] userID in .success(self?.membersPublisher.value.first { $0.userID == userID }?.role ?? .user != .user) } - canUserTriggerRoomNotificationUserIDReturnValue = .success(configuration.canUserTriggerRoomNotification) - canUserJoinCallUserIDReturnValue = .success(configuration.canUserJoinCall) - canUserPinOrUnpinUserIDReturnValue = .success(configuration.canUserPin) + powerLevelsProxyMock.canUserTriggerRoomNotificationUserIDReturnValue = .success(configuration.canUserTriggerRoomNotification) + powerLevelsProxyMock.canUserJoinCallUserIDReturnValue = .success(configuration.canUserJoinCall) + powerLevelsProxyMock.canUserPinOrUnpinUserIDReturnValue = .success(configuration.canUserPin) + + powerLevelsReturnValue = .success(powerLevelsProxyMock) kickUserReasonReturnValue = .success(()) banUserReasonReturnValue = .success(()) diff --git a/ElementX/Sources/Mocks/RoomPowerLevelsProxyMock.swift b/ElementX/Sources/Mocks/RoomPowerLevelsProxyMock.swift new file mode 100644 index 000000000..0b05e13da --- /dev/null +++ b/ElementX/Sources/Mocks/RoomPowerLevelsProxyMock.swift @@ -0,0 +1,44 @@ +// +// Copyright 2025 New Vector Ltd. +// +// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial +// Please see LICENSE files in the repository root for full details. +// + +import MatrixRustSDK + +extension RoomPowerLevelsProxyMock { + struct Configuration { } + + convenience init(configuration: Configuration) { + self.init() + + underlyingValues = RoomPowerLevelsValues.mock + + canUserUserIDSendMessageReturnValue = .success(true) + canUserUserIDSendStateEventReturnValue = .success(true) + canUserInviteUserIDReturnValue = .success(true) + canUserRedactOtherUserIDReturnValue = .success(true) + canUserRedactOwnUserIDReturnValue = .success(true) + canUserKickUserIDReturnValue = .success(true) + canUserBanUserIDReturnValue = .success(true) + canUserTriggerRoomNotificationUserIDReturnValue = .success(true) + canUserPinOrUnpinUserIDReturnValue = .success(true) + canUserJoinCallUserIDReturnValue = .success(true) + } +} + +extension RoomPowerLevelsValues { + static var mock: RoomPowerLevelsValues { + RoomPowerLevelsValues(ban: 50, + invite: 0, + kick: 50, + redact: 50, + eventsDefault: 0, + stateDefault: 50, + usersDefault: 0, + roomName: 50, + roomAvatar: 50, + roomTopic: 50) + } +} diff --git a/ElementX/Sources/Screens/KnockRequestsListScreen/KnockRequestsListScreenViewModel.swift b/ElementX/Sources/Screens/KnockRequestsListScreen/KnockRequestsListScreenViewModel.swift index e44c63a43..5f4dcde90 100644 --- a/ElementX/Sources/Screens/KnockRequestsListScreen/KnockRequestsListScreenViewModel.swift +++ b/ElementX/Sources/Screens/KnockRequestsListScreen/KnockRequestsListScreenViewModel.swift @@ -224,9 +224,10 @@ class KnockRequestsListScreenViewModel: KnockRequestsListScreenViewModelType, Kn } private func updatePermissions() async { - state.canAccept = await (try? roomProxy.canUserInvite(userID: roomProxy.ownUserID).get()) == true - state.canDecline = await (try? roomProxy.canUserKick(userID: roomProxy.ownUserID).get()) == true - state.canBan = await (try? roomProxy.canUserBan(userID: roomProxy.ownUserID).get()) == true + let powerLevels = try? await roomProxy.powerLevels().get() + state.canAccept = (try? powerLevels?.canUserInvite(userID: roomProxy.ownUserID).get()) == true + state.canDecline = (try? powerLevels?.canUserKick(userID: roomProxy.ownUserID).get()) == true + state.canBan = (try? powerLevels?.canUserBan(userID: roomProxy.ownUserID).get()) == true } private static let loadingIndicatorIdentifier = "\(KnockRequestsListScreenViewModel.self)-Loading" diff --git a/ElementX/Sources/Screens/RoomDetailsEditScreen/RoomDetailsEditScreenViewModel.swift b/ElementX/Sources/Screens/RoomDetailsEditScreen/RoomDetailsEditScreenViewModel.swift index 8b77a02c9..76cce137b 100644 --- a/ElementX/Sources/Screens/RoomDetailsEditScreen/RoomDetailsEditScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomDetailsEditScreen/RoomDetailsEditScreenViewModel.swift @@ -40,10 +40,10 @@ class RoomDetailsEditScreenViewModel: RoomDetailsEditScreenViewModelType, RoomDe bindings: .init(name: roomName ?? "", topic: roomTopic ?? "")), mediaProvider: mediaProvider) Task { - // Can't use async let because the mocks aren't thread safe when calling the same method 🤦‍♂️ - state.canEditAvatar = await (try? roomProxy.canUser(userID: roomProxy.ownUserID, sendStateEvent: .roomAvatar).get()) == .some(true) - state.canEditName = await (try? roomProxy.canUser(userID: roomProxy.ownUserID, sendStateEvent: .roomName).get()) == .some(true) - state.canEditTopic = await (try? roomProxy.canUser(userID: roomProxy.ownUserID, sendStateEvent: .roomTopic).get()) == .some(true) + let powerLevels = try? await roomProxy.powerLevels().get() + state.canEditAvatar = (try? powerLevels?.canUser(userID: roomProxy.ownUserID, sendStateEvent: .roomAvatar).get()) == .some(true) + state.canEditName = (try? powerLevels?.canUser(userID: roomProxy.ownUserID, sendStateEvent: .roomName).get()) == .some(true) + state.canEditTopic = (try? powerLevels?.canUser(userID: roomProxy.ownUserID, sendStateEvent: .roomTopic).get()) == .some(true) } } diff --git a/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenViewModel.swift b/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenViewModel.swift index 939ea8f19..54da808d3 100644 --- a/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenViewModel.swift @@ -90,13 +90,6 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr } .store(in: &cancellables) - Task { - let userID = roomProxy.ownUserID - if case let .success(permission) = await roomProxy.canUserJoinCall(userID: userID) { - state.canJoinCall = permission - } - } - Task { if case let .success(permalinkURL) = await roomProxy.matrixToPermalink() { state.permalink = permalinkURL @@ -288,13 +281,16 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr } private func updatePowerLevelPermissions() async { - state.canEditRoomName = await (try? roomProxy.canUser(userID: roomProxy.ownUserID, sendStateEvent: .roomName).get()) == true - state.canEditRoomTopic = await (try? roomProxy.canUser(userID: roomProxy.ownUserID, sendStateEvent: .roomTopic).get()) == true - state.canEditRoomAvatar = await (try? roomProxy.canUser(userID: roomProxy.ownUserID, sendStateEvent: .roomAvatar).get()) == true state.canEditRolesOrPermissions = await (try? roomProxy.suggestedRole(for: roomProxy.ownUserID).get()) == .administrator - state.canInviteUsers = await (try? roomProxy.canUserInvite(userID: roomProxy.ownUserID).get()) == true - state.canKickUsers = await (try? roomProxy.canUserKick(userID: roomProxy.ownUserID).get()) == true - state.canBanUsers = await (try? roomProxy.canUserBan(userID: roomProxy.ownUserID).get()) == true + + let powerLevels = try? await roomProxy.powerLevels().get() + state.canEditRoomName = (try? powerLevels?.canUser(userID: roomProxy.ownUserID, sendStateEvent: .roomName).get()) == true + state.canEditRoomTopic = (try? powerLevels?.canUser(userID: roomProxy.ownUserID, sendStateEvent: .roomTopic).get()) == true + state.canEditRoomAvatar = (try? powerLevels?.canUser(userID: roomProxy.ownUserID, sendStateEvent: .roomAvatar).get()) == true + state.canInviteUsers = (try? powerLevels?.canUserInvite(userID: roomProxy.ownUserID).get()) == true + state.canKickUsers = (try? powerLevels?.canUserKick(userID: roomProxy.ownUserID).get()) == true + state.canBanUsers = (try? powerLevels?.canUserBan(userID: roomProxy.ownUserID).get()) == true + state.canJoinCall = (try? powerLevels?.canUserJoinCall(userID: roomProxy.ownUserID).get()) == true } private func setupNotificationSettingsSubscription() { diff --git a/ElementX/Sources/Screens/RoomMemberListScreen/RoomMembersListScreenViewModel.swift b/ElementX/Sources/Screens/RoomMemberListScreen/RoomMembersListScreenViewModel.swift index b267adf90..bedd562e3 100644 --- a/ElementX/Sources/Screens/RoomMemberListScreen/RoomMembersListScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomMemberListScreen/RoomMembersListScreenViewModel.swift @@ -99,10 +99,11 @@ class RoomMembersListScreenViewModel: RoomMembersListScreenViewModelType, RoomMe bannedMembers: roomMembersDetails.bannedMembers, bindings: state.bindings) - self.state.canInviteUsers = await (try? roomProxy.canUserInvite(userID: roomProxy.ownUserID).get()) == true - self.state.canKickUsers = await (try? roomProxy.canUserKick(userID: roomProxy.ownUserID).get()) == true - self.state.canBanUsers = await (try? roomProxy.canUserBan(userID: roomProxy.ownUserID).get()) == true - + let powerLevels = try? await roomProxy.powerLevels().get() + self.state.canInviteUsers = (try? powerLevels?.canUserInvite(userID: roomProxy.ownUserID).get()) == true + self.state.canKickUsers = (try? powerLevels?.canUserKick(userID: roomProxy.ownUserID).get()) == true + self.state.canBanUsers = (try? powerLevels?.canUserBan(userID: roomProxy.ownUserID).get()) == true + hideLoadingIndicator(Self.updateStateLoadingIndicatorIdentifier) } } diff --git a/ElementX/Sources/Screens/RoomRolesAndPermissionsScreen/RoomRolesAndPermissionsScreenViewModel.swift b/ElementX/Sources/Screens/RoomRolesAndPermissionsScreen/RoomRolesAndPermissionsScreenViewModel.swift index 6316db18e..8c31587dc 100644 --- a/ElementX/Sources/Screens/RoomRolesAndPermissionsScreen/RoomRolesAndPermissionsScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomRolesAndPermissionsScreen/RoomRolesAndPermissionsScreenViewModel.swift @@ -116,7 +116,7 @@ class RoomRolesAndPermissionsScreenViewModel: RoomRolesAndPermissionsScreenViewM private func updatePermissions() async { switch await roomProxy.powerLevels() { case .success(let powerLevels): - state.permissions = .init(powerLevels: powerLevels) + state.permissions = .init(powerLevels: powerLevels.values) case .failure: break } diff --git a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/CompletionSuggestionService.swift b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/CompletionSuggestionService.swift index ec24e280f..3810305ca 100644 --- a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/CompletionSuggestionService.swift +++ b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/CompletionSuggestionService.swift @@ -48,12 +48,7 @@ final class CompletionSuggestionService: CompletionSuggestionServiceProtocol { } Task { - switch await roomProxy.canUserTriggerRoomNotification(userID: roomProxy.ownUserID) { - case .success(let value): - canMentionAllUsers = value - case .failure: - canMentionAllUsers = false - } + canMentionAllUsers = await (try? roomProxy.powerLevels().get().canUserTriggerRoomNotification(userID: roomProxy.ownUserID).get()) == true } } diff --git a/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift b/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift index 69bae71f9..fc64dd9db 100644 --- a/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift @@ -347,13 +347,13 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol default: state.isKnockableRoom = false } - - let ownUserID = roomProxy.ownUserID - state.canSendMessage = await (try? roomProxy.canUser(userID: ownUserID, sendMessage: .roomMessage).get()) == true - state.canJoinCall = await (try? roomProxy.canUserJoinCall(userID: ownUserID).get()) == true - state.canAcceptKnocks = await (try? roomProxy.canUserInvite(userID: ownUserID).get()) == true - state.canDeclineKnocks = await (try? roomProxy.canUserKick(userID: ownUserID).get()) == true - state.canBan = await (try? roomProxy.canUserBan(userID: ownUserID).get()) == true + + let powerLevels = try? await roomProxy.powerLevels().get() + state.canSendMessage = (try? powerLevels?.canUser(userID: roomProxy.ownUserID, sendMessage: .roomMessage).get()) == true + state.canJoinCall = (try? powerLevels?.canUserJoinCall(userID: roomProxy.ownUserID).get()) == true + state.canAcceptKnocks = (try? powerLevels?.canUserInvite(userID: roomProxy.ownUserID).get()) == true + state.canDeclineKnocks = (try? powerLevels?.canUserKick(userID: roomProxy.ownUserID).get()) == true + state.canBan = (try? powerLevels?.canUserBan(userID: roomProxy.ownUserID).get()) == true } private func setupPinnedEventsTimelineItemProviderIfNeeded() { diff --git a/ElementX/Sources/Screens/ThreadTimelineScreen/ThreadTimelineScreenViewModel.swift b/ElementX/Sources/Screens/ThreadTimelineScreen/ThreadTimelineScreenViewModel.swift index 66b58fa73..25ebaf94f 100644 --- a/ElementX/Sources/Screens/ThreadTimelineScreen/ThreadTimelineScreenViewModel.swift +++ b/ElementX/Sources/Screens/ThreadTimelineScreen/ThreadTimelineScreenViewModel.swift @@ -65,6 +65,6 @@ class ThreadTimelineScreenViewModel: ThreadTimelineScreenViewModelType, ThreadTi // MARK: - Private private func handleRoomInfoUpdate(_ roomInfo: RoomInfoProxy) async { - state.canSendMessage = await (try? roomProxy.canUser(userID: roomProxy.ownUserID, sendMessage: .roomMessage).get()) == true + state.canSendMessage = await (try? roomProxy.powerLevels().get().canUser(userID: roomProxy.ownUserID, sendMessage: .roomMessage).get()) == true } } diff --git a/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift b/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift index 719e2c1af..ed0db6106 100644 --- a/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift +++ b/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift @@ -404,41 +404,13 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol { } private func updatePermissions() async { - if case let .success(value) = await roomProxy.canUser(userID: roomProxy.ownUserID, sendMessage: .roomMessage) { - state.canCurrentUserSendMessage = value - } else { - state.canCurrentUserSendMessage = false - } - - if case let .success(value) = await roomProxy.canUserRedactOther(userID: roomProxy.ownUserID) { - state.canCurrentUserRedactOthers = value - } else { - state.canCurrentUserRedactOthers = false - } - - if case let .success(value) = await roomProxy.canUserRedactOwn(userID: roomProxy.ownUserID) { - state.canCurrentUserRedactSelf = value - } else { - state.canCurrentUserRedactSelf = false - } - - if case let .success(value) = await roomProxy.canUserPinOrUnpin(userID: roomProxy.ownUserID) { - state.canCurrentUserPin = value - } else { - state.canCurrentUserPin = false - } - - if case let .success(value) = await roomProxy.canUserKick(userID: roomProxy.ownUserID) { - state.canCurrentUserKick = value - } else { - state.canCurrentUserKick = false - } - - if case let .success(value) = await roomProxy.canUserBan(userID: roomProxy.ownUserID) { - state.canCurrentUserBan = value - } else { - state.canCurrentUserBan = false - } + let powerLevels = try? await roomProxy.powerLevels().get() + state.canCurrentUserSendMessage = (try? powerLevels?.canUser(userID: roomProxy.ownUserID, sendMessage: .roomMessage).get()) == true + state.canCurrentUserRedactOthers = (try? powerLevels?.canUserRedactOther(userID: roomProxy.ownUserID).get()) == true + state.canCurrentUserRedactSelf = (try? powerLevels?.canUserRedactOwn(userID: roomProxy.ownUserID).get()) == true + state.canCurrentUserPin = (try? powerLevels?.canUserPinOrUnpin(userID: roomProxy.ownUserID).get()) == true + state.canCurrentUserKick = (try? powerLevels?.canUserKick(userID: roomProxy.ownUserID).get()) == true + state.canCurrentUserBan = (try? powerLevels?.canUserBan(userID: roomProxy.ownUserID).get()) == true } private func setupSubscriptions() { diff --git a/ElementX/Sources/Services/Room/JoinedRoomProxy.swift b/ElementX/Sources/Services/Room/JoinedRoomProxy.swift index 4bef99d13..fb7058ab9 100644 --- a/ElementX/Sources/Services/Room/JoinedRoomProxy.swift +++ b/ElementX/Sources/Services/Room/JoinedRoomProxy.swift @@ -552,9 +552,9 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol { // MARK: - Power Levels - func powerLevels() async -> Result { + func powerLevels() async -> Result { do { - return try await .success(room.getPowerLevels()) + return try await .success(RoomPowerLevelsProxy(room.getPowerLevels())) } catch { MXLog.error("Failed building the current power level settings: \(error)") return .failure(.sdkError(error)) @@ -570,9 +570,10 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol { } } - func resetPowerLevels() async -> Result { + func resetPowerLevels() async -> Result { do { - return try await .success(room.resetPowerLevels()) + _ = try await room.resetPowerLevels() + return .success(()) } catch { MXLog.error("Failed resetting the power levels: \(error)") return .failure(.sdkError(error)) @@ -598,87 +599,6 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol { } } - func canUser(userID: String, sendMessage messageType: MessageLikeEventType) async -> Result { - do { - return try await .success(room.canUserSendMessage(userId: userID, message: messageType)) - } catch { - MXLog.error("Failed checking if the user can send message with error: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUser(userID: String, sendStateEvent event: StateEventType) async -> Result { - do { - return try await .success(room.canUserSendState(userId: userID, stateEvent: event)) - } catch { - MXLog.error("Failed checking if the user can send \(event) with error: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUserInvite(userID: String) async -> Result { - do { - return try await .success(room.canUserInvite(userId: userID)) - } catch { - MXLog.error("Failed checking if the user can invite with error: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUserRedactOther(userID: String) async -> Result { - do { - return try await .success(room.canUserRedactOther(userId: userID)) - } catch { - MXLog.error("Failed checking if the user can redact others with error: \(error)") - return .failure(.sdkError(error)) - } - } - - 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(.sdkError(error)) - } - } - - func canUserKick(userID: String) async -> Result { - do { - return try await .success(room.canUserKick(userId: userID)) - } catch { - MXLog.error("Failed checking if the user can kick with error: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUserBan(userID: String) async -> Result { - do { - return try await .success(room.canUserBan(userId: userID)) - } catch { - MXLog.error("Failed checking if the user can ban with error: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUserTriggerRoomNotification(userID: String) async -> Result { - do { - return try await .success(room.canUserTriggerRoomNotification(userId: userID)) - } catch { - MXLog.error("Failed checking if the user can trigger room notification with error: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUserPinOrUnpin(userID: String) async -> Result { - do { - return try await .success(room.canUserPinUnpin(userId: userID)) - } catch { - MXLog.error("Failed checking if the user can pin or unnpin: \(error)") - return .failure(.sdkError(error)) - } - } - // MARK: - Moderation func kickUser(_ userID: String, reason: String?) async -> Result { @@ -713,15 +633,6 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol { // MARK: - Element Call - func canUserJoinCall(userID: String) async -> Result { - do { - return try await .success(room.canUserSendState(userId: userID, stateEvent: .callMember)) - } catch { - MXLog.error("Failed checking if the user can trigger room notification with error: \(error)") - return .failure(.sdkError(error)) - } - } - func elementCallWidgetDriver(deviceID: String) -> ElementCallWidgetDriverProtocol { ElementCallWidgetDriver(room: room, deviceID: deviceID) } diff --git a/ElementX/Sources/Services/Room/RoomPermissions.swift b/ElementX/Sources/Services/Room/RoomPermissions.swift index ab611d664..4d49d3536 100644 --- a/ElementX/Sources/Services/Room/RoomPermissions.swift +++ b/ElementX/Sources/Services/Room/RoomPermissions.swift @@ -70,7 +70,7 @@ struct RoomPermissions { extension RoomPermissions { /// Create permissions from the room's power levels. - init(powerLevels: RoomPowerLevels) { + init(powerLevels: RoomPowerLevelsValues) { ban = RoomMemberDetails.Role(rustPowerLevel: powerLevels.ban) invite = RoomMemberDetails.Role(rustPowerLevel: powerLevels.invite) kick = RoomMemberDetails.Role(rustPowerLevel: powerLevels.kick) @@ -104,18 +104,3 @@ extension RoomMemberDetails.Role { suggestedPowerLevelForRole(role: rustRole) } } - -extension RoomPowerLevels { - static var mock: RoomPowerLevels { - RoomPowerLevels(ban: 50, - invite: 0, - kick: 50, - redact: 50, - eventsDefault: 0, - stateDefault: 50, - usersDefault: 0, - roomName: 50, - roomAvatar: 50, - roomTopic: 50) - } -} diff --git a/ElementX/Sources/Services/Room/RoomPowerLevelProxyProtocol.swift b/ElementX/Sources/Services/Room/RoomPowerLevelProxyProtocol.swift new file mode 100644 index 000000000..3c8d0e4a3 --- /dev/null +++ b/ElementX/Sources/Services/Room/RoomPowerLevelProxyProtocol.swift @@ -0,0 +1,24 @@ +// +// Copyright 2025 New Vector Ltd. +// +// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial +// Please see LICENSE files in the repository root for full details. +// + +import MatrixRustSDK + +// sourcery: AutoMockable +protocol RoomPowerLevelsProxyProtocol { + var values: RoomPowerLevelsValues { get } + + func canUser(userID: String, sendMessage messageType: MessageLikeEventType) -> Result + func canUser(userID: String, sendStateEvent event: StateEventType) -> Result + func canUserInvite(userID: String) -> Result + func canUserRedactOther(userID: String) -> Result + func canUserRedactOwn(userID: String) -> Result + func canUserKick(userID: String) -> Result + func canUserBan(userID: String) -> Result + func canUserTriggerRoomNotification(userID: String) -> Result + func canUserPinOrUnpin(userID: String) -> Result + func canUserJoinCall(userID: String) -> Result +} diff --git a/ElementX/Sources/Services/Room/RoomPowerLevelsProxy.swift b/ElementX/Sources/Services/Room/RoomPowerLevelsProxy.swift new file mode 100644 index 000000000..887f59628 --- /dev/null +++ b/ElementX/Sources/Services/Room/RoomPowerLevelsProxy.swift @@ -0,0 +1,110 @@ +// +// Copyright 2025 New Vector Ltd. +// +// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial +// Please see LICENSE files in the repository root for full details. +// + +import MatrixRustSDK + +struct RoomPowerLevelsProxy: RoomPowerLevelsProxyProtocol { + private let powerLevels: RoomPowerLevels + + init(_ powerLevels: RoomPowerLevels) { + self.powerLevels = powerLevels + } + + var values: RoomPowerLevelsValues { + powerLevels.values() + } + + func canUser(userID: String, sendMessage messageType: MessageLikeEventType) -> Result { + do { + return try .success(powerLevels.canUserSendMessage(userId: userID, message: messageType)) + } catch { + MXLog.error("Failed checking if the user can send message with error: \(error)") + return .failure(.sdkError(error)) + } + } + + func canUser(userID: String, sendStateEvent event: StateEventType) -> Result { + do { + return try .success(powerLevels.canUserSendState(userId: userID, stateEvent: event)) + } catch { + MXLog.error("Failed checking if the user can send \(event) with error: \(error)") + return .failure(.sdkError(error)) + } + } + + func canUserInvite(userID: String) -> Result { + do { + return try .success(powerLevels.canUserInvite(userId: userID)) + } catch { + MXLog.error("Failed checking if the user can invite with error: \(error)") + return .failure(.sdkError(error)) + } + } + + func canUserRedactOther(userID: String) -> Result { + do { + return try .success(powerLevels.canUserRedactOther(userId: userID)) + } catch { + MXLog.error("Failed checking if the user can redact others with error: \(error)") + return .failure(.sdkError(error)) + } + } + + func canUserRedactOwn(userID: String) -> Result { + do { + return try .success(powerLevels.canUserRedactOwn(userId: userID)) + } catch { + MXLog.error("Failed checking if the user can redact self with error: \(error)") + return .failure(.sdkError(error)) + } + } + + func canUserKick(userID: String) -> Result { + do { + return try .success(powerLevels.canUserKick(userId: userID)) + } catch { + MXLog.error("Failed checking if the user can kick with error: \(error)") + return .failure(.sdkError(error)) + } + } + + func canUserBan(userID: String) -> Result { + do { + return try .success(powerLevels.canUserBan(userId: userID)) + } catch { + MXLog.error("Failed checking if the user can ban with error: \(error)") + return .failure(.sdkError(error)) + } + } + + func canUserTriggerRoomNotification(userID: String) -> Result { + do { + return try .success(powerLevels.canUserTriggerRoomNotification(userId: userID)) + } catch { + MXLog.error("Failed checking if the user can trigger room notification with error: \(error)") + return .failure(.sdkError(error)) + } + } + + func canUserPinOrUnpin(userID: String) -> Result { + do { + return try .success(powerLevels.canUserPinUnpin(userId: userID)) + } catch { + MXLog.error("Failed checking if the user can pin or unnpin: \(error)") + return .failure(.sdkError(error)) + } + } + + func canUserJoinCall(userID: String) -> Result { + do { + return try .success(powerLevels.canUserSendState(userId: userID, stateEvent: .callMember)) + } catch { + MXLog.error("Failed checking if the user can trigger room notification with error: \(error)") + return .failure(.sdkError(error)) + } + } +} diff --git a/ElementX/Sources/Services/Room/RoomProxyProtocol.swift b/ElementX/Sources/Services/Room/RoomProxyProtocol.swift index ed63761ff..2032083f9 100644 --- a/ElementX/Sources/Services/Room/RoomProxyProtocol.swift +++ b/ElementX/Sources/Services/Room/RoomProxyProtocol.swift @@ -152,20 +152,11 @@ protocol JoinedRoomProxyProtocol: RoomProxyProtocol { // MARK: - Power Levels - func powerLevels() async -> Result + func powerLevels() async -> Result func applyPowerLevelChanges(_ changes: RoomPowerLevelChanges) async -> Result - func resetPowerLevels() async -> Result + func resetPowerLevels() async -> Result func suggestedRole(for userID: String) async -> Result func updatePowerLevelsForUsers(_ updates: [(userID: String, powerLevel: Int64)]) async -> Result - func canUser(userID: String, sendMessage messageType: MessageLikeEventType) async -> Result - func canUser(userID: String, sendStateEvent event: StateEventType) async -> Result - func canUserInvite(userID: String) async -> Result - func canUserRedactOther(userID: String) async -> Result - func canUserRedactOwn(userID: String) async -> Result - func canUserKick(userID: String) async -> Result - func canUserBan(userID: String) async -> Result - func canUserTriggerRoomNotification(userID: String) async -> Result - func canUserPinOrUnpin(userID: String) async -> Result // MARK: - Moderation @@ -175,9 +166,7 @@ protocol JoinedRoomProxyProtocol: RoomProxyProtocol { // MARK: - Element Call - func canUserJoinCall(userID: String) async -> Result func elementCallWidgetDriver(deviceID: String) -> ElementCallWidgetDriverProtocol - func sendCallNotificationIfNeeded() async -> Result // MARK: - Permalinks diff --git a/UnitTests/Sources/RoomDetailsViewModelTests.swift b/UnitTests/Sources/RoomDetailsViewModelTests.swift index a8c15f42d..86040e8b4 100644 --- a/UnitTests/Sources/RoomDetailsViewModelTests.swift +++ b/UnitTests/Sources/RoomDetailsViewModelTests.swift @@ -356,7 +356,11 @@ class RoomDetailsScreenViewModelTests: XCTestCase { func testCanEditAvatar() async { let mockedMembers: [RoomMemberProxyMock] = [.mockMe, .mockBob, .mockAlice] roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", isDirect: false, isPublic: false, members: mockedMembers)) - roomProxyMock.canUserUserIDSendStateEventClosure = { _, event in + + let powerLevelsMock = RoomPowerLevelsProxyMock(configuration: .init()) + roomProxyMock.powerLevelsReturnValue = .success(powerLevelsMock) + + powerLevelsMock.canUserUserIDSendStateEventClosure = { _, event in .success(event == .roomAvatar) } viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock, @@ -380,7 +384,11 @@ class RoomDetailsScreenViewModelTests: XCTestCase { func testCanEditName() async { let mockedMembers: [RoomMemberProxyMock] = [.mockMe, .mockBob, .mockAlice] roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", isDirect: false, isPublic: false, members: mockedMembers)) - roomProxyMock.canUserUserIDSendStateEventClosure = { _, event in + + let powerLevelsMock = RoomPowerLevelsProxyMock(configuration: .init()) + roomProxyMock.powerLevelsReturnValue = .success(powerLevelsMock) + + powerLevelsMock.canUserUserIDSendStateEventClosure = { _, event in .success(event == .roomName) } viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock, @@ -404,7 +412,11 @@ class RoomDetailsScreenViewModelTests: XCTestCase { func testCanEditTopic() async { let mockedMembers: [RoomMemberProxyMock] = [.mockMe, .mockBob, .mockAlice] roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", isDirect: false, isPublic: false, members: mockedMembers)) - roomProxyMock.canUserUserIDSendStateEventClosure = { _, event in + + let powerLevelsMock = RoomPowerLevelsProxyMock(configuration: .init()) + roomProxyMock.powerLevelsReturnValue = .success(powerLevelsMock) + + powerLevelsMock.canUserUserIDSendStateEventClosure = { _, event in .success(event == .roomTopic) } viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock, diff --git a/UnitTests/Sources/RoomPermissionsTests.swift b/UnitTests/Sources/RoomPermissionsTests.swift index fbdb2982a..eed58f552 100644 --- a/UnitTests/Sources/RoomPermissionsTests.swift +++ b/UnitTests/Sources/RoomPermissionsTests.swift @@ -13,16 +13,16 @@ import XCTest class RoomPermissionsTests: XCTestCase { func testFromRust() { // Given a set of power level changes with various values. - let powerLevels = RoomPowerLevels(ban: 100, - invite: 100, - kick: 100, - redact: 50, - eventsDefault: 50, - stateDefault: 50, - usersDefault: 0, - roomName: 0, - roomAvatar: 0, - roomTopic: 0) + let powerLevels = RoomPowerLevelsValues(ban: 100, + invite: 100, + kick: 100, + redact: 50, + eventsDefault: 50, + stateDefault: 50, + usersDefault: 0, + roomName: 0, + roomAvatar: 0, + roomTopic: 0) // When creating room permissions from them. let permissions = RoomPermissions(powerLevels: powerLevels) diff --git a/UnitTests/Sources/RoomScreenViewModelTests.swift b/UnitTests/Sources/RoomScreenViewModelTests.swift index f5fb93804..efc50324b 100644 --- a/UnitTests/Sources/RoomScreenViewModelTests.swift +++ b/UnitTests/Sources/RoomScreenViewModelTests.swift @@ -167,8 +167,12 @@ class RoomScreenViewModelTests: XCTestCase { var configuration = JoinedRoomProxyMockConfiguration(id: "TestID", name: "StartingName", avatarURL: nil, hasOngoingCall: false) let infoSubject = CurrentValueSubject(.init(roomInfo: RoomInfo(configuration))) let roomProxyMock = JoinedRoomProxyMock(configuration) + + let powerLevelsMock = RoomPowerLevelsProxyMock(configuration: .init()) + roomProxyMock.powerLevelsReturnValue = .success(powerLevelsMock) + // setup the room proxy actions publisher - roomProxyMock.canUserJoinCallUserIDReturnValue = .success(false) + powerLevelsMock.canUserJoinCallUserIDReturnValue = .success(false) roomProxyMock.underlyingInfoPublisher = infoSubject.asCurrentValuePublisher() let viewModel = RoomScreenViewModel(clientProxy: ClientProxyMock(), roomProxy: roomProxyMock, @@ -193,7 +197,7 @@ class RoomScreenViewModelTests: XCTestCase { configuration.name = "NewName" configuration.avatarURL = .mockMXCAvatar configuration.hasOngoingCall = true - roomProxyMock.canUserJoinCallUserIDReturnValue = .success(true) + powerLevelsMock.canUserJoinCallUserIDReturnValue = .success(true) deferred = deferFulfillment(viewModel.context.$viewState) { viewState in viewState.roomTitle == "NewName" && diff --git a/UnitTests/Sources/TimelineViewModelTests.swift b/UnitTests/Sources/TimelineViewModelTests.swift index 9fdb9cade..c15f66592 100644 --- a/UnitTests/Sources/TimelineViewModelTests.swift +++ b/UnitTests/Sources/TimelineViewModelTests.swift @@ -517,7 +517,10 @@ class TimelineViewModelTests: XCTestCase { } try await deferred.fulfill() - roomProxyMock.canUserPinOrUnpinUserIDReturnValue = .success(false) + let powerLevelsMock = RoomPowerLevelsProxyMock(configuration: .init()) + powerLevelsMock.canUserPinOrUnpinUserIDReturnValue = .success(false) + roomProxyMock.powerLevelsReturnValue = .success(powerLevelsMock) + deferred = deferFulfillment(viewModel.context.$viewState) { value in !value.canCurrentUserPin } diff --git a/project.yml b/project.yml index b579dbf48..4ab9af86e 100644 --- a/project.yml +++ b/project.yml @@ -65,7 +65,7 @@ packages: # Element/Matrix dependencies MatrixRustSDK: url: https://github.com/element-hq/matrix-rust-components-swift - exactVersion: 25.06.18 + exactVersion: 25.06.20 # path: ../matrix-rust-sdk Compound: url: https://github.com/element-hq/compound-ios