Explorar el Código

Skip redundant 'Enable SMB' options if 'Enable Always' is true; change note text

Deniz Cengiz hace 1 año
padre
commit
086cbd6897

+ 1 - 4
Trio/Sources/Localizations/Main/Localizable.xcstrings

@@ -84413,7 +84413,7 @@
         }
       }
     },
-    "Enabling SMB Always will disable other subsequent \"Enable SMB\" options during Onboarding." : {
+    "Enabling SMB Always will disable some of the subsequent \"Enable SMB\" options during Onboarding. These redundant options will be skipped." : {
 
     },
     "Enabling the UAM (Unannounced Meals) feature allows the system to detect and respond to unexpected rises in glucose readings caused by unannounced or miscalculated carbs, meals high in fat or protein, or other factors like adrenaline." : {
@@ -170711,9 +170711,6 @@
         }
       }
     },
-    "Setting cannot be changed for as long as \"Enable SMB Always\" is enabled." : {
-
-    },
     "Setting this to 100% means only the past 24 hours will be used." : {
       "localizations" : {
         "bg" : {

+ 16 - 2
Trio/Sources/Modules/Onboarding/View/OnboardingRootView.swift

@@ -440,7 +440,14 @@ struct OnboardingNavigationButtons: View {
 
         case .smbSettings:
             if let previous = SMBSettingsSubstep(rawValue: currentSMBSubstep.rawValue - 1) {
-                currentSMBSubstep = previous
+                /// If user has activated setting `.enableSMBAlways`, when navigating backwards
+                /// skip other redundant "Enable SMB"-settings and go straight to `enableSMBAlways`
+                /// from current substep `.allowSMBWithHighTempTarget`.
+                if state.enableSMBAlways, currentSMBSubstep == .allowSMBWithHighTempTarget {
+                    currentSMBSubstep = .enableSMBAlways
+                } else {
+                    currentSMBSubstep = previous
+                }
             } else if let previousStep = currentStep.previous {
                 currentStep = previousStep
                 currentSMBSubstep = .enableSMBAlways
@@ -503,7 +510,14 @@ struct OnboardingNavigationButtons: View {
 
         case .smbSettings:
             if let next = SMBSettingsSubstep(rawValue: currentSMBSubstep.rawValue + 1) {
-                currentSMBSubstep = next
+                /// If user has activated setting `.enableSMBAlways`, when navigating forward
+                /// skip other redundant "Enable SMB"-settings and go straight to `.allowSMBWithHighTempTarget`
+                /// from current substep `.enableSMBAlways`.
+                if state.enableSMBAlways, currentSMBSubstep == .enableSMBAlways {
+                    currentSMBSubstep = .allowSMBWithHighTempTarget
+                } else {
+                    currentSMBSubstep = next
+                }
             } else if let nextStep = currentStep.next {
                 currentStep = nextStep
                 currentSMBSubstep = .enableSMBAlways

+ 0 - 7
Trio/Sources/Modules/Onboarding/View/OnboardingSteps/AlgorithmSettings/AlgorithmSettingsSubstepView.swift

@@ -272,13 +272,6 @@ struct AlgorithmSettingsSubstepView<Substep: AlgorithmSubstepProtocol & RawRepre
             .padding()
             .background(Color.chart.opacity(0.65))
             .cornerRadius(10)
-
-            if disabled {
-                Text("Setting cannot be changed for as long as \"Enable SMB Always\" is enabled.")
-                    .font(.footnote)
-                    .foregroundColor(Color.orange)
-                    .padding()
-            }
         }
     }
 

+ 1 - 1
Trio/Sources/Modules/Onboarding/View/OnboardingView+AlgorithmUtil.swift

@@ -207,7 +207,7 @@ enum AlgorithmSettingsSubstep: Int, CaseIterable, Identifiable {
         case .enableSMBAlways:
             return VStack(alignment: .leading, spacing: 8) {
                 Text(
-                    "Enabling SMB Always will disable other subsequent \"Enable SMB\" options during Onboarding."
+                    "Enabling SMB Always will disable some of the subsequent \"Enable SMB\" options during Onboarding. These redundant options will be skipped."
                 )
                 .padding(.bottom)
                 .foregroundStyle(Color.orange)