From 8090c4a078e244dc78619dae7713e9dbcf281c19 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Thu, 22 Jan 2026 17:18:12 +0100 Subject: [PATCH] added the create button in the empty state of the space screen and refactored some code --- ElementX.xcodeproj/project.pbxproj | 67 +++++++++++-------- .../en-US.lproj/Localizable.strings | 4 +- .../en.lproj/Localizable.strings | 4 +- .../SpacesTabFlowCoordinator.swift | 2 +- .../StartChatFlowCoordinator.swift | 21 +++--- ElementX/Sources/Generated/Strings.swift | 6 +- .../CreateRoomScreenModels.swift | 4 +- .../CreateRoomScreenViewModel.swift | 4 +- .../View/CreateRoomScreen.swift | 14 ++-- .../View/CreateRoomSpaceSelectionSheet.swift | 2 +- .../Spaces/SpaceScreen/View/SpaceScreen.swift | 13 +++- .../Services/Spaces/SpaceServiceProxy.swift | 2 +- .../Sources/GeneratedPreviewTests.swift | 1 + .../spaceScreen.New-Space-iPad-en-GB.png | 4 +- .../spaceScreen.New-Space-iPad-pseudo.png | 4 +- .../spaceScreen.New-Space-iPhone-en-GB.png | 4 +- .../spaceScreen.New-Space-iPhone-pseudo.png | 4 +- .../Sources/CreateRoomViewModelTests.swift | 6 +- 18 files changed, 96 insertions(+), 70 deletions(-) diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index 0ac17ee39..951b64728 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 63; + objectVersion = 77; objects = { /* Begin PBXAggregateTarget section */ @@ -980,7 +980,6 @@ A6FFC4C5154C446BAD6B40D8 /* TimelineItemProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8520AFD6680CBAD388F6D927 /* TimelineItemProvider.swift */; }; A722F426FD81FC67706BB1E0 /* CustomLayoutLabelStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42236480CF0431535EBE8387 /* CustomLayoutLabelStyle.swift */; }; A74438ED16F8683A4B793E6A /* AnalyticsSettingsScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BCE3FAF40932AC7C7639AC4 /* AnalyticsSettingsScreenViewModel.swift */; }; - A765AFE12F1EAA730040CEC2 /* CreateRoomSpaceSelectionSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = A765AFE02F1EAA6C0040CEC2 /* CreateRoomSpaceSelectionSheet.swift */; }; A7D48E44D485B143AADDB77D /* Strings+Untranslated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A18F6CE4D694D21E4EA9B25 /* Strings+Untranslated.swift */; }; A7DB75E090542331F6668A23 /* CreateRoomScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF19027E7FFA5E63D148873A /* CreateRoomScreenViewModel.swift */; }; A808DC3F72D15C6C5A52317E /* TimelineItemDebugView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCDA016D05107DED3B9495CB /* TimelineItemDebugView.swift */; }; @@ -1581,7 +1580,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; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; + 048A21188AB19349D026BECD /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; 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 = ""; }; @@ -1665,7 +1664,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; lastKnownFileType = text; path = IntegrationTests.xctestplan; sourceTree = ""; }; + 1304D9191300873EADA52D6E /* IntegrationTests.xctestplan */ = {isa = PBXFileReference; path = IntegrationTests.xctestplan; sourceTree = ""; }; 130ED565A078F7E0B59D9D25 /* UNTextInputNotificationResponse+Creator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UNTextInputNotificationResponse+Creator.swift"; sourceTree = ""; }; 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 = ""; }; @@ -1686,7 +1685,7 @@ 16D09C79746BDCD9173EB3A7 /* RoomDetailsEditScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDetailsEditScreenModels.swift; sourceTree = ""; }; 16D353E10A64172D863769BF /* TombstonedAvatarImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TombstonedAvatarImage.swift; sourceTree = ""; }; 1715E3D7F53C0748AA50C91C /* PostHogAnalyticsClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogAnalyticsClient.swift; sourceTree = ""; }; - 174E4AEF3DED300AA81046EC /* compound-ios */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "compound-ios"; sourceTree = SOURCE_ROOT; }; + 174E4AEF3DED300AA81046EC /* compound-ios */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "compound-ios"; path = "compound-ios"; sourceTree = SOURCE_ROOT; }; 17A8AA0DFA06012A9DAB951E /* TimelineProxyMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineProxyMock.swift; sourceTree = ""; }; 17BAE25A0E9E9F2F1BBA8930 /* DeactivateAccountScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeactivateAccountScreenViewModel.swift; sourceTree = ""; }; 181CF280BC8E3F335AFCB4B8 /* RemotePreferenceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemotePreferenceTests.swift; sourceTree = ""; }; @@ -1777,7 +1776,7 @@ 25E7E9B7FEAB6169D960C206 /* QRCodeLoginScreenViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeLoginScreenViewModelTests.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; lastKnownFileType = text; path = PreviewTests.xctestplan; sourceTree = ""; }; + 267BB1D5B08A9511F894CB57 /* PreviewTests.xctestplan */ = {isa = PBXFileReference; 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 = ""; }; @@ -1860,7 +1859,7 @@ 358528B29FA72ACFD0D9644B /* SpacesScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpacesScreenCoordinator.swift; sourceTree = ""; }; 35A057BA9BE0F079784CD061 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 35AFCF4C05DEED04E3DB1A16 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; - 36DA824791172B9821EACBED /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; + 36DA824791172B9821EACBED /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 36FD673E24FBFCFDF398716A /* RoomMemberProxyMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMemberProxyMock.swift; sourceTree = ""; }; 3747C96188856006F784BF49 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ko; path = ko.lproj/Localizable.stringsdict; sourceTree = ""; }; 37A63A59BFDDC494B1C20119 /* CallScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallScreenViewModel.swift; sourceTree = ""; }; @@ -1979,7 +1978,7 @@ 4A2B5274C1D3D2999D643786 /* EncryptionResetPasswordScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncryptionResetPasswordScreenViewModelProtocol.swift; sourceTree = ""; }; 4A5B4CD611DE7E94F5BA87B2 /* AppLockTimerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockTimerTests.swift; sourceTree = ""; }; 4AB29A2D95D3469B5F016655 /* SecureBackupControllerMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackupControllerMock.swift; sourceTree = ""; }; - 4B1F71AC585827E6C416C15A /* AppIcon.icon */ = {isa = PBXFileReference; lastKnownFileType = folder.iconcomposer.icon; path = AppIcon.icon; sourceTree = ""; }; + 4B1F71AC585827E6C416C15A /* AppIcon.icon */ = {isa = PBXFileReference; path = AppIcon.icon; sourceTree = ""; }; 4B2B564CA6570E1487A7C7CC /* SpaceRoomListProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpaceRoomListProxy.swift; sourceTree = ""; }; 4B2D4EEBE8C098BBADD10939 /* SecureBackupKeyBackupScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackupKeyBackupScreenCoordinator.swift; sourceTree = ""; }; 4B41FABA2B0AEF4389986495 /* LoginMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginMode.swift; sourceTree = ""; }; @@ -2328,7 +2327,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; lastKnownFileType = text; path = UITests.xctestplan; sourceTree = ""; }; + 8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; 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 = ""; }; @@ -2456,7 +2455,6 @@ A6C11AD9813045E44F950410 /* ElementCallWidgetDriverProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementCallWidgetDriverProtocol.swift; sourceTree = ""; }; A6EA0D8B0BBD8805F7D5A133 /* TextBasedRoomTimelineViewProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextBasedRoomTimelineViewProtocol.swift; sourceTree = ""; }; A73A07BAEDD74C48795A996A /* AsyncSequence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsyncSequence.swift; sourceTree = ""; }; - A765AFE02F1EAA6C0040CEC2 /* CreateRoomSpaceSelectionSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomSpaceSelectionSheet.swift; sourceTree = ""; }; A768CA51A59B8A5D8C8FD599 /* AuthenticationStartScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationStartScreen.swift; sourceTree = ""; }; A7978C9EFBDD7DE39BD86726 /* RestorationTokenTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RestorationTokenTests.swift; sourceTree = ""; }; A7A1B80FE6E3BA72F9C748AD /* AdvancedSettingsScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvancedSettingsScreenViewModel.swift; sourceTree = ""; }; @@ -2480,7 +2478,7 @@ AAD8234D0E9C9B12BF9F240B /* LocationAnnotation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationAnnotation.swift; sourceTree = ""; }; AB07F03461023BC39C730922 /* PhishingDetector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhishingDetector.swift; sourceTree = ""; }; AB26D5444A4A7E095222DE8B /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.stringsdict"; sourceTree = ""; }; - AB389C38BD41EB3E47092CFB /* AccessibilityTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = AccessibilityTests.xctestplan; sourceTree = ""; }; + AB389C38BD41EB3E47092CFB /* AccessibilityTests.xctestplan */ = {isa = PBXFileReference; path = AccessibilityTests.xctestplan; sourceTree = ""; }; ABA4CF2F5B4F68D02E412004 /* ServerConfirmationScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerConfirmationScreenViewModelProtocol.swift; sourceTree = ""; }; AC0275CEE9CA078B34028BDF /* AppLockScreenViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockScreenViewModelTests.swift; sourceTree = ""; }; AC1DA29A5A041CC0BACA7CB0 /* MockImageCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockImageCache.swift; sourceTree = ""; }; @@ -2548,7 +2546,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; lastKnownFileType = file.bplist; path = ConfettiScene.scn; sourceTree = ""; }; + B61C339A2FDDBD067FF6635C /* ConfettiScene.scn */ = {isa = PBXFileReference; path = ConfettiScene.scn; sourceTree = ""; }; B6404166CBF5CC88673FF9E2 /* RoomDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDetails.swift; sourceTree = ""; }; B65DDCF8E41759890355ACBC /* AuthenticationStartScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationStartScreenViewModelProtocol.swift; sourceTree = ""; }; B682FE2C44C5E163E7023B05 /* CopyTextButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CopyTextButton.swift; sourceTree = ""; }; @@ -2580,7 +2578,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; lastKnownFileType = file; path = test_apple_image.heic; sourceTree = ""; }; + BB576F4118C35E6B5124FA22 /* test_apple_image.heic */ = {isa = PBXFileReference; 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 = ""; }; @@ -2686,7 +2684,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; lastKnownFileType = text; path = UnitTests.xctestplan; sourceTree = ""; }; + CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; path = UnitTests.xctestplan; sourceTree = ""; }; CF19027E7FFA5E63D148873A /* CreateRoomScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomScreenViewModel.swift; sourceTree = ""; }; CF847A34FC4C8C937CD39E08 /* LabsScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabsScreenViewModelProtocol.swift; sourceTree = ""; }; CFFA5E881D281810AB428EA3 /* RoomPowerLevelsProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomPowerLevelsProxy.swift; sourceTree = ""; }; @@ -2755,7 +2753,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; lastKnownFileType = file; path = test_voice_message.m4a; sourceTree = ""; }; + DCA2D836BD10303F37FAAEED /* test_voice_message.m4a */ = {isa = PBXFileReference; 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 = ""; }; @@ -2801,7 +2799,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; lastKnownFileType = file; path = portrait_test_video.mp4; sourceTree = ""; }; + E5E7D4EE7CA295E5039FDA21 /* portrait_test_video.mp4 */ = {isa = PBXFileReference; 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 = ""; }; @@ -2849,7 +2847,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; lastKnownFileType = file; path = message.caf; sourceTree = ""; }; + ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; 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 = ""; }; EDDE826EAB1BAB80C1104980 /* SpaceFlowCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpaceFlowCoordinator.swift; sourceTree = ""; }; @@ -5714,7 +5712,6 @@ A7694BCE812C4D7B2B1B42DF /* View */ = { isa = PBXGroup; children = ( - A765AFE02F1EAA6C0040CEC2 /* CreateRoomSpaceSelectionSheet.swift */, EFD1CFB730C7417925264F17 /* CreateRoomScreen.swift */, C3141EE5B2CBEC45270E01EB /* CreateRoomSpaceSelectionSheet.swift */, ); @@ -7240,6 +7237,7 @@ EE40B0E16A55BD23ECBFFD22 /* XCRemoteSwiftPackageReference "matrix-rich-text-editor-swift" */, C89CF7729E028671C5DC461E /* XCLocalSwiftPackageReference "compound-ios" */, ); + preferredProjectObjectVersion = 77; projectDirPath = ""; projectRoot = ""; targets = ( @@ -8399,7 +8397,6 @@ FDD5B4B616D9FF4DE3E9A418 /* QRCodeScannerView.swift in Sources */, C292A8DA07E6DBD66E946383 /* RageshakeConfiguration.swift in Sources */, C9A631FD968249B4BA0B7B3C /* ReactionsSummaryView.swift in Sources */, - A765AFE12F1EAA730040CEC2 /* CreateRoomSpaceSelectionSheet.swift in Sources */, 743790BF6A5B0577EA74AF14 /* ReadMarkerRoomTimelineItem.swift in Sources */, 2BBC0EB1E07963810A5D7423 /* ReadMarkerRoomTimelineView.swift in Sources */, 91ABC91758A6E4A5FAA2E9C4 /* ReadReceipt.swift in Sources */, @@ -9154,7 +9151,9 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - OTHER_SWIFT_FLAGS = "-DRELEASE"; + OTHER_SWIFT_FLAGS = ( + "-DRELEASE", + ); PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.accessibility.tests"; PRODUCT_NAME = AccessibilityTests; SDKROOT = iphoneos; @@ -9173,7 +9172,9 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - OTHER_SWIFT_FLAGS = "-DDEBUG"; + OTHER_SWIFT_FLAGS = ( + "-DDEBUG", + ); PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.accessibility.tests"; PRODUCT_NAME = AccessibilityTests; SDKROOT = iphoneos; @@ -9195,7 +9196,9 @@ "@executable_path/../../Frameworks", ); MARKETING_VERSION = "$(MARKETING_VERSION)"; - OTHER_SWIFT_FLAGS = "-DIS_NSE"; + OTHER_SWIFT_FLAGS = ( + "-DIS_NSE", + ); PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.nse"; PRODUCT_DISPLAY_NAME = "$(APP_DISPLAY_NAME)"; PRODUCT_NAME = NSE; @@ -9262,7 +9265,9 @@ "$(inherited)", "-ObjC", ); - 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)"; @@ -9292,7 +9297,9 @@ "$(inherited)", "-ObjC", ); - 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)"; @@ -9517,7 +9524,9 @@ "@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; @@ -9536,7 +9545,9 @@ "@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; @@ -9558,7 +9569,9 @@ "@executable_path/../../Frameworks", ); MARKETING_VERSION = "$(MARKETING_VERSION)"; - OTHER_SWIFT_FLAGS = "-DIS_NSE"; + OTHER_SWIFT_FLAGS = ( + "-DIS_NSE", + ); PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.nse"; PRODUCT_DISPLAY_NAME = "$(APP_DISPLAY_NAME)"; PRODUCT_NAME = NSE; diff --git a/ElementX/Resources/Localizations/en-US.lproj/Localizable.strings b/ElementX/Resources/Localizations/en-US.lproj/Localizable.strings index 74e277814..3261627a7 100644 --- a/ElementX/Resources/Localizations/en-US.lproj/Localizable.strings +++ b/ElementX/Resources/Localizations/en-US.lproj/Localizable.strings @@ -67,7 +67,7 @@ "action_copy_link_to_message" = "Copy link to message"; "action_copy_text" = "Copy text"; "action_create" = "Create"; -"action_create_a_room" = "Create room"; +"action_create_room" = "Create room"; "action_create_space" = "Create space"; "action_deactivate" = "Deactivate"; "action_deactivate_account" = "Deactivate account"; @@ -283,6 +283,7 @@ "common_report_a_problem" = "Report a problem"; "common_report_submitted" = "Report submitted"; "common_rich_text_editor" = "Rich text editor"; +"common_role" = "Role"; "common_room" = "Room"; "common_room_name" = "Room name"; "common_room_name_placeholder" = "e.g. your project name"; @@ -727,6 +728,7 @@ "screen_security_and_privacy_room_visibility_section_footer" = "Addresses are a way to find and access rooms and spaces. This also ensures you can easily share them with others."; "screen_security_and_privacy_room_visibility_section_header" = "Visibility"; "screen_security_and_privacy_title" = "Security & privacy"; +"screen_space_add_room_action" = "Room"; "screen_space_empty_state_title" = "Add your first room"; "screen_space_menu_action_members" = "View members"; "screen_space_remove_rooms_confirmation_content" = "Removing a room will not affect the room access. To change the access go to Room info > Privacy & security."; diff --git a/ElementX/Resources/Localizations/en.lproj/Localizable.strings b/ElementX/Resources/Localizations/en.lproj/Localizable.strings index 02e158e1f..21b577bff 100644 --- a/ElementX/Resources/Localizations/en.lproj/Localizable.strings +++ b/ElementX/Resources/Localizations/en.lproj/Localizable.strings @@ -67,7 +67,7 @@ "action_copy_link_to_message" = "Copy link to message"; "action_copy_text" = "Copy text"; "action_create" = "Create"; -"action_create_a_room" = "Create room"; +"action_create_room" = "Create room"; "action_create_space" = "Create space"; "action_deactivate" = "Deactivate"; "action_deactivate_account" = "Deactivate account"; @@ -283,6 +283,7 @@ "common_report_a_problem" = "Report a problem"; "common_report_submitted" = "Report submitted"; "common_rich_text_editor" = "Rich text editor"; +"common_role" = "Role"; "common_room" = "Room"; "common_room_name" = "Room name"; "common_room_name_placeholder" = "e.g. your project name"; @@ -727,6 +728,7 @@ "screen_security_and_privacy_room_visibility_section_footer" = "Addresses are a way to find and access rooms and spaces. This also ensures you can easily share them with others."; "screen_security_and_privacy_room_visibility_section_header" = "Visibility"; "screen_security_and_privacy_title" = "Security & privacy"; +"screen_space_add_room_action" = "Room"; "screen_space_empty_state_title" = "Add your first room"; "screen_space_menu_action_members" = "View members"; "screen_space_remove_rooms_confirmation_content" = "Removing a room will not affect the room access. To change the access go to Room info > Privacy & security."; diff --git a/ElementX/Sources/FlowCoordinators/SpacesTabFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/SpacesTabFlowCoordinator.swift index d382ad779..de88d065a 100644 --- a/ElementX/Sources/FlowCoordinators/SpacesTabFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/SpacesTabFlowCoordinator.swift @@ -225,7 +225,7 @@ class SpacesTabFlowCoordinator: FlowCoordinatorProtocol { .store(in: &cancellables) navigationSplitCoordinator.setSheetCoordinator(coordinator) { [weak self] in - self?.stateMachine.tryEvent(.dismissedCreateSpaceFlow) + self?.stateMachine.tryEvent(.dismissedCreateSpaceFlow, userInfo: spaceRoomListProxy) } flowCoordinator.start(animated: true) diff --git a/ElementX/Sources/FlowCoordinators/StartChatFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/StartChatFlowCoordinator.swift index 234313cf2..800d1d1ad 100644 --- a/ElementX/Sources/FlowCoordinators/StartChatFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/StartChatFlowCoordinator.swift @@ -141,14 +141,17 @@ class StartChatFlowCoordinator: FlowCoordinatorProtocol { case .startChat: presentStartChatScreen() case .createSpace: - presentCreateRoomScreen(isSpace: true, isRoot: true) + presentCreateRoomScreen(isSpace: true, spaceSelectionMode: nil, isRoot: true) case .createRoomInSpace(let space): - presentCreateRoomScreen(isSpace: false, selectedSpace: space, isRoot: true) + presentCreateRoomScreen(isSpace: false, spaceSelectionMode: .preSelected(space), isRoot: true) } } stateMachine.addRoutes(event: .createRoom, transitions: [.startChat => .createRoom]) { [weak self] _ in - self?.presentCreateRoomScreen(isSpace: false, isRoot: false) + guard let self else { return } + presentCreateRoomScreen(isSpace: false, + spaceSelectionMode: flowParameters.appSettings.createSpaceEnabled ? .editableSpacesList : nil, + isRoot: false) } stateMachine.addRoutes(event: .dismissedCreateRoom, transitions: [.createRoom => .startChat]) { [weak self] _ in self?.createRoomScreenCoordinator = nil @@ -204,15 +207,9 @@ class StartChatFlowCoordinator: FlowCoordinatorProtocol { navigationStackCoordinator.setRootCoordinator(coordinator) } - private func presentCreateRoomScreen(isSpace: Bool, selectedSpace: SpaceServiceRoomProtocol? = nil, isRoot: Bool) { - let spaceSelectionMode: CreateRoomScreenSpaceSelectionMode? = if let selectedSpace { - .selected(selectedSpace) - } else if !isSpace, flowParameters.appSettings.createSpaceEnabled { - .list - } else { - nil - } - + private func presentCreateRoomScreen(isSpace: Bool, + spaceSelectionMode: CreateRoomScreenSpaceSelectionMode?, + isRoot: Bool) { let createParameters = CreateRoomScreenCoordinatorParameters(isSpace: isSpace, spaceSelectionMode: spaceSelectionMode, shouldShowCancelButton: isRoot, diff --git a/ElementX/Sources/Generated/Strings.swift b/ElementX/Sources/Generated/Strings.swift index f7fde0518..c854cc6ba 100644 --- a/ElementX/Sources/Generated/Strings.swift +++ b/ElementX/Sources/Generated/Strings.swift @@ -169,7 +169,7 @@ internal enum L10n { /// Create internal static var actionCreate: String { return L10n.tr("Localizable", "action_create") } /// Create room - internal static var actionCreateARoom: String { return L10n.tr("Localizable", "action_create_a_room") } + internal static var actionCreateRoom: String { return L10n.tr("Localizable", "action_create_room") } /// Create space internal static var actionCreateSpace: String { return L10n.tr("Localizable", "action_create_space") } /// Deactivate @@ -640,6 +640,8 @@ internal enum L10n { internal static var commonReportSubmitted: String { return L10n.tr("Localizable", "common_report_submitted") } /// Rich text editor internal static var commonRichTextEditor: String { return L10n.tr("Localizable", "common_rich_text_editor") } + /// Role + internal static var commonRole: String { return L10n.tr("Localizable", "common_role") } /// Room internal static var commonRoom: String { return L10n.tr("Localizable", "common_room") } /// Room name @@ -3149,6 +3151,8 @@ internal enum L10n { internal static var screenSignoutSaveRecoveryKeySubtitle: String { return L10n.tr("Localizable", "screen_signout_save_recovery_key_subtitle") } /// Have you saved your recovery key? internal static var screenSignoutSaveRecoveryKeyTitle: String { return L10n.tr("Localizable", "screen_signout_save_recovery_key_title") } + /// Room + internal static var screenSpaceAddRoomAction: String { return L10n.tr("Localizable", "screen_space_add_room_action") } /// Adding a room will not affect the room access. To change the access go to Room settings > Security & privacy. internal static var screenSpaceAddRoomsRoomAccessDescription: String { return L10n.tr("Localizable", "screen_space_add_rooms_room_access_description") } /// View spaces you've created or joined diff --git a/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenModels.swift b/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenModels.swift index eada798d6..4a5ec3de2 100644 --- a/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenModels.swift +++ b/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenModels.swift @@ -143,6 +143,6 @@ enum CreateRoomScreenAccessType { } enum CreateRoomScreenSpaceSelectionMode { - case list - case selected(SpaceServiceRoomProtocol) + case editableSpacesList + case preSelected(SpaceServiceRoomProtocol) } diff --git a/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenViewModel.swift b/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenViewModel.swift index 46f49c541..120f97d80 100644 --- a/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenViewModel.swift +++ b/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenViewModel.swift @@ -42,9 +42,9 @@ class CreateRoomScreenViewModel: CreateRoomScreenViewModelType, CreateRoomScreen var selectedSpace: SpaceServiceRoomProtocol? var canSelectSpace = false switch spaceSelectionMode { - case .list: + case .editableSpacesList: canSelectSpace = true - case .selected(let value): + case .preSelected(let value): selectedSpace = value case .none: break diff --git a/ElementX/Sources/Screens/CreateRoomScreen/View/CreateRoomScreen.swift b/ElementX/Sources/Screens/CreateRoomScreen/View/CreateRoomScreen.swift index caee02b59..b77db1c8e 100644 --- a/ElementX/Sources/Screens/CreateRoomScreen/View/CreateRoomScreen.swift +++ b/ElementX/Sources/Screens/CreateRoomScreen/View/CreateRoomScreen.swift @@ -378,9 +378,9 @@ struct CreateRoom_Previews: PreviewProvider, TestablePreview { return viewModel }() - static let selectedSpaceViewModel = makeViewModel(selectionMode: .selected(SpaceServiceRoomMock(.init(name: "Awesome Space", - isSpace: true, - joinRule: .private)))) + static let selectedSpaceViewModel = makeViewModel(selectionMode: .preSelected(SpaceServiceRoomMock(.init(name: "Awesome Space", + isSpace: true, + joinRule: .private)))) static let selectedSpaceWithListViewModel = { let viewModel = makeViewModel() @@ -390,9 +390,9 @@ struct CreateRoom_Previews: PreviewProvider, TestablePreview { static let selectedSpaceWithAskToJoinViewModel = { let viewModel = makeViewModel(isKnockingEnabled: true, - selectionMode: .selected(SpaceServiceRoomMock(.init(name: "Awesome Space", - isSpace: true, - joinRule: .private)))) + selectionMode: .preSelected(SpaceServiceRoomMock(.init(name: "Awesome Space", + isSpace: true, + joinRule: .private)))) viewModel.context.selectedAccessType = .askToJoinWithSpaceMembers return viewModel }() @@ -460,7 +460,7 @@ struct CreateRoom_Previews: PreviewProvider, TestablePreview { private static func makeViewModel(isKnockingEnabled: Bool = false, isSpace: Bool = false, - selectionMode: CreateRoomScreenSpaceSelectionMode? = .list, + selectionMode: CreateRoomScreenSpaceSelectionMode? = .editableSpacesList, isAliasAvailable: Bool = true) -> CreateRoomScreenViewModel { AppSettings.resetAllSettings() let appSettings = AppSettings() diff --git a/ElementX/Sources/Screens/CreateRoomScreen/View/CreateRoomSpaceSelectionSheet.swift b/ElementX/Sources/Screens/CreateRoomScreen/View/CreateRoomSpaceSelectionSheet.swift index cc75f96cf..b0a514998 100644 --- a/ElementX/Sources/Screens/CreateRoomScreen/View/CreateRoomSpaceSelectionSheet.swift +++ b/ElementX/Sources/Screens/CreateRoomScreen/View/CreateRoomSpaceSelectionSheet.swift @@ -75,7 +75,7 @@ struct CreateRoomSpaceSelectionSheet_Previews: PreviewProvider, TestablePreview let userSession = UserSessionMock(.init(clientProxy: clientProxy)) return CreateRoomScreenViewModel(isSpace: false, - spaceSelectionMode: .list, + spaceSelectionMode: .editableSpacesList, shouldShowCancelButton: false, userSession: userSession, analytics: ServiceLocator.shared.analytics, diff --git a/ElementX/Sources/Screens/Spaces/SpaceScreen/View/SpaceScreen.swift b/ElementX/Sources/Screens/Spaces/SpaceScreen/View/SpaceScreen.swift index 342143594..731a90cc5 100644 --- a/ElementX/Sources/Screens/Spaces/SpaceScreen/View/SpaceScreen.swift +++ b/ElementX/Sources/Screens/Spaces/SpaceScreen/View/SpaceScreen.swift @@ -76,7 +76,12 @@ struct SpaceScreen: View { } .buttonStyle(.compound(.primary)) - // @Velin92 Create Room button goes here. + if context.viewState.canCreateRoom { + Button(L10n.actionCreateRoom) { + context.send(viewAction: .createChildRoom) + } + .buttonStyle(.compound(.secondary)) + } } .padding(.horizontal, 16) } @@ -123,7 +128,7 @@ struct SpaceScreen: View { Section { if context.viewState.canCreateRoom { Button { context.send(viewAction: .createChildRoom) } label: { - Label(L10n.actionCreateARoom, icon: \.plus) + Label(L10n.actionCreateRoom, icon: \.plus) } } Button { context.send(viewAction: .addExistingRooms) } label: { @@ -195,7 +200,9 @@ struct SpaceScreen_Previews: PreviewProvider, TestablePreview { SpaceScreen(context: newSpaceViewModel.context) } .previewDisplayName("New Space") - .snapshotPreferences(expect: newSpaceViewModel.context.observe(\.viewState.shouldShowEmptyState)) + .snapshotPreferences(expect: newSpaceViewModel.context.observe(\.viewState).map { + $0.canCreateRoom && $0.canEditChildren + }) } static func makeViewModel(isManagingRooms: Bool = false, isNewSpace: Bool = false) -> SpaceScreenViewModel { diff --git a/ElementX/Sources/Services/Spaces/SpaceServiceProxy.swift b/ElementX/Sources/Services/Spaces/SpaceServiceProxy.swift index 9c2912a89..0fde5b02f 100644 --- a/ElementX/Sources/Services/Spaces/SpaceServiceProxy.swift +++ b/ElementX/Sources/Services/Spaces/SpaceServiceProxy.swift @@ -98,7 +98,7 @@ class SpaceServiceProxy: SpaceServiceProxyProtocol { return .failure(.sdkError(error)) } } - + // MARK: - Private private func handleSpaceListUpdates(_ updates: [SpaceListUpdate]) { diff --git a/PreviewTests/Sources/GeneratedPreviewTests.swift b/PreviewTests/Sources/GeneratedPreviewTests.swift index 4896d1dcf..7a66b05ae 100644 --- a/PreviewTests/Sources/GeneratedPreviewTests.swift +++ b/PreviewTests/Sources/GeneratedPreviewTests.swift @@ -173,6 +173,7 @@ extension PreviewTests { } func testCreateRoomSpaceSelectionSheet() async throws { + AppSettings.resetAllSettings() // Ensure this test's previews start with fresh settings. for (index, preview) in CreateRoomSpaceSelectionSheet_Previews._allPreviews.enumerated() { try await assertSnapshots(matching: preview, step: index) } diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPad-en-GB.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPad-en-GB.png index 8bd038ca4..1f5b980ad 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPad-en-GB.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPad-en-GB.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:65f117e0aa251da2d4bc8d2d1f98d36a653dd3049613d0a8ff69486debaca72f -size 131043 +oid sha256:80f868c99906b7c84e2d9223af3fcdf0f9b840337163b6dedfd617663629f65c +size 137783 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPad-pseudo.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPad-pseudo.png index d232ff18c..74ceef7c1 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPad-pseudo.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPad-pseudo.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:989cff06585632050964aff0d5cb8a9da15e8be009acbc584f0fde3477c3cee1 -size 137412 +oid sha256:3840d243a457a5469cd1d94b1b43121a222204a5ddd66e848df6b137a231b5df +size 145959 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPhone-en-GB.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPhone-en-GB.png index 4b097b6b7..cd5603ef0 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPhone-en-GB.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPhone-en-GB.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f1c645564a1248975e005dc8208ee9b8fc5e7d85f8c6c03167fcb0ef5b1681b0 -size 86553 +oid sha256:74d95c37df429e12f09944fd9959538a7199d17a54b7a0a04d2708e48655cd5b +size 92051 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPhone-pseudo.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPhone-pseudo.png index 46fb469eb..67bf385f9 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPhone-pseudo.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/spaceScreen.New-Space-iPhone-pseudo.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b6753951ad86e77d21fadc03ddd6faedc24dd59256225901d83d5f253e23f65 -size 96839 +oid sha256:3967452bce1adb55c30f7f5409c467657d0640935ee580560ecda1620952ecf3 +size 105035 diff --git a/UnitTests/Sources/CreateRoomViewModelTests.swift b/UnitTests/Sources/CreateRoomViewModelTests.swift index 210df6375..ce6ee12b0 100644 --- a/UnitTests/Sources/CreateRoomViewModelTests.swift +++ b/UnitTests/Sources/CreateRoomViewModelTests.swift @@ -273,7 +273,7 @@ class CreateRoomScreenViewModelTests: XCTestCase { func testCreateRoomInAnAlreadySelectedSpace() async throws { let space = SpaceServiceRoomMock(.init(isSpace: true, joinRule: .private)) - setup(spacesSelectionMode: .selected(space)) + setup(spacesSelectionMode: .preSelected(space)) context.send(viewAction: .updateRoomName("A")) context.selectedAccessType = .spaceMembers @@ -308,7 +308,7 @@ class CreateRoomScreenViewModelTests: XCTestCase { func testCreateRoomInAnPublicSpaceAvailableTypes() async throws { let space = SpaceServiceRoomMock(.init(isSpace: true, joinRule: .public)) - setup(spacesSelectionMode: .selected(space)) + setup(spacesSelectionMode: .preSelected(space)) // Given a form with a blank topic. context.send(viewAction: .updateRoomName("A")) @@ -320,7 +320,7 @@ class CreateRoomScreenViewModelTests: XCTestCase { XCTAssertFalse(context.viewState.canSelectSpace) } - private func setup(isSpace: Bool = false, spacesSelectionMode: CreateRoomScreenSpaceSelectionMode = .list) { + private func setup(isSpace: Bool = false, spacesSelectionMode: CreateRoomScreenSpaceSelectionMode = .editableSpacesList) { spaceService = SpaceServiceProxyMock(.init(editableSpaces: .mockJoinedSpaces2, spaceRoomLists: ["1": .init()])) clientProxy = ClientProxyMock(.init(userIDServerName: "matrix.org",