|
|
@@ -80,7 +80,7 @@ extension Onboarding {
|
|
|
stepsWithSubsteps: [
|
|
|
.nightscout: NightscoutSubstep.allCases.count,
|
|
|
.deliveryLimits: DeliveryLimitSubstep.allCases.count,
|
|
|
- .autosensSettings: AutosensSettingsSubstep.allCases.count,
|
|
|
+ .autosensSettings: state.filteredAutosensSettingsSubsteps.count,
|
|
|
.smbSettings: SMBSettingsSubstep.allCases.count,
|
|
|
.targetBehavior: TargetBehaviorSubstep.allCases.count
|
|
|
],
|
|
|
@@ -431,18 +431,14 @@ struct OnboardingNavigationButtons: View {
|
|
|
}
|
|
|
|
|
|
case .autosensSettings:
|
|
|
- if let previous = AutosensSettingsSubstep(rawValue: currentAutosensSubstep.rawValue - 1) {
|
|
|
- currentAutosensSubstep = previous
|
|
|
+ let steps = state.filteredAutosensSettingsSubsteps
|
|
|
+ if let current = steps.firstIndex(of: currentAutosensSubstep),
|
|
|
+ current > 0
|
|
|
+ {
|
|
|
+ currentAutosensSubstep = steps[current - 1]
|
|
|
} else if let previousStep = currentStep.previous {
|
|
|
currentStep = previousStep
|
|
|
- currentAutosensSubstep = .autosensMin
|
|
|
-
|
|
|
- /// Skip Autosens substep `.rewindResetsAutosens` if pump model is not `.minimed`.
|
|
|
- if state.pumpOptionForOnboardingUnits == .minimed || state.pumpOptionForOnboardingUnits == .dana {
|
|
|
- currentAutosensSubstep = .rewindResetsAutosens
|
|
|
- } else {
|
|
|
- currentAutosensSubstep = .autosensMax
|
|
|
- }
|
|
|
+ currentAutosensSubstep = steps.first ?? .autosensMin
|
|
|
}
|
|
|
|
|
|
case .smbSettings:
|
|
|
@@ -458,6 +454,15 @@ struct OnboardingNavigationButtons: View {
|
|
|
} else if let previousStep = currentStep.previous {
|
|
|
currentStep = previousStep
|
|
|
currentSMBSubstep = .enableSMBAlways
|
|
|
+
|
|
|
+ switch state.pumpOptionForOnboardingUnits {
|
|
|
+ case .dana,
|
|
|
+ .minimed:
|
|
|
+ currentAutosensSubstep = .rewindResetsAutosens
|
|
|
+ case .omnipodDash,
|
|
|
+ .omnipodEros:
|
|
|
+ currentAutosensSubstep = .autosensMax
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
case .targetBehavior:
|
|
|
@@ -507,19 +512,14 @@ struct OnboardingNavigationButtons: View {
|
|
|
}
|
|
|
|
|
|
case .autosensSettings:
|
|
|
- if let next = AutosensSettingsSubstep(rawValue: currentAutosensSubstep.rawValue + 1) {
|
|
|
- /// Skip Autosens substep `.rewindResetsAutosens` if pump model is not `.minimed`.
|
|
|
- if currentAutosensSubstep == .autosensMax,
|
|
|
- state.pumpOptionForOnboardingUnits != .minimed || state.pumpOptionForOnboardingUnits != .dana,
|
|
|
- let nextMainStep = currentStep.next
|
|
|
- {
|
|
|
- currentStep = nextMainStep
|
|
|
- } else {
|
|
|
- currentAutosensSubstep = next
|
|
|
- }
|
|
|
+ let steps = state.filteredAutosensSettingsSubsteps
|
|
|
+ if let current = steps.firstIndex(of: currentAutosensSubstep),
|
|
|
+ current + 1 < steps.count
|
|
|
+ {
|
|
|
+ currentAutosensSubstep = steps[current + 1]
|
|
|
} else if let nextStep = currentStep.next {
|
|
|
currentStep = nextStep
|
|
|
- currentAutosensSubstep = .autosensMin
|
|
|
+ currentAutosensSubstep = steps.first ?? .autosensMin
|
|
|
}
|
|
|
|
|
|
case .smbSettings:
|