mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Bundle ClientProxy & MediaProvider injections together in UserSession.
This commit is contained in:
+2
-4
@@ -10,8 +10,7 @@ import SwiftUI
|
||||
|
||||
struct UserDetailsEditScreenCoordinatorParameters {
|
||||
let orientationManager: OrientationManagerProtocol
|
||||
let clientProxy: ClientProxyProtocol
|
||||
let mediaProvider: MediaProviderProtocol
|
||||
let userSession: UserSessionProtocol
|
||||
let mediaUploadingPreprocessor: MediaUploadingPreprocessor
|
||||
weak var navigationStackCoordinator: NavigationStackCoordinator?
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
@@ -26,8 +25,7 @@ final class UserDetailsEditScreenCoordinator: CoordinatorProtocol {
|
||||
init(parameters: UserDetailsEditScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = UserDetailsEditScreenViewModel(clientProxy: parameters.clientProxy,
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
viewModel = UserDetailsEditScreenViewModel(userSession: parameters.userSession,
|
||||
mediaUploadingPreprocessor: parameters.mediaUploadingPreprocessor,
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
}
|
||||
|
||||
+3
-4
@@ -20,16 +20,15 @@ class UserDetailsEditScreenViewModel: UserDetailsEditScreenViewModelType, UserDe
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(clientProxy: ClientProxyProtocol,
|
||||
mediaProvider: MediaProviderProtocol,
|
||||
init(userSession: UserSessionProtocol,
|
||||
mediaUploadingPreprocessor: MediaUploadingPreprocessor,
|
||||
userIndicatorController: UserIndicatorControllerProtocol) {
|
||||
self.clientProxy = clientProxy
|
||||
clientProxy = userSession.clientProxy
|
||||
self.mediaUploadingPreprocessor = mediaUploadingPreprocessor
|
||||
self.userIndicatorController = userIndicatorController
|
||||
|
||||
super.init(initialViewState: UserDetailsEditScreenViewState(userID: clientProxy.userID,
|
||||
bindings: .init()), mediaProvider: mediaProvider)
|
||||
bindings: .init()), mediaProvider: userSession.mediaProvider)
|
||||
|
||||
clientProxy.userAvatarURLPublisher
|
||||
.receive(on: DispatchQueue.main)
|
||||
|
||||
+1
-2
@@ -115,8 +115,7 @@ struct UserDetailsEditScreen: View {
|
||||
// MARK: - Previews
|
||||
|
||||
struct UserDetailsEditScreen_Previews: PreviewProvider, TestablePreview {
|
||||
static let viewModel = UserDetailsEditScreenViewModel(clientProxy: ClientProxyMock(.init(userID: "@stefan:matrix.org")),
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
static let viewModel = UserDetailsEditScreenViewModel(userSession: UserSessionMock(.init(clientProxy: ClientProxyMock(.init(userID: "@stefan:matrix.org")))),
|
||||
mediaUploadingPreprocessor: .init(appSettings: ServiceLocator.shared.settings),
|
||||
userIndicatorController: UserIndicatorControllerMock.default)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user