mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Replace the ServiceLocator with direct dependency injection (#5548)
Removes the ServiceLocator singleton and instead directly injects the dependencies it was holding for more control over instantiation of the various component subtrees and better visibility over how they're being used.
This commit is contained in:
@@ -21,16 +21,16 @@ final class JoinRoomScreenViewModelTests {
|
||||
var viewModel: JoinRoomScreenViewModelProtocol!
|
||||
|
||||
var clientProxy: ClientProxyMock!
|
||||
var appSettings: AppSettings!
|
||||
|
||||
var context: JoinRoomScreenViewModelType.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
private let appSettings: AppSettings
|
||||
|
||||
init() {
|
||||
AppSettings.resetAllSettings()
|
||||
appSettings = AppSettings()
|
||||
ServiceLocator.shared.register(appSettings: appSettings)
|
||||
}
|
||||
|
||||
deinit {
|
||||
@@ -205,7 +205,7 @@ final class JoinRoomScreenViewModelTests {
|
||||
viewModel = JoinRoomScreenViewModel(source: .generic(roomID: "1", via: []),
|
||||
appSettings: appSettings,
|
||||
userSession: UserSessionMock(.init(clientProxy: clientProxy)),
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
userIndicatorController: UserIndicatorControllerMock.default)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user