From 12ca5c70f7b90dace9614e7bcce0c354b2e6cc04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20Bu=CC=88nz?= Date: Sun, 4 Aug 2024 10:17:59 +0200 Subject: [PATCH] set observationModeStore value after loading settings --- CriticalMapsKit/Sources/AppFeature/AppFeatureCore.swift | 3 +++ .../Tests/AppFeatureTests/AppFeatureCoreTests.swift | 1 + 2 files changed, 4 insertions(+) diff --git a/CriticalMapsKit/Sources/AppFeature/AppFeatureCore.swift b/CriticalMapsKit/Sources/AppFeature/AppFeatureCore.swift index 3bf1177d..c4de716e 100644 --- a/CriticalMapsKit/Sources/AppFeature/AppFeatureCore.swift +++ b/CriticalMapsKit/Sources/AppFeature/AppFeatureCore.swift @@ -35,6 +35,7 @@ public struct AppFeature { @Dependency(\.uiApplicationClient) var uiApplicationClient @Dependency(\.setUserInterfaceStyle) var setUserInterfaceStyle @Dependency(\.isNetworkAvailable) var isNetworkAvailable + @Dependency(\.observationModeStore) var observationModeStore // MARK: State @@ -367,6 +368,8 @@ public struct AppFeature { state.settingsState = .init(userSettings: userSettings) state.nextRideState.rideEventSettings = userSettings.rideEventSettings + observationModeStore.setObservationModeState(isEnabled: userSettings.isObservationModeEnabled) + let style = state.settingsState.appearanceSettings.colorScheme.userInterfaceStyle return .run { _ in diff --git a/CriticalMapsKit/Tests/AppFeatureTests/AppFeatureCoreTests.swift b/CriticalMapsKit/Tests/AppFeatureTests/AppFeatureCoreTests.swift index 181e8316..335fd183 100644 --- a/CriticalMapsKit/Tests/AppFeatureTests/AppFeatureCoreTests.swift +++ b/CriticalMapsKit/Tests/AppFeatureTests/AppFeatureCoreTests.swift @@ -200,6 +200,7 @@ final class AppFeatureTests: XCTestCase { $0.continuousClock = testClock $0.nextRideService.nextRide = { _, _, _ in [] } $0.userDefaultsClient.setString = { _, _ in } + $0.observationModeStore.setObservationModeState = { _ in } } ) store.exhaustivity = .off