Skip to content

Commit

Permalink
rename property
Browse files Browse the repository at this point in the history
  • Loading branch information
mltbnz committed Jun 6, 2023
1 parent 78265dd commit e965549
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CriticalMapsKit/Sources/AppFeature/AppFeatureCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public struct AppFeature: ReducerProtocol {
return .none

case let .setObservationMode(value):
state.settingsState.userSettings.enableObservationMode = value
state.settingsState.userSettings.isObservationModeEnabled = value

let userSettings = state.settingsState.userSettings
return .fireAndForget {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public struct SettingsFeature: ReducerProtocol {
}

case let .setObservationMode(value):
state.userSettings.enableObservationMode = value
state.userSettings.isObservationModeEnabled = value
return .none

case .binding:
Expand Down
6 changes: 3 additions & 3 deletions CriticalMapsKit/Sources/SettingsFeature/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public struct SettingsView: View {
SettingsRow {
observationModeRow
.accessibilityValue(
viewStore.userSettings.enableObservationMode
viewStore.userSettings.isObservationModeEnabled
? Text(L10n.A11y.General.on)
: Text(L10n.A11y.General.off)
)
.accessibilityAction {
viewStore.send(.setObservationMode(!viewStore.userSettings.enableObservationMode))
viewStore.send(.setObservationMode(!viewStore.userSettings.isObservationModeEnabled))
}
}

Expand Down Expand Up @@ -85,7 +85,7 @@ public struct SettingsView: View {
Spacer()
Toggle(
isOn: viewStore.binding(
get: { $0.userSettings.enableObservationMode },
get: { $0.userSettings.isObservationModeEnabled },
send: SettingsFeature.Action.setObservationMode
),
label: { EmptyView() }
Expand Down
6 changes: 3 additions & 3 deletions CriticalMapsKit/Sources/SharedModels/UserSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SwiftUI
/// A structure to store a users settings
public struct UserSettings: Codable, Equatable {
public var appearanceSettings: AppearanceSettings
public var enableObservationMode: Bool
public var isObservationModeEnabled: Bool
public var rideEventSettings: RideEventSettings

public init(
Expand All @@ -13,14 +13,14 @@ public struct UserSettings: Codable, Equatable {
rideEventSettings: RideEventSettings = .default
) {
self.appearanceSettings = appearanceSettings
self.enableObservationMode = enableObservationMode
self.isObservationModeEnabled = enableObservationMode
self.rideEventSettings = rideEventSettings
}

public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
appearanceSettings = (try? container.decode(AppearanceSettings.self, forKey: .appearanceSettings)) ?? .init(colorScheme: .system)
enableObservationMode = (try? container.decode(Bool.self, forKey: .enableObservationMode)) ?? false
isObservationModeEnabled = (try? container.decode(Bool.self, forKey: .isObservationModeEnabled)) ?? false
rideEventSettings = (try? container.decode(RideEventSettings.self, forKey: .rideEventSettings)) ?? .default
}
}

0 comments on commit e965549

Please sign in to comment.