Add RoomChangeRolesScreen. (#2534)
Not part of a flow yet, just the screen.
This commit is contained in:
@@ -148,6 +148,7 @@
|
||||
23701DE32ACD6FD40AA992C3 /* MediaUploadingPreprocessorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE203026B9AD3DB412439866 /* MediaUploadingPreprocessorTests.swift */; };
|
||||
237FC70AA257B935F53316BA /* SessionVerificationControllerProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C55D7E514F9DE4E3D72FDCAD /* SessionVerificationControllerProxy.swift */; };
|
||||
241CDEFE23819867D9B39066 /* RoomChangePermissionsScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE75941583A033A9EDC9FE0 /* RoomChangePermissionsScreenViewModel.swift */; };
|
||||
244407B18B2F2D6466BA5961 /* RoomChangeRolesScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82DFA1B7B088D033E0794B82 /* RoomChangeRolesScreenCoordinator.swift */; };
|
||||
245F7FE5961BD10C145A26E0 /* UITimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA689E792E679F5E3956F21 /* UITimelineView.swift */; };
|
||||
24A75F72EEB7561B82D726FD /* Date.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2141693488CE5446BB391964 /* Date.swift */; };
|
||||
24B7CD41342C143117ADA768 /* Comparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2B1CC9AA154F4D5435BF60A /* Comparable.swift */; };
|
||||
@@ -251,6 +252,7 @@
|
||||
3DA57CA0D609A6B37CA1DC2F /* BugReportService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DC38E64A5ED3FDB201029A /* BugReportService.swift */; };
|
||||
3DAD62988F072607441CB7A5 /* PollFormScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25F8664F1FB95AF3C4202478 /* PollFormScreenCoordinator.swift */; };
|
||||
3DAF325D8AE461F7CDB282BD /* StartChatScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6861FE915C7B5466E6962BBA /* StartChatScreen.swift */; };
|
||||
3EC5A41F9FB7DD63A4DC6144 /* RoomChangeRolesScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B14B1DE3E2D5D26732C49036 /* RoomChangeRolesScreenViewModel.swift */; };
|
||||
3EC698F80DDEEFA273857841 /* ArrayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893777A4997BBDB68079D4F5 /* ArrayTests.swift */; };
|
||||
3ED2725734568F6B8CC87544 /* AttributedStringBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A5C6FBF97B6EED3D4FA5EFF /* AttributedStringBuilder.swift */; };
|
||||
3F2148F11164C7C5609984EB /* GZIP in Frameworks */ = {isa = PBXBuildFile; productRef = 2B788C81F6369D164ADEB917 /* GZIP */; };
|
||||
@@ -311,6 +313,7 @@
|
||||
4C8C0C9FC10BA73AB7780534 /* RoomListFiltersStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AE0C9653870803E4F91F474 /* RoomListFiltersStateTests.swift */; };
|
||||
4D4D236F0BBCDC4D2CBCCBB5 /* RoomChangePermissionsScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = C729D95CB4588D4D9AAC3DFA /* RoomChangePermissionsScreenModels.swift */; };
|
||||
4E0D9E09B52CEC4C0E6211A8 /* MediaPickerScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64F49FB9EE2913234F06CE68 /* MediaPickerScreenCoordinator.swift */; };
|
||||
4E36A66E0EDA74BF3A036FD0 /* RoomChangeRolesScreenViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AAD8C633AA57948B34EDCF7 /* RoomChangeRolesScreenViewModelProtocol.swift */; };
|
||||
4E8A2A2CFEB212F14E49E1A1 /* AppLockSetupSettingsScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5484457C81B325660901B161 /* AppLockSetupSettingsScreen.swift */; };
|
||||
4E8F17EBA24FBBA6ABB62ECB /* MockBackgroundTaskService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3948D16F021DFDB2CD26EAA8 /* MockBackgroundTaskService.swift */; };
|
||||
4E945AD6862C403F74E57755 /* RoomTimelineItemFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 105B2A8426404EF66F00CFDB /* RoomTimelineItemFactory.swift */; };
|
||||
@@ -508,7 +511,9 @@
|
||||
7F61F9ACD5EC9E845EF3EFBF /* BugReportServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EFFD3200F9960D4996159F10 /* BugReportServiceTests.swift */; };
|
||||
7F64FA937B95924B3A44EC12 /* OnboardingScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB8E75B9CB6C78BE8D09B1AF /* OnboardingScreen.swift */; };
|
||||
7F7EA51A9A43125A8CB6AC90 /* NotificationSettingsScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46D560DDA3B20C82766ACFAD /* NotificationSettingsScreenViewModel.swift */; };
|
||||
7F941B063C94E1718DFC2CF3 /* RoomChangeRolesScreenRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23E6EB7960BC9D0F7396B3BD /* RoomChangeRolesScreenRow.swift */; };
|
||||
7FB0BDE26838F1A92782D5E1 /* MediaUploadPreviewScreenUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39B6C8690AEA1E49FF1BAF95 /* MediaUploadPreviewScreenUITests.swift */; };
|
||||
7FF6E1FBE6E9517FD29A1D8E /* RoomChangeRolesScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48A5C34C4E4268EF65D171EF /* RoomChangeRolesScreenModels.swift */; };
|
||||
8015842CB4DE1BE414D2CDED /* AppLockSetupBiometricsScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C62E07C1164F5120727A2A8 /* AppLockSetupBiometricsScreenCoordinator.swift */; };
|
||||
8024BE37156FF0A95A7A3465 /* AnalyticsPromptUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF11DD57D9FACF2A757AB024 /* AnalyticsPromptUITests.swift */; };
|
||||
804C15D8ADE0EA7A5268F58A /* OverridableAvatarImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 648DD1C10E4957CB791FE0B8 /* OverridableAvatarImage.swift */; };
|
||||
@@ -519,6 +524,7 @@
|
||||
828EA5009557C2B9DCD4CA0F /* UserDiscoverySection.swift in Sources */ = {isa = PBXBuildFile; fileRef = D071F86CD47582B9196C9D16 /* UserDiscoverySection.swift */; };
|
||||
829062DD3C3F7016FE1A6476 /* RoomDetailsScreenUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BFDAF6918BB096C44788FC9 /* RoomDetailsScreenUITests.swift */; };
|
||||
8317E1314C00DCCC99D30DA8 /* TextBasedRoomTimelineItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9227F7495DA43324050A863 /* TextBasedRoomTimelineItem.swift */; };
|
||||
832A4EA1094B8FE423A08700 /* RoomChangeRolesScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B2A421198FD20AAAED20004 /* RoomChangeRolesScreen.swift */; };
|
||||
8358D145F9BF94F412BEDCA8 /* RoomRolesAndPermissionsScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DE7969EBCAF078813E18EA1 /* RoomRolesAndPermissionsScreenModels.swift */; };
|
||||
835B7AD20407F766C747BEC5 /* RoomPollsHistoryScreenUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D147EB979902DBBE452EADC /* RoomPollsHistoryScreenUITests.swift */; };
|
||||
83A4DAB181C56987C3E804FF /* MapTilerStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B9F5BC4C80543DE7228B9D /* MapTilerStyle.swift */; };
|
||||
@@ -776,6 +782,7 @@
|
||||
BD0BE20DBCE31253AE4490A1 /* RoomListFiltersEmptyStateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC1DDB2293A51EA4C2739351 /* RoomListFiltersEmptyStateView.swift */; };
|
||||
BD203FC6A7AE7637EA003643 /* RoomProxyMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ABDE6F66532CBEB0E016F94 /* RoomProxyMock.swift */; };
|
||||
BD2BF1EC73FFB0C01552ECDA /* WelcomeScreenScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0FB782CE6176A5D2C082EC5D /* WelcomeScreenScreenModels.swift */; };
|
||||
BD6685592716CA957D7BAAC4 /* RoomChangeRolesScreenSelectedItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D9B45D584D232CB9E5C7734 /* RoomChangeRolesScreenSelectedItem.swift */; };
|
||||
BD6D98676111DA8FC2BE4908 /* InvitesScreenViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86873A768B13069BB5CAECF6 /* InvitesScreenViewModelProtocol.swift */; };
|
||||
BD782053BE4C3D2F0BDE5699 /* ServiceLocator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F95CADD0A5DBD76B990FCB /* ServiceLocator.swift */; };
|
||||
BDA68E8D95B2B24B28825B8B /* LoginScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C368CAB3063EF275357ECD4 /* LoginScreenViewModel.swift */; };
|
||||
@@ -861,6 +868,7 @@
|
||||
D1E29F345F1220E1AF1BE9DF /* ReadReceiptsSummaryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB0A77874B29D79DDFC051AC /* ReadReceiptsSummaryView.swift */; };
|
||||
D1EEF0CB0F5D9C15E224E670 /* landscape_test_video.mov in Resources */ = {isa = PBXBuildFile; fileRef = 9A2AC7BE17C05CF7D2A22338 /* landscape_test_video.mov */; };
|
||||
D2048FD56760BDABA3DB5FC2 /* AppLockServiceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAAB54C6CE91D64B69A9F8 /* AppLockServiceProtocol.swift */; };
|
||||
D2825E013A8ECFB66D9A1DE6 /* RoomChangeRolesScreenViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F841F219ACDFC1D3F42FEFB /* RoomChangeRolesScreenViewModelTests.swift */; };
|
||||
D2D70B5DB1A5E4AF0CD88330 /* target.yml in Resources */ = {isa = PBXBuildFile; fileRef = 033DB41C51865A2E83174E87 /* target.yml */; };
|
||||
D33AC79A50DFC26D2498DD28 /* FileRoomTimelineItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5098DA7799946A61E34A2373 /* FileRoomTimelineItem.swift */; };
|
||||
D34E328E9E65904358248FDD /* GlobalSearchScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 436A0D98D372B17EAE9AA999 /* GlobalSearchScreenModels.swift */; };
|
||||
@@ -1242,6 +1250,7 @@
|
||||
2355398E4A55DA5A89128AD1 /* EncryptionKeyProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncryptionKeyProvider.swift; sourceTree = "<group>"; };
|
||||
2389732B0E115A999A069083 /* NotificationSettingsScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationSettingsScreenCoordinator.swift; sourceTree = "<group>"; };
|
||||
23AA3F4B285570805CB0CCDD /* MapTiler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapTiler.swift; sourceTree = "<group>"; };
|
||||
23E6EB7960BC9D0F7396B3BD /* RoomChangeRolesScreenRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomChangeRolesScreenRow.swift; sourceTree = "<group>"; };
|
||||
240610DF32F3213BEC5611D7 /* BlockedUsersScreenViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlockedUsersScreenViewModelTests.swift; sourceTree = "<group>"; };
|
||||
24227FF9A2797F6EA7F69CDD /* HomeScreenInvitesButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenInvitesButton.swift; sourceTree = "<group>"; };
|
||||
2429224EB0EEA34D35CE9249 /* UserIndicatorControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserIndicatorControllerTests.swift; sourceTree = "<group>"; };
|
||||
@@ -1339,6 +1348,7 @@
|
||||
3D487C1185D658F8B15B8F55 /* SettingsViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewModelTests.swift; sourceTree = "<group>"; };
|
||||
3D4DD336905C72F95EAF34B7 /* ElementX-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ElementX-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
3D65BCC659FD9087E49B3C25 /* AppAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppAppearance.swift; sourceTree = "<group>"; };
|
||||
3D9B45D584D232CB9E5C7734 /* RoomChangeRolesScreenSelectedItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomChangeRolesScreenSelectedItem.swift; sourceTree = "<group>"; };
|
||||
3D9FCE4D1E3A81AC1CC5CB91 /* AppLockSetupSettingsScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockSetupSettingsScreenCoordinator.swift; sourceTree = "<group>"; };
|
||||
3DC1943ADE6A62ED5129D7C8 /* LoggingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggingTests.swift; sourceTree = "<group>"; };
|
||||
3DF1FFC3336EB23374BBBFCC /* UIKitBackgroundTaskService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIKitBackgroundTaskService.swift; sourceTree = "<group>"; };
|
||||
@@ -1383,6 +1393,7 @@
|
||||
47873756E45B46683D97DC32 /* LegalInformationScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegalInformationScreenModels.swift; sourceTree = "<group>"; };
|
||||
47EBB5D698CE9A25BB553A2D /* Strings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = "<group>"; };
|
||||
47F29139BC2A804CE5E0757E /* MediaUploadPreviewScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaUploadPreviewScreenViewModel.swift; sourceTree = "<group>"; };
|
||||
48A5C34C4E4268EF65D171EF /* RoomChangeRolesScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomChangeRolesScreenModels.swift; sourceTree = "<group>"; };
|
||||
48FEFF746DB341CDB18D7AAA /* RoomRolesAndPermissionsScreenViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomRolesAndPermissionsScreenViewModelTests.swift; sourceTree = "<group>"; };
|
||||
490BEADEFB2D6B7C9F618AE8 /* AppLockTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockTimer.swift; sourceTree = "<group>"; };
|
||||
49193CB0C248D621A96FB2AA /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bg; path = bg.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
@@ -1505,6 +1516,7 @@
|
||||
6A8E19C4645D3F5F9FB02355 /* UnitTestsAppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnitTestsAppCoordinator.swift; sourceTree = "<group>"; };
|
||||
6AB54B4F94686CCF0289B72F /* UserIndicatorPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserIndicatorPresenter.swift; sourceTree = "<group>"; };
|
||||
6AD1A853D605C2146B0DC028 /* MatrixEntityRegex.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MatrixEntityRegex.swift; sourceTree = "<group>"; };
|
||||
6B2A421198FD20AAAED20004 /* RoomChangeRolesScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomChangeRolesScreen.swift; sourceTree = "<group>"; };
|
||||
6B5E29E9A22F45534FBD5B58 /* EmojiPickerScreenHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPickerScreenHeaderView.swift; sourceTree = "<group>"; };
|
||||
6C113E0CB7E15E9765B1817A /* EmojiProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiProvider.swift; sourceTree = "<group>"; };
|
||||
6CEBE5EA91E8691EDF364EC2 /* UITestsScreenIdentifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITestsScreenIdentifier.swift; sourceTree = "<group>"; };
|
||||
@@ -1556,6 +1568,7 @@
|
||||
78913D6E120D46138E97C107 /* NavigationSplitCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationSplitCoordinatorTests.swift; sourceTree = "<group>"; };
|
||||
7893780A1FD6E3F38B3E9049 /* UserIndicatorControllerMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserIndicatorControllerMock.swift; sourceTree = "<group>"; };
|
||||
7A5D2323D7B6BF4913EB7EED /* landscape_test_image.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = landscape_test_image.jpg; sourceTree = "<group>"; };
|
||||
7AAD8C633AA57948B34EDCF7 /* RoomChangeRolesScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomChangeRolesScreenViewModelProtocol.swift; sourceTree = "<group>"; };
|
||||
7AB7ED3A898B07976F3AA90F /* BugReportViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BugReportViewModelTests.swift; sourceTree = "<group>"; };
|
||||
7AE094FCB6387D268C436161 /* SecureBackupScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackupScreenViewModel.swift; sourceTree = "<group>"; };
|
||||
7AE75941583A033A9EDC9FE0 /* RoomChangePermissionsScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomChangePermissionsScreenViewModel.swift; sourceTree = "<group>"; };
|
||||
@@ -1587,6 +1600,7 @@
|
||||
81B17DB1BC3B0C62AF84D230 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||
8296D6FB451E25CEC0767BBA /* RoomNotificationSettingsScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomNotificationSettingsScreenCoordinator.swift; sourceTree = "<group>"; };
|
||||
82B612853BFB68373249777B /* SecureBackupKeyBackupScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackupKeyBackupScreenViewModel.swift; sourceTree = "<group>"; };
|
||||
82DFA1B7B088D033E0794B82 /* RoomChangeRolesScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomChangeRolesScreenCoordinator.swift; sourceTree = "<group>"; };
|
||||
837B440C4705E4B899BCB899 /* RoomDetailsScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDetailsScreenViewModel.swift; sourceTree = "<group>"; };
|
||||
839E2C35DF3F9C7B54C3CE49 /* RoundedCornerShape.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundedCornerShape.swift; sourceTree = "<group>"; };
|
||||
840E86A67DB2C92C09771EAD /* AnalyticsPromptScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsPromptScreenModels.swift; sourceTree = "<group>"; };
|
||||
@@ -1637,6 +1651,7 @@
|
||||
8F21ED7205048668BEB44A38 /* AppActivityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppActivityView.swift; sourceTree = "<group>"; };
|
||||
8F421E51DF00377DE1A01354 /* CompletionSuggestionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompletionSuggestionView.swift; sourceTree = "<group>"; };
|
||||
8F61A0DD8243B395499C99A2 /* InvitesScreenUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvitesScreenUITests.swift; sourceTree = "<group>"; };
|
||||
8F841F219ACDFC1D3F42FEFB /* RoomChangeRolesScreenViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomChangeRolesScreenViewModelTests.swift; sourceTree = "<group>"; };
|
||||
8FC803282F9268D49F4ABF14 /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = "<group>"; };
|
||||
90791B9C739C716A40E1B230 /* target.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = target.yml; sourceTree = "<group>"; };
|
||||
907FA4DE17DEA1A3738EFB83 /* AudioRecorder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioRecorder.swift; sourceTree = "<group>"; };
|
||||
@@ -1760,6 +1775,7 @@
|
||||
AFEF489B8E2450E2BA1A314E /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/SAS.strings; sourceTree = "<group>"; };
|
||||
B0A307A44F952CD73E63AE31 /* RoomEventStringBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomEventStringBuilder.swift; sourceTree = "<group>"; };
|
||||
B0BA67B3E4EF9D29D14A78CE /* AppLockSettingsScreenViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockSettingsScreenViewModelTests.swift; sourceTree = "<group>"; };
|
||||
B14B1DE3E2D5D26732C49036 /* RoomChangeRolesScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomChangeRolesScreenViewModel.swift; sourceTree = "<group>"; };
|
||||
B16048D30F0438731C41F775 /* StateRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateRoomTimelineItem.swift; sourceTree = "<group>"; };
|
||||
B16CAF20C9AC874A210E2DCF /* SessionVerificationScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionVerificationScreenViewModelProtocol.swift; sourceTree = "<group>"; };
|
||||
B172057567E049007A5C4D92 /* Strings+SAS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Strings+SAS.swift"; sourceTree = "<group>"; };
|
||||
@@ -3179,6 +3195,16 @@
|
||||
path = Polls;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5AD98DB6E142A4A4A2D8BA2D /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6B2A421198FD20AAAED20004 /* RoomChangeRolesScreen.swift */,
|
||||
23E6EB7960BC9D0F7396B3BD /* RoomChangeRolesScreenRow.swift */,
|
||||
3D9B45D584D232CB9E5C7734 /* RoomChangeRolesScreenSelectedItem.swift */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5B2C520AB9863B8CBC8EB3CA /* SoftLogoutScreen */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -3448,6 +3474,7 @@
|
||||
347D708104CCEF771428C9A3 /* PollFormScreenViewModelTests.swift */,
|
||||
086C19086DD16E9B38E25954 /* ReportContentViewModelTests.swift */,
|
||||
41D041A857614A9AE13C7795 /* RoomChangePermissionsScreenViewModelTests.swift */,
|
||||
8F841F219ACDFC1D3F42FEFB /* RoomChangeRolesScreenViewModelTests.swift */,
|
||||
00E5B2CBEF8F96424F095508 /* RoomDetailsEditScreenViewModelTests.swift */,
|
||||
2EFE1922F39398ABFB36DF3F /* RoomDetailsViewModelTests.swift */,
|
||||
4FCB2126C091EEF2454B4D56 /* RoomFlowCoordinatorTests.swift */,
|
||||
@@ -4607,6 +4634,18 @@
|
||||
path = RoomPollsHistoryScreen;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D8388454B5909D862CAC78F7 /* RoomChangeRolesScreen */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
82DFA1B7B088D033E0794B82 /* RoomChangeRolesScreenCoordinator.swift */,
|
||||
48A5C34C4E4268EF65D171EF /* RoomChangeRolesScreenModels.swift */,
|
||||
B14B1DE3E2D5D26732C49036 /* RoomChangeRolesScreenViewModel.swift */,
|
||||
7AAD8C633AA57948B34EDCF7 /* RoomChangeRolesScreenViewModelProtocol.swift */,
|
||||
5AD98DB6E142A4A4A2D8BA2D /* View */,
|
||||
);
|
||||
path = RoomChangeRolesScreen;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D977D4E565C06D3F41C8F8FC /* Virtual */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -4716,6 +4755,7 @@
|
||||
A448A3A8F764174C60CD0CA1 /* Other */,
|
||||
5970F275D6014548DCED6106 /* ReportContentScreen */,
|
||||
DAB7DC51866A6D1B51BDC3A2 /* RoomChangePermissionsScreen */,
|
||||
D8388454B5909D862CAC78F7 /* RoomChangeRolesScreen */,
|
||||
E71742A824A7192C8D378875 /* RoomDetailsEditScreen */,
|
||||
E703BBD16266053B8A193C7B /* RoomDetailsScreen */,
|
||||
B86CF59E083C82C2A842E4AD /* RoomMemberDetailsScreen */,
|
||||
@@ -5531,6 +5571,7 @@
|
||||
D415764645491F10344FC6AC /* Publisher.swift in Sources */,
|
||||
D53B80EF02C1062E68659EDD /* ReportContentViewModelTests.swift in Sources */,
|
||||
9B03943616A1147539DF7F08 /* RoomChangePermissionsScreenViewModelTests.swift in Sources */,
|
||||
D2825E013A8ECFB66D9A1DE6 /* RoomChangeRolesScreenViewModelTests.swift in Sources */,
|
||||
9DD84E014ADFB2DD813022D5 /* RoomDetailsEditScreenViewModelTests.swift in Sources */,
|
||||
EA974337FA7D040E7C74FE6E /* RoomDetailsViewModelTests.swift in Sources */,
|
||||
095D3906CF2F940C2D2D17CC /* RoomFlowCoordinatorTests.swift in Sources */,
|
||||
@@ -6009,6 +6050,13 @@
|
||||
4D4D236F0BBCDC4D2CBCCBB5 /* RoomChangePermissionsScreenModels.swift in Sources */,
|
||||
241CDEFE23819867D9B39066 /* RoomChangePermissionsScreenViewModel.swift in Sources */,
|
||||
FEFD5290B31FCBA6999912C8 /* RoomChangePermissionsScreenViewModelProtocol.swift in Sources */,
|
||||
832A4EA1094B8FE423A08700 /* RoomChangeRolesScreen.swift in Sources */,
|
||||
244407B18B2F2D6466BA5961 /* RoomChangeRolesScreenCoordinator.swift in Sources */,
|
||||
7FF6E1FBE6E9517FD29A1D8E /* RoomChangeRolesScreenModels.swift in Sources */,
|
||||
7F941B063C94E1718DFC2CF3 /* RoomChangeRolesScreenRow.swift in Sources */,
|
||||
BD6685592716CA957D7BAAC4 /* RoomChangeRolesScreenSelectedItem.swift in Sources */,
|
||||
3EC5A41F9FB7DD63A4DC6144 /* RoomChangeRolesScreenViewModel.swift in Sources */,
|
||||
4E36A66E0EDA74BF3A036FD0 /* RoomChangeRolesScreenViewModelProtocol.swift in Sources */,
|
||||
859E2CA2EDF343BD24DE52EB /* RoomDetails.swift in Sources */,
|
||||
0BDA19079FD6E17C5AC62E22 /* RoomDetailsEditScreen.swift in Sources */,
|
||||
E78D429F18071545BF661A52 /* RoomDetailsEditScreenCoordinator.swift in Sources */,
|
||||
|
||||
@@ -2750,6 +2750,27 @@ class RoomProxyMock: RoomProxyProtocol {
|
||||
return applyPowerLevelChangesReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - updatePowerLevelsForUsers
|
||||
|
||||
var updatePowerLevelsForUsersCallsCount = 0
|
||||
var updatePowerLevelsForUsersCalled: Bool {
|
||||
return updatePowerLevelsForUsersCallsCount > 0
|
||||
}
|
||||
var updatePowerLevelsForUsersReceivedUpdates: [(userID: String, powerLevel: Int64)]?
|
||||
var updatePowerLevelsForUsersReceivedInvocations: [[(userID: String, powerLevel: Int64)]] = []
|
||||
var updatePowerLevelsForUsersReturnValue: Result<Void, RoomProxyError>!
|
||||
var updatePowerLevelsForUsersClosure: (([(userID: String, powerLevel: Int64)]) async -> Result<Void, RoomProxyError>)?
|
||||
|
||||
func updatePowerLevelsForUsers(_ updates: [(userID: String, powerLevel: Int64)]) async -> Result<Void, RoomProxyError> {
|
||||
updatePowerLevelsForUsersCallsCount += 1
|
||||
updatePowerLevelsForUsersReceivedUpdates = updates
|
||||
updatePowerLevelsForUsersReceivedInvocations.append(updates)
|
||||
if let updatePowerLevelsForUsersClosure = updatePowerLevelsForUsersClosure {
|
||||
return await updatePowerLevelsForUsersClosure(updates)
|
||||
} else {
|
||||
return updatePowerLevelsForUsersReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - canUser
|
||||
|
||||
var canUserUserIDSendStateEventCallsCount = 0
|
||||
|
||||
@@ -91,6 +91,12 @@ extension RoomMemberProxyMock {
|
||||
membership: .join))
|
||||
}
|
||||
|
||||
static var mockVerbose: RoomMemberProxyMock {
|
||||
RoomMemberProxyMock(with: .init(userID: "@charliev:matrix.org",
|
||||
displayName: "Charlie is the best display name",
|
||||
membership: .join))
|
||||
}
|
||||
|
||||
static var mockInvited: RoomMemberProxyMock {
|
||||
RoomMemberProxyMock(with: .init(userID: "@invited:matrix.org",
|
||||
displayName: "Invited",
|
||||
|
||||
@@ -90,6 +90,7 @@ extension RoomProxyMock {
|
||||
|
||||
currentPowerLevelChangesReturnValue = .success(.init())
|
||||
applyPowerLevelChangesReturnValue = .success(())
|
||||
updatePowerLevelsForUsersReturnValue = .success(())
|
||||
canUserUserIDSendStateEventClosure = { [weak self] userID, _ in
|
||||
.success(self?.membersPublisher.value.first { $0.userID == userID }?.role ?? .user != .user)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
// periphery:ignore:all - this is just a roomChangeRoles remove this comment once generating the final file
|
||||
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
struct RoomChangeRolesScreenCoordinatorParameters {
|
||||
let mode: RoomMemberDetails.Role
|
||||
let roomProxy: RoomProxyProtocol
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
}
|
||||
|
||||
enum RoomChangeRolesScreenCoordinatorAction {
|
||||
case done
|
||||
}
|
||||
|
||||
final class RoomChangeRolesScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: RoomChangeRolesScreenCoordinatorParameters
|
||||
private let viewModel: RoomChangeRolesScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
private let actionsSubject: PassthroughSubject<RoomChangeRolesScreenCoordinatorAction, Never> = .init()
|
||||
var actionsPublisher: AnyPublisher<RoomChangeRolesScreenCoordinatorAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(parameters: RoomChangeRolesScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = RoomChangeRolesScreenViewModel(mode: parameters.mode,
|
||||
roomProxy: parameters.roomProxy,
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
}
|
||||
|
||||
func start() {
|
||||
viewModel.actionsPublisher.sink { [weak self] action in
|
||||
MXLog.info("Coordinator: received view model action: \(action)")
|
||||
|
||||
guard let self else { return }
|
||||
switch action {
|
||||
case .done:
|
||||
self.actionsSubject.send(.done)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
func toPresentable() -> AnyView {
|
||||
AnyView(RoomChangeRolesScreen(context: viewModel.context))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Collections
|
||||
import Foundation
|
||||
|
||||
enum RoomChangeRolesScreenViewModelAction {
|
||||
case done
|
||||
}
|
||||
|
||||
struct RoomChangeRolesScreenViewState: BindableState {
|
||||
/// The screen's current mode (which role we are promoting/demoting users to/from.
|
||||
let mode: RoomMemberDetails.Role
|
||||
/// All of the room's members.
|
||||
var members: [RoomMemberDetails]
|
||||
var bindings: RoomChangeRolesScreenViewStateBindings
|
||||
|
||||
/// The members selected for promotion to the current role.
|
||||
var membersToPromote: Set<RoomMemberDetails> = []
|
||||
/// The member selected for demotion back to a regular user.
|
||||
var membersToDemote: Set<RoomMemberDetails> = []
|
||||
|
||||
/// The last member added to the carousel at the top of the screen.
|
||||
var lastPromotedMember: RoomMemberDetails?
|
||||
|
||||
/// The screen's title.
|
||||
var title: String {
|
||||
switch mode {
|
||||
case .administrator:
|
||||
L10n.screenRoomChangeRoleAdministratorsTitle
|
||||
case .moderator:
|
||||
L10n.screenRoomChangeRoleModeratorsTitle
|
||||
case .user:
|
||||
"" // The screen can't be configured with this role.
|
||||
}
|
||||
}
|
||||
|
||||
/// The visible members in the screen (after searching).
|
||||
var visibleMembers: [RoomMemberDetails] {
|
||||
guard !bindings.searchQuery.isEmpty else { return members }
|
||||
|
||||
return members.filter { member in
|
||||
member.name?.localizedStandardContains(bindings.searchQuery) == true
|
||||
|| member.id.localizedStandardContains(bindings.searchQuery)
|
||||
}
|
||||
}
|
||||
|
||||
/// All of the members who will gain/keep this screen's role after saving any changes.
|
||||
var membersWithRole: [RoomMemberDetails] {
|
||||
members.filter(isMemberSelected)
|
||||
}
|
||||
|
||||
/// Whether or not any changes have been made to the members.
|
||||
var hasChanges: Bool {
|
||||
!membersToPromote.isEmpty || !membersToDemote.isEmpty
|
||||
}
|
||||
|
||||
/// Whether or not the user is searching.
|
||||
var isSearching: Bool {
|
||||
!bindings.searchQuery.isEmpty
|
||||
}
|
||||
|
||||
/// Whether or not a specific member has this screen's role.
|
||||
func isMemberSelected(_ member: RoomMemberDetails) -> Bool {
|
||||
guard !membersToDemote.contains(member) else { return false }
|
||||
return member.role == mode || membersToPromote.contains(member)
|
||||
}
|
||||
}
|
||||
|
||||
struct RoomChangeRolesScreenViewStateBindings {
|
||||
var searchQuery = ""
|
||||
/// Information about the currently displayed alert.
|
||||
var alertInfo: AlertInfo<RoomChangePermissionsScreenAlertType>?
|
||||
}
|
||||
|
||||
enum RoomChangeRolesScreenAlertType {
|
||||
/// The generic error message.
|
||||
case generic
|
||||
}
|
||||
|
||||
enum RoomChangeRolesScreenViewAction {
|
||||
/// Promote/Demote the specified member, toggling their role between user and this screen's role.
|
||||
case toggleMember(RoomMemberDetails)
|
||||
/// Demote the specified member to a regular user.
|
||||
case demoteMember(RoomMemberDetails)
|
||||
/// Save all the changes that the user has made.
|
||||
case save
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
typealias RoomChangeRolesScreenViewModelType = StateStoreViewModel<RoomChangeRolesScreenViewState, RoomChangeRolesScreenViewAction>
|
||||
|
||||
class RoomChangeRolesScreenViewModel: RoomChangeRolesScreenViewModelType, RoomChangeRolesScreenViewModelProtocol {
|
||||
private let roomProxy: RoomProxyProtocol
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
|
||||
private let actionsSubject: PassthroughSubject<RoomChangeRolesScreenViewModelAction, Never> = .init()
|
||||
var actionsPublisher: AnyPublisher<RoomChangeRolesScreenViewModelAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(mode: RoomMemberDetails.Role, roomProxy: RoomProxyProtocol, userIndicatorController: UserIndicatorControllerProtocol) {
|
||||
guard mode != .user else { fatalError("Invalid screen configuration: \(mode)") }
|
||||
|
||||
self.roomProxy = roomProxy
|
||||
self.userIndicatorController = userIndicatorController
|
||||
|
||||
super.init(initialViewState: RoomChangeRolesScreenViewState(mode: mode,
|
||||
members: [],
|
||||
bindings: .init()))
|
||||
|
||||
roomProxy.membersPublisher
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] members in
|
||||
self?.updateMembers(members)
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
roomProxy.timeline.timelineProvider.membershipChangePublisher.sink { [roomProxy] in
|
||||
Task { await roomProxy.updateMembers() }
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
updateMembers(roomProxy.membersPublisher.value)
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
override func process(viewAction: RoomChangeRolesScreenViewAction) {
|
||||
MXLog.info("View model: received view action: \(viewAction)")
|
||||
|
||||
switch viewAction {
|
||||
case .toggleMember(let member):
|
||||
toggleMember(member)
|
||||
case .demoteMember(let member):
|
||||
demoteMember(member)
|
||||
case .save:
|
||||
Task { await save() }
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func updateMembers(_ members: [RoomMemberProxyProtocol]) {
|
||||
state.members = members.sorted().compactMap { member in
|
||||
guard member.membership == .join, member.userID != roomProxy.ownUserID else { return nil }
|
||||
return RoomMemberDetails(withProxy: member)
|
||||
}
|
||||
}
|
||||
|
||||
private func toggleMember(_ member: RoomMemberDetails) {
|
||||
if state.membersToPromote.contains(member) {
|
||||
state.membersToPromote.remove(member)
|
||||
} else if state.membersToDemote.contains(member) {
|
||||
state.membersToDemote.remove(member)
|
||||
state.lastPromotedMember = member
|
||||
} else if member.role == state.mode {
|
||||
state.membersToDemote.insert(member)
|
||||
} else {
|
||||
state.membersToPromote.insert(member)
|
||||
state.lastPromotedMember = member
|
||||
}
|
||||
}
|
||||
|
||||
private func demoteMember(_ member: RoomMemberDetails) {
|
||||
if state.membersToPromote.contains(member) {
|
||||
state.membersToPromote.remove(member)
|
||||
} else {
|
||||
state.membersToDemote.insert(member)
|
||||
}
|
||||
}
|
||||
|
||||
private func save() async {
|
||||
showSavingIndicator()
|
||||
|
||||
defer {
|
||||
hideSavingIndicator()
|
||||
}
|
||||
|
||||
let promotingUpdates = state.membersToPromote.map { ($0.id, state.mode.rustPowerLevel) }
|
||||
let demotingUpdates = state.membersToDemote.map { ($0.id, Int64(0)) }
|
||||
switch await roomProxy.updatePowerLevelsForUsers(promotingUpdates + demotingUpdates) {
|
||||
case .success:
|
||||
MXLog.info("Success")
|
||||
case .failure:
|
||||
context.alertInfo = AlertInfo(id: .generic)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Loading indicator
|
||||
|
||||
private static let indicatorID = "SavingRoomRoles"
|
||||
|
||||
private func showSavingIndicator() {
|
||||
userIndicatorController.submitIndicator(UserIndicator(id: Self.indicatorID,
|
||||
type: .modal(progress: .indeterminate, interactiveDismissDisabled: true, allowsInteraction: false),
|
||||
title: L10n.commonSaving,
|
||||
persistent: true))
|
||||
}
|
||||
|
||||
private func hideSavingIndicator() {
|
||||
userIndicatorController.retractIndicatorWithId(Self.indicatorID)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Combine
|
||||
|
||||
@MainActor
|
||||
protocol RoomChangeRolesScreenViewModelProtocol {
|
||||
var actionsPublisher: AnyPublisher<RoomChangeRolesScreenViewModelAction, Never> { get }
|
||||
var context: RoomChangeRolesScreenViewModelType.Context { get }
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Compound
|
||||
import SwiftUI
|
||||
|
||||
struct RoomChangeRolesScreen: View {
|
||||
@ObservedObject var context: RoomChangeRolesScreenViewModel.Context
|
||||
|
||||
var showTopSection: Bool {
|
||||
!context.viewState.membersWithRole.isEmpty || context.viewState.isSearching
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
mainContent
|
||||
.compoundList()
|
||||
.scrollDismissesKeyboard(.immediately)
|
||||
.navigationTitle(context.viewState.title)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationBarBackButtonHidden(context.viewState.hasChanges)
|
||||
.toolbar { toolbar }
|
||||
.searchController(query: $context.searchQuery,
|
||||
placeholder: L10n.commonSearchForSomeone,
|
||||
showsCancelButton: false,
|
||||
disablesInteractiveDismiss: true)
|
||||
.compoundSearchField()
|
||||
.alert(item: $context.alertInfo)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private var mainContent: some View {
|
||||
GeometryReader { proxy in
|
||||
Form {
|
||||
if showTopSection {
|
||||
// this is a fix for having the carousel not clipped, and inside the form, so when the search is dismissed, it wont break the design
|
||||
Section {
|
||||
EmptyView()
|
||||
} header: {
|
||||
membersWithRoleSection
|
||||
.textCase(.none)
|
||||
.frame(width: proxy.size.width)
|
||||
}
|
||||
}
|
||||
|
||||
membersSection
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var noResultsContent: some View {
|
||||
Text(L10n.commonNoResults)
|
||||
.font(.compound.bodyLG)
|
||||
.foregroundColor(.compound.textSecondary)
|
||||
.frame(maxWidth: .infinity)
|
||||
.listRowBackground(Color.clear)
|
||||
.accessibilityIdentifier(A11yIdentifiers.startChatScreen.searchNoResults)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var membersSection: some View {
|
||||
if !context.viewState.visibleMembers.isEmpty {
|
||||
Section {
|
||||
ForEach(context.viewState.visibleMembers, id: \.id) { member in
|
||||
RoomChangeRolesScreenRow(member: member,
|
||||
imageProvider: context.imageProvider,
|
||||
kind: .multiSelection(isSelected: context.viewState.isMemberSelected(member)) {
|
||||
context.send(viewAction: .toggleMember(member))
|
||||
})
|
||||
.disabled(member.role == .administrator)
|
||||
}
|
||||
} header: {
|
||||
Text(L10n.screenRoomMemberListRoomMembersHeaderTitle)
|
||||
.compoundListSectionHeader()
|
||||
}
|
||||
} else {
|
||||
Section.empty
|
||||
}
|
||||
}
|
||||
|
||||
@ScaledMetric private var cellWidth: CGFloat = 72
|
||||
|
||||
private var membersWithRoleSection: some View {
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
ScrollViewReader { scrollView in
|
||||
HStack(spacing: 16) {
|
||||
ForEach(context.viewState.membersWithRole, id: \.id) { member in
|
||||
RoomChangeRolesScreenSelectedItem(member: member, imageProvider: context.imageProvider) {
|
||||
context.send(viewAction: .demoteMember(member))
|
||||
}
|
||||
.frame(width: cellWidth)
|
||||
}
|
||||
}
|
||||
.onChange(of: context.viewState.lastPromotedMember) { member in
|
||||
guard let member else { return }
|
||||
withElementAnimation(.easeInOut) {
|
||||
scrollView.scrollTo(member.id)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 14)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ToolbarContentBuilder
|
||||
private var toolbar: some ToolbarContent {
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
Button(L10n.actionSave) {
|
||||
context.send(viewAction: .save)
|
||||
}
|
||||
.disabled(!context.viewState.hasChanges)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
|
||||
struct RoomChangeRolesScreen_Previews: PreviewProvider, TestablePreview {
|
||||
static let administratorViewModel = makeViewModel(mode: .administrator)
|
||||
static let moderatorViewModel = makeViewModel(mode: .moderator)
|
||||
|
||||
static var previews: some View {
|
||||
NavigationStack {
|
||||
RoomChangeRolesScreen(context: administratorViewModel.context)
|
||||
}
|
||||
.previewDisplayName("Administrators")
|
||||
|
||||
NavigationStack {
|
||||
RoomChangeRolesScreen(context: moderatorViewModel.context)
|
||||
}
|
||||
.previewDisplayName("Moderators")
|
||||
}
|
||||
|
||||
static func makeViewModel(mode: RoomMemberDetails.Role) -> RoomChangeRolesScreenViewModel {
|
||||
RoomChangeRolesScreenViewModel(mode: mode,
|
||||
roomProxy: RoomProxyMock(with: .init(members: .allMembersAsAdmin)),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// Copyright 2023 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Compound
|
||||
import MatrixRustSDK
|
||||
import SwiftUI
|
||||
|
||||
struct RoomChangeRolesScreenRow: View {
|
||||
let member: RoomMemberDetails
|
||||
let imageProvider: ImageProviderProtocol?
|
||||
|
||||
let kind: ListRow<LoadableAvatarImage, EmptyView, EmptyView, Bool>.Kind<EmptyView, Bool>
|
||||
|
||||
var body: some View {
|
||||
ListRow(label: .avatar(title: member.name ?? member.id,
|
||||
description: member.name == nil ? nil : member.id,
|
||||
icon: avatar),
|
||||
kind: kind)
|
||||
}
|
||||
|
||||
var avatar: LoadableAvatarImage {
|
||||
LoadableAvatarImage(url: member.avatarURL,
|
||||
name: member.name,
|
||||
contentID: member.id,
|
||||
avatarSize: .user(on: .startChat),
|
||||
imageProvider: imageProvider)
|
||||
}
|
||||
}
|
||||
|
||||
struct RoomChangeRolesScreenRow_Previews: PreviewProvider, TestablePreview {
|
||||
static let action: () -> Void = { }
|
||||
|
||||
static var previews: some View {
|
||||
Form {
|
||||
RoomChangeRolesScreenRow(member: .init(withProxy: RoomMemberProxyMock.mockAlice),
|
||||
imageProvider: MockMediaProvider(),
|
||||
kind: .multiSelection(isSelected: true, action: action))
|
||||
|
||||
RoomChangeRolesScreenRow(member: .init(withProxy: RoomMemberProxyMock.mockBob),
|
||||
imageProvider: MockMediaProvider(),
|
||||
kind: .multiSelection(isSelected: false, action: action))
|
||||
|
||||
RoomChangeRolesScreenRow(member: .init(withProxy: RoomMemberProxyMock.mockCharlie),
|
||||
imageProvider: MockMediaProvider(),
|
||||
kind: .multiSelection(isSelected: true, action: action))
|
||||
.disabled(true)
|
||||
|
||||
RoomChangeRolesScreenRow(member: .init(withProxy: RoomMemberProxyMock(with: .init(userID: "@someone:matrix.org", membership: .join))),
|
||||
imageProvider: MockMediaProvider(),
|
||||
kind: .multiSelection(isSelected: false, action: action))
|
||||
.disabled(true)
|
||||
|
||||
RoomChangeRolesScreenRow(member: .init(withProxy: RoomMemberProxyMock(with: .init(userID: "@someone:matrix.org", membership: .join))),
|
||||
imageProvider: MockMediaProvider(),
|
||||
kind: .multiSelection(isSelected: false, action: action))
|
||||
}
|
||||
.compoundList()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// Copyright 2023 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct RoomChangeRolesScreenSelectedItem: View {
|
||||
let member: RoomMemberDetails
|
||||
let imageProvider: ImageProviderProtocol?
|
||||
let dismissAction: () -> Void
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 4) {
|
||||
avatar
|
||||
|
||||
Text(member.name ?? member.id)
|
||||
.font(.compound.bodyMD)
|
||||
.foregroundColor(.compound.textPrimary)
|
||||
.lineLimit(1)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
var avatar: some View {
|
||||
LoadableAvatarImage(url: member.avatarURL,
|
||||
name: member.name,
|
||||
contentID: member.id,
|
||||
avatarSize: .user(on: .inviteUsers),
|
||||
imageProvider: imageProvider)
|
||||
.overlay(alignment: .topTrailing) {
|
||||
if member.role != .administrator {
|
||||
Button(action: dismissAction) {
|
||||
Image(systemName: "xmark.circle.fill")
|
||||
.resizable()
|
||||
.scaledFrame(size: 20)
|
||||
.symbolRenderingMode(.palette)
|
||||
.foregroundStyle(Color.compound.iconOnSolidPrimary, Color.compound.iconPrimary)
|
||||
}
|
||||
.offset(x: 4)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct RoomChangeRolesScreenSelectedItem_Previews: PreviewProvider, TestablePreview {
|
||||
static let members: [RoomMemberDetails] = [
|
||||
RoomMemberProxyMock.mockAlice,
|
||||
RoomMemberProxyMock.mockDan,
|
||||
RoomMemberProxyMock.mockVerbose,
|
||||
RoomMemberProxyMock(with: .init(userID: "@someone:server.org", membership: .join)),
|
||||
RoomMemberProxyMock.mockAdmin
|
||||
]
|
||||
.map { .init(withProxy: $0) }
|
||||
|
||||
static var previews: some View {
|
||||
HStack(spacing: 12) {
|
||||
ForEach(members, id: \.id) { member in
|
||||
RoomChangeRolesScreenSelectedItem(member: member,
|
||||
imageProvider: MockMediaProvider(),
|
||||
dismissAction: { })
|
||||
.frame(width: 72)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.previewLayout(.sizeThatFits)
|
||||
}
|
||||
}
|
||||
@@ -395,6 +395,16 @@ class RoomProxy: RoomProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func updatePowerLevelsForUsers(_ updates: [(userID: String, powerLevel: Int64)]) async -> Result<Void, RoomProxyError> {
|
||||
do {
|
||||
let updates = updates.map { UserPowerLevelUpdate(userId: $0.userID, powerLevel: $0.powerLevel) }
|
||||
return try await .success(room.updatePowerLevelsForUsers(updates: updates))
|
||||
} catch {
|
||||
MXLog.error("Failed updating user power levels changes: \(error)")
|
||||
return .failure(.failedSettingPermission)
|
||||
}
|
||||
}
|
||||
|
||||
func canUser(userID: String, sendStateEvent event: StateEventType) async -> Result<Bool, RoomProxyError> {
|
||||
do {
|
||||
return try await .success(room.canUserSendState(userId: userID, stateEvent: event))
|
||||
|
||||
@@ -118,6 +118,7 @@ protocol RoomProxyProtocol {
|
||||
|
||||
func currentPowerLevelChanges() async -> Result<RoomPowerLevelChanges, RoomProxyError>
|
||||
func applyPowerLevelChanges(_ changes: RoomPowerLevelChanges) async -> Result<Void, RoomProxyError>
|
||||
func updatePowerLevelsForUsers(_ updates: [(userID: String, powerLevel: Int64)]) async -> Result<Void, RoomProxyError>
|
||||
func canUser(userID: String, sendStateEvent event: StateEventType) async -> Result<Bool, RoomProxyError>
|
||||
func canUserInvite(userID: String) async -> Result<Bool, RoomProxyError>
|
||||
func canUserRedactOther(userID: String) async -> Result<Bool, RoomProxyError>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:24fccfe79cfc77e77046fe423545001352ce1f4e0c66be73b6dacdd2f17a708f
|
||||
size 181257
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8a2f1caedbf217a348a766ac55218d3b2d352e30c00115a7780f985a7b7ff0e7
|
||||
size 184620
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e76bed7659ccba488a12c2a921752f91656a125b3878cb72c2e6b2e98d0ea0cd
|
||||
size 126522
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:21b64e2db9d6c469858f3ed63f626cd376ded04f85bb096e70c1347a0c68ab93
|
||||
size 66446
|
||||
176
UnitTests/Sources/RoomChangeRolesScreenViewModelTests.swift
Normal file
176
UnitTests/Sources/RoomChangeRolesScreenViewModelTests.swift
Normal file
@@ -0,0 +1,176 @@
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
@MainActor
|
||||
class RoomChangeRolesScreenViewModelTests: XCTestCase {
|
||||
var viewModel: RoomChangeRolesScreenViewModelProtocol!
|
||||
var roomProxy: RoomProxyMock!
|
||||
|
||||
var context: RoomChangeRolesScreenViewModelType.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
func testInitialStateAdministrators() {
|
||||
setupRoomProxy()
|
||||
viewModel = RoomChangeRolesScreenViewModel(mode: .administrator, roomProxy: roomProxy, userIndicatorController: UserIndicatorControllerMock())
|
||||
XCTAssertEqual(context.viewState.membersToPromote, [])
|
||||
XCTAssertEqual(context.viewState.membersToDemote, [])
|
||||
XCTAssertEqual(context.viewState.members, context.viewState.visibleMembers)
|
||||
XCTAssertEqual(context.viewState.membersWithRole.count, 1)
|
||||
XCTAssertEqual(context.viewState.membersWithRole.first?.id, RoomMemberProxyMock.mockAdmin.userID)
|
||||
XCTAssertFalse(context.viewState.hasChanges)
|
||||
XCTAssertFalse(context.viewState.isSearching)
|
||||
}
|
||||
|
||||
func testInitialStateModerators() {
|
||||
setupRoomProxy()
|
||||
viewModel = RoomChangeRolesScreenViewModel(mode: .moderator, roomProxy: roomProxy, userIndicatorController: UserIndicatorControllerMock())
|
||||
XCTAssertEqual(context.viewState.membersToPromote, [])
|
||||
XCTAssertEqual(context.viewState.membersToDemote, [])
|
||||
XCTAssertEqual(context.viewState.members, context.viewState.visibleMembers)
|
||||
XCTAssertEqual(context.viewState.membersWithRole.count, 1)
|
||||
XCTAssertEqual(context.viewState.membersWithRole.first?.id, RoomMemberProxyMock.mockModerator.userID)
|
||||
XCTAssertFalse(context.viewState.hasChanges)
|
||||
XCTAssertFalse(context.viewState.isSearching)
|
||||
}
|
||||
|
||||
func testToggleUserOn() {
|
||||
testInitialStateModerators()
|
||||
guard let firstUser = context.viewState.members.first(where: { !context.viewState.isMemberSelected($0) }) else {
|
||||
XCTFail("There should be a regular user available to promote.")
|
||||
return
|
||||
}
|
||||
|
||||
context.send(viewAction: .toggleMember(firstUser))
|
||||
|
||||
XCTAssertEqual(context.viewState.membersToPromote, [firstUser])
|
||||
XCTAssertEqual(context.viewState.membersToDemote, [])
|
||||
XCTAssertEqual(context.viewState.membersWithRole.count, 2)
|
||||
XCTAssertTrue(context.viewState.membersWithRole.contains(firstUser))
|
||||
XCTAssertTrue(context.viewState.hasChanges)
|
||||
}
|
||||
|
||||
func testToggleUserOff() {
|
||||
testToggleUserOn()
|
||||
guard let firstUser = context.viewState.membersToPromote.first else {
|
||||
XCTFail("There should be a promoted member before we begin.")
|
||||
return
|
||||
}
|
||||
|
||||
context.send(viewAction: .toggleMember(firstUser))
|
||||
|
||||
XCTAssertEqual(context.viewState.membersToPromote, [])
|
||||
XCTAssertEqual(context.viewState.membersToDemote, [])
|
||||
XCTAssertEqual(context.viewState.membersWithRole.count, 1)
|
||||
XCTAssertFalse(context.viewState.membersWithRole.contains(firstUser))
|
||||
XCTAssertFalse(context.viewState.hasChanges)
|
||||
}
|
||||
|
||||
func testDemoteToggledUser() {
|
||||
testToggleUserOn()
|
||||
guard let firstUser = context.viewState.membersToPromote.first else {
|
||||
XCTFail("There should be a promoted member before we begin.")
|
||||
return
|
||||
}
|
||||
|
||||
context.send(viewAction: .demoteMember(firstUser))
|
||||
|
||||
XCTAssertEqual(context.viewState.membersToPromote, [])
|
||||
XCTAssertEqual(context.viewState.membersToDemote, [])
|
||||
XCTAssertEqual(context.viewState.membersWithRole.count, 1)
|
||||
XCTAssertFalse(context.viewState.membersWithRole.contains(firstUser))
|
||||
XCTAssertFalse(context.viewState.hasChanges)
|
||||
}
|
||||
|
||||
func testToggleModeratorOff() {
|
||||
testInitialStateModerators()
|
||||
guard let existingModerator = context.viewState.membersWithRole.first else {
|
||||
XCTFail("There should be a member with the role before we begin.")
|
||||
return
|
||||
}
|
||||
|
||||
context.send(viewAction: .toggleMember(existingModerator))
|
||||
|
||||
XCTAssertEqual(context.viewState.membersToPromote, [])
|
||||
XCTAssertEqual(context.viewState.membersToDemote, [existingModerator])
|
||||
XCTAssertEqual(context.viewState.membersWithRole.count, 0)
|
||||
XCTAssertFalse(context.viewState.membersWithRole.contains(existingModerator))
|
||||
XCTAssertTrue(context.viewState.hasChanges)
|
||||
}
|
||||
|
||||
func testToggleModeratorOn() {
|
||||
testToggleModeratorOff()
|
||||
|
||||
guard let demotedMember = context.viewState.membersToDemote.first else {
|
||||
XCTFail("There should be a member selected to demote before we begin.")
|
||||
return
|
||||
}
|
||||
|
||||
context.send(viewAction: .toggleMember(demotedMember))
|
||||
|
||||
XCTAssertEqual(context.viewState.membersToPromote, [])
|
||||
XCTAssertEqual(context.viewState.membersToDemote, [])
|
||||
XCTAssertEqual(context.viewState.membersWithRole.count, 1)
|
||||
XCTAssertTrue(context.viewState.membersWithRole.contains(demotedMember))
|
||||
XCTAssertFalse(context.viewState.hasChanges)
|
||||
}
|
||||
|
||||
func testDemoteModerator() {
|
||||
testInitialStateModerators()
|
||||
guard let existingModerator = context.viewState.membersWithRole.first else {
|
||||
XCTFail("There should be a member with the role before we begin.")
|
||||
return
|
||||
}
|
||||
|
||||
context.send(viewAction: .demoteMember(existingModerator))
|
||||
|
||||
XCTAssertEqual(context.viewState.membersToPromote, [])
|
||||
XCTAssertEqual(context.viewState.membersToDemote, [existingModerator])
|
||||
XCTAssertEqual(context.viewState.membersWithRole.count, 0)
|
||||
XCTAssertFalse(context.viewState.membersWithRole.contains(existingModerator))
|
||||
XCTAssertTrue(context.viewState.hasChanges)
|
||||
}
|
||||
|
||||
func testSaveChanges() async throws {
|
||||
setupRoomProxy()
|
||||
viewModel = RoomChangeRolesScreenViewModel(mode: .moderator, roomProxy: roomProxy, userIndicatorController: UserIndicatorControllerMock())
|
||||
|
||||
guard let firstUser = context.viewState.members.first(where: { !context.viewState.isMemberSelected($0) }),
|
||||
let existingModerator = context.viewState.membersWithRole.first else {
|
||||
XCTFail("There should be a regular user and a moderator to begin with.")
|
||||
return
|
||||
}
|
||||
|
||||
context.send(viewAction: .toggleMember(firstUser))
|
||||
context.send(viewAction: .toggleMember(existingModerator))
|
||||
context.send(viewAction: .save)
|
||||
|
||||
try await Task.sleep(for: .milliseconds(100))
|
||||
|
||||
XCTAssertTrue(roomProxy.updatePowerLevelsForUsersCalled)
|
||||
XCTAssertEqual(roomProxy.updatePowerLevelsForUsersReceivedUpdates?.count, 2)
|
||||
XCTAssertEqual(roomProxy.updatePowerLevelsForUsersReceivedUpdates?.contains(where: { $0.userID == existingModerator.id && $0.powerLevel == 0 }), true)
|
||||
XCTAssertEqual(roomProxy.updatePowerLevelsForUsersReceivedUpdates?.contains(where: { $0.userID == firstUser.id && $0.powerLevel == 50 }), true)
|
||||
}
|
||||
|
||||
private func setupRoomProxy() {
|
||||
roomProxy = RoomProxyMock(with: .init(members: .allMembersAsAdmin))
|
||||
}
|
||||
}
|
||||
1
changelog.d/2356.wip
Normal file
1
changelog.d/2356.wip
Normal file
@@ -0,0 +1 @@
|
||||
Add RoomChangeRolesScreen.
|
||||
Reference in New Issue
Block a user