Browse Source

Merge pull request #280 from nightscout/dev

Merge dev into alpha
bjornoleh 1 năm trước cách đây
mục cha
commit
8e9ced6beb
39 tập tin đã thay đổi với 711 bổ sung163 xóa
  1. 1 1
      FreeAPS/Resources/javascript/bundle/autosens.js
  2. 1 1
      FreeAPS/Resources/javascript/bundle/autotune-prep.js
  3. 1 1
      FreeAPS/Resources/javascript/bundle/iob.js
  4. 1 1
      FreeAPS/Resources/javascript/bundle/meal.js
  5. 1 1
      FreeAPS/Resources/javascript/bundle/profile.js
  6. 2 0
      FreeAPS/Resources/json/defaults/freeaps/freeaps_settings.json
  7. 1 1
      FreeAPS/Resources/json/defaults/preferences.json
  8. 27 6
      FreeAPS/Sources/Localizations/Main/ar.lproj/Localizable.strings
  9. 31 4
      FreeAPS/Sources/Localizations/Main/ca.lproj/Localizable.strings
  10. 27 6
      FreeAPS/Sources/Localizations/Main/da.lproj/Localizable.strings
  11. 27 6
      FreeAPS/Sources/Localizations/Main/de.lproj/Localizable.strings
  12. 27 6
      FreeAPS/Sources/Localizations/Main/en.lproj/Localizable.strings
  13. 27 6
      FreeAPS/Sources/Localizations/Main/es.lproj/Localizable.strings
  14. 27 6
      FreeAPS/Sources/Localizations/Main/fi.lproj/Localizable.strings
  15. 27 6
      FreeAPS/Sources/Localizations/Main/fr.lproj/Localizable.strings
  16. 27 6
      FreeAPS/Sources/Localizations/Main/he.lproj/Localizable.strings
  17. 27 6
      FreeAPS/Sources/Localizations/Main/hu.lproj/Localizable.strings
  18. 27 6
      FreeAPS/Sources/Localizations/Main/it.lproj/Localizable.strings
  19. 27 6
      FreeAPS/Sources/Localizations/Main/nb.lproj/Localizable.strings
  20. 27 6
      FreeAPS/Sources/Localizations/Main/nl.lproj/Localizable.strings
  21. 27 6
      FreeAPS/Sources/Localizations/Main/pl.lproj/Localizable.strings
  22. 27 6
      FreeAPS/Sources/Localizations/Main/pt-BR.lproj/Localizable.strings
  23. 27 6
      FreeAPS/Sources/Localizations/Main/pt-PT.lproj/Localizable.strings
  24. 27 6
      FreeAPS/Sources/Localizations/Main/ru.lproj/Localizable.strings
  25. 27 6
      FreeAPS/Sources/Localizations/Main/sk.lproj/Localizable.strings
  26. 27 6
      FreeAPS/Sources/Localizations/Main/sv.lproj/Localizable.strings
  27. 27 6
      FreeAPS/Sources/Localizations/Main/tr.lproj/Localizable.strings
  28. 27 6
      FreeAPS/Sources/Localizations/Main/uk.lproj/Localizable.strings
  29. 27 6
      FreeAPS/Sources/Localizations/Main/vi.lproj/Localizable.strings
  30. 27 6
      FreeAPS/Sources/Localizations/Main/zh-Hans.lproj/Localizable.strings
  31. 10 0
      FreeAPS/Sources/Models/FreeAPSSettings.swift
  32. 17 1
      FreeAPS/Sources/Modules/AddCarbs/AddCarbsStateModel.swift
  33. 17 7
      FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift
  34. 11 7
      FreeAPS/Sources/Modules/Bolus/View/BolusRootView.swift
  35. 4 0
      FreeAPS/Sources/Modules/FPUConfig/FPUConfigStateModel.swift
  36. 9 1
      FreeAPS/Sources/Modules/FPUConfig/View/FPUConfigRootView.swift
  37. 3 3
      FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorStateModel.swift
  38. 6 1
      oref0_source_version.txt
  39. 1 1
      trio-oref/lib/profile/index.js

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
FreeAPS/Resources/javascript/bundle/autosens.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
FreeAPS/Resources/javascript/bundle/autotune-prep.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
FreeAPS/Resources/javascript/bundle/iob.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
FreeAPS/Resources/javascript/bundle/meal.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
FreeAPS/Resources/javascript/bundle/profile.js


+ 2 - 0
FreeAPS/Resources/json/defaults/freeaps/freeaps_settings.json

@@ -41,6 +41,8 @@
   "oneDimensionalGraph" : false,
   "rulerMarks" : true,
   "maxCarbs": 250,
+  "maxFat": 250,
+  "maxProtein": 250,
   "displayFatAndProteinOnWatch": false,
   "confirmBolusFaster": false,
   "lockScreenView": "simple"

+ 1 - 1
FreeAPS/Resources/json/defaults/preferences.json

@@ -49,6 +49,6 @@
   "tddAdjBasal" : false,
   "enableSMB_high_bg" : false,
   "enableSMB_high_bg_target" : 110,
-  "threshold_setting" : 65,
+  "threshold_setting" : 60,
   "updateInterval" : 20
 }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/ar.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 31 - 4
FreeAPS/Sources/Localizations/Main/ca.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/da.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/de.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/en.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/es.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/fi.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/fr.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/he.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/hu.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/it.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/nb.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/nl.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/pl.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/pt-BR.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/pt-PT.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/ru.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/sk.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/sv.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/tr.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/uk.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/vi.lproj/Localizable.strings


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 6
FreeAPS/Sources/Localizations/Main/zh-Hans.lproj/Localizable.strings


+ 10 - 0
FreeAPS/Sources/Models/FreeAPSSettings.swift

@@ -42,6 +42,8 @@ struct FreeAPSSettings: JSON, Equatable {
     var oneDimensionalGraph: Bool = false
     var rulerMarks: Bool = true
     var maxCarbs: Decimal = 250
+    var maxFat: Decimal = 250
+    var maxProtein: Decimal = 250
     var displayFatAndProteinOnWatch: Bool = false
     var confirmBolusFaster: Bool = false
     var onlyAutotuneBasals: Bool = false
@@ -224,6 +226,14 @@ extension FreeAPSSettings: Decodable {
             settings.maxCarbs = maxCarbs
         }
 
+        if let maxFat = try? container.decode(Decimal.self, forKey: .maxFat) {
+            settings.maxFat = maxFat
+        }
+
+        if let maxProtein = try? container.decode(Decimal.self, forKey: .maxProtein) {
+            settings.maxProtein = maxProtein
+        }
+
         if let displayFatAndProteinOnWatch = try? container.decode(Bool.self, forKey: .displayFatAndProteinOnWatch) {
             settings.displayFatAndProteinOnWatch = displayFatAndProteinOnWatch
         }

+ 17 - 1
FreeAPS/Sources/Modules/AddCarbs/AddCarbsStateModel.swift

@@ -16,7 +16,9 @@ extension AddCarbs {
         @Published var dish: String = ""
         @Published var selection: Presets?
         @Published var summation: [String] = []
-        @Published var maxCarbs: Decimal = 0
+        @Published var maxCarbs: Decimal = 250
+        @Published var maxFat: Decimal = 250
+        @Published var maxProtein: Decimal = 250
         @Published var note: String = ""
 
         let coredataContext = CoreDataStack.shared.persistentContainer.viewContext
@@ -25,6 +27,8 @@ extension AddCarbs {
             subscribeSetting(\.useFPUconversion, on: $useFPUconversion) { useFPUconversion = $0 }
             carbsRequired = provider.suggestion?.carbsReq
             maxCarbs = settings.settings.maxCarbs
+            maxFat = settings.settings.maxFat
+            maxProtein = settings.settings.maxProtein
         }
 
         func add() {
@@ -160,5 +164,17 @@ extension AddCarbs {
             }
             return waitersNotepadString
         }
+
+        func saveButtonText() -> String {
+            if carbs > maxCarbs {
+                return "\(NSLocalizedString("Max Carbs of", comment: "")) \(maxCarbs) \(NSLocalizedString("g", comment: "")) \(NSLocalizedString("exceeded", comment: ""))"
+            } else if fat > maxFat {
+                return "\(NSLocalizedString("Max Fat of", comment: "")) \(maxFat) \(NSLocalizedString("g", comment: "")) \(NSLocalizedString("exceeded", comment: ""))"
+            } else if protein > maxProtein {
+                return "\(NSLocalizedString("Max Protein of", comment: "")) \(maxProtein) \(NSLocalizedString("g", comment: "")) \(NSLocalizedString("exceeded", comment: ""))"
+            } else {
+                return NSLocalizedString("Save and continue", comment: "")
+            }
+        }
     }
 }

+ 17 - 7
FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift

@@ -49,7 +49,7 @@ extension AddCarbs {
                             autofocus: true,
                             cleanInput: true
                         )
-                        Text("grams").foregroundColor(.secondary)
+                        Text(state.carbs > state.maxCarbs ? "⚠️" : "g").foregroundColor(.secondary)
                     }.padding(.vertical)
 
                     if state.useFPUconversion {
@@ -122,8 +122,19 @@ extension AddCarbs {
                         mealSaved = true
                         state.add()
                     }
-                    label: { Text("Save and continue").font(.title3) }
-                        .disabled(mealSaved || state.carbs <= 0 && state.fat <= 0 && state.protein <= 0)
+                    label: { Text(state.saveButtonText()).font(.title3) }
+                        .disabled(
+                            mealSaved
+                                || state.carbs > state.maxCarbs
+                                || state.fat > state.maxFat
+                                || state.protein > state.maxProtein
+                                || (state.carbs <= 0 && state.fat <= 0 && state.protein <= 0)
+                        )
+                        .foregroundStyle(
+                            mealSaved || (state.carbs <= 0 && state.fat <= 0 && state.protein <= 0) ? .gray :
+                                state.carbs > state.maxCarbs || state.fat > state.maxFat || state.protein > state
+                                .maxProtein ? .red : .blue
+                        )
                         .frame(maxWidth: .infinity, alignment: .center)
                 } footer: { Text(state.waitersNotepad().description) }
 
@@ -264,7 +275,7 @@ extension AddCarbs {
                     autofocus: false,
                     cleanInput: true
                 )
-                Text("grams").foregroundColor(.secondary)
+                Text(state.fat > state.maxFat ? "⚠️" : "g").foregroundColor(.secondary)
             }
             HStack {
                 Text("Protein").foregroundColor(.red) // .fontWeight(.thin)
@@ -275,9 +286,8 @@ extension AddCarbs {
                     formatter: formatter,
                     autofocus: false,
                     cleanInput: true
-                ).foregroundColor(.loopRed)
-
-                Text("grams").foregroundColor(.secondary)
+                )
+                Text(state.protein > state.maxProtein ? "⚠️" : "g").foregroundColor(.secondary)
             }
         }
     }

+ 11 - 7
FreeAPS/Sources/Modules/Bolus/View/BolusRootView.swift

@@ -72,7 +72,7 @@ extension Bolus {
                                 autofocus: true,
                                 cleanInput: true
                             )
-                            Text("U").foregroundColor(.secondary)
+                            Text(state.amount > state.maxBolus ? "⚠️" : "U").foregroundColor(.secondary)
                         }
                     }
                     header: { Text("Bolus") }
@@ -81,15 +81,19 @@ extension Bolus {
                         label: {
                             Text(
                                 state.amount <= state.maxBolus ? NSLocalizedString("Enact bolus", comment: "") :
-                                    NSLocalizedString("Max Bolus exceeded!", comment: "")
-                                    + " (>"
+                                    NSLocalizedString("Max Bolus of", comment: "")
+                                    + " "
                                     + formatter.string(from: state.maxBolus as NSNumber)!
                                     + NSLocalizedString("U", comment: "Insulin unit")
-                                    + ")"
-                            ) }
-                            .disabled(
-                                state.amount <= 0 || state.amount > state.maxBolus
+                                    + " "
+                                    + NSLocalizedString("exceeded", comment: "")
+                            ).font(.title3) }
+                            .disabled(state.amount <= 0 || state.amount > state.maxBolus)
+                            .foregroundStyle(
+                                state.amount <= 0 ? .gray :
+                                    state.amount > state.maxBolus ? .red : .blue
                             )
+                            .frame(maxWidth: .infinity, alignment: .center)
                     }
                     if waitForSuggestion {
                         Section {

+ 4 - 0
FreeAPS/Sources/Modules/FPUConfig/FPUConfigStateModel.swift

@@ -3,6 +3,8 @@ import SwiftUI
 extension FPUConfig {
     final class StateModel: BaseStateModel<Provider> {
         @Published var maxCarbs: Decimal = 250
+        @Published var maxFat: Decimal = 250
+        @Published var maxProtein: Decimal = 250
         @Published var individualAdjustmentFactor: Decimal = 0
         @Published var timeCap: Decimal = 0
         @Published var minuteInterval: Decimal = 0
@@ -10,6 +12,8 @@ extension FPUConfig {
 
         override func subscribe() {
             subscribeSetting(\.maxCarbs, on: $maxCarbs) { maxCarbs = $0 }
+            subscribeSetting(\.maxFat, on: $maxFat) { maxFat = $0 }
+            subscribeSetting(\.maxProtein, on: $maxProtein) { maxProtein = $0 }
             subscribeSetting(\.timeCap, on: $timeCap.map(Int.init), initial: {
                 let value = max(min($0, 12), 5)
                 timeCap = Decimal(value)

+ 9 - 1
FreeAPS/Sources/Modules/FPUConfig/View/FPUConfigRootView.swift

@@ -28,11 +28,19 @@ extension FPUConfig {
 
         var body: some View {
             Form {
-                Section(header: Text("Carbohydrate limit")) {
+                Section(header: Text("Limit Per Entry")) {
                     HStack {
                         Text("Max Carbs")
                         DecimalTextField("g", value: $state.maxCarbs, formatter: formatter)
                     }
+                    HStack {
+                        Text("Max Fat")
+                        DecimalTextField("g", value: $state.maxFat, formatter: formatter)
+                    }
+                    HStack {
+                        Text("Max Protein")
+                        DecimalTextField("g", value: $state.maxProtein, formatter: formatter)
+                    }
                 }
 
                 Section(header: Text("Fat and Protein Conversion Settings")) {

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 3 - 3
FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorStateModel.swift


+ 6 - 1
oref0_source_version.txt

@@ -1,6 +1,11 @@
-oref0 branch: dev - git version: e023125
+oref0 branch: dev - git version: d1dfb70
 
 Last commits:
+d1dfb70 Merge pull request #26 from MikePlante1/typo
+d9f1662 fix `threshold_setting` typo
+b454837 Merge pull request #24 from nightscout/Trio_renames
+5319e39 update Discord url
+5b7affa Github issue templates and config.yml: rename from Open-iAPS to Trio
 e023125 Replace Open-iAPS with Trio (#23)
 fa373c9 Merge pull request #22 from nightscout/tmhastings-tddAdjBasal
 fc0ae69 tddAdjBasal pop-up correction

+ 1 - 1
trio-oref/lib/profile/index.js

@@ -77,7 +77,7 @@ function defaults ( ) {
     , tddAdjBasal: false // Enable adjustment of basal based on the ratio of 24 h : 10 day average TDD
     , enableSMB_high_bg: false // enable SMBs when a high BG is detected, based on the high BG target (adjusted or profile)
     , enableSMB_high_bg_target: 110 // set the value enableSMB_high_bg will compare against to enable SMB. If BG > than this value, SMBs should enable.
-    , threshold_setting: 0.60 // Use a configurable threshold setting
+    , threshold_setting: 60 // Use a configurable threshold setting
   }
 }