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

Merge branch 'dev' of https://github.com/nightscout/Trio-dev into currentTDDForOref

polscm32 1 год назад
Родитель
Сommit
f08b2c2053

+ 11 - 0
Trio Watch App Extension/Views/AcknowledgementPendingView.swift

@@ -43,6 +43,17 @@ struct AcknowledgementPendingView: View {
         .navigationBarBackButtonHidden(true)
         .toolbar(.hidden)
         .background(trioBackgroundColor)
+        .onChange(of: state.showCommsAnimation) { oldValue, newValue in
+            if newValue && !oldValue {
+                DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
+                    // If after 5 seconds there is still no acknowledgement banner, return to root
+                    if !state.showAcknowledgmentBanner {
+                        // Navigate back to the root
+                        navigationPath.removeLast(navigationPath.count)
+                    }
+                }
+            }
+        }
         .onChange(of: state.showAcknowledgmentBanner) { _, newValue in
             if !newValue {
                 // Navigate back to the root when acknowledgment banner disappears

+ 3 - 5
Trio Watch App Extension/WatchState.swift

@@ -110,15 +110,13 @@ import WatchConnectivity
             acknowledgmentMessage = "\(message)"
         } else {
             print("⌚️ Acknowledgment failed: \(message)")
+            DispatchQueue.main.async {
+                self.showCommsAnimation = false // Hide progress animation
+            }
             acknowledgementStatus = .failure
             acknowledgmentMessage = "\(message)"
         }
 
-        DispatchQueue.main.async {
-            self.showCommsAnimation = false // Hide progress animation
-            self.showSyncingAnimation = false // Just ensure this is 100% set to false
-        }
-
         if isFinal {
             showAcknowledgmentBanner = true
             DispatchQueue.main.asyncAfter(deadline: .now() + 2) {

+ 6 - 1
Trio/Sources/APS/OpenAPS/OpenAPS.swift

@@ -751,7 +751,12 @@ final class OpenAPS {
         }
 
         if let url = Foundation.Bundle.main.url(forResource: "javascript/\(name)", withExtension: "") {
-            return Script(name: name, body: try! String(contentsOf: url))
+            do {
+                let body = try String(contentsOf: url)
+                return Script(name: name, body: body)
+            } catch {
+                debug(.openAPS, "Failed to load script \(name): \(error)")
+            }
         }
 
         return nil

+ 1 - 0
Trio/Sources/Modules/AlgorithmAdvancedSettings/AlgorithmAdvancedSettingsStateModel.swift

@@ -36,6 +36,7 @@ extension AlgorithmAdvancedSettings {
                 currentBasalSafetyMultiplier = $0 }
             subscribePreferencesSetting(\.useCustomPeakTime, on: $useCustomPeakTime) { useCustomPeakTime = $0 }
             subscribePreferencesSetting(\.insulinPeakTime, on: $insulinPeakTime) { insulinPeakTime = $0 }
+            subscribePreferencesSetting(\.skipNeutralTemps, on: $skipNeutralTemps) { skipNeutralTemps = $0 }
             subscribePreferencesSetting(\.unsuspendIfNoTemp, on: $unsuspendIfNoTemp) { unsuspendIfNoTemp = $0 }
             subscribePreferencesSetting(\.suspendZerosIOB, on: $suspendZerosIOB) { suspendZerosIOB = $0 }
             subscribePreferencesSetting(\.suspendZerosIOB, on: $suspendZerosIOB) { suspendZerosIOB = $0 }