Removed unused swipe gesture (+3 squashed commits)

Squashed commits:
[d64bb3bb] Stop using the ServiceLocator directly in the ScreenTrackerViewModifier
[37c46ab9] Rename Analytics to AnalyticsService
[8852a371] #920 - Cleanup ServiceLocator usages
This commit is contained in:
Stefan Ceriu
2023-06-23 09:56:22 +03:00
committed by Stefan Ceriu
parent b4cd58b209
commit e6711a0236
104 changed files with 720 additions and 366 deletions
@@ -60,7 +60,11 @@ final class StartChatScreenCoordinator: CoordinatorProtocol {
init(parameters: StartChatScreenCoordinatorParameters) {
self.parameters = parameters
viewModel = StartChatScreenViewModel(userSession: parameters.userSession, userIndicatorController: parameters.userIndicatorController, userDiscoveryService: parameters.userDiscoveryService)
viewModel = StartChatScreenViewModel(userSession: parameters.userSession,
appSettings: ServiceLocator.shared.settings,
analytics: ServiceLocator.shared.analytics,
userIndicatorController: parameters.userIndicatorController,
userDiscoveryService: parameters.userDiscoveryService)
}
func start() {
@@ -21,19 +21,28 @@ typealias StartChatScreenViewModelType = StateStoreViewModel<StartChatScreenView
class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenViewModelProtocol {
private let userSession: UserSessionProtocol
private let actionsSubject: PassthroughSubject<StartChatScreenViewModelAction, Never> = .init()
private let appSettings: AppSettings
private let analytics: AnalyticsService
private weak var userIndicatorController: UserIndicatorControllerProtocol?
private let userDiscoveryService: UserDiscoveryServiceProtocol
private let actionsSubject: PassthroughSubject<StartChatScreenViewModelAction, Never> = .init()
var actions: AnyPublisher<StartChatScreenViewModelAction, Never> {
actionsSubject.eraseToAnyPublisher()
}
weak var userIndicatorController: UserIndicatorControllerProtocol?
init(userSession: UserSessionProtocol, userIndicatorController: UserIndicatorControllerProtocol?, userDiscoveryService: UserDiscoveryServiceProtocol) {
init(userSession: UserSessionProtocol,
appSettings: AppSettings,
analytics: AnalyticsService,
userIndicatorController: UserIndicatorControllerProtocol?,
userDiscoveryService: UserDiscoveryServiceProtocol) {
self.userSession = userSession
self.appSettings = appSettings
self.analytics = analytics
self.userIndicatorController = userIndicatorController
self.userDiscoveryService = userDiscoveryService
super.init(initialViewState: StartChatScreenViewState(userID: userSession.userID), imageProvider: userSession.mediaProvider)
setupBindings()
@@ -106,7 +115,7 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
}
private func fetchSuggestions() {
guard ServiceLocator.shared.settings.userSuggestionsEnabled else {
guard appSettings.userSuggestionsEnabled else {
state.usersSection = .init(type: .suggestions, users: [])
return
}
@@ -133,7 +142,7 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
showLoadingIndicator()
switch await clientProxy.createDirectRoom(with: user.userID, expectedRoomName: user.displayName) {
case .success(let roomId):
ServiceLocator.shared.analytics.trackCreatedRoom(isDM: true)
analytics.trackCreatedRoom(isDM: true)
actionsSubject.send(.openRoom(withIdentifier: roomId))
case .failure(let failure):
displayError(failure)
@@ -140,7 +140,11 @@ struct StartChatScreen_Previews: PreviewProvider {
let userDiscoveryService = UserDiscoveryServiceMock()
userDiscoveryService.fetchSuggestionsReturnValue = .success([.mockAlice])
userDiscoveryService.searchProfilesWithReturnValue = .success([.mockAlice])
let viewModel = StartChatScreenViewModel(userSession: userSession, userIndicatorController: nil, userDiscoveryService: userDiscoveryService)
let viewModel = StartChatScreenViewModel(userSession: userSession,
appSettings: ServiceLocator.shared.settings,
analytics: ServiceLocator.shared.analytics,
userIndicatorController: nil,
userDiscoveryService: userDiscoveryService)
return viewModel
}()