فهرست منبع

Merge branch 'dev' into Crowdin

Jon B.M 3 سال پیش
والد
کامیت
458a398307

+ 2 - 2
Config.xcconfig

@@ -1,5 +1,5 @@
-APP_DISPLAY_NAME = FreeAPS X
-APP_VERSION = 1.1.0
+APP_DISPLAY_NAME = iAPS
+APP_VERSION = 1.1.2
 APP_BUILD_NUMBER = 1
 COPYRIGHT_NOTICE =
 DEVELOPER_TEAM = ##TEAM_ID##

+ 4 - 4
Dependencies/LoopKit/LoopKitUI/Views/Settings Editors/TherapySettingsView.swift

@@ -236,8 +236,8 @@ extension TherapySettingsView {
     
     private var preMealCorrectionRangeSection: Card {
         card(for: .preMealCorrectionRangeOverride) {
-            if let correctionRangeOverrides = self.viewModel.correctionRangeOverrides,
-               let schedule = self.viewModel.glucoseTargetRangeSchedule
+            let correctionRangeOverrides = self.viewModel.correctionRangeOverrides
+            if let schedule = self.viewModel.glucoseTargetRangeSchedule
             {
                 SectionDivider()
                 CorrectionRangeOverridesRangeItem(
@@ -253,8 +253,8 @@ extension TherapySettingsView {
     
     private var workoutCorrectionRangeSection: Card {
         card(for: .workoutCorrectionRangeOverride) {
-            if let correctionRangeOverrides = self.viewModel.correctionRangeOverrides,
-               let schedule = self.viewModel.glucoseTargetRangeSchedule
+            let correctionRangeOverrides = self.viewModel.correctionRangeOverrides
+            if let schedule = self.viewModel.glucoseTargetRangeSchedule
             {
                 SectionDivider()
                 CorrectionRangeOverridesRangeItem(

+ 38 - 0
FreeAPS/Resources/Assets.xcassets/Colors/minus.colorset/Contents.json

@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0.976",
+          "green" : "0.839",
+          "red" : "0.635"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0.976",
+          "green" : "0.839",
+          "red" : "0.635"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 1
FreeAPS/Resources/javascript/bundle/determine-basal.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 1
FreeAPS/Resources/javascript/bundle/profile.js


+ 1 - 0
FreeAPS/Sources/Helpers/Color+Extensions.swift

@@ -61,4 +61,5 @@ extension Color {
     static let darkerBlue = Color("DarkerBlue")
     static let loopPink = Color("LoopPink")
     static let lemon = Color("Lemon")
+    static let minus = Color("minus")
 }

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

@@ -1373,6 +1373,7 @@ Enact a temp Basal or a temp target */
 
 /* New Experimental feature */
 "Experimental" = "Experimental";
+
 /* Smoothing of CGM readings */
 "Smooth Glucose Value" = "Smooth Glucose Value";
 

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

@@ -112,6 +112,21 @@
 /*  */
 "Enact Temp Target" = "Enact Temp Target";
 
+/* */
+"Target" = "Target";
+
+/* */
+"Basal Insulin and Sensitivity ratio" = "Basal Insulin and Sensitivity ratio";
+
+/* */
+"A lower 'Half Basal Target' setting will reduce the basal and raise the ISF earlier, at a lower target glucose." = "A lower 'Half Basal Target' setting will reduce the basal and raise the ISF earlier, at a lower target glucose.";
+
+/* */
+" Your setting: " = " Your setting: ";
+
+/* */
+"mg/dl. Autosens.max limits the max endpoint" = "mg/dl. Autosens.max limits the max endpoint";
+
 /*  */
 "Enter preset name" = "Enter preset name";
 
@@ -130,6 +145,24 @@
 /*  */
 "Save as preset" = "Save as preset";
 
+/* Delete Meal Preset */
+"Delete Preset" = "Delete Preset";
+
+/* Confirm Deletion */
+"Delete preset '%@'?" = "Delete preset '%@'?";
+
+/* Button */
+"No" = "No";
+
+/* Button */
+"Yes" = "Yes";
+
+/* + Button */
+"[ +1 ]" = "[ +1 ]";
+
+/* - Button */
+"[ -1 ]" = "[ -1 ]";
+
 /* Upper temp target limit */
 "Top target" = "Top target";
 

+ 36 - 0
FreeAPS/Sources/Localizations/Main/sv.lproj/Localizable.strings

@@ -112,6 +112,24 @@
 /*  */
 "Enact Temp Target" = "Tillfälliga målvärden";
 
+/* */
+"Target" = "Målvärde";
+
+/* */
+"Basal Insulin and Sensitivity ratio" = "Basalinsulin och insulinkänslighetskvot";
+
+/* */
+"A lower 'Half Basal Target' setting will reduce the basal and raise the ISF earlier, at a lower target glucose." = "En lägre inställning för 'Halva basaldosen vid Motionsläge' kommer leda till en sänkning av basalinsulin och ett ökad insulinkänslighet tidigare, vid ett lägre målvärde.";
+
+/* */
+" Your setting: " = " Nuvarande inställning: ";
+
+/* */
+"mg/dl. Autosens.max limits the max endpoint" = "mg/dl. Autosens.max begränsar maxvärdet";
+
+/* */
+"Target" = "Målvärde";
+
 /*  */
 "Enter preset name" = "Ange namn för förval";
 
@@ -130,6 +148,24 @@
 /*  */
 "Save as preset" = "Spara som förval";
 
+/* Delete Meal Preset */
+"Delete Preset" = "Radera Förval";
+
+/* Confirm Deletion */
+"Delete preset '%@'?" = "Radera förval '%@'?";
+
+/* Button */
+"No" = "Nej";
+
+/* Button */
+"Yes" = "Ja";
+
+/* + Button */
+"[ +1 ]" = "[ +1 ]";
+
+/* - Button */
+"[ -1 ]" = "[ -1 ]";
+
 /* Upper temp target limit */
 "Top target" = "Övre målvärde";
 

+ 2 - 4
FreeAPS/Sources/Models/Preferences.swift

@@ -8,8 +8,8 @@ struct Preferences: JSON {
     var autosensMin: Decimal = 0.7
     var smbDeliveryRatio: Decimal = 0.5
     var rewindResetsAutosens: Bool = true
-    var highTemptargetRaisesSensitivity: Bool = false
-    var lowTemptargetLowersSensitivity: Bool = false
+    var highTemptargetRaisesSensitivity: Bool = true
+    var lowTemptargetLowersSensitivity: Bool = true
     var sensitivityRaisesTarget: Bool = true
     var resistanceLowersTarget: Bool = false
     var advTargetAdjustments: Bool = false
@@ -19,7 +19,6 @@ struct Preferences: JSON {
     var wideBGTargetRange: Bool = false
     var skipNeutralTemps: Bool = false
     var unsuspendIfNoTemp: Bool = false
-    var bolusSnoozeDIADivisor: Decimal = 2
     var min5mCarbimpact: Decimal = 8
     var autotuneISFAdjustmentFraction: Decimal = 1.0
     var remainingCarbsFraction: Decimal = 1.0
@@ -80,7 +79,6 @@ extension Preferences {
         case wideBGTargetRange = "wide_bg_target_range"
         case skipNeutralTemps = "skip_neutral_temps"
         case unsuspendIfNoTemp = "unsuspend_if_no_temp"
-        case bolusSnoozeDIADivisor = "bolussnooze_dia_divisor"
         case min5mCarbimpact = "min_5m_carbimpact"
         case autotuneISFAdjustmentFraction = "autotune_isf_adjustmentFraction"
         case remainingCarbsFraction

+ 40 - 4
FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift

@@ -9,6 +9,7 @@ extension AddCarbs {
         @State var dish: String = ""
         @State var isPromtPresented = false
         @State var saved = false
+        @State private var showAlert = false
 
         @FetchRequest(
             entity: Presets.entity(),
@@ -106,12 +107,47 @@ extension AddCarbs {
                         state.protein = ((state.selection?.protein ?? 0) as NSDecimalNumber) as Decimal
                     }
                 }
-                Button {
-                    state.deletePreset()
-                }
-                label: { Text("Delete Selected Preset") }
+                HStack {
+                    Button("Delete Preset") {
+                        showAlert.toggle()
+                    }
                     .disabled(state.selection == nil)
                     .accentColor(.orange)
+                    .buttonStyle(BorderlessButtonStyle())
+                    .alert(
+                        "Delete preset '\(state.selection?.dish ?? "")'?",
+                        isPresented: $showAlert,
+                        actions: {
+                            Button("No", role: .cancel) {}
+                            Button("Yes", role: .destructive) {
+                                state.deletePreset()
+                            }
+                        }
+                    )
+                    Button {
+                        if state.carbs != 0 { state.carbs -= ((state.selection?.carbs ?? 0) as NSDecimalNumber) as Decimal }
+                        if state.fat != 0 { state.fat -= ((state.selection?.fat ?? 0) as NSDecimalNumber) as Decimal }
+                        if state.protein != 0 { state.protein -= ((state.selection?.protein ?? 0) as NSDecimalNumber) as Decimal }
+                    }
+                    label: { Text("[ -1 ]") }
+                        .disabled(state.selection == nil || (
+                            (((state.selection?.carbs ?? 0) as NSDecimalNumber) as Decimal) == state
+                                .carbs && (((state.selection?.fat ?? 0) as NSDecimalNumber) as Decimal) == state
+                                .fat && (((state.selection?.protein ?? 0) as NSDecimalNumber) as Decimal) == state
+                                .protein
+                        ))
+                        .buttonStyle(BorderlessButtonStyle())
+                        .frame(maxWidth: .infinity, alignment: .trailing)
+                        .accentColor(.minus)
+                    Button {
+                        state.carbs += ((state.selection?.carbs ?? 0) as NSDecimalNumber) as Decimal
+                        state.fat += ((state.selection?.fat ?? 0) as NSDecimalNumber) as Decimal
+                        state.protein += ((state.selection?.protein ?? 0) as NSDecimalNumber) as Decimal }
+                    label: { Text("[ +1 ]") }
+                        .disabled(state.selection == nil)
+                        .buttonStyle(BorderlessButtonStyle())
+                        .accentColor(.blue)
+                }
             }
         }
 

+ 11 - 18
FreeAPS/Sources/Modules/AddTempTarget/AddTempTargetStateModel.swift

@@ -11,24 +11,24 @@ extension AddTempTarget {
         @Published var date = Date()
         @Published var newPresetName = ""
         @Published var presets: [TempTarget] = []
+        @Published var percentage = 100.0
+        @Published var maxValue: Decimal = 1.2
+        @Published var halfBasal: Decimal = 160
 
         private(set) var units: GlucoseUnits = .mmolL
 
         override func subscribe() {
             units = settingsManager.settings.units
             presets = storage.presets()
+            maxValue = settingsManager.preferences.autosensMax
+            halfBasal = settingsManager.preferences.halfBasalExerciseTarget
         }
 
         func enact() {
-            var lowTarget = low
-            var highTarget = high
-
-            highTarget = max(highTarget, lowTarget)
-
-            if units == .mmolL {
-                lowTarget = lowTarget.asMgdL
-                highTarget = highTarget.asMgdL
-            }
+            let diff = Double(halfBasal - 100)
+            let multiplier = percentage - (diff * (percentage / 100))
+            let lowTarget = Decimal(diff + multiplier) / (Decimal(percentage) / 100)
+            let highTarget = lowTarget
 
             let entry = TempTarget(
                 name: TempTarget.custom,
@@ -50,15 +50,8 @@ extension AddTempTarget {
         }
 
         func save() {
-            var lowTarget = low
-            var highTarget = high
-
-            highTarget = max(highTarget, lowTarget)
-
-            if units == .mmolL {
-                lowTarget = lowTarget.asMgdL
-                highTarget = highTarget.asMgdL
-            }
+            let lowTarget = Decimal(60 + 40 * (percentage / 100)) / (Decimal(percentage) / 100)
+            let highTarget = lowTarget
 
             let entry = TempTarget(
                 name: newPresetName.isEmpty ? TempTarget.custom : newPresetName,

+ 50 - 12
FreeAPS/Sources/Modules/AddTempTarget/View/AddTempTargetRootView.swift

@@ -8,6 +8,7 @@ extension AddTempTarget {
         @State private var isPromtPresented = false
         @State private var isRemoveAlertPresented = false
         @State private var removeAlert: Alert?
+        @State private var isEditing = false
 
         private var formatter: NumberFormatter {
             let formatter = NumberFormatter()
@@ -26,19 +27,44 @@ extension AddTempTarget {
                     }
                 }
 
-                Section(header: Text("Custom")) {
-                    HStack {
-                        Text("Bottom target")
-                        Spacer()
-                        DecimalTextField("0", value: $state.low, formatter: formatter, cleanInput: true)
-                        Text(state.units.rawValue).foregroundColor(.secondary)
-                    }
-                    HStack {
-                        Text("Top target")
-                        Spacer()
-                        DecimalTextField("0", value: $state.high, formatter: formatter, cleanInput: true)
-                        Text(state.units.rawValue).foregroundColor(.secondary)
+                Section(
+                    header: Text("Basal Insulin and Sensitivity ratio"),
+                    footer: Text(
+                        NSLocalizedString(
+                            "A lower 'Half Basal Target' setting will reduce the basal and raise the ISF earlier, at a lower target glucose.",
+                            comment: ""
+                        ) +
+                            NSLocalizedString(" Your setting: ", comment: "") + "\(state.halfBasal) " +
+                            NSLocalizedString("mg/dl. Autosens.max limits the max endpoint", comment: "") +
+                            " (\(state.maxValue * 100) %)"
+                    )
+                ) {
+                    VStack {
+                        Slider(
+                            value: $state.percentage,
+                            in: 15 ...
+                                Double(state.maxValue * 100),
+                            step: 1,
+                            onEditingChanged: { editing in
+                                isEditing = editing
+                            }
+                        )
+                        Text("\(state.percentage.formatted(.number)) %")
+                            .foregroundColor(isEditing ? .orange : .blue)
+                            .font(.largeTitle)
+                        Divider()
+                        Text(
+                            NSLocalizedString("Target", comment: "") +
+                                (
+                                    state
+                                        .units == .mmolL ? ": \(computeTarget().asMmolL.formatted(.number)) mmol/L" :
+                                        ": \(computeTarget().formatted(.number)) mg/dl"
+                                )
+                        ).foregroundColor(.secondary).italic()
                     }
+                }
+
+                Section {
                     HStack {
                         Text("Duration")
                         Spacer()
@@ -77,6 +103,18 @@ extension AddTempTarget {
             .navigationBarItems(leading: Button("Close", action: state.hideModal))
         }
 
+        func computeTarget() -> Decimal {
+            let ratio = min(Decimal(state.percentage / 100), state.maxValue)
+            let diff = Double(state.halfBasal - 100)
+            let multiplier = state.percentage - (diff * (state.percentage / 100))
+            var target = Decimal(diff + multiplier) / ratio
+
+            if (state.halfBasal + (state.halfBasal + target - 100)) <= 0 {
+                target = (state.halfBasal - 100 + (state.halfBasal - 100) * state.maxValue) / state.maxValue
+            }
+            return target
+        }
+
         private func presetView(for preset: TempTarget) -> some View {
             var low = preset.targetBottom
             var high = preset.targetTop

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 61
FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorStateModel.swift


+ 33 - 8
README.md

@@ -6,14 +6,14 @@ iAPS - an artificial pancreas system for iOS based on [OpenAPS Reference](https:
 
 Thousands of commits later, with many new and unique features added, the iOS app has been renamed to iAPS under a new organisation, Artificial Pancreas. 
 
-To download this repo: 
+iAPS uses lot of frameworks published by the Loop community. 
 
-In Terminal:
-git clone --branch=main https://github.com/artificial-pancreas/iaps.git
+## To download this repo: 
 
-cd iaps
-
-xed .
+In Terminal:  
+git clone --branch=main https://github.com/artificial-pancreas/iaps.git  
+cd iaps  
+xed .  
 
 Or use the GitHub interface: 
 Download and open in Xcode directly using the Code button: "Open with Xcode".
@@ -23,6 +23,29 @@ Please understand that this version is:
 - highly experimental and evolving rapidly.
 - not CE approved for therapy yet
 
+# Pumps
+
+- Omnipod EROS  
+- Omnipod DASH  
+- Medtronic 515 or 715 (any firmware)  
+- Medtronic 522 or 722 (any firmware)  
+- Medtronic 523 or 723 (firmware 2.4 or lower)  
+- Medtronic Worldwide Veo 554 or 754 (firmware 2.6A or lower)  
+- Medtronic Canadian/Australian Veo 554 or 754 (firmware 2.7A or lower)   
+
+# CGM Sensors
+
+- Dexcom G5  
+- Dexcom G6   
+- Dexcom G7   
+- Libre 1   
+- Libre 2 (European)   
+- Medtronic Enlite
+- Nightscout as CGM
+
+# iPhone and iPod
+
+iAPS app runs on iPhone or iPod. An iPhone 7 or newer is recommended.
 
 # Documentation
 
@@ -40,10 +63,12 @@ Please understand that this version is:
 
 [OpenAPS documentation](https://openaps.readthedocs.io/en/latest/)
 
+[iAPS documentation (under development)](https://iaps-documentation.readthedocs.io/en/main/)
+
 # Contribute
 
 Code contributions as PRs are welcome!
 
-Translators can click the Crowdin link above. 
+Translators can click the Crowdin link above  
 
-Code is open for everyone. For questions or contributions: jon.m@live.se
+For questions or contributions: jon.m@live.se