Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force reload from UserDefaults #2279

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Loop/Views/GlucoseBasedApplicationFactorSelectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ public struct GlucoseBasedApplicationFactorSelectionView: View {
}
}
.padding()
.onChange(of: isGlucoseBasedApplicationFactorEnabled) { newValue in
UserDefaults.standard.glucoseBasedApplicationFactorEnabled = newValue
}
}
.navigationBarTitleDisplayMode(.inline)
}
Expand Down
3 changes: 0 additions & 3 deletions Loop/Views/IntegralRetrospectiveCorrectionSelectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public struct IntegralRetrospectiveCorrectionSelectionView: View {
Divider()

Toggle(NSLocalizedString("Enable Integral Retrospective Correction", comment: "Title for Integral Retrospective Correction toggle"), isOn: $isIntegralRetrospectiveCorrectionEnabled)
.onChange(of: isIntegralRetrospectiveCorrectionEnabled) { newValue in
UserDefaults.standard.integralRetrospectiveCorrectionEnabled = newValue
}
.padding(.top, 20)
}
.padding()
Expand Down
6 changes: 3 additions & 3 deletions Loop/Views/SettingsView+algorithmExperimentsSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public struct ExperimentRow: View {
}

public struct ExperimentsSettingsView: View {
@State private var isGlucoseBasedApplicationFactorEnabled = UserDefaults.standard.glucoseBasedApplicationFactorEnabled
@State private var isIntegralRetrospectiveCorrectionEnabled = UserDefaults.standard.integralRetrospectiveCorrectionEnabled
@AppStorage(UserDefaults.Key.GlucoseBasedApplicationFactorEnabled.rawValue) private var isGlucoseBasedApplicationFactorEnabled = false
@AppStorage(UserDefaults.Key.IntegralRetrospectiveCorrectionEnabled.rawValue) private var isIntegralRetrospectiveCorrectionEnabled = false
var automaticDosingStrategy: AutomaticDosingStrategy

public var body: some View {
Expand Down Expand Up @@ -80,7 +80,7 @@ public struct ExperimentsSettingsView: View {


extension UserDefaults {
private enum Key: String {
fileprivate enum Key: String {
case GlucoseBasedApplicationFactorEnabled = "com.loopkit.algorithmExperiments.glucoseBasedApplicationFactorEnabled"
case IntegralRetrospectiveCorrectionEnabled = "com.loopkit.algorithmExperiments.integralRetrospectiveCorrectionEnabled"
}
Expand Down