mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +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:
@@ -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
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user