Просмотр исходного кода

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

Deniz Cengiz 1 год назад
Родитель
Сommit
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." : {
     "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." : {
     "Setting this to 100% means only the past 24 hours will be used." : {
       "localizations" : {
       "localizations" : {
         "bg" : {
         "bg" : {

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

@@ -440,7 +440,14 @@ struct OnboardingNavigationButtons: View {
 
 
         case .smbSettings:
         case .smbSettings:
             if let previous = SMBSettingsSubstep(rawValue: currentSMBSubstep.rawValue - 1) {
             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 {
             } else if let previousStep = currentStep.previous {
                 currentStep = previousStep
                 currentStep = previousStep
                 currentSMBSubstep = .enableSMBAlways
                 currentSMBSubstep = .enableSMBAlways
@@ -503,7 +510,14 @@ struct OnboardingNavigationButtons: View {
 
 
         case .smbSettings:
         case .smbSettings:
             if let next = SMBSettingsSubstep(rawValue: currentSMBSubstep.rawValue + 1) {
             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 {
             } else if let nextStep = currentStep.next {
                 currentStep = nextStep
                 currentStep = nextStep
                 currentSMBSubstep = .enableSMBAlways
                 currentSMBSubstep = .enableSMBAlways

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

@@ -272,13 +272,6 @@ struct AlgorithmSettingsSubstepView<Substep: AlgorithmSubstepProtocol & RawRepre
             .padding()
             .padding()
             .background(Color.chart.opacity(0.65))
             .background(Color.chart.opacity(0.65))
             .cornerRadius(10)
             .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:
         case .enableSMBAlways:
             return VStack(alignment: .leading, spacing: 8) {
             return VStack(alignment: .leading, spacing: 8) {
                 Text(
                 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)
                 .padding(.bottom)
                 .foregroundStyle(Color.orange)
                 .foregroundStyle(Color.orange)