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

Merge branch 'Crowdin' into crowdin_generated

Jon B Mårtensson 2 лет назад
Родитель
Сommit
98a884247a

+ 11 - 1
Core_Data.xcdatamodeld/Core_Data.xcdatamodel/contents

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="22158.8" systemVersion="22F66" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
+<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21754" systemVersion="22F82" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
     <entity name="BGaverages" representedClassName="BGaverages" syncable="YES" codeGenerationType="class">
         <attribute name="average" optional="YES" attributeType="Decimal" defaultValueString="0.0"/>
         <attribute name="average_1" optional="YES" attributeType="Decimal" defaultValueString="0.0"/>
@@ -19,6 +19,11 @@
         <attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
         <attribute name="enteredBy" optional="YES" attributeType="String"/>
     </entity>
+    <entity name="Fat" representedClassName="Fat" syncable="YES" codeGenerationType="class">
+        <attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="enteredBy" optional="YES" attributeType="String"/>
+        <attribute name="fat" optional="YES" attributeType="Decimal" defaultValueString="0.0"/>
+    </entity>
     <entity name="HbA1c" representedClassName="HbA1c" syncable="YES" codeGenerationType="class">
         <attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
         <attribute name="hba1c" optional="YES" attributeType="Decimal" defaultValueString="0.0"/>
@@ -89,6 +94,11 @@
         <attribute name="fat" optional="YES" attributeType="Decimal" defaultValueString="0.0"/>
         <attribute name="protein" optional="YES" attributeType="Decimal" defaultValueString="0.0"/>
     </entity>
+    <entity name="Protein" representedClassName="Protein" syncable="YES" codeGenerationType="class">
+        <attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="enteredBy" optional="YES" attributeType="String"/>
+        <attribute name="protein" optional="YES" attributeType="Decimal" defaultValueString="0.0"/>
+    </entity>
     <entity name="Readings" representedClassName="Readings" syncable="YES" codeGenerationType="class">
         <attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
         <attribute name="glucose" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
FreeAPS/Resources/javascript/bundle/determine-basal.js


+ 7 - 2
FreeAPS/Sources/APS/Extensions/PumpManagerExtensions.swift

@@ -19,13 +19,18 @@ extension PumpManagerUI {
 //        )
 //    }
 
-    func settingsViewController(bluetoothProvider: BluetoothProvider) -> UIViewController & CompletionNotifying {
-        settingsViewController(
+    func settingsViewController(
+        bluetoothProvider: BluetoothProvider,
+        pumpManagerOnboardingDelegate: PumpManagerOnboardingDelegate?
+    ) -> UIViewController & CompletionNotifying {
+        var vc = settingsViewController(
             bluetoothProvider: bluetoothProvider,
             colorPalette: .default,
             allowDebugFeatures: false,
             allowedInsulinTypes: [.apidra, .humalog, .novolog, .fiasp, .lyumjev]
         )
+        vc.pumpManagerOnboardingDelegate = pumpManagerOnboardingDelegate
+        return vc
     }
 
 //    func settingsViewController() -> UIViewController & CompletionNotifying {

+ 3 - 1
FreeAPS/Sources/APS/FetchAnnouncementsManager.swift

@@ -32,7 +32,9 @@ final class BaseFetchAnnouncementsManager: FetchAnnouncementsManager, Injectable
                 return self.nightscoutManager.fetchAnnouncements()
             }
             .sink { announcements in
-                guard let last = announcements.filter({ $0.createdAt > self.announcementsStorage.syncDate() }).last
+                guard let last = announcements.filter({ $0.createdAt > self.announcementsStorage.syncDate() })
+                    .sorted(by: { $0.createdAt < $1.createdAt })
+                    .last
                 else { return }
 
                 self.announcementsStorage.storeAnnouncements([last], enacted: false)

+ 1 - 1
FreeAPS/Sources/Localizations/Main/ca.lproj/Localizable.strings

@@ -1087,7 +1087,7 @@ Enact a temp Basal or a temp target */
 "For write data to Apple Health you must give permissions in Settings > Health > Data Access" = "For write data to Apple Health you must give permissions in Settings > Health > Data Access";
 
 /* */
-"After you create glucose records in the Health app, please open iAPS to help us guaranteed transfer changed data" = "After you create glucose records in the Health app, please open iAPS to help us guaranteed transfer changed data";
+"This allows iAPS to read from and write to Apple Heath. You must also give permissions in Settings > Health > Data Access. If you enter a glucose value into Apple Health, open iAPS to confirm it shows up." = "This allows iAPS to read from and write to Apple Heath. You must also give permissions in Settings > Health > Data Access. If you enter a glucose value into Apple Health, open iAPS to confirm it shows up.";
 
 /* New ALerts ------------------------- */
 /* Info title */

+ 1 - 1
FreeAPS/Sources/Localizations/Main/en.lproj/Localizable.strings

@@ -1090,7 +1090,7 @@ Enact a temp Basal or a temp target */
 "For write data to Apple Health you must give permissions in Settings > Health > Data Access" = "For write data to Apple Health you must give permissions in Settings > Health > Data Access";
 
 /* */
-"After you create glucose records in the Health app, please open iAPS to help us guaranteed transfer changed data" = "After you create glucose records in the Health app, please open iAPS to help us guaranteed transfer changed data";
+"This allows iAPS to read from and write to Apple Heath. You must also give permissions in Settings > Health > Data Access. If you enter a glucose value into Apple Health, open iAPS to confirm it shows up." = "This allows iAPS to read from and write to Apple Heath. You must also give permissions in Settings > Health > Data Access. If you enter a glucose value into Apple Health, open iAPS to confirm it shows up.";
 
  /* New ALerts ------------------------- */
  

+ 1 - 1
FreeAPS/Sources/Modules/HealthKit/View/AppleHealthKitRootView.swift

@@ -13,7 +13,7 @@ extension AppleHealthKit {
                     HStack {
                         Image(systemName: "pencil.circle.fill")
                         Text(
-                            "After you create glucose records in the Health app, please open iAPS to help us guaranteed transfer changed data"
+                            "This allows iAPS to read from and write to Apple Heath. You must also give permissions in Settings > Health > Data Access. If you enter a glucose value into Apple Health, open iAPS to confirm it shows up."
                         )
                         .font(.caption)
                     }

+ 19 - 1
FreeAPS/Sources/Modules/Home/HomeStateModel.swift

@@ -181,7 +181,8 @@ extension Home {
                         let view = PumpConfig.PumpSettingsView(
                             pumpManager: pumpManager,
                             bluetoothManager: bluetoothProvider,
-                            completionDelegate: self
+                            completionDelegate: self,
+                            setupDelegate: self
                         ).asAny()
                         self.router.mainSecondaryModalView.send(view)
                     } else {
@@ -457,3 +458,20 @@ extension Home.StateModel: CompletionDelegate {
         setupPump = false
     }
 }
+
+extension Home.StateModel: PumpManagerOnboardingDelegate {
+    func pumpManagerOnboarding(didCreatePumpManager pumpManager: PumpManagerUI) {
+        provider.apsManager.pumpManager = pumpManager
+        if let insulinType = pumpManager.status.insulinType {
+            settingsManager.updateInsulinCurve(insulinType)
+        }
+    }
+
+    func pumpManagerOnboarding(didOnboardPumpManager _: PumpManagerUI) {
+        // nothing to do
+    }
+
+    func pumpManagerOnboarding(didPauseOnboarding _: PumpManagerUI) {
+        // TODO:
+    }
+}

+ 0 - 1
FreeAPS/Sources/Modules/PumpConfig/PumpConfigStateModel.swift

@@ -61,7 +61,6 @@ extension PumpConfig.StateModel: PumpManagerOnboardingDelegate {
         if let insulinType = pumpManager.status.insulinType {
             settingsManager.updateInsulinCurve(insulinType)
         }
-        setupPump = false
     }
 
     func pumpManagerOnboarding(didOnboardPumpManager _: PumpManagerUI) {

+ 2 - 1
FreeAPS/Sources/Modules/PumpConfig/View/PumpConfigRootView.swift

@@ -39,7 +39,8 @@ extension PumpConfig {
                         PumpSettingsView(
                             pumpManager: pumpManager,
                             bluetoothManager: state.provider.apsManager.bluetoothManager!,
-                            completionDelegate: state
+                            completionDelegate: state,
+                            setupDelegate: state
                         )
                     } else {
                         PumpSetupView(

+ 5 - 1
FreeAPS/Sources/Modules/PumpConfig/View/PumpSettingsView.swift

@@ -7,9 +7,13 @@ extension PumpConfig {
         let pumpManager: PumpManagerUI
         let bluetoothManager: BluetoothStateManager
         weak var completionDelegate: CompletionDelegate?
+        weak var setupDelegate: PumpManagerOnboardingDelegate?
 
         func makeUIViewController(context _: UIViewControllerRepresentableContext<PumpSettingsView>) -> UIViewController {
-            var vc = pumpManager.settingsViewController(bluetoothProvider: bluetoothManager)
+            var vc = pumpManager.settingsViewController(
+                bluetoothProvider: bluetoothManager,
+                pumpManagerOnboardingDelegate: setupDelegate
+            )
             vc.completionDelegate = completionDelegate
             return vc
         }

+ 18 - 34
FreeAPS/Sources/Modules/Stat/View/ChartsView.swift

@@ -213,32 +213,23 @@ struct ChartsView: View {
                 let mapGlucoseAcuteLow = mapGlucose.filter({ $0 < Int16(3.3 / 0.0555) })
                 let mapGlucoseHigh = mapGlucose.filter({ $0 > Int16(11 / 0.0555) })
                 let mapGlucoseNormal = mapGlucose.filter({ $0 > Int16(3.8 / 0.0555) && $0 < Int16(7.9 / 0.0555) })
-
                 HStack {
                     let value = Double(mapGlucoseHigh.count * 100 / mapGlucose.count)
-                    if value != 0 {
-                        Text(units == .mmolL ? ">  11  " : ">  200 ").foregroundColor(.secondary)
-                        Text(value.formatted()).foregroundColor(.orange)
-                        Text("%").foregroundColor(.secondary)
-                    }
+                    Text(units == .mmolL ? ">  11  " : ">  200 ").foregroundColor(.secondary)
+                    Text(value.formatted()).foregroundColor(.orange)
+                    Text("%").foregroundColor(.secondary)
                 }.font(.caption)
-
                 HStack {
                     let value = Double(mapGlucoseNormal.count * 100 / mapGlucose.count)
-                    if value != 0 {
-                        Text(units == .mmolL ? "3.9-7.8" : "70-140").foregroundColor(.secondary)
-                        Text(value.formatted()).foregroundColor(.green)
-                        Text("%").foregroundColor(.secondary)
-                    }
+                    Text(units == .mmolL ? "3.9-7.8" : "70-140").foregroundColor(.secondary)
+                    Text(value.formatted()).foregroundColor(.green)
+                    Text("%").foregroundColor(.secondary)
                 }.font(.caption)
-
                 HStack {
                     let value = Double(mapGlucoseAcuteLow.count * 100 / mapGlucose.count)
-                    if value != 0 {
-                        Text(units == .mmolL ? "<  3.3 " : "<  59  ").foregroundColor(.secondary)
-                        Text(value.formatted()).foregroundColor(.red)
-                        Text("%").foregroundColor(.secondary)
-                    }
+                    Text(units == .mmolL ? "<  3.3 " : "<  59  ").foregroundColor(.secondary)
+                    Text(value.formatted()).foregroundColor(.red)
+                    Text("%").foregroundColor(.secondary)
                 }.font(.caption)
             }
         }
@@ -252,32 +243,25 @@ struct ChartsView: View {
                 let mapGlucoseLow = mapGlucose.filter({ $0 < Int16(3.3 / 0.0555) })
                 let mapGlucoseNormal = mapGlucose.filter({ $0 > Int16(3.8 / 0.0555) && $0 < Int16(7.9 / 0.0555) })
                 let mapGlucoseAcuteHigh = mapGlucose.filter({ $0 > Int16(11 / 0.0555) })
-
                 HStack {
                     let value = Double(mapGlucoseLow.count * 100 / mapGlucose.count)
-                    if value != 0 {
-                        Text(units == .mmolL ? "< 3.3" : "< 59").font(.caption2).foregroundColor(.secondary)
-                        Text(value.formatted()).font(.caption).foregroundColor(value == 0 ? .green : .red)
-                        Text("%").font(.caption)
-                    }
+                    Text(units == .mmolL ? "< 3.3" : "< 59").font(.caption2).foregroundColor(.secondary)
+                    Text(value.formatted()).font(.caption).foregroundColor(value == 0 ? .green : .red)
+                    Text("%").font(.caption)
                 }
                 Spacer()
                 HStack {
                     let value = Double(mapGlucoseNormal.count * 100 / mapGlucose.count)
-                    if value != 0 {
-                        Text(units == .mmolL ? "3.9-7.8" : "70-140").foregroundColor(.secondary)
-                        Text(value.formatted()).foregroundColor(.green)
-                        Text("%").foregroundColor(.secondary)
-                    }
+                    Text(units == .mmolL ? "3.9-7.8" : "70-140").foregroundColor(.secondary)
+                    Text(value.formatted()).foregroundColor(.green)
+                    Text("%").foregroundColor(.secondary)
                 }.font(.caption)
                 Spacer()
                 HStack {
                     let value = Double(mapGlucoseAcuteHigh.count * 100 / mapGlucose.count)
-                    if value != 0 {
-                        Text(units == .mmolL ? "> 11.0" : "> 216").font(.caption).foregroundColor(.secondary)
-                        Text(value.formatted()).font(.caption).foregroundColor(value == 0 ? .green : .orange)
-                        Text("%").font(.caption)
-                    }
+                    Text(units == .mmolL ? "> 11.0" : "> 216").font(.caption).foregroundColor(.secondary)
+                    Text(value.formatted()).font(.caption).foregroundColor(value == 0 ? .green : .orange)
+                    Text("%").font(.caption)
                 }
             }
         }

+ 2 - 2
FreeAPS/Sources/Services/HealthKit/HealthKitManager.swift

@@ -327,9 +327,9 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsObserver {
 
         let query = HKObserverQuery(sampleType: bgType, predicate: nil) { [weak self] _, _, observerError in
             guard let self = self else { return }
-            debug(.service, "Execute HelathKit observer query for loading increment samples")
+            debug(.service, "Execute HealthKit observer query for loading increment samples")
             guard observerError == nil else {
-                warning(.service, "Error during execution of HelathKit Observer's query", error: observerError!)
+                warning(.service, "Error during execution of HealthKit Observer's query", error: observerError!)
                 return
             }
 

+ 1 - 1
FreeAPS/Sources/Views/TagCloudView.swift

@@ -59,7 +59,7 @@ struct TagCloudView: View {
                 return .uam
             case textTag where textTag.contains("Bolus"):
                 return .green
-            case textTag where textTag.contains("Total insulin:"),
+            case textTag where textTag.contains("TDD:"),
                  textTag where textTag.contains("tdd_factor"),
                  textTag where textTag.contains("Sigmoid function"),
                  textTag where textTag.contains("Logarithmic formula"),

+ 4 - 3
README.md

@@ -20,14 +20,14 @@ Download and open in Xcode directly using the Code button: "Open with Xcode".
 
 ## To build directly in GitHub, without using Xcode: 
 
-Intructions:  
+Instructions:  
 https://github.com/Artificial-Pancreas/iAPS/blob/main/fastlane/testflight.md   
 Instructions in greater detail, but not iAPS-specific:  
 https://loopkit.github.io/loopdocs/gh-actions/gh-overview/
  
 ## Please understand that iAPS is:  
 - highly experimental and evolving rapidly.
-- not CE approved for therapy.
+- not CE or FDA approved for therapy.
 
 # Pumps
 
@@ -43,6 +43,7 @@ https://loopkit.github.io/loopdocs/gh-actions/gh-overview/
 
 - Dexcom G5  
 - Dexcom G6   
+- Dexcom ONE   
 - Dexcom G7   
 - Libre 1   
 - Libre 2 (European)   
@@ -55,7 +56,7 @@ iAPS app runs on iPhone or iPod. An iPhone 8 or newer is required.
 
 # Documentation
 
-[Discord iAPS - main branch channel](https://discord.com/channels/1020905149037813862/1021041588627062854)
+[Discord iAPS - Server ](https://discord.gg/pmQjr9RDC)
 
 [iAPS documentation (under development)](https://iaps.readthedocs.io/en/latest/)