mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 13:37:11 +00:00
Join room by address (#3840)
* Implemented join room by address * improved the text field typing * some improvements to how the text is edited * remove navigation link * moved room directory search to the start chat flow * updated preview tests * added unit tests and improved the code * updated strings * some pr suggestions: - moving the file - changing the name of the action - reintroduce the debounce text queries - add comments * renamed the auth text field style to Element updated tests
This commit is contained in:
parent
2b58f57483
commit
7f6ea1c2ae
@ -3,7 +3,7 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 54;
|
||||
objectVersion = 56;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXAggregateTarget section */
|
||||
@ -209,7 +209,6 @@
|
||||
2797C9D9BA642370F1C85D78 /* Untranslated.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = F75DF9500D69A3AAF8339E69 /* Untranslated.stringsdict */; };
|
||||
27F015B0D5436633B5B3C8C3 /* SecureBackupRecoveryKeyScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7061BE2C0BF427C38AEDEF5E /* SecureBackupRecoveryKeyScreenViewModel.swift */; };
|
||||
27FEF0F40750465195C9D6D6 /* RoomSelectionScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B9D191A81FFB0C72CE73E77 /* RoomSelectionScreenModels.swift */; };
|
||||
2814E7075BF3A5C0CCBC9F90 /* RoomDirectorySearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AF32E4136FD6F159D86C2C /* RoomDirectorySearchView.swift */; };
|
||||
281BED345D59A9A6A99E9D98 /* UNNotificationContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE148A4FFEE853C5A281500C /* UNNotificationContent.swift */; };
|
||||
2835FD52F3F618D07F799B3D /* Publisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7310D8DFE01AF45F0689C3AA /* Publisher.swift */; };
|
||||
290FDB0FFDC2F1DDF660343E /* TestMeasurementParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C4048041C1A6B20CB97FD18 /* TestMeasurementParser.swift */; };
|
||||
@ -486,7 +485,7 @@
|
||||
601AB75BD52B0B4276CEB84A /* SessionVerificationScreenStateMachine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 161CD412E75F4086F422AE39 /* SessionVerificationScreenStateMachine.swift */; };
|
||||
60ED66E63A169E47489348A8 /* Sentry in Frameworks */ = {isa = PBXBuildFile; productRef = 886A0A498FA01E8EDD451D05 /* Sentry */; };
|
||||
611BEE29B8B622204E1E6B04 /* SecurityAndPrivacyScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97F2F6B6E56055EF173A2DD3 /* SecurityAndPrivacyScreenCoordinator.swift */; };
|
||||
6146996D5C4DDD5DA816FC87 /* AuthenticationTextFieldStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCACD75595C40EACD6AD4A74 /* AuthenticationTextFieldStyle.swift */; };
|
||||
6146996D5C4DDD5DA816FC87 /* ElementTextFieldStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCACD75595C40EACD6AD4A74 /* ElementTextFieldStyle.swift */; };
|
||||
617624A97BDBB75ED3DD8156 /* RoomScreenViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = A00C7A331B72C0F05C00392F /* RoomScreenViewModelProtocol.swift */; };
|
||||
6189B4ABD535CE526FA1107B /* StartChatViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DF438EAFC732D2D95D34BF6 /* StartChatViewModelTests.swift */; };
|
||||
61941DEE5F3834765770BE01 /* InviteUsersScreenSelectedItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10F32E0B4B83D2A11EE8D011 /* InviteUsersScreenSelectedItem.swift */; };
|
||||
@ -859,6 +858,7 @@
|
||||
A722F426FD81FC67706BB1E0 /* CustomLayoutLabelStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42236480CF0431535EBE8387 /* CustomLayoutLabelStyle.swift */; };
|
||||
A74438ED16F8683A4B793E6A /* AnalyticsSettingsScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BCE3FAF40932AC7C7639AC4 /* AnalyticsSettingsScreenViewModel.swift */; };
|
||||
A7D48E44D485B143AADDB77D /* Strings+Untranslated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A18F6CE4D694D21E4EA9B25 /* Strings+Untranslated.swift */; };
|
||||
A7F55DC52D6F5CEC00CE60E9 /* JoinRoomByAddressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7F55DC42D6F5CCF00CE60E9 /* JoinRoomByAddressView.swift */; };
|
||||
A808DC3F72D15C6C5A52317E /* TimelineItemDebugView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCDA016D05107DED3B9495CB /* TimelineItemDebugView.swift */; };
|
||||
A816F7087C495D85048AC50E /* RoomMemberDetailsScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B6E30BB748F3F480F077969 /* RoomMemberDetailsScreenModels.swift */; };
|
||||
A851635B3255C6DC07034A12 /* RoomScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8108C8F0ACF6A7EB72D0117 /* RoomScreenCoordinator.swift */; };
|
||||
@ -1364,7 +1364,7 @@
|
||||
044E501B8331B339874D1B96 /* CompoundIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompoundIcon.swift; sourceTree = "<group>"; };
|
||||
045253F9967A535EE5B16691 /* Label.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Label.swift; sourceTree = "<group>"; };
|
||||
046C0D3F53B0B5EF0A1F5BEA /* RoomSummaryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryTests.swift; sourceTree = "<group>"; };
|
||||
048A21188AB19349D026BECD /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
|
||||
048A21188AB19349D026BECD /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
|
||||
04BB8DDE245ED86C489BA983 /* AccessibilityIdentifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessibilityIdentifiers.swift; sourceTree = "<group>"; };
|
||||
04DF593C3F7AF4B2FBAEB05D /* FileManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileManager.swift; sourceTree = "<group>"; };
|
||||
0516C69708D5CBDE1A8E77EC /* RoomDirectorySearchProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDirectorySearchProxyProtocol.swift; sourceTree = "<group>"; };
|
||||
@ -1436,7 +1436,7 @@
|
||||
128501375217576AF0FE3E92 /* RoomAttachmentPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomAttachmentPicker.swift; sourceTree = "<group>"; };
|
||||
12B09A94C519227264A41208 /* RoomMembershipDetailsProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMembershipDetailsProxy.swift; sourceTree = "<group>"; };
|
||||
12FD5280AF55AB7F50F8E47D /* preview_avatar_room.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = preview_avatar_room.jpg; sourceTree = "<group>"; };
|
||||
1304D9191300873EADA52D6E /* IntegrationTests.xctestplan */ = {isa = PBXFileReference; path = IntegrationTests.xctestplan; sourceTree = "<group>"; };
|
||||
1304D9191300873EADA52D6E /* IntegrationTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = IntegrationTests.xctestplan; sourceTree = "<group>"; };
|
||||
130ED565A078F7E0B59D9D25 /* UNTextInputNotificationResponse+Creator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UNTextInputNotificationResponse+Creator.swift"; sourceTree = "<group>"; };
|
||||
136F80A613B55BDD071DCEA5 /* JoinRoomScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinRoomScreenModels.swift; sourceTree = "<group>"; };
|
||||
13802897C7AFA360EA74C0B0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
||||
@ -1537,7 +1537,7 @@
|
||||
25F7FE40EF7490A7E09D7BE6 /* NotificationItemProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationItemProxy.swift; sourceTree = "<group>"; };
|
||||
25F8664F1FB95AF3C4202478 /* PollFormScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PollFormScreenCoordinator.swift; sourceTree = "<group>"; };
|
||||
260004737C573A56FA01E86E /* Encodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Encodable.swift; sourceTree = "<group>"; };
|
||||
267BB1D5B08A9511F894CB57 /* PreviewTests.xctestplan */ = {isa = PBXFileReference; path = PreviewTests.xctestplan; sourceTree = "<group>"; };
|
||||
267BB1D5B08A9511F894CB57 /* PreviewTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = PreviewTests.xctestplan; sourceTree = "<group>"; };
|
||||
26B0A96B8FE4849227945067 /* VoiceMessageRecorder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceMessageRecorder.swift; sourceTree = "<group>"; };
|
||||
26EAAB54C6CE91D64B69A9F8 /* AppLockServiceProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockServiceProtocol.swift; sourceTree = "<group>"; };
|
||||
2711E5996016ABD6EAAEB58A /* LogLevel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogLevel.swift; sourceTree = "<group>"; };
|
||||
@ -1611,7 +1611,7 @@
|
||||
3558A15CFB934F9229301527 /* RestorationToken.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RestorationToken.swift; sourceTree = "<group>"; };
|
||||
35AFCF4C05DEED04E3DB1A16 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
35FA991289149D31F4286747 /* UserPreference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserPreference.swift; sourceTree = "<group>"; };
|
||||
36DA824791172B9821EACBED /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
|
||||
36DA824791172B9821EACBED /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
|
||||
36FD673E24FBFCFDF398716A /* RoomMemberProxyMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMemberProxyMock.swift; sourceTree = "<group>"; };
|
||||
371B248460BD1A3F20318137 /* TimelineProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineProvider.swift; sourceTree = "<group>"; };
|
||||
376D941BF8BB294389C0DE24 /* MapTilerURLBuildersTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapTilerURLBuildersTests.swift; sourceTree = "<group>"; };
|
||||
@ -1967,7 +1967,6 @@
|
||||
848F69921527D31CAACB93AF /* SecureBackupLogoutConfirmationScreenViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackupLogoutConfirmationScreenViewModelTests.swift; sourceTree = "<group>"; };
|
||||
84A00BB9CD12CF6AC98D5485 /* SecureBackupScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackupScreen.swift; sourceTree = "<group>"; };
|
||||
84A87D0471D438A233C2CF4A /* RoomMemberDetailsScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMemberDetailsScreenViewModel.swift; sourceTree = "<group>"; };
|
||||
84AF32E4136FD6F159D86C2C /* RoomDirectorySearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDirectorySearchView.swift; sourceTree = "<group>"; };
|
||||
84B7A28A6606D58D1E38C55A /* ExpiringTaskRunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpiringTaskRunnerTests.swift; sourceTree = "<group>"; };
|
||||
8512B82404B1751D0BCC82D2 /* MediaEventsTimelineScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaEventsTimelineScreenCoordinator.swift; sourceTree = "<group>"; };
|
||||
85149F56BA333619900E2410 /* UserDetailsEditScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDetailsEditScreenViewModelProtocol.swift; sourceTree = "<group>"; };
|
||||
@ -2016,7 +2015,7 @@
|
||||
8D55702474F279D910D2D162 /* RoomStateEventStringBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomStateEventStringBuilder.swift; sourceTree = "<group>"; };
|
||||
8D8169443E5AC5FF71BFB3DB /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
8DA1E8F287680C8ED25EDBAC /* NetworkMonitorMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkMonitorMock.swift; sourceTree = "<group>"; };
|
||||
8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; path = UITests.xctestplan; sourceTree = "<group>"; };
|
||||
8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UITests.xctestplan; sourceTree = "<group>"; };
|
||||
8E1584F8BCF407BB94F48F04 /* EncryptionResetPasswordScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncryptionResetPasswordScreen.swift; sourceTree = "<group>"; };
|
||||
8EAF4A49F3ACD8BB8B0D2371 /* ClientSDKMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientSDKMock.swift; sourceTree = "<group>"; };
|
||||
8F062DD2CCD95DC33528A16F /* KnockRequestProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KnockRequestProxy.swift; sourceTree = "<group>"; };
|
||||
@ -2134,6 +2133,7 @@
|
||||
A7C4EA55DA62F9D0F984A2AE /* CollapsibleTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollapsibleTimelineItem.swift; sourceTree = "<group>"; };
|
||||
A7D452AF7B5F7E3A0A7DB54C /* SessionVerificationScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionVerificationScreenViewModelProtocol.swift; sourceTree = "<group>"; };
|
||||
A7E37072597F67C4DD8CC2DB /* ComposerDraftServiceProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposerDraftServiceProtocol.swift; sourceTree = "<group>"; };
|
||||
A7F55DC42D6F5CCF00CE60E9 /* JoinRoomByAddressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinRoomByAddressView.swift; sourceTree = "<group>"; };
|
||||
A84D413BF49F0E980F010A6B /* LogViewerScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogViewerScreenCoordinator.swift; sourceTree = "<group>"; };
|
||||
A8558D41DD4B553A752C868A /* StackedAvatarsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StackedAvatarsView.swift; sourceTree = "<group>"; };
|
||||
A861DA5932B128FE1DCB5CE2 /* InviteUsersScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InviteUsersScreenCoordinator.swift; sourceTree = "<group>"; };
|
||||
@ -2210,7 +2210,7 @@
|
||||
B50F03079F6B5EF9CA005F14 /* TimelineProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineProxyProtocol.swift; sourceTree = "<group>"; };
|
||||
B53AC78E49A297AC1D72A7CF /* AppMediator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppMediator.swift; sourceTree = "<group>"; };
|
||||
B590BD4507D4F0A377FDE01A /* LoadableAvatarImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadableAvatarImage.swift; sourceTree = "<group>"; };
|
||||
B61C339A2FDDBD067FF6635C /* ConfettiScene.scn */ = {isa = PBXFileReference; path = ConfettiScene.scn; sourceTree = "<group>"; };
|
||||
B61C339A2FDDBD067FF6635C /* ConfettiScene.scn */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; path = ConfettiScene.scn; sourceTree = "<group>"; };
|
||||
B63B69F9A2BC74DD40DC75C8 /* AdvancedSettingsScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvancedSettingsScreenViewModel.swift; sourceTree = "<group>"; };
|
||||
B6404166CBF5CC88673FF9E2 /* RoomDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDetails.swift; sourceTree = "<group>"; };
|
||||
B655A536341D2695158C6664 /* AuthenticationClientBuilderFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationClientBuilderFactory.swift; sourceTree = "<group>"; };
|
||||
@ -2237,7 +2237,7 @@
|
||||
BA40B98B098B6F0371B750B3 /* TemplateScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateScreenModels.swift; sourceTree = "<group>"; };
|
||||
BA919F521E9F0EE3638AFC85 /* BugReportScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BugReportScreen.swift; sourceTree = "<group>"; };
|
||||
BB284643AF7AB131E307DCE0 /* AudioSessionProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioSessionProtocol.swift; sourceTree = "<group>"; };
|
||||
BB576F4118C35E6B5124FA22 /* test_apple_image.heic */ = {isa = PBXFileReference; path = test_apple_image.heic; sourceTree = "<group>"; };
|
||||
BB576F4118C35E6B5124FA22 /* test_apple_image.heic */ = {isa = PBXFileReference; lastKnownFileType = file; path = test_apple_image.heic; sourceTree = "<group>"; };
|
||||
BB5B00A014307CE37B2812CD /* TimelineViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineViewModelProtocol.swift; sourceTree = "<group>"; };
|
||||
BB8BC4C791D0E88CFCF4E5DF /* ServerSelectionScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSelectionScreenCoordinator.swift; sourceTree = "<group>"; };
|
||||
BBEC57C204D77908E355EF42 /* AudioRecorderProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioRecorderProtocol.swift; sourceTree = "<group>"; };
|
||||
@ -2330,14 +2330,14 @@
|
||||
CC437C491EA6996513B1CEAB /* ElementCallConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementCallConfiguration.swift; sourceTree = "<group>"; };
|
||||
CC680E0E79D818706CB28CF8 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
CC743C7A85E3171BCBF0A653 /* AvatarHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvatarHeaderView.swift; sourceTree = "<group>"; };
|
||||
CCACD75595C40EACD6AD4A74 /* AuthenticationTextFieldStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationTextFieldStyle.swift; sourceTree = "<group>"; };
|
||||
CCACD75595C40EACD6AD4A74 /* ElementTextFieldStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementTextFieldStyle.swift; sourceTree = "<group>"; };
|
||||
CCF71646898A2F720C5BFDF5 /* RoomDirectorySearchScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDirectorySearchScreenViewModel.swift; sourceTree = "<group>"; };
|
||||
CD469F7513574341181F7EAA /* ServerSelectionScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSelectionScreen.swift; sourceTree = "<group>"; };
|
||||
CD6613DE16AD26B3A74DA1F5 /* LocationRoomTimelineItemContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationRoomTimelineItemContent.swift; sourceTree = "<group>"; };
|
||||
CDB3227C7A74B734924942E9 /* RoomSummaryProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryProvider.swift; sourceTree = "<group>"; };
|
||||
CDE3F3911FF7CC639BDE5844 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
CEE20623EB4A9B88FB29F2BA /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/SAS.strings; sourceTree = "<group>"; };
|
||||
CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; path = UnitTests.xctestplan; sourceTree = "<group>"; };
|
||||
CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UnitTests.xctestplan; sourceTree = "<group>"; };
|
||||
D01FD1171FF40E34D707FD00 /* BigIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigIcon.swift; sourceTree = "<group>"; };
|
||||
D046ABB22E680F7C5054441B /* SecurityAndPrivacyScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecurityAndPrivacyScreenViewModelProtocol.swift; sourceTree = "<group>"; };
|
||||
D071F86CD47582B9196C9D16 /* UserDiscoverySection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDiscoverySection.swift; sourceTree = "<group>"; };
|
||||
@ -2394,7 +2394,7 @@
|
||||
DC0AEA686E425F86F6BA0404 /* UNNotification+Creator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UNNotification+Creator.swift"; sourceTree = "<group>"; };
|
||||
DC10CCC8D68B863E20660DBC /* MessageForwardingScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageForwardingScreenViewModelProtocol.swift; sourceTree = "<group>"; };
|
||||
DC528B3764E3CF7FCFEF40E7 /* PollInteractionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PollInteractionHandler.swift; sourceTree = "<group>"; };
|
||||
DCA2D836BD10303F37FAAEED /* test_voice_message.m4a */ = {isa = PBXFileReference; path = test_voice_message.m4a; sourceTree = "<group>"; };
|
||||
DCA2D836BD10303F37FAAEED /* test_voice_message.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = test_voice_message.m4a; sourceTree = "<group>"; };
|
||||
DCAC01A97A43BE07B9E94E43 /* ShareExtensionModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareExtensionModels.swift; sourceTree = "<group>"; };
|
||||
DCF239C619971FDE48132550 /* SecureBackupLogoutConfirmationScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackupLogoutConfirmationScreenModels.swift; sourceTree = "<group>"; };
|
||||
DD8C9BBB729C941BEE0E2A63 /* TimelineProviderProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineProviderProtocol.swift; sourceTree = "<group>"; };
|
||||
@ -2435,7 +2435,7 @@
|
||||
E5272BC4A60B6AD7553BACA1 /* BlurHashDecode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlurHashDecode.swift; sourceTree = "<group>"; };
|
||||
E53BFB7E4F329621C844E8C3 /* AnalyticsPromptScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsPromptScreen.swift; sourceTree = "<group>"; };
|
||||
E55B5EA766E89FF1F87C3ACB /* RoomNotificationSettingsProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomNotificationSettingsProxyProtocol.swift; sourceTree = "<group>"; };
|
||||
E5E7D4EE7CA295E5039FDA21 /* portrait_test_video.mp4 */ = {isa = PBXFileReference; path = portrait_test_video.mp4; sourceTree = "<group>"; };
|
||||
E5E7D4EE7CA295E5039FDA21 /* portrait_test_video.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = portrait_test_video.mp4; sourceTree = "<group>"; };
|
||||
E5E94DCFEE803E5ABAE8ACCE /* KeychainControllerProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainControllerProtocol.swift; sourceTree = "<group>"; };
|
||||
E5F2B6443D1ED8602F328539 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ru; path = ru.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
||||
E5FDFAA04174CC99FB66391C /* EditRoomAddressScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditRoomAddressScreenViewModel.swift; sourceTree = "<group>"; };
|
||||
@ -2477,7 +2477,7 @@
|
||||
ED0CBEAB5F796BEFBAF7BB6A /* VideoRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoRoomTimelineView.swift; sourceTree = "<group>"; };
|
||||
ED1D792EB82506A19A72C8DE /* RoomTimelineItemProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTimelineItemProtocol.swift; sourceTree = "<group>"; };
|
||||
ED33988DA4FD4FC666800106 /* SessionVerificationScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionVerificationScreenViewModel.swift; sourceTree = "<group>"; };
|
||||
ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; path = message.caf; sourceTree = "<group>"; };
|
||||
ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = message.caf; sourceTree = "<group>"; };
|
||||
ED49073BB1C1FC649DAC2CCD /* LocationRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationRoomTimelineView.swift; sourceTree = "<group>"; };
|
||||
ED60E4D2CD678E1EBF16F77A /* BlockedUsersScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlockedUsersScreen.swift; sourceTree = "<group>"; };
|
||||
EE378083653EF0C9B5E9D580 /* EmoteRoomTimelineItemContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmoteRoomTimelineItemContent.swift; sourceTree = "<group>"; };
|
||||
@ -3776,7 +3776,6 @@
|
||||
05512FB13987D221B7205DE0 /* HomeScreenRecoveryKeyConfirmationBanner.swift */,
|
||||
ED044D00F2176681CC02CD54 /* HomeScreenRoomCell.swift */,
|
||||
C7661EFFCAA307A97D71132A /* HomeScreenRoomList.swift */,
|
||||
84AF32E4136FD6F159D86C2C /* RoomDirectorySearchView.swift */,
|
||||
037A5661B26EC6BE068188D7 /* Filters */,
|
||||
);
|
||||
path = View;
|
||||
@ -5063,6 +5062,7 @@
|
||||
A7F3784CAF9F4CF654BC52CD /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A7F55DC42D6F5CCF00CE60E9 /* JoinRoomByAddressView.swift */,
|
||||
F276F31C1AEC19E52B951B62 /* SendInviteConfirmationView.swift */,
|
||||
6861FE915C7B5466E6962BBA /* StartChatScreen.swift */,
|
||||
);
|
||||
@ -5763,6 +5763,7 @@
|
||||
E6E1D07163F8752D62DA4A93 /* Styles */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CCACD75595C40EACD6AD4A74 /* ElementTextFieldStyle.swift */,
|
||||
89FBFC09F9DAFF1E4BA97849 /* FormButtonStyles.swift */,
|
||||
);
|
||||
path = Styles;
|
||||
@ -5795,7 +5796,6 @@
|
||||
E74CD7681375AD2EAA34D66B /* Authentication */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CCACD75595C40EACD6AD4A74 /* AuthenticationTextFieldStyle.swift */,
|
||||
92390F9FA98255440A6BF5F8 /* OIDCAuthenticationPresenter.swift */,
|
||||
9E6D88E8AFFBF2C1D589C0FA /* UIConstants.swift */,
|
||||
90F48FEF84016ED42A94BA24 /* LoginScreen */,
|
||||
@ -6911,7 +6911,7 @@
|
||||
0E3A2787C6AEC761A81A938A /* AuthenticationStartScreenModels.swift in Sources */,
|
||||
E79B247A6DD28759636317EA /* AuthenticationStartScreenViewModel.swift in Sources */,
|
||||
874FEFB9D4A4AF447E0E086E /* AuthenticationStartScreenViewModelProtocol.swift in Sources */,
|
||||
6146996D5C4DDD5DA816FC87 /* AuthenticationTextFieldStyle.swift in Sources */,
|
||||
6146996D5C4DDD5DA816FC87 /* ElementTextFieldStyle.swift in Sources */,
|
||||
4AAA8606FBA290E23D15422E /* AvatarHeaderView.swift in Sources */,
|
||||
1621BF6316FFFEF5AE067C77 /* Avatars.swift in Sources */,
|
||||
7A25D6926A2C01DB8D0D67A5 /* BadgeLabel.swift in Sources */,
|
||||
@ -7373,7 +7373,6 @@
|
||||
49500BBA1CD65A5AE252D970 /* RoomDirectorySearchScreenModels.swift in Sources */,
|
||||
91C6AC0E9D2B9C0C76CC6AD4 /* RoomDirectorySearchScreenScreenModelProtocol.swift in Sources */,
|
||||
1DC227816777A2F3A19657E5 /* RoomDirectorySearchScreenViewModel.swift in Sources */,
|
||||
2814E7075BF3A5C0CCBC9F90 /* RoomDirectorySearchView.swift in Sources */,
|
||||
42F1C8731166633E35A6D7E6 /* RoomEventStringBuilder.swift in Sources */,
|
||||
D55AF9B5B55FEED04771A461 /* RoomFlowCoordinator.swift in Sources */,
|
||||
9C63171267E22FEB288EC860 /* RoomHeaderView.swift in Sources */,
|
||||
@ -7515,6 +7514,7 @@
|
||||
5710AAB27D5D866292C1FE06 /* SessionVerificationScreenModels.swift in Sources */,
|
||||
601AB75BD52B0B4276CEB84A /* SessionVerificationScreenStateMachine.swift in Sources */,
|
||||
4A8287E5281B44A8754BE509 /* SessionVerificationScreenViewModel.swift in Sources */,
|
||||
A7F55DC52D6F5CEC00CE60E9 /* JoinRoomByAddressView.swift in Sources */,
|
||||
762DB0973865293F0C3D3D7B /* SessionVerificationScreenViewModelProtocol.swift in Sources */,
|
||||
755395927DDD6EBDDA5E217A /* SettingsFlowCoordinator.swift in Sources */,
|
||||
34F1261CEF6D6A00D559B520 /* SettingsScreen.swift in Sources */,
|
||||
@ -7956,9 +7956,7 @@
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = "$(MARKETING_VERSION)";
|
||||
OTHER_SWIFT_FLAGS = (
|
||||
"-DIS_NSE",
|
||||
);
|
||||
OTHER_SWIFT_FLAGS = "-DIS_NSE";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.nse";
|
||||
PRODUCT_DISPLAY_NAME = "$(APP_DISPLAY_NAME)";
|
||||
PRODUCT_NAME = NSE;
|
||||
@ -8007,9 +8005,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = "$(MARKETING_VERSION)";
|
||||
OTHER_SWIFT_FLAGS = (
|
||||
"-DIS_MAIN_APP",
|
||||
);
|
||||
OTHER_SWIFT_FLAGS = "-DIS_MAIN_APP";
|
||||
PILLS_UT_TYPE_IDENTIFIER = "$(BASE_BUNDLE_IDENTIFIER).pills";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "$(BASE_BUNDLE_IDENTIFIER)";
|
||||
PRODUCT_NAME = "$(APP_NAME)";
|
||||
@ -8035,9 +8031,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = "$(MARKETING_VERSION)";
|
||||
OTHER_SWIFT_FLAGS = (
|
||||
"-DIS_MAIN_APP",
|
||||
);
|
||||
OTHER_SWIFT_FLAGS = "-DIS_MAIN_APP";
|
||||
PILLS_UT_TYPE_IDENTIFIER = "$(BASE_BUNDLE_IDENTIFIER).pills";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "$(BASE_BUNDLE_IDENTIFIER)";
|
||||
PRODUCT_NAME = "$(APP_NAME)";
|
||||
@ -8301,9 +8295,7 @@
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = "$(MARKETING_VERSION)";
|
||||
OTHER_SWIFT_FLAGS = (
|
||||
"-DIS_NSE",
|
||||
);
|
||||
OTHER_SWIFT_FLAGS = "-DIS_NSE";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.nse";
|
||||
PRODUCT_DISPLAY_NAME = "$(APP_DISPLAY_NAME)";
|
||||
PRODUCT_NAME = NSE;
|
||||
|
@ -480,6 +480,7 @@
|
||||
"screen_security_and_privacy_room_publishing_section_header" = "Room publishing";
|
||||
"screen_security_and_privacy_room_visibility_section_footer" = "Room addresses are ways to find and access rooms. This also ensures you can easily share your room with others.\nThe address is also required to make the room visible in %1$@ public room directory.";
|
||||
"screen_security_and_privacy_title" = "Security & privacy";
|
||||
"screen_start_chat_join_room_by_address_action" = "Join room by address";
|
||||
"screen_start_chat_join_room_by_address_invalid_address" = "Not a valid address";
|
||||
"screen_start_chat_join_room_by_address_placeholder" = "Enter...";
|
||||
"screen_start_chat_join_room_by_address_room_found" = "Matching room found";
|
||||
@ -488,7 +489,6 @@
|
||||
"screen_timeline_item_menu_send_failure_changed_identity" = "Message not sent because %1$@’s verified identity has changed.";
|
||||
"screen_timeline_item_menu_send_failure_unsigned_device" = "Message not sent because %1$@ has not verified all devices.";
|
||||
"screen_timeline_item_menu_send_failure_you_unsigned_device" = "Message not sent because you have not verified one or more of your devices.";
|
||||
"screen.start_chat.join_room_by_address_action" = "Join room by address";
|
||||
"screen_account_provider_form_hint" = "Homeserver address";
|
||||
"screen_account_provider_form_notice" = "Enter a search term or a domain address.";
|
||||
"screen_account_provider_form_subtitle" = "Search for a company, community, or private server.";
|
||||
|
@ -480,6 +480,7 @@
|
||||
"screen_security_and_privacy_room_publishing_section_header" = "Room publishing";
|
||||
"screen_security_and_privacy_room_visibility_section_footer" = "Room addresses are ways to find and access rooms. This also ensures you can easily share your room with others.\nThe address is also required to make the room visible in %1$@ public room directory.";
|
||||
"screen_security_and_privacy_title" = "Security & privacy";
|
||||
"screen_start_chat_join_room_by_address_action" = "Join room by address";
|
||||
"screen_start_chat_join_room_by_address_invalid_address" = "Not a valid address";
|
||||
"screen_start_chat_join_room_by_address_placeholder" = "Enter...";
|
||||
"screen_start_chat_join_room_by_address_room_found" = "Matching room found";
|
||||
@ -488,7 +489,6 @@
|
||||
"screen_timeline_item_menu_send_failure_changed_identity" = "Message not sent because %1$@’s verified identity has changed.";
|
||||
"screen_timeline_item_menu_send_failure_unsigned_device" = "Message not sent because %1$@ has not verified all devices.";
|
||||
"screen_timeline_item_menu_send_failure_you_unsigned_device" = "Message not sent because you have not verified one or more of your devices.";
|
||||
"screen.start_chat.join_room_by_address_action" = "Join room by address";
|
||||
"screen_account_provider_form_hint" = "Homeserver address";
|
||||
"screen_account_provider_form_notice" = "Enter a search term or a domain address.";
|
||||
"screen_account_provider_form_subtitle" = "Search for a company, community, or private server.";
|
||||
|
@ -509,8 +509,6 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
stateMachine.processEvent(.showStartChatScreen)
|
||||
case .presentGlobalSearch:
|
||||
presentGlobalSearch()
|
||||
case .presentRoomDirectorySearch:
|
||||
stateMachine.processEvent(.showRoomDirectorySearchScreen)
|
||||
case .logoutWithoutConfirmation:
|
||||
self.actionsSubject.send(.logout)
|
||||
case .logout:
|
||||
@ -654,10 +652,13 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
guard let self else { return }
|
||||
switch action {
|
||||
case .close:
|
||||
self.navigationSplitCoordinator.setSheetCoordinator(nil)
|
||||
navigationSplitCoordinator.setSheetCoordinator(nil)
|
||||
case .openRoom(let roomID):
|
||||
self.navigationSplitCoordinator.setSheetCoordinator(nil)
|
||||
self.stateMachine.processEvent(.selectRoom(roomID: roomID, via: [], entryPoint: .room))
|
||||
navigationSplitCoordinator.setSheetCoordinator(nil)
|
||||
stateMachine.processEvent(.selectRoom(roomID: roomID, via: [], entryPoint: .room))
|
||||
case .openRoomDirectorySearch:
|
||||
navigationSplitCoordinator.setSheetCoordinator(nil)
|
||||
stateMachine.processEvent(.showRoomDirectorySearchScreen)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
@ -668,9 +669,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
self?.stateMachine.processEvent(.dismissedStartChatScreen)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Session Verification
|
||||
|
||||
|
||||
// MARK: Calls
|
||||
|
||||
private func presentCallScreen(genericCallLink url: URL) {
|
||||
|
@ -2460,6 +2460,8 @@ internal enum L10n {
|
||||
internal static var screenSignoutSaveRecoveryKeyTitle: String { return L10n.tr("Localizable", "screen_signout_save_recovery_key_title") }
|
||||
/// An error occurred when trying to start a chat
|
||||
internal static var screenStartChatErrorStartingChat: String { return L10n.tr("Localizable", "screen_start_chat_error_starting_chat") }
|
||||
/// Join room by address
|
||||
internal static var screenStartChatJoinRoomByAddressAction: String { return L10n.tr("Localizable", "screen_start_chat_join_room_by_address_action") }
|
||||
/// Not a valid address
|
||||
internal static var screenStartChatJoinRoomByAddressInvalidAddress: String { return L10n.tr("Localizable", "screen_start_chat_join_room_by_address_invalid_address") }
|
||||
/// Enter...
|
||||
@ -2874,13 +2876,6 @@ internal enum L10n {
|
||||
/// You
|
||||
internal static var you: String { return L10n.tr("Localizable", "common.you") }
|
||||
}
|
||||
|
||||
internal enum Screen {
|
||||
internal enum StartChat {
|
||||
/// Join room by address
|
||||
internal static var joinRoomByAddressAction: String { return L10n.tr("Localizable", "screen.start_chat.join_room_by_address_action") }
|
||||
}
|
||||
}
|
||||
}
|
||||
// swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length
|
||||
// swiftlint:enable nesting type_body_length type_name vertical_whitespace_opening_braces
|
||||
|
@ -0,0 +1,214 @@
|
||||
//
|
||||
// Copyright 2022-2024 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Compound
|
||||
import SwiftUI
|
||||
import SwiftUIIntrospect
|
||||
|
||||
extension TextFieldStyle where Self == ElementTextFieldStyle {
|
||||
static func element(labelText: String? = nil,
|
||||
footerText: String? = nil,
|
||||
state: ElementTextFieldStyle.State = .default,
|
||||
accessibilityIdentifier: String? = nil) -> ElementTextFieldStyle {
|
||||
ElementTextFieldStyle(labelText: labelText.map(Text.init),
|
||||
footerText: footerText.map(Text.init),
|
||||
state: state,
|
||||
accessibilityIdentifier: accessibilityIdentifier)
|
||||
}
|
||||
|
||||
@_disfavoredOverload
|
||||
static func element(labelText: Text? = nil,
|
||||
footerText: Text? = nil,
|
||||
state: ElementTextFieldStyle.State = .default,
|
||||
accessibilityIdentifier: String? = nil) -> ElementTextFieldStyle {
|
||||
ElementTextFieldStyle(labelText: labelText,
|
||||
footerText: footerText,
|
||||
state: state,
|
||||
accessibilityIdentifier: accessibilityIdentifier)
|
||||
}
|
||||
}
|
||||
|
||||
/// The text field style used in authentication screens.
|
||||
struct ElementTextFieldStyle: TextFieldStyle {
|
||||
enum State {
|
||||
case success
|
||||
case error
|
||||
case `default`
|
||||
}
|
||||
|
||||
@Environment(\.isEnabled) private var isEnabled
|
||||
|
||||
@FocusState private var isFocused: Bool
|
||||
let labelText: Text?
|
||||
let footerText: Text?
|
||||
let state: State
|
||||
let accessibilityIdentifier: String?
|
||||
|
||||
private var isError: Bool {
|
||||
state == .error
|
||||
}
|
||||
|
||||
/// The color of the text field's border.
|
||||
private var borderColor: Color {
|
||||
isError ? .compound.textCriticalPrimary : .compound._borderTextFieldFocused
|
||||
}
|
||||
|
||||
/// The width of the text field's border.
|
||||
private var borderWidth: CGFloat {
|
||||
isFocused || isError ? 1.0 : 0
|
||||
}
|
||||
|
||||
private var accentColor: Color {
|
||||
isError ? .compound.textCriticalPrimary : .compound.iconAccentTertiary
|
||||
}
|
||||
|
||||
/// The color of the text inside the text field.
|
||||
private var textColor: Color {
|
||||
isEnabled ? .compound.textPrimary : .compound.textDisabled
|
||||
}
|
||||
|
||||
/// The color of the text field's background.
|
||||
private var backgroundColor: Color {
|
||||
isError ? .compound.bgCriticalSubtleHovered :
|
||||
.compound.bgSubtleSecondary.opacity(isEnabled ? 1 : 0.5)
|
||||
}
|
||||
|
||||
/// The color of the placeholder text inside the text field.
|
||||
private var placeholderColor: UIColor {
|
||||
.compound.textSecondary
|
||||
}
|
||||
|
||||
/// The color of the label above the text field.
|
||||
private var labelColor: Color {
|
||||
isEnabled ? .compound.textPrimary : .compound.textDisabled
|
||||
}
|
||||
|
||||
/// The color of the footer label below the text field.
|
||||
private var footerTextColor: Color {
|
||||
switch state {
|
||||
case .default:
|
||||
.compound.textSecondary
|
||||
case .error:
|
||||
.compound.textCriticalPrimary
|
||||
case .success:
|
||||
.compound.textSuccessPrimary
|
||||
}
|
||||
}
|
||||
|
||||
private var footerIconColor: Color {
|
||||
switch state {
|
||||
// Doesn't matter we don't render it
|
||||
case .default:
|
||||
.clear
|
||||
case .error:
|
||||
.compound.iconCriticalPrimary
|
||||
case .success:
|
||||
.compound.iconSuccessPrimary
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates the text field style configured as required.
|
||||
/// - Parameters:
|
||||
/// - labelText: The text shown in the label above the field.
|
||||
/// - footerText: The text shown in the footer label below the field.
|
||||
/// - isError: Whether or not the text field is currently in the error state.
|
||||
init(labelText: Text? = nil, footerText: Text? = nil, state: State = .default, accessibilityIdentifier: String? = nil) {
|
||||
self.labelText = labelText
|
||||
self.footerText = footerText
|
||||
self.state = state
|
||||
self.accessibilityIdentifier = accessibilityIdentifier
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func _body(configuration: TextField<_Label>) -> some View {
|
||||
let rectangle = RoundedRectangle(cornerRadius: 14.0)
|
||||
|
||||
return VStack(alignment: .leading, spacing: 8) {
|
||||
labelText
|
||||
.font(.compound.bodySMSemibold)
|
||||
.foregroundColor(labelColor)
|
||||
.padding(.horizontal, 16)
|
||||
|
||||
configuration
|
||||
.focused($isFocused)
|
||||
.font(.compound.bodyLG)
|
||||
.foregroundColor(textColor)
|
||||
.accentColor(accentColor)
|
||||
.padding(.leading, 16.0)
|
||||
.padding([.vertical, .trailing], 11.0)
|
||||
.background {
|
||||
ZStack {
|
||||
backgroundColor
|
||||
.clipShape(rectangle)
|
||||
rectangle
|
||||
.stroke(borderColor, lineWidth: borderWidth)
|
||||
}
|
||||
.onTapGesture { isFocused = true } // Set focus with taps outside of the text field
|
||||
}
|
||||
.introspect(.textField, on: .supportedVersions) { textField in
|
||||
textField.clearButtonMode = .whileEditing
|
||||
textField.attributedPlaceholder = NSAttributedString(string: textField.placeholder ?? "",
|
||||
attributes: [NSAttributedString.Key.foregroundColor: placeholderColor])
|
||||
textField.accessibilityIdentifier = accessibilityIdentifier
|
||||
}
|
||||
|
||||
if let footerText {
|
||||
Label {
|
||||
footerText
|
||||
.tint(.compound.textLinkExternal)
|
||||
.font(.compound.bodySM)
|
||||
.foregroundColor(footerTextColor)
|
||||
} icon: {
|
||||
switch state {
|
||||
case .success:
|
||||
CompoundIcon(\.checkCircleSolid, size: .xSmall, relativeTo: .compound.bodySM)
|
||||
.foregroundStyle(.compound.iconSuccessPrimary)
|
||||
case .error:
|
||||
CompoundIcon(\.errorSolid, size: .xSmall, relativeTo: .compound.bodySM)
|
||||
.foregroundStyle(.compound.iconCriticalPrimary)
|
||||
case .default:
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
.labelStyle(.custom(spacing: 4, alignment: .top))
|
||||
.padding(.horizontal, 16)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ElementTextFieldStyle_Previews: PreviewProvider, TestablePreview {
|
||||
static var previews: some View {
|
||||
VStack(spacing: 20) {
|
||||
// Plain text field.
|
||||
TextField("Placeholder", text: .constant(""))
|
||||
.textFieldStyle(.element())
|
||||
TextField("Placeholder", text: .constant("Web"))
|
||||
.textFieldStyle(.element())
|
||||
TextField("Placeholder", text: .constant("Web"))
|
||||
.textFieldStyle(.element())
|
||||
.disabled(true)
|
||||
TextField("Placeholder", text: .constant("Web"))
|
||||
.textFieldStyle(.element(state: .error))
|
||||
|
||||
// Text field with labels
|
||||
TextField("Placeholder", text: .constant(""))
|
||||
.textFieldStyle(.element(labelText: "Label", footerText: "Footer"))
|
||||
TextField("Placeholder", text: .constant("Input text"))
|
||||
.textFieldStyle(.element(labelText: "Title", footerText: "Footer"))
|
||||
TextField("Placeholder", text: .constant("Bad text"))
|
||||
.textFieldStyle(.element(labelText: "Title", footerText: "Footer", state: .error))
|
||||
TextField("Placeholder", text: .constant(""))
|
||||
.textFieldStyle(.element(labelText: "Title", footerText: "Footer"))
|
||||
.disabled(true)
|
||||
TextField("Placeholder", text: .constant(""))
|
||||
.textFieldStyle(.element(labelText: "Title", footerText: "Footer", state: .success))
|
||||
}
|
||||
.previewLayout(.sizeThatFits)
|
||||
.padding()
|
||||
}
|
||||
}
|
@ -1,167 +0,0 @@
|
||||
//
|
||||
// Copyright 2022-2024 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Compound
|
||||
import SwiftUI
|
||||
import SwiftUIIntrospect
|
||||
|
||||
public extension TextFieldStyle where Self == AuthenticationTextFieldStyle {
|
||||
static func authentication(labelText: String? = nil,
|
||||
footerText: String? = nil,
|
||||
isError: Bool = false,
|
||||
accessibilityIdentifier: String? = nil) -> AuthenticationTextFieldStyle {
|
||||
AuthenticationTextFieldStyle(labelText: labelText.map(Text.init),
|
||||
footerText: footerText.map(Text.init),
|
||||
isError: isError,
|
||||
accessibilityIdentifier: accessibilityIdentifier)
|
||||
}
|
||||
|
||||
@_disfavoredOverload
|
||||
static func authentication(labelText: Text? = nil,
|
||||
footerText: Text? = nil,
|
||||
isError: Bool = false,
|
||||
accessibilityIdentifier: String? = nil) -> AuthenticationTextFieldStyle {
|
||||
AuthenticationTextFieldStyle(labelText: labelText,
|
||||
footerText: footerText,
|
||||
isError: isError,
|
||||
accessibilityIdentifier: accessibilityIdentifier)
|
||||
}
|
||||
}
|
||||
|
||||
/// The text field style used in authentication screens.
|
||||
public struct AuthenticationTextFieldStyle: TextFieldStyle {
|
||||
@Environment(\.isEnabled) private var isEnabled
|
||||
|
||||
@FocusState private var isFocused: Bool
|
||||
public let labelText: Text?
|
||||
public let footerText: Text?
|
||||
public let isError: Bool
|
||||
public let accessibilityIdentifier: String?
|
||||
|
||||
/// The color of the text field's border.
|
||||
private var borderColor: Color {
|
||||
isError ? .compound.textCriticalPrimary : .compound._borderTextFieldFocused
|
||||
}
|
||||
|
||||
/// The width of the text field's border.
|
||||
private var borderWidth: CGFloat {
|
||||
isFocused || isError ? 1.0 : 0
|
||||
}
|
||||
|
||||
private var accentColor: Color {
|
||||
isError ? .compound.textCriticalPrimary : .compound.iconAccentTertiary
|
||||
}
|
||||
|
||||
/// The color of the text inside the text field.
|
||||
private var textColor: Color {
|
||||
isEnabled ? .compound.textPrimary : .compound.textDisabled
|
||||
}
|
||||
|
||||
/// The color of the text field's background.
|
||||
private var backgroundColor: Color {
|
||||
.compound.bgSubtleSecondary.opacity(isEnabled ? 1 : 0.5)
|
||||
}
|
||||
|
||||
/// The color of the placeholder text inside the text field.
|
||||
private var placeholderColor: UIColor {
|
||||
.compound.textSecondary
|
||||
}
|
||||
|
||||
/// The color of the label above the text field.
|
||||
private var labelColor: Color {
|
||||
isEnabled ? .compound.textPrimary : .compound.textDisabled
|
||||
}
|
||||
|
||||
/// The color of the footer label below the text field.
|
||||
private var footerColor: Color {
|
||||
isError ? .compound.textCriticalPrimary : .compound.textSecondary
|
||||
}
|
||||
|
||||
/// Creates the text field style configured as required.
|
||||
/// - Parameters:
|
||||
/// - labelText: The text shown in the label above the field.
|
||||
/// - footerText: The text shown in the footer label below the field.
|
||||
/// - isError: Whether or not the text field is currently in the error state.
|
||||
public init(labelText: Text? = nil, footerText: Text? = nil, isError: Bool = false, accessibilityIdentifier: String? = nil) {
|
||||
self.labelText = labelText
|
||||
self.footerText = footerText
|
||||
self.isError = isError
|
||||
self.accessibilityIdentifier = accessibilityIdentifier
|
||||
}
|
||||
|
||||
@MainActor
|
||||
public func _body(configuration: TextField<_Label>) -> some View {
|
||||
let rectangle = RoundedRectangle(cornerRadius: 14.0)
|
||||
|
||||
return VStack(alignment: .leading, spacing: 8) {
|
||||
labelText
|
||||
.font(.compound.bodySM)
|
||||
.foregroundColor(labelColor)
|
||||
.padding(.horizontal, 16)
|
||||
|
||||
configuration
|
||||
.focused($isFocused)
|
||||
.font(.compound.bodyLG)
|
||||
.foregroundColor(textColor)
|
||||
.accentColor(accentColor)
|
||||
.padding(.leading, 16.0)
|
||||
.padding([.vertical, .trailing], 11.0)
|
||||
.background {
|
||||
ZStack {
|
||||
backgroundColor
|
||||
.clipShape(rectangle)
|
||||
rectangle
|
||||
.stroke(borderColor, lineWidth: borderWidth)
|
||||
}
|
||||
.onTapGesture { isFocused = true } // Set focus with taps outside of the text field
|
||||
}
|
||||
.introspect(.textField, on: .supportedVersions) { textField in
|
||||
textField.clearButtonMode = .whileEditing
|
||||
textField.attributedPlaceholder = NSAttributedString(string: textField.placeholder ?? "",
|
||||
attributes: [NSAttributedString.Key.foregroundColor: placeholderColor])
|
||||
textField.accessibilityIdentifier = accessibilityIdentifier
|
||||
}
|
||||
|
||||
footerText
|
||||
.tint(.compound.textLinkExternal)
|
||||
.font(.compound.bodyXS)
|
||||
.foregroundColor(footerColor)
|
||||
.padding(.horizontal, 16)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ElementTextFieldStyle_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ScrollView {
|
||||
VStack(spacing: 20) {
|
||||
// Plain text field.
|
||||
TextField("Placeholder", text: .constant(""))
|
||||
.textFieldStyle(.authentication())
|
||||
TextField("Placeholder", text: .constant("Web"))
|
||||
.textFieldStyle(.authentication())
|
||||
TextField("Placeholder", text: .constant("Web"))
|
||||
.textFieldStyle(.authentication())
|
||||
.disabled(true)
|
||||
TextField("Placeholder", text: .constant("Web"))
|
||||
.textFieldStyle(.authentication(isError: true))
|
||||
|
||||
// Text field with labels
|
||||
TextField("Placeholder", text: .constant(""))
|
||||
.textFieldStyle(.authentication(labelText: "Label", footerText: "Footer"))
|
||||
TextField("Placeholder", text: .constant("Input text"))
|
||||
.textFieldStyle(.authentication(labelText: "Title", footerText: "Footer"))
|
||||
TextField("Placeholder", text: .constant("Bad text"))
|
||||
.textFieldStyle(.authentication(labelText: "Title", footerText: "Footer", isError: true))
|
||||
TextField("Placeholder", text: .constant(""))
|
||||
.textFieldStyle(.authentication(labelText: "Title", footerText: "Footer"))
|
||||
.disabled(true)
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
}
|
@ -69,7 +69,7 @@ struct LoginScreen: View {
|
||||
Text(L10n.commonUsername).foregroundColor(.compound.textSecondary)
|
||||
}
|
||||
.focused($isUsernameFocused)
|
||||
.textFieldStyle(.authentication(accessibilityIdentifier: A11yIdentifiers.loginScreen.emailUsername))
|
||||
.textFieldStyle(.element(accessibilityIdentifier: A11yIdentifiers.loginScreen.emailUsername))
|
||||
.disableAutocorrection(true)
|
||||
.textContentType(.username)
|
||||
.autocapitalization(.none)
|
||||
@ -84,7 +84,7 @@ struct LoginScreen: View {
|
||||
Text(L10n.commonPassword).foregroundColor(.compound.textSecondary)
|
||||
}
|
||||
.focused($isPasswordFocused)
|
||||
.textFieldStyle(.authentication(accessibilityIdentifier: A11yIdentifiers.loginScreen.password))
|
||||
.textFieldStyle(.element(accessibilityIdentifier: A11yIdentifiers.loginScreen.password))
|
||||
.textContentType(.password)
|
||||
.submitLabel(.done)
|
||||
.onSubmit(submit)
|
||||
|
@ -52,10 +52,10 @@ struct ServerSelectionScreen: View {
|
||||
var serverForm: some View {
|
||||
VStack(alignment: .leading, spacing: 24) {
|
||||
TextField(L10n.commonServerUrl, text: $context.homeserverAddress)
|
||||
.textFieldStyle(.authentication(labelText: Text(L10n.screenChangeServerFormHeader),
|
||||
footerText: Text(context.viewState.footerMessage),
|
||||
isError: context.viewState.isShowingFooterError,
|
||||
accessibilityIdentifier: A11yIdentifiers.changeServerScreen.server))
|
||||
.textFieldStyle(.element(labelText: Text(L10n.screenChangeServerFormHeader),
|
||||
footerText: Text(context.viewState.footerMessage),
|
||||
state: context.viewState.isShowingFooterError ? .error : .default,
|
||||
accessibilityIdentifier: A11yIdentifiers.changeServerScreen.server))
|
||||
.keyboardType(.URL)
|
||||
.autocapitalization(.none)
|
||||
.disableAutocorrection(true)
|
||||
|
@ -74,7 +74,7 @@ struct SoftLogoutScreen: View {
|
||||
VStack(spacing: 14) {
|
||||
SecureField(L10n.commonPassword, text: $context.password)
|
||||
.focused($isPasswordFocused)
|
||||
.textFieldStyle(.authentication())
|
||||
.textFieldStyle(.element())
|
||||
.textContentType(.password)
|
||||
.submitLabel(.done)
|
||||
.onSubmit(submit)
|
||||
|
@ -25,7 +25,6 @@ enum HomeScreenCoordinatorAction {
|
||||
case presentEncryptionResetScreen
|
||||
case presentStartChatScreen
|
||||
case presentGlobalSearch
|
||||
case presentRoomDirectorySearch
|
||||
case logoutWithoutConfirmation
|
||||
case logout
|
||||
}
|
||||
@ -75,8 +74,6 @@ final class HomeScreenCoordinator: CoordinatorProtocol {
|
||||
actionsSubject.send(.presentStartChatScreen)
|
||||
case .presentGlobalSearch:
|
||||
actionsSubject.send(.presentGlobalSearch)
|
||||
case .presentRoomDirectorySearch:
|
||||
actionsSubject.send(.presentRoomDirectorySearch)
|
||||
case .logoutWithoutConfirmation:
|
||||
actionsSubject.send(.logoutWithoutConfirmation)
|
||||
case .logout:
|
||||
|
@ -20,7 +20,6 @@ enum HomeScreenViewModelAction: Equatable {
|
||||
case presentFeedbackScreen
|
||||
case presentStartChatScreen
|
||||
case presentGlobalSearch
|
||||
case presentRoomDirectorySearch
|
||||
case logoutWithoutConfirmation
|
||||
case logout
|
||||
}
|
||||
@ -41,7 +40,6 @@ enum HomeScreenViewAction {
|
||||
case markRoomAsUnread(roomIdentifier: String)
|
||||
case markRoomAsRead(roomIdentifier: String)
|
||||
case markRoomAsFavourite(roomIdentifier: String, isFavourite: Bool)
|
||||
case selectRoomDirectorySearch
|
||||
|
||||
case acceptInvite(roomIdentifier: String)
|
||||
case declineInvite(roomIdentifier: String)
|
||||
@ -97,9 +95,7 @@ struct HomeScreenViewState: BindableState {
|
||||
var roomListMode: HomeScreenRoomListMode = .skeletons
|
||||
|
||||
var hasPendingInvitations = false
|
||||
|
||||
var isRoomDirectorySearchEnabled = false
|
||||
|
||||
|
||||
var selectedRoomID: String?
|
||||
|
||||
var visibleRooms: [HomeScreenRoom] {
|
||||
|
@ -94,10 +94,6 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
.sink { [weak self] _ in self?.updateRooms() }
|
||||
.store(in: &cancellables)
|
||||
|
||||
appSettings.$publicSearchEnabled
|
||||
.weakAssign(to: \.state.isRoomDirectorySearchEnabled, on: self)
|
||||
.store(in: &cancellables)
|
||||
|
||||
appSettings.$seenInvites
|
||||
.removeDuplicates()
|
||||
.sink { [weak self] _ in
|
||||
@ -194,8 +190,6 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
Task {
|
||||
await markRoomAsFavourite(roomIdentifier, isFavourite: isFavourite)
|
||||
}
|
||||
case .selectRoomDirectorySearch:
|
||||
actionsSubject.send(.presentRoomDirectorySearch)
|
||||
case .acceptInvite(let roomIdentifier):
|
||||
Task {
|
||||
await acceptInvite(roomID: roomIdentifier)
|
||||
|
@ -16,10 +16,6 @@ struct HomeScreenRoomList: View {
|
||||
// avoids glitches when focusing the search bar
|
||||
if !context.viewState.shouldHideRoomList {
|
||||
content
|
||||
} else if context.viewState.isRoomDirectorySearchEnabled {
|
||||
RoomDirectorySearchView {
|
||||
context.send(viewAction: .selectRoomDirectorySearch)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,28 +0,0 @@
|
||||
//
|
||||
// Copyright 2024 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Compound
|
||||
import SwiftUI
|
||||
|
||||
struct RoomDirectorySearchView: View {
|
||||
let onTap: () -> Void
|
||||
|
||||
var body: some View {
|
||||
Button(action: onTap) {
|
||||
Label(L10n.screenRoomlistRoomDirectoryButtonTitle, icon: \.listBulleted)
|
||||
}
|
||||
.buttonStyle(.compound(.super))
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
}
|
||||
|
||||
struct RoomDirectorySearchView_Previews: PreviewProvider, TestablePreview {
|
||||
static var previews: some View {
|
||||
RoomDirectorySearchView { }
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ struct StartChatScreenCoordinatorParameters {
|
||||
enum StartChatScreenCoordinatorAction {
|
||||
case close
|
||||
case openRoom(withIdentifier: String)
|
||||
case openRoomDirectorySearch
|
||||
}
|
||||
|
||||
final class StartChatScreenCoordinator: CoordinatorProtocol {
|
||||
@ -48,7 +49,8 @@ final class StartChatScreenCoordinator: CoordinatorProtocol {
|
||||
viewModel = StartChatScreenViewModel(userSession: parameters.userSession,
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
userDiscoveryService: parameters.userDiscoveryService)
|
||||
userDiscoveryService: parameters.userDiscoveryService,
|
||||
appSettings: ServiceLocator.shared.settings)
|
||||
}
|
||||
|
||||
func start() {
|
||||
@ -60,8 +62,10 @@ final class StartChatScreenCoordinator: CoordinatorProtocol {
|
||||
case .createRoom:
|
||||
// before creating a room we select the users we would like to invite in that room
|
||||
presentInviteUsersScreen()
|
||||
case .openRoom(let identifier):
|
||||
case .showRoom(let identifier):
|
||||
actionsSubject.send(.openRoom(withIdentifier: identifier))
|
||||
case .openRoomDirectorySearch:
|
||||
actionsSubject.send(.openRoomDirectorySearch)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
@ -12,16 +12,18 @@ enum StartChatScreenErrorType: Error {
|
||||
case unknown
|
||||
}
|
||||
|
||||
enum StartChatScreenViewModelAction {
|
||||
enum StartChatScreenViewModelAction: Equatable {
|
||||
case close
|
||||
case createRoom
|
||||
case openRoom(withIdentifier: String)
|
||||
case showRoom(withIdentifier: String)
|
||||
case openRoomDirectorySearch
|
||||
}
|
||||
|
||||
struct StartChatScreenViewState: BindableState {
|
||||
let userID: String
|
||||
var bindings = StartChatScreenViewStateBindings()
|
||||
var usersSection: UserDiscoverySection = .init(type: .suggestions, users: [])
|
||||
var isRoomDirectoryEnabled = false
|
||||
|
||||
var isSearching: Bool {
|
||||
!bindings.searchQuery.isEmpty
|
||||
@ -30,15 +32,19 @@ struct StartChatScreenViewState: BindableState {
|
||||
var hasEmptySearchResults: Bool {
|
||||
isSearching && usersSection.type == .searchResult && usersSection.users.isEmpty
|
||||
}
|
||||
|
||||
var joinByAddressState: JoinByAddressState = .example
|
||||
}
|
||||
|
||||
struct StartChatScreenViewStateBindings {
|
||||
var searchQuery = ""
|
||||
var roomAddress = ""
|
||||
|
||||
/// Information describing the currently displayed alert.
|
||||
var alertInfo: AlertInfo<StartChatScreenErrorType>?
|
||||
|
||||
var selectedUserToInvite: UserProfileProxy?
|
||||
var isJoinRoomByAddressSheetPresented = false
|
||||
}
|
||||
|
||||
enum StartChatScreenViewAction {
|
||||
@ -46,4 +52,13 @@ enum StartChatScreenViewAction {
|
||||
case createRoom
|
||||
case createDM(user: UserProfileProxy)
|
||||
case selectUser(UserProfileProxy)
|
||||
case joinRoomByAddress
|
||||
case openRoomDirectorySearch
|
||||
}
|
||||
|
||||
enum JoinByAddressState: Equatable {
|
||||
case example
|
||||
case invalidAddress
|
||||
case addressNotFound
|
||||
case addressFound(address: String, roomID: String)
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import MatrixRustSDK
|
||||
import SwiftUI
|
||||
|
||||
typealias StartChatScreenViewModelType = StateStoreViewModel<StartChatScreenViewState, StartChatScreenViewAction>
|
||||
@ -15,6 +16,7 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
private let analytics: AnalyticsService
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private let userDiscoveryService: UserDiscoveryServiceProtocol
|
||||
private let appSettings: AppSettings
|
||||
|
||||
private var suggestedUsers = [UserProfileProxy]()
|
||||
|
||||
@ -26,11 +28,13 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
init(userSession: UserSessionProtocol,
|
||||
analytics: AnalyticsService,
|
||||
userIndicatorController: UserIndicatorControllerProtocol,
|
||||
userDiscoveryService: UserDiscoveryServiceProtocol) {
|
||||
userDiscoveryService: UserDiscoveryServiceProtocol,
|
||||
appSettings: AppSettings) {
|
||||
self.userSession = userSession
|
||||
self.analytics = analytics
|
||||
self.userIndicatorController = userIndicatorController
|
||||
self.userDiscoveryService = userDiscoveryService
|
||||
self.appSettings = appSettings
|
||||
|
||||
super.init(initialViewState: StartChatScreenViewState(userID: userSession.clientProxy.userID), mediaProvider: userSession.mediaProvider)
|
||||
|
||||
@ -60,7 +64,7 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
switch currentDirectRoom {
|
||||
case .success(.some(let roomId)):
|
||||
hideLoadingIndicator()
|
||||
actionsSubject.send(.openRoom(withIdentifier: roomId))
|
||||
actionsSubject.send(.showRoom(withIdentifier: roomId))
|
||||
case .success:
|
||||
hideLoadingIndicator()
|
||||
state.bindings.selectedUserToInvite = user
|
||||
@ -71,12 +75,24 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
}
|
||||
case .createDM(let user):
|
||||
Task { await createDirectRoom(user: user) }
|
||||
case .joinRoomByAddress:
|
||||
joinRoomByAddress()
|
||||
case .openRoomDirectorySearch:
|
||||
actionsSubject.send(.openRoomDirectorySearch)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
// periphery:ignore - auto cancels when reassigned
|
||||
@CancellableTask private var resolveAliasTask: Task<Void, Never>?
|
||||
private var internalRoomAddressState: JoinByAddressState = .example
|
||||
|
||||
private func setupBindings() {
|
||||
appSettings.$publicSearchEnabled
|
||||
.weakAssign(to: \.state.isRoomDirectoryEnabled, on: self)
|
||||
.store(in: &cancellables)
|
||||
|
||||
context.$viewState
|
||||
.map(\.bindings.searchQuery)
|
||||
.debounceTextQueriesAndRemoveDuplicates()
|
||||
@ -84,6 +100,62 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
self?.fetchUsers()
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
context.$viewState
|
||||
.map(\.bindings.roomAddress)
|
||||
.removeDuplicates()
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] _ in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
state.joinByAddressState = .example
|
||||
internalRoomAddressState = .example
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
context.$viewState
|
||||
.map(\.bindings.roomAddress)
|
||||
.debounceTextQueriesAndRemoveDuplicates()
|
||||
.sink { [weak self] roomAddress in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
resolveRoomAddress(roomAddress)
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
private func resolveRoomAddress(_ roomAddress: String) {
|
||||
guard !roomAddress.isEmpty,
|
||||
isRoomAliasFormatValid(alias: roomAddress) else {
|
||||
internalRoomAddressState = .invalidAddress
|
||||
resolveAliasTask = nil
|
||||
return
|
||||
}
|
||||
|
||||
resolveAliasTask = Task { [weak self] in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
defer { resolveAliasTask = nil }
|
||||
|
||||
guard case let .success(resolved) = await userSession.clientProxy.resolveRoomAlias(roomAddress) else {
|
||||
if Task.isCancelled {
|
||||
return
|
||||
}
|
||||
internalRoomAddressState = .addressNotFound
|
||||
return
|
||||
}
|
||||
|
||||
guard !Task.isCancelled else {
|
||||
return
|
||||
}
|
||||
|
||||
let result = JoinByAddressState.addressFound(address: roomAddress, roomID: resolved.roomId)
|
||||
internalRoomAddressState = result
|
||||
state.joinByAddressState = result
|
||||
}
|
||||
}
|
||||
|
||||
// periphery:ignore - auto cancels when reassigned
|
||||
@ -118,7 +190,7 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
switch await userSession.clientProxy.createDirectRoom(with: user.userID, expectedRoomName: user.displayName) {
|
||||
case .success(let roomId):
|
||||
analytics.trackCreatedRoom(isDM: true)
|
||||
actionsSubject.send(.openRoom(withIdentifier: roomId))
|
||||
actionsSubject.send(.showRoom(withIdentifier: roomId))
|
||||
case .failure:
|
||||
displayError()
|
||||
}
|
||||
@ -129,6 +201,28 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
title: L10n.commonError,
|
||||
message: L10n.screenStartChatErrorStartingChat)
|
||||
}
|
||||
|
||||
private func joinRoomByAddress() {
|
||||
if case let .addressFound(lastTestedAddress, roomID) = internalRoomAddressState,
|
||||
lastTestedAddress == state.bindings.roomAddress {
|
||||
actionsSubject.send(.showRoom(withIdentifier: roomID))
|
||||
} else if let resolveAliasTask {
|
||||
// If the task is still running we wait for it to complete and we check the state again
|
||||
showLoadingIndicator(delay: .milliseconds(250))
|
||||
Task {
|
||||
await resolveAliasTask.value
|
||||
hideLoadingIndicator()
|
||||
joinRoomByAddress()
|
||||
}
|
||||
} else if internalRoomAddressState == .example {
|
||||
// If we are in the example state internally, this means that the task has not started yet so we start it, and the check the state again
|
||||
resolveRoomAddress(state.bindings.roomAddress)
|
||||
joinRoomByAddress()
|
||||
} else {
|
||||
// In any other case we just use the internal state
|
||||
state.joinByAddressState = internalRoomAddressState
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Loading indicator
|
||||
|
||||
|
@ -0,0 +1,95 @@
|
||||
//
|
||||
// Copyright 2025 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Compound
|
||||
import SwiftUI
|
||||
|
||||
struct JoinRoomByAddressView: View {
|
||||
@ObservedObject var context: StartChatScreenViewModel.Context
|
||||
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
@State private var sheetHeight: CGFloat = .zero
|
||||
@FocusState private var textFieldFocus
|
||||
private let topPadding: CGFloat = 22
|
||||
|
||||
private var footerText: String {
|
||||
switch context.viewState.joinByAddressState {
|
||||
case .example:
|
||||
L10n.screenStartChatJoinRoomByAddressSupportingText
|
||||
case .addressNotFound:
|
||||
L10n.screenStartChatJoinRoomByAddressRoomNotFound
|
||||
case .addressFound:
|
||||
L10n.screenStartChatJoinRoomByAddressRoomFound
|
||||
case .invalidAddress:
|
||||
L10n.screenStartChatJoinRoomByAddressInvalidAddress
|
||||
}
|
||||
}
|
||||
|
||||
private var textFieldState: ElementTextFieldStyle.State {
|
||||
switch context.viewState.joinByAddressState {
|
||||
case .addressFound:
|
||||
.success
|
||||
case .example:
|
||||
.default
|
||||
case .addressNotFound, .invalidAddress:
|
||||
.error
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack(spacing: 24) {
|
||||
TextField(L10n.screenStartChatJoinRoomByAddressPlaceholder,
|
||||
text: $context.roomAddress)
|
||||
.textFieldStyle(.element(labelText: L10n.screenStartChatJoinRoomByAddressAction,
|
||||
footerText: footerText,
|
||||
state: textFieldState))
|
||||
.textInputAutocapitalization(.never)
|
||||
.autocorrectionDisabled()
|
||||
.textContentType(.URL)
|
||||
.focused($textFieldFocus)
|
||||
.onChange(of: context.roomAddress) { _, newValue in
|
||||
context.roomAddress = newValue.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
}
|
||||
|
||||
Button(L10n.actionContinue) {
|
||||
context.send(viewAction: .joinRoomByAddress)
|
||||
}
|
||||
.buttonStyle(.compound(.primary))
|
||||
}
|
||||
.padding(.horizontal, 16)
|
||||
.readHeight($sheetHeight)
|
||||
}
|
||||
.scrollBounceBehavior(.basedOnSize)
|
||||
.padding(.top, topPadding) // For the drag indicator
|
||||
.presentationDetents([.height(sheetHeight + topPadding)])
|
||||
.presentationDragIndicator(.visible)
|
||||
.presentationBackground(.compound.bgCanvasDefault)
|
||||
.onAppear {
|
||||
textFieldFocus = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct JoinRoomByAddressView_Previews: PreviewProvider, TestablePreview {
|
||||
static let viewModel = {
|
||||
let userSession = UserSessionMock(.init(clientProxy: ClientProxyMock(.init(userID: "@userid:example.com"))))
|
||||
let userDiscoveryService = UserDiscoveryServiceMock()
|
||||
userDiscoveryService.searchProfilesWithReturnValue = .success([.mockAlice])
|
||||
let viewModel = StartChatScreenViewModel(userSession: userSession,
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
userDiscoveryService: userDiscoveryService,
|
||||
appSettings: ServiceLocator.shared.settings)
|
||||
return viewModel
|
||||
}()
|
||||
|
||||
static var previews: some View {
|
||||
JoinRoomByAddressView(context: viewModel.context)
|
||||
}
|
||||
}
|
@ -36,6 +36,11 @@ struct StartChatScreen: View {
|
||||
context.send(viewAction: .createDM(user: user))
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $context.isJoinRoomByAddressSheetPresented) {
|
||||
context.roomAddress = ""
|
||||
} content: {
|
||||
JoinRoomByAddressView(context: context)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
@ -44,10 +49,34 @@ struct StartChatScreen: View {
|
||||
@ViewBuilder
|
||||
private var mainContent: some View {
|
||||
createRoomSection
|
||||
if context.viewState.isRoomDirectoryEnabled {
|
||||
roomDirectorySearch
|
||||
}
|
||||
inviteFriendsSection
|
||||
joinRoomByAddressSection
|
||||
usersSection
|
||||
}
|
||||
|
||||
private var joinRoomByAddressSection: some View {
|
||||
Section {
|
||||
ListRow(label: .default(title: L10n.screenStartChatJoinRoomByAddressAction,
|
||||
icon: \.room),
|
||||
kind: .button {
|
||||
context.isJoinRoomByAddressSheetPresented = true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private var roomDirectorySearch: some View {
|
||||
Section {
|
||||
ListRow(label: .default(title: L10n.screenRoomDirectorySearchTitle,
|
||||
icon: \.listBulleted),
|
||||
kind: .navigationLink {
|
||||
context.send(viewAction: .openRoomDirectorySearch)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// The content shown in the form when a search query has been entered.
|
||||
@ViewBuilder
|
||||
private var searchContent: some View {
|
||||
@ -125,13 +154,16 @@ struct StartChatScreen: View {
|
||||
|
||||
struct StartChatScreen_Previews: PreviewProvider, TestablePreview {
|
||||
static let viewModel = {
|
||||
let appSettings = AppSettings()
|
||||
appSettings.publicSearchEnabled = true
|
||||
let userSession = UserSessionMock(.init(clientProxy: ClientProxyMock(.init(userID: "@userid:example.com"))))
|
||||
let userDiscoveryService = UserDiscoveryServiceMock()
|
||||
userDiscoveryService.searchProfilesWithReturnValue = .success([.mockAlice])
|
||||
let viewModel = StartChatScreenViewModel(userSession: userSession,
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
userDiscoveryService: userDiscoveryService)
|
||||
userDiscoveryService: userDiscoveryService,
|
||||
appSettings: appSettings)
|
||||
return viewModel
|
||||
}()
|
||||
|
||||
|
@ -149,6 +149,12 @@ extension PreviewTests {
|
||||
}
|
||||
}
|
||||
|
||||
func test_elementTextFieldStyle() async throws {
|
||||
for preview in ElementTextFieldStyle_Previews._allPreviews {
|
||||
try await assertSnapshots(matching: preview)
|
||||
}
|
||||
}
|
||||
|
||||
func test_emojiPickerScreenHeaderView() async throws {
|
||||
for preview in EmojiPickerScreenHeaderView_Previews._allPreviews {
|
||||
try await assertSnapshots(matching: preview)
|
||||
@ -317,6 +323,12 @@ extension PreviewTests {
|
||||
}
|
||||
}
|
||||
|
||||
func test_joinRoomByAddressView() async throws {
|
||||
for preview in JoinRoomByAddressView_Previews._allPreviews {
|
||||
try await assertSnapshots(matching: preview)
|
||||
}
|
||||
}
|
||||
|
||||
func test_joinRoomScreen() async throws {
|
||||
for preview in JoinRoomScreen_Previews._allPreviews {
|
||||
try await assertSnapshots(matching: preview)
|
||||
@ -647,12 +659,6 @@ extension PreviewTests {
|
||||
}
|
||||
}
|
||||
|
||||
func test_roomDirectorySearchView() async throws {
|
||||
for preview in RoomDirectorySearchView_Previews._allPreviews {
|
||||
try await assertSnapshots(matching: preview)
|
||||
}
|
||||
}
|
||||
|
||||
func test_roomHeaderView() async throws {
|
||||
for preview in RoomHeaderView_Previews._allPreviews {
|
||||
try await assertSnapshots(matching: preview)
|
||||
|
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_elementTextFieldStyle-iPad-en-GB.1.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_elementTextFieldStyle-iPad-en-GB.1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_elementTextFieldStyle-iPad-pseudo.1.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_elementTextFieldStyle-iPad-pseudo.1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_elementTextFieldStyle-iPhone-16-en-GB.1.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_elementTextFieldStyle-iPhone-16-en-GB.1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_elementTextFieldStyle-iPhone-16-pseudo.1.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_elementTextFieldStyle-iPhone-16-pseudo.1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_joinRoomByAddressView-iPad-en-GB.1.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_joinRoomByAddressView-iPad-en-GB.1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_joinRoomByAddressView-iPad-pseudo.1.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_joinRoomByAddressView-iPad-pseudo.1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_joinRoomByAddressView-iPhone-16-en-GB.1.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_joinRoomByAddressView-iPhone-16-en-GB.1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_joinRoomByAddressView-iPhone-16-pseudo.1.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_joinRoomByAddressView-iPhone-16-pseudo.1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchView-iPad-en-GB.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchView-iPad-en-GB.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchView-iPad-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchView-iPad-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchView-iPhone-16-en-GB.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchView-iPhone-16-en-GB.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchView-iPhone-16-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchView-iPhone-16-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-en-GB.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-en-GB.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-en-GB.2.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-en-GB.2.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-en-GB.3.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-en-GB.3.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-en-GB.4.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-en-GB.4.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-pseudo.2.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-pseudo.2.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-pseudo.3.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-pseudo.3.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-pseudo.4.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPad-pseudo.4.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-en-GB.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-en-GB.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-en-GB.2.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-en-GB.2.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-en-GB.3.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-en-GB.3.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-en-GB.4.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-en-GB.4.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-pseudo.2.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-pseudo.2.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-pseudo.3.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-pseudo.3.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-pseudo.4.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_serverSelection-iPhone-16-pseudo.4.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_startChatScreen-iPad-en-GB.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_startChatScreen-iPad-en-GB.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_startChatScreen-iPad-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_startChatScreen-iPad-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_startChatScreen-iPhone-16-en-GB.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_startChatScreen-iPhone-16-en-GB.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_startChatScreen-iPhone-16-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_startChatScreen-iPhone-16-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
@ -27,7 +27,8 @@ class StartChatScreenViewModelTests: XCTestCase {
|
||||
viewModel = StartChatScreenViewModel(userSession: userSession,
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
userDiscoveryService: userDiscoveryService)
|
||||
userDiscoveryService: userDiscoveryService,
|
||||
appSettings: ServiceLocator.shared.settings)
|
||||
}
|
||||
|
||||
func testQueryShowingNoResults() async throws {
|
||||
@ -44,6 +45,42 @@ class StartChatScreenViewModelTests: XCTestCase {
|
||||
XCTAssertTrue(userDiscoveryService.searchProfilesWithCalled)
|
||||
}
|
||||
|
||||
func testJoinRoomByAddress() async throws {
|
||||
clientProxy.resolveRoomAliasReturnValue = .success(.init(roomId: "id", servers: []))
|
||||
|
||||
let deferredViewState = deferFulfillment(viewModel.context.$viewState) { viewState in
|
||||
viewState.joinByAddressState == .addressFound(address: "#room:example.com", roomID: "id")
|
||||
}
|
||||
viewModel.context.roomAddress = "#room:example.com"
|
||||
try await deferredViewState.fulfill()
|
||||
|
||||
let deferredAction = deferFulfillment(viewModel.actions) { action in
|
||||
action == .showRoom(withIdentifier: "id")
|
||||
}
|
||||
context.send(viewAction: .joinRoomByAddress)
|
||||
try await deferredAction.fulfill()
|
||||
}
|
||||
|
||||
func testJoinRoomByAddressFailsBecauseInvalid() async throws {
|
||||
let deferred = deferFulfillment(viewModel.context.$viewState) { viewState in
|
||||
viewState.joinByAddressState == .invalidAddress
|
||||
}
|
||||
viewModel.context.roomAddress = ":"
|
||||
context.send(viewAction: .joinRoomByAddress)
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
func testJoinRoomByAddressFailsBecauseNotFound() async throws {
|
||||
clientProxy.resolveRoomAliasReturnValue = .failure(.failedResolvingRoomAlias)
|
||||
|
||||
let deferred = deferFulfillment(viewModel.context.$viewState) { viewState in
|
||||
viewState.joinByAddressState == .addressNotFound
|
||||
}
|
||||
viewModel.context.roomAddress = "#room:example.com"
|
||||
context.send(viewAction: .joinRoomByAddress)
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func assertSearchResults(toBe count: Int) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user