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:
Mauro
2025-02-28 13:35:15 +01:00
committed by GitHub
parent 2b58f57483
commit 7f6ea1c2ae
54 changed files with 611 additions and 340 deletions
@@ -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
}()