mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +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:
@@ -17,17 +17,10 @@ class UnitTestsAppCoordinator: AppCoordinatorProtocol {
|
||||
|
||||
init(appDelegate: AppDelegate) {
|
||||
windowManager = WindowManager(appDelegate: appDelegate)
|
||||
ServiceLocator.shared.register(userIndicatorController: UserIndicatorControllerMock.default)
|
||||
|
||||
AppSettings.configureWithSuiteName("io.element.elementx.unittests")
|
||||
AppSettings.resetAllSettings()
|
||||
ServiceLocator.shared.register(appSettings: AppSettings())
|
||||
|
||||
let analyticsClient = AnalyticsClientMock()
|
||||
analyticsClient.isRunning = false
|
||||
ServiceLocator.shared.register(analytics: AnalyticsService(client: analyticsClient,
|
||||
appSettings: ServiceLocator.shared.settings))
|
||||
|
||||
|
||||
// As the tests take advantage of Rust's ability to redirect the log files, there is
|
||||
// often some debris left from the previous run, so we wipe the entire directory.
|
||||
// This is an NOT an advised way to delete logs in production, `Tracing.deleteLogFiles`
|
||||
|
||||
Reference in New Issue
Block a user