Bläddra i källkod

Merge branch 'dev' into alpha

Jon B.M 2 år sedan
förälder
incheckning
7d9aca9c19
45 ändrade filer med 1173 tillägg och 276 borttagningar
  1. 2 2
      Dependencies/OmniBLE/Localizations/da.lproj/Localizable.strings
  2. 33 1
      FreeAPS.xcodeproj/project.pbxproj
  3. 1 1
      FreeAPS/Sources/APS/CGM/LibreTransmitterSource.swift
  4. 39 0
      FreeAPS/Sources/Localizations/Main/ar.lproj/Localizable.strings
  5. 39 0
      FreeAPS/Sources/Localizations/Main/da.lproj/Localizable.strings
  6. 36 0
      FreeAPS/Sources/Localizations/Main/de.lproj/Localizable.strings
  7. 3 0
      FreeAPS/Sources/Localizations/Main/en.lproj/Localizable.strings
  8. 39 0
      FreeAPS/Sources/Localizations/Main/es.lproj/Localizable.strings
  9. 39 0
      FreeAPS/Sources/Localizations/Main/fi.lproj/Localizable.strings
  10. 39 0
      FreeAPS/Sources/Localizations/Main/fr.lproj/Localizable.strings
  11. 39 0
      FreeAPS/Sources/Localizations/Main/he.lproj/Localizable.strings
  12. 39 0
      FreeAPS/Sources/Localizations/Main/it.lproj/Localizable.strings
  13. 39 0
      FreeAPS/Sources/Localizations/Main/nb.lproj/Localizable.strings
  14. 39 0
      FreeAPS/Sources/Localizations/Main/nl.lproj/Localizable.strings
  15. 39 0
      FreeAPS/Sources/Localizations/Main/pl.lproj/Localizable.strings
  16. 39 0
      FreeAPS/Sources/Localizations/Main/pt-BR.lproj/Localizable.strings
  17. 39 0
      FreeAPS/Sources/Localizations/Main/pt-PT.lproj/Localizable.strings
  18. 39 0
      FreeAPS/Sources/Localizations/Main/ru.lproj/Localizable.strings
  19. 39 0
      FreeAPS/Sources/Localizations/Main/sk.lproj/Localizable.strings
  20. 39 0
      FreeAPS/Sources/Localizations/Main/sv.lproj/Localizable.strings
  21. 39 0
      FreeAPS/Sources/Localizations/Main/tr.lproj/Localizable.strings
  22. 40 1
      FreeAPS/Sources/Localizations/Main/uk.lproj/Localizable.strings
  23. 39 0
      FreeAPS/Sources/Localizations/Main/zh-Hans.lproj/Localizable.strings
  24. 5 3
      FreeAPS/Sources/Modules/AddCarbs/AddCarbsStateModel.swift
  25. 96 119
      FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift
  26. 1 0
      FreeAPS/Sources/Modules/Bolus/BolusDataFlow.swift
  27. 19 0
      FreeAPS/Sources/Modules/Bolus/BolusProvider.swift
  28. 6 4
      FreeAPS/Sources/Modules/Bolus/BolusStateModel.swift
  29. 7 6
      FreeAPS/Sources/Modules/Bolus/View/AlternativeBolusCalcRootView.swift
  30. 1 1
      FreeAPS/Sources/Modules/Bolus/View/DefaultBolusCalcRootView.swift
  31. 2 1
      FreeAPS/Sources/Modules/BolusCalculatorConfig/BolusCalculatorStateModel.swift
  32. 39 21
      FreeAPS/Sources/Modules/BolusCalculatorConfig/View/BolusCalculatorConfigRootView.swift
  33. 5 0
      FreeAPS/Sources/Modules/Dynamic/DynamicDataFlow.swift
  34. 3 0
      FreeAPS/Sources/Modules/Dynamic/DynamicProvider.swift
  35. 69 0
      FreeAPS/Sources/Modules/Dynamic/DynamicStateModel.swift
  36. 89 0
      FreeAPS/Sources/Modules/Dynamic/View/DynamicRootView.swift
  37. 2 0
      FreeAPS/Sources/Modules/NightscoutConfig/NightscoutConfigStateModel.swift
  38. 4 0
      FreeAPS/Sources/Modules/NightscoutConfig/View/NightscoutConfigRootView.swift
  39. 2 78
      FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorStateModel.swift
  40. 0 11
      FreeAPS/Sources/Modules/PreferencesEditor/View/PreferencesEditorRootView.swift
  41. 23 16
      FreeAPS/Sources/Modules/Settings/View/SettingsRootView.swift
  42. 4 2
      FreeAPS/Sources/Modules/StatConfig/StatConfigStateModel.swift
  43. 12 6
      FreeAPS/Sources/Modules/StatConfig/View/StatConfigRootView.swift
  44. 3 0
      FreeAPS/Sources/Router/Screen.swift
  45. 3 3
      FreeAPS/Sources/Services/HealthKit/HealthKitManager.swift

+ 2 - 2
Dependencies/OmniBLE/Localizations/da.lproj/Localizable.strings

@@ -15,7 +15,7 @@
 "Pod Expired" = "Pod udløbet";
 
 /* Alert content title for lowReservoir pod alert */
-"Low Reservoir" = "Lavt reservoir";
+"Low Reservoir" = "Lavt Reservoir";
 
 /* Alert content title for suspendInProgress pod alert */
 "Suspend In Progress Reminder" = "Påmindelse om igangværende suspension";
@@ -532,7 +532,7 @@
 "Setup Complete" = "Opsætning fuldført";
 
 /* Value text for no expiration reminder */
-"No Reminder" = "Ingen påmindelse";
+"No Reminder" = "Ingen Påmindelse";
 
 /* Error message description for PeripheralManagerError.notReady */
 "Peripheral Not Ready" = "Perifer Enhed Ikke Klar";

+ 33 - 1
FreeAPS.xcodeproj/project.pbxproj

@@ -22,6 +22,10 @@
 		1927C8E62744606D00347C69 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1927C8E82744606D00347C69 /* InfoPlist.strings */; };
 		1935364028496F7D001E0B16 /* Oref2_variables.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1935363F28496F7D001E0B16 /* Oref2_variables.swift */; };
 		193F6CDD2A512C8F001240FD /* Loops.swift in Sources */ = {isa = PBXBuildFile; fileRef = 193F6CDC2A512C8F001240FD /* Loops.swift */; };
+		195D80B42AF6973A00D25097 /* DynamicRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 195D80B32AF6973A00D25097 /* DynamicRootView.swift */; };
+		195D80B72AF697B800D25097 /* DynamicDataFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 195D80B62AF697B800D25097 /* DynamicDataFlow.swift */; };
+		195D80B92AF697F700D25097 /* DynamicProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 195D80B82AF697F700D25097 /* DynamicProvider.swift */; };
+		195D80BB2AF6980B00D25097 /* DynamicStateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 195D80BA2AF6980B00D25097 /* DynamicStateModel.swift */; };
 		1967DFBE29D052C200759F30 /* Icons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1967DFBD29D052C200759F30 /* Icons.swift */; };
 		1967DFC029D053AC00759F30 /* IconSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1967DFBF29D053AC00759F30 /* IconSelection.swift */; };
 		1967DFC229D053D300759F30 /* IconImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1967DFC129D053D300759F30 /* IconImage.swift */; };
@@ -526,6 +530,10 @@
 		1927C8FE274489BA00347C69 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/InfoPlist.strings; sourceTree = "<group>"; };
 		1935363F28496F7D001E0B16 /* Oref2_variables.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Oref2_variables.swift; sourceTree = "<group>"; };
 		193F6CDC2A512C8F001240FD /* Loops.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Loops.swift; sourceTree = "<group>"; };
+		195D80B32AF6973A00D25097 /* DynamicRootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DynamicRootView.swift; sourceTree = "<group>"; };
+		195D80B62AF697B800D25097 /* DynamicDataFlow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DynamicDataFlow.swift; sourceTree = "<group>"; };
+		195D80B82AF697F700D25097 /* DynamicProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DynamicProvider.swift; sourceTree = "<group>"; };
+		195D80BA2AF6980B00D25097 /* DynamicStateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DynamicStateModel.swift; sourceTree = "<group>"; };
 		1967DFBD29D052C200759F30 /* Icons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Icons.swift; sourceTree = "<group>"; };
 		1967DFBF29D053AC00759F30 /* IconSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconSelection.swift; sourceTree = "<group>"; };
 		1967DFC129D053D300759F30 /* IconImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconImage.swift; sourceTree = "<group>"; };
@@ -1050,6 +1058,25 @@
 			name = "Recovered References";
 			sourceTree = "<group>";
 		};
+		195D80B22AF696EE00D25097 /* Dynamic */ = {
+			isa = PBXGroup;
+			children = (
+				195D80B62AF697B800D25097 /* DynamicDataFlow.swift */,
+				195D80B82AF697F700D25097 /* DynamicProvider.swift */,
+				195D80BA2AF6980B00D25097 /* DynamicStateModel.swift */,
+				195D80B52AF6974200D25097 /* View */,
+			);
+			path = Dynamic;
+			sourceTree = "<group>";
+		};
+		195D80B52AF6974200D25097 /* View */ = {
+			isa = PBXGroup;
+			children = (
+				195D80B32AF6973A00D25097 /* DynamicRootView.swift */,
+			);
+			path = View;
+			sourceTree = "<group>";
+		};
 		198377CF266BFEDE004DE65E /* Localizations */ = {
 			isa = PBXGroup;
 			children = (
@@ -1168,10 +1195,11 @@
 		3811DE0325C9D31700A708ED /* Modules */ = {
 			isa = PBXGroup;
 			children = (
+				195D80B22AF696EE00D25097 /* Dynamic */,
 				BD7DA9A32AE06DBA00601B20 /* BolusCalculatorConfig */,
 				190EBCC229FF134900BA767D /* StatConfig */,
-				CE94597C29E9E1CD0047C9C6 /* WatchConfig */,
 				19F95FF129F10F9C00314DDC /* Stat */,
+				CE94597C29E9E1CD0047C9C6 /* WatchConfig */,
 				19E1F7E629D0828B005C8D20 /* IconConfig */,
 				19D466A129AA2B0A004D5F33 /* FPUConfig */,
 				F90692CD274B99850037068D /* HealthKit */,
@@ -2576,6 +2604,7 @@
 				38C4D33725E9A1A300D30B77 /* DispatchQueue+Extensions.swift in Sources */,
 				F90692CF274B999A0037068D /* HealthKitDataFlow.swift in Sources */,
 				CE7CA3552A064973004BE681 /* ListStateIntent.swift in Sources */,
+				195D80B72AF697B800D25097 /* DynamicDataFlow.swift in Sources */,
 				3862CC2E2743F9F700BF832C /* CalendarManager.swift in Sources */,
 				CEA4F62329BE10F70011ADF7 /* SavitzkyGolayFilter.swift in Sources */,
 				38B4F3C325E2A20B00E76A18 /* PumpSetupView.swift in Sources */,
@@ -2758,6 +2787,7 @@
 				19F95FF729F10FEE00314DDC /* StatStateModel.swift in Sources */,
 				385CEAC125F2EA52002D6D5B /* Announcement.swift in Sources */,
 				8B759CFCF47B392BB365C251 /* BasalProfileEditorDataFlow.swift in Sources */,
+				195D80B42AF6973A00D25097 /* DynamicRootView.swift in Sources */,
 				389442CB25F65F7100FA1F27 /* NightscoutTreatment.swift in Sources */,
 				CE7CA3512A064973004BE681 /* ApplyTempPresetIntent.swift in Sources */,
 				FA630397F76B582C8D8681A7 /* BasalProfileEditorProvider.swift in Sources */,
@@ -2770,6 +2800,7 @@
 				38887CCE25F5725200944304 /* IOBEntry.swift in Sources */,
 				38E98A2425F52C9300C0CED0 /* Logger.swift in Sources */,
 				CA370FC152BC98B3D1832968 /* BasalProfileEditorRootView.swift in Sources */,
+				195D80BB2AF6980B00D25097 /* DynamicStateModel.swift in Sources */,
 				E00EEC0327368630002FF094 /* ServiceAssembly.swift in Sources */,
 				38192E07261BA9960094D973 /* FetchTreatmentsManager.swift in Sources */,
 				19012CDC291D2CB900FB8210 /* LoopStats.swift in Sources */,
@@ -2853,6 +2884,7 @@
 				1D845DF2E3324130E1D95E67 /* DataTableProvider.swift in Sources */,
 				19F95FFA29F1102A00314DDC /* StatRootView.swift in Sources */,
 				0D9A5E34A899219C5C4CDFAF /* DataTableStateModel.swift in Sources */,
+				195D80B92AF697F700D25097 /* DynamicProvider.swift in Sources */,
 				D6D02515BBFBE64FEBE89856 /* DataTableRootView.swift in Sources */,
 				38569349270B5DFB0002C50D /* AppGroupSource.swift in Sources */,
 				F5CA3DB1F9DC8B05792BBFAA /* CGMDataFlow.swift in Sources */,

+ 1 - 1
FreeAPS/Sources/APS/CGM/LibreTransmitterSource.swift

@@ -72,7 +72,7 @@ extension BaseLibreTransmitterSource: LibreTransmitterManagerDelegate {
         case let .success(newGlucose):
             let glucose = newGlucose.map { value -> BloodGlucose in
                 BloodGlucose(
-                    _id: value.syncId,
+                    _id: UUID().uuidString,
                     sgv: Int(value.glucose),
                     direction: manager.glucoseDisplay?.trendType
                         .map { .init(trendType: $0) },

+ 39 - 0
FreeAPS/Sources/Localizations/Main/ar.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Error at";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Home";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatic";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Other";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manual Basal";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/da.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Fejl ved";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Hjem";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatisk";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Andet";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manuel Basal";
 

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

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Fehler um";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Hauptseite";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatisch";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Sonstiges";
 

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

@@ -88,6 +88,9 @@
 /* For the  Bolus View pop-up */
 "Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
 
+/* Bolus View Continue Button */
+"Continue" = "Continue";
+
 /* Home title */
 "Home" = "Home";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/es.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Error at";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Inicio";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatic";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Otro";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manual Basal";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/fi.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Error at";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Home";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatic";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Other";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manual Basal";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/fr.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Error at";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Page d'accueil";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatic";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Autre";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manual Basal";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/he.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Error at";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Home";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatic";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Other";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manual Basal";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/it.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Errore a";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Home";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatic";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Altro";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Basale manuale temporanea";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/nb.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Feil kl.";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Hjem";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatisk";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Annet";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manuell basal";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/nl.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Foutmelding op";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Hoofdmenu";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatisch";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Anders";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Handmatige tijdelijke basaal";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/pl.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Error at";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Home";
 
@@ -571,6 +604,9 @@ Połączono z Nightscout!";
 /* Automatic delivered treatments */
 "Automatic" = "Automatic";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Other";
 
@@ -1173,6 +1209,9 @@ Połączono z Nightscout!";
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manual Basal";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/pt-BR.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Error at";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Tela inicial";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatic";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Outros";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manual Basal";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/pt-PT.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Error at";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Tela inicial";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatic";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Outro";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manual Basal";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/ru.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Ошибка в";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Главная";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Автоматически";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Прочее";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Ручная ВБС";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/sk.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Error at";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Home";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatic";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Other";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manual Basal";
 

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

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Fel vid";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Måltidssammanfattning";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Ändra måltid";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Lägg till Måltid";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Sammanfattnig av bolus";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Beräkningar";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fettrik måltid";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Total mängd";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Faktor";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fettrik måltidsfaktor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Resultat";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Du har angivit en insulinmängd som är över din maxinställning på %d%@";
+
 /* Home title */
 "Home" = "Hem";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatisk";
 
+/* External insulin treatments */
+"External" = "Externt";
+
 /* */
 "Other" = "Annan";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "Externt insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manuell temporär basal";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/tr.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Error at";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "Ana sayfa";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatic";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "Diğer";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manuel Bazal";
 

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

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Помилка в";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Резюме харчування";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Редагувати їжу";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Додати прийом їжі";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Підсумок болюсу";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Розрахунки";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Жирна їжа";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Повний болюс";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Частка";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Фактор жирної їжі";
+
+/* For the  Bolus View pop-up */
+"Result" = "Результат";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Введена вами сума була обмежена налаштуванням максимального болюсу %d%@";
+
 /* Home title */
 "Home" = "Головна";
 
@@ -351,7 +384,7 @@ Enact a temp Basal or a temp target */
 "Can't find the default Nightscout Profile." = "Не вдається знайти профіль Nightscout за замовчуванням.";
 
 /* Add Blood Glucose Test, header */
-"Blood Glucose Test" = "Blood Glucose Test";
+"Blood Glucose Test" = "Тест на глюкозу у крові";
 
 /* Add Medtronic pump */
 "Add Medtronic" = "Додати Medtronic";
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Автоматично";
 
+/* External insulin treatments */
+"External" = "Зовнішній";
+
 /* */
 "Other" = "Інше";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "Зовнішній інсулін";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Ручна тимчасова базальна швидкість (ТБШ)";
 

+ 39 - 0
FreeAPS/Sources/Localizations/Main/zh-Hans.lproj/Localizable.strings

@@ -55,6 +55,39 @@
 /* Headline in enacted pop up (at: at what time) */
 "Error at" = "Error at";
 
+/* Bolus View Meal Summary Header */
+"Meal Summary" = "Meal Summary";
+
+/* Bolus View Meal Edit Meal Button */
+"Edit Meal" = "Edit Meal";
+
+/* Bolus View Meal Add Meal Button */
+"Add Meal" = "Add Meal";
+
+/* Bolus View Bolus Summary Header */
+"Bolus Summary" = "Bolus Summary";
+
+/* For the  Bolus View pop-up */
+"Calculations" = "Calculations";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal" = "Fatty Meal";
+
+/* For the  Bolus View pop-up */
+"Full Bolus" = "Full Bolus";
+
+/* For the  Bolus View pop-up */
+"Fraction" = "Fraction";
+
+/* For the  Bolus View pop-up */
+"Fatty Meal Factor" = "Fatty Meal Factor";
+
+/* For the  Bolus View pop-up */
+"Result" = "Result";
+
+/* For the  Bolus View pop-up */
+"Your entered amount was limited by your max Bolus setting of %d%@" = "Your entered amount was limited by your max Bolus setting of %d%@";
+
 /* Home title */
 "Home" = "主页";
 
@@ -569,6 +602,9 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatic";
 
+/* External insulin treatments */
+"External" = "External";
+
 /* */
 "Other" = "其他";
 
@@ -1171,6 +1207,9 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
+
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manual Basal";
 

+ 5 - 3
FreeAPS/Sources/Modules/AddCarbs/AddCarbsStateModel.swift

@@ -12,7 +12,7 @@ extension AddCarbs {
         @Published var protein: Decimal = 0
         @Published var fat: Decimal = 0
         @Published var carbsRequired: Decimal?
-        @Published var useFPUconversion: Bool = true
+        @Published var useFPUconversion: Bool = false
         @Published var dish: String = ""
         @Published var selection: Presets?
         @Published var summation: [String] = []
@@ -20,13 +20,15 @@ extension AddCarbs {
         @Published var note: String = ""
         @Published var id_: String = ""
         @Published var summary: String = ""
+        @Published var skipBolus: Bool = false
 
         let coredataContext = CoreDataStack.shared.persistentContainer.viewContext
 
         override func subscribe() {
-            subscribeSetting(\.useFPUconversion, on: $useFPUconversion) { useFPUconversion = $0 }
             carbsRequired = provider.suggestion?.carbsReq
             maxCarbs = settings.settings.maxCarbs
+            skipBolus = settingsManager.settings.skipBolusScreenAfterCarbs
+            useFPUconversion = settingsManager.settings.useFPUconversion
         }
 
         func add() {
@@ -49,7 +51,7 @@ extension AddCarbs {
             )]
             carbsStorage.storeCarbs(carbsToStore)
 
-            if settingsManager.settings.skipBolusScreenAfterCarbs {
+            if skipBolus {
                 apsManager.determineBasalSync()
                 showModal(for: nil)
             } else if carbs > 0 {

+ 96 - 119
FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift

@@ -63,71 +63,24 @@ extension AddCarbs {
                                 .controlSize(.mini)
                         }
                     }.focused($isFocused)
-                    HStack {
-                        Button {
-                            state.useFPUconversion.toggle()
+                        .popover(isPresented: $isPromptPresented) {
+                            presetPopover
                         }
-                        label: {
-                            Text(
-                                state
-                                    .useFPUconversion ? NSLocalizedString("Hide Fat & Protein", comment: "") :
-                                    NSLocalizedString("Fat & Protein", comment: "")
-                            ) }
-                            .controlSize(.mini)
-                            .buttonStyle(BorderlessButtonStyle())
-                        Button {
-                            isPromptPresented = true
-                        }
-                        label: { Text("Save as Preset") }
-                            .frame(maxWidth: .infinity, alignment: .trailing)
-                            .controlSize(.mini)
-                            .buttonStyle(BorderlessButtonStyle())
-                            .foregroundColor(
-                                (state.carbs <= 0 && state.fat <= 0 && state.protein <= 0) ||
-                                    (
-                                        (((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
-                                    ) ? .secondary : .orange
-                            )
-                            .disabled(
-                                (state.carbs <= 0 && state.fat <= 0 && state.protein <= 0) ||
-                                    (
-                                        (((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
-                                    )
-                            )
-                    }
-                    .popover(isPresented: $isPromptPresented) {
-                        presetPopover
-                    }
-                }
-
-                if state.useFPUconversion {
-                    Section {
-                        mealPresets
-                    }
                 }
 
                 Section {
-                    DatePicker("Date", selection: $state.date)
+                    mealPresets
                 }
 
                 Section {
                     Button { state.add() }
-                    label: { Text(state.carbs > 0 ? "Continue" : "Save") }
+                    label: { Text(state.skipBolus ? "Save" : "Continue") }
                         .disabled(state.carbs <= 0 && state.fat <= 0 && state.protein <= 0)
                         .frame(maxWidth: .infinity, alignment: .center)
                 } footer: { Text(state.waitersNotepad().description) }
 
-                if !state.useFPUconversion {
-                    Section {
-                        mealPresets
-                    }
+                Section {
+                    DatePicker("Date", selection: $state.date)
                 }
             }
             .onAppear {
@@ -135,7 +88,7 @@ extension AddCarbs {
                     state.loadEntries(editMode)
                 }
             }
-            .navigationTitle("Add Meals")
+            .navigationTitle("Add Meal")
             .navigationBarTitleDisplayMode(.inline)
             .navigationBarItems(leading: Button("Close", action: state.hideModal))
         }
@@ -168,16 +121,36 @@ extension AddCarbs {
             }
         }
 
+        var notEmpty: Bool {
+            state.carbs > 0 || state.protein > 0 || state.fat > 0
+        }
+
         var mealPresets: some View {
             Section {
-                VStack {
-                    Picker("Meal Presets", selection: $state.selection) {
-                        Text("Empty").tag(nil as Presets?)
+                HStack {
+                    Button {
+                        isPromptPresented = true
+                    }
+                    label: { Text("Save as Preset") }
+                        .buttonStyle(BorderlessButtonStyle())
+                        .disabled(
+                            !notEmpty ||
+                                (
+                                    (((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
+                                )
+                        )
+
+                    Picker("Select a Preset", selection: $state.selection) {
+                        Text("Presets").tag(nil as Presets?)
                         ForEach(carbPresets, id: \.self) { (preset: Presets) in
                             Text(preset.dish ?? "").tag(preset as Presets?)
                         }
                     }
-                    .pickerStyle(.automatic)
+                    .labelsHidden()
+                    .frame(maxWidth: .infinity, alignment: .trailing)
                     ._onBindingChange($state.selection) { _ in
                         state.carbs += ((state.selection?.carbs ?? 0) as NSDecimalNumber) as Decimal
                         state.fat += ((state.selection?.fat ?? 0) as NSDecimalNumber) as Decimal
@@ -185,80 +158,84 @@ extension AddCarbs {
                         state.addToSummation()
                     }
                 }
-                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()
 
-                                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
+                if state.selection != nil {
+                    HStack {
+                        Button("Delete Preset") {
+                            showAlert.toggle()
+                        }
+                        .disabled(state.selection == nil)
+                        .tint(.orange)
+                        .buttonStyle(BorderlessButtonStyle())
+                        .alert(
+                            "Delete preset '\(state.selection?.dish ?? "")'?",
+                            isPresented: $showAlert,
+                            actions: {
+                                Button("No", role: .cancel) {}
+                                Button("Yes", role: .destructive) {
+                                    state.deletePreset()
 
-                                state.addPresetToNewMeal()
+                                    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
+
+                                    state.addPresetToNewMeal()
+                                }
                             }
-                        }
-                    )
-                    Button {
-                        if state.carbs != 0,
-                           (state.carbs - (((state.selection?.carbs ?? 0) as NSDecimalNumber) as Decimal) as Decimal) >= 0
-                        {
-                            state.carbs -= (((state.selection?.carbs ?? 0) as NSDecimalNumber) as Decimal)
-                        } else { state.carbs = 0 }
+                        )
+                        Button {
+                            if state.carbs != 0,
+                               (state.carbs - (((state.selection?.carbs ?? 0) as NSDecimalNumber) as Decimal) as Decimal) >= 0
+                            {
+                                state.carbs -= (((state.selection?.carbs ?? 0) as NSDecimalNumber) as Decimal)
+                            } else { state.carbs = 0 }
 
-                        if state.fat != 0,
-                           (state.fat - (((state.selection?.fat ?? 0) as NSDecimalNumber) as Decimal) as Decimal) >= 0
-                        {
-                            state.fat -= (((state.selection?.fat ?? 0) as NSDecimalNumber) as Decimal)
-                        } else { state.fat = 0 }
+                            if state.fat != 0,
+                               (state.fat - (((state.selection?.fat ?? 0) as NSDecimalNumber) as Decimal) as Decimal) >= 0
+                            {
+                                state.fat -= (((state.selection?.fat ?? 0) as NSDecimalNumber) as Decimal)
+                            } else { state.fat = 0 }
 
-                        if state.protein != 0,
-                           (state.protein - (((state.selection?.protein ?? 0) as NSDecimalNumber) as Decimal) as Decimal) >= 0
-                        {
-                            state.protein -= (((state.selection?.protein ?? 0) as NSDecimalNumber) as Decimal)
-                        } else { state.protein = 0 }
+                            if state.protein != 0,
+                               (state.protein - (((state.selection?.protein ?? 0) as NSDecimalNumber) as Decimal) as Decimal) >= 0
+                            {
+                                state.protein -= (((state.selection?.protein ?? 0) as NSDecimalNumber) as Decimal)
+                            } else { state.protein = 0 }
 
-                        state.removePresetFromNewMeal()
-                        if state.carbs == 0, state.fat == 0, state.protein == 0 { state.summation = [] }
-                    }
-                    label: { Text("[ -1 ]") }
-                        .disabled(
-                            state
-                                .selection == nil ||
-                                (
-                                    !state.summation.contains(state.selection?.dish ?? "") && (state.selection?.dish ?? "") != ""
-                                )
-                        )
-                        .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
+                            state.removePresetFromNewMeal()
+                            if state.carbs == 0, state.fat == 0, state.protein == 0 { state.summation = [] }
+                        }
+                        label: { Text("[ -1 ]") }
+                            .disabled(
+                                state
+                                    .selection == nil ||
+                                    (
+                                        !state.summation
+                                            .contains(state.selection?.dish ?? "") && (state.selection?.dish ?? "") != ""
+                                    )
+                            )
+                            .buttonStyle(BorderlessButtonStyle())
+                            .frame(maxWidth: .infinity, alignment: .trailing)
+                            .tint(.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
 
-                        state.addPresetToNewMeal()
+                            state.addPresetToNewMeal()
+                        }
+                        label: { Text("[ +1 ]") }
+                            .disabled(state.selection == nil)
+                            .buttonStyle(BorderlessButtonStyle())
+                            .tint(.blue)
                     }
-                    label: { Text("[ +1 ]") }
-                        .disabled(state.selection == nil)
-                        .buttonStyle(BorderlessButtonStyle())
-                        .accentColor(.blue)
                 }
             }
         }
 
         @ViewBuilder private func proteinAndFat() -> some View {
             HStack {
-                Text("Fat").foregroundColor(.orange) // .fontWeight(.thin)
+                Text("Fat").foregroundColor(.orange)
                 Spacer()
                 DecimalTextField(
                     "0",
@@ -270,7 +247,7 @@ extension AddCarbs {
                 Text("grams").foregroundColor(.secondary)
             }
             HStack {
-                Text("Protein").foregroundColor(.red) // .fontWeight(.thin)
+                Text("Protein").foregroundColor(.red)
                 Spacer()
                 DecimalTextField(
                     "0",

+ 1 - 0
FreeAPS/Sources/Modules/Bolus/BolusDataFlow.swift

@@ -5,4 +5,5 @@ enum Bolus {
 protocol BolusProvider: Provider {
     var suggestion: Suggestion? { get }
     func pumpSettings() -> PumpSettings
+    func fetchGlucose() -> [Readings]
 }

+ 19 - 0
FreeAPS/Sources/Modules/Bolus/BolusProvider.swift

@@ -1,5 +1,9 @@
+import CoreData
+
 extension Bolus {
     final class Provider: BaseProvider, BolusProvider {
+        let coredataContext = CoreDataStack.shared.persistentContainer.viewContext
+
         var suggestion: Suggestion? {
             storage.retrieve(OpenAPS.Enact.suggested, as: Suggestion.self)
         }
@@ -9,5 +13,20 @@ extension Bolus {
                 ?? PumpSettings(from: OpenAPS.defaults(for: OpenAPS.Settings.settings))
                 ?? PumpSettings(insulinActionCurve: 6, maxBolus: 10, maxBasal: 2)
         }
+
+        func fetchGlucose() -> [Readings] {
+            var fetchGlucose = [Readings]()
+            coredataContext.performAndWait {
+                let requestReadings = Readings.fetchRequest() as NSFetchRequest<Readings>
+                let sort = NSSortDescriptor(key: "date", ascending: true)
+                requestReadings.sortDescriptors = [sort]
+                requestReadings.predicate = NSPredicate(
+                    format: "glucose > 0 AND date > %@",
+                    Date().addingTimeInterval(-1.hours.timeInterval) as NSDate
+                )
+                try? fetchGlucose = self.coredataContext.fetch(requestReadings)
+            }
+            return fetchGlucose
+        }
     }
 }

+ 6 - 4
FreeAPS/Sources/Modules/Bolus/BolusStateModel.swift

@@ -1,4 +1,5 @@
 
+import CoreData
 import LoopKit
 import SwiftUI
 import Swinject
@@ -10,10 +11,11 @@ extension Bolus {
         @Injected() var broadcaster: Broadcaster!
         @Injected() var pumpHistoryStorage: PumpHistoryStorage!
         // added for bolus calculator
-        @Injected() var glucoseStorage: GlucoseStorage!
         @Injected() var settings: SettingsManager!
         @Injected() var nsManager: NightscoutManager!
 
+        let coredataContext = CoreDataStack.shared.persistentContainer.viewContext
+
         @Published var suggestion: Suggestion?
         @Published var amount: Decimal = 0
         @Published var insulinRecommended: Decimal = 0
@@ -94,11 +96,11 @@ extension Bolus {
         }
 
         func getDeltaBG() {
-            let glucose = glucoseStorage.recent()
+            let glucose = provider.fetchGlucose()
             guard glucose.count >= 3 else { return }
-            let lastGlucose = glucose.last!
+            let lastGlucose = glucose.last?.glucose ?? 0
             let thirdLastGlucose = glucose[glucose.count - 3]
-            let delta = Decimal(lastGlucose.glucose!) - Decimal(thirdLastGlucose.glucose!)
+            let delta = Decimal(lastGlucose) - Decimal(thirdLastGlucose.glucose)
             deltaBG = delta
         }
 

+ 7 - 6
FreeAPS/Sources/Modules/Bolus/View/AlternativeBolusCalcRootView.swift

@@ -1,4 +1,3 @@
-import Charts
 import CoreData
 import SwiftUI
 import Swinject
@@ -159,12 +158,14 @@ extension Bolus {
                             )
                     }
                 }
-                Section {
-                    Button {
-                        keepForNextWiew = true
-                        state.showModal(for: nil)
+                if state.amount <= 0 {
+                    Section {
+                        Button {
+                            keepForNextWiew = true
+                            state.showModal(for: nil)
+                        }
+                        label: { Text("Continue without bolus") }.frame(maxWidth: .infinity, alignment: .center)
                     }
-                    label: { Text("Continue without bolus") }.frame(maxWidth: .infinity, alignment: .center)
                 }
             }
             .blur(radius: showInfo ? 3 : 0)

+ 1 - 1
FreeAPS/Sources/Modules/Bolus/View/DefaultBolusCalcRootView.swift

@@ -146,7 +146,7 @@ extension Bolus {
                                 )
                         }
                     }
-                    if waitForSuggestion {
+                    if state.amount <= 0 {
                         Section {
                             Button {
                                 keepForNextWiew = true

+ 2 - 1
FreeAPS/Sources/Modules/BolusCalculatorConfig/BolusCalculatorStateModel.swift

@@ -6,7 +6,7 @@ extension BolusCalculatorConfig {
         @Published var useCalc: Bool = false
         @Published var fattyMeals: Bool = false
         @Published var fattyMealFactor: Decimal = 0
-
+        @Published var insulinReqPercentage: Decimal = 70
         override func subscribe() {
             subscribeSetting(\.overrideFactor, on: $overrideFactor, initial: {
                 let value = max(min($0, 1.2), 0.1)
@@ -22,6 +22,7 @@ extension BolusCalculatorConfig {
             }, map: {
                 $0
             })
+            subscribeSetting(\.insulinReqPercentage, on: $insulinReqPercentage) { insulinReqPercentage = $0 }
         }
     }
 }

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 39 - 21
FreeAPS/Sources/Modules/BolusCalculatorConfig/View/BolusCalculatorConfigRootView.swift


+ 5 - 0
FreeAPS/Sources/Modules/Dynamic/DynamicDataFlow.swift

@@ -0,0 +1,5 @@
+enum Dynamic {
+    enum Config {}
+}
+
+protocol DynamicProvider: Provider {}

+ 3 - 0
FreeAPS/Sources/Modules/Dynamic/DynamicProvider.swift

@@ -0,0 +1,3 @@
+extension Dynamic {
+    final class Provider: BaseProvider, DynamicProvider {}
+}

+ 69 - 0
FreeAPS/Sources/Modules/Dynamic/DynamicStateModel.swift

@@ -0,0 +1,69 @@
+import SwiftUI
+
+extension Dynamic {
+    final class StateModel: BaseStateModel<Provider> {
+        @Injected() var settings: SettingsManager!
+        @Injected() var storage: FileStorage!
+
+        @Published var useNewFormula: Bool = false
+        @Published var enableDynamicCR: Bool = false
+        @Published var sigmoid: Bool = false
+        @Published var adjustmentFactor: Decimal = 0.5
+        @Published var weightPercentage: Decimal = 0.65
+        @Published var tddAdjBasal: Bool = false
+        @Published var threshold_setting: Decimal = 65
+        @Published var unit: GlucoseUnits = .mmolL
+
+        var preferences: Preferences {
+            settingsManager.preferences
+        }
+
+        override func subscribe() {
+            unit = settingsManager.settings.units
+            useNewFormula = settings.preferences.useNewFormula
+            enableDynamicCR = settings.preferences.enableDynamicCR
+            sigmoid = settings.preferences.sigmoid
+            adjustmentFactor = settings.preferences.adjustmentFactor
+            weightPercentage = settings.preferences.weightPercentage
+            tddAdjBasal = settings.preferences.tddAdjBasal
+
+            if unit == .mmolL {
+                threshold_setting = settings.preferences.threshold_setting.asMmolL
+            } else {
+                threshold_setting = settings.preferences.threshold_setting
+            }
+        }
+
+        var unChanged: Bool {
+            preferences.enableDynamicCR == enableDynamicCR &&
+                preferences.adjustmentFactor == adjustmentFactor &&
+                preferences.sigmoid == sigmoid &&
+                preferences.tddAdjBasal == tddAdjBasal &&
+                preferences.threshold_setting == convertBack(threshold_setting) &&
+                preferences.useNewFormula == useNewFormula &&
+                preferences.weightPercentage == weightPercentage
+        }
+
+        func convertBack(_ glucose: Decimal) -> Decimal {
+            if unit == .mmolL {
+                return glucose.asMgdL
+            }
+            return glucose
+        }
+
+        func saveIfChanged() {
+            if !unChanged {
+                var newSettings = storage.retrieve(OpenAPS.Settings.preferences, as: Preferences.self) ?? Preferences()
+                newSettings.enableDynamicCR = enableDynamicCR
+                newSettings.adjustmentFactor = adjustmentFactor
+                newSettings.sigmoid = sigmoid
+                newSettings.tddAdjBasal = tddAdjBasal
+                newSettings.threshold_setting = convertBack(threshold_setting)
+                newSettings.useNewFormula = useNewFormula
+                newSettings.weightPercentage = weightPercentage
+                newSettings.timestamp = Date()
+                storage.save(newSettings, as: OpenAPS.Settings.preferences)
+            }
+        }
+    }
+}

+ 89 - 0
FreeAPS/Sources/Modules/Dynamic/View/DynamicRootView.swift

@@ -0,0 +1,89 @@
+import SwiftUI
+import Swinject
+
+extension Dynamic {
+    struct RootView: BaseView {
+        let resolver: Resolver
+        @StateObject var state = StateModel()
+
+        private var conversionFormatter: NumberFormatter {
+            let formatter = NumberFormatter()
+            formatter.numberStyle = .decimal
+            formatter.maximumFractionDigits = 1
+
+            return formatter
+        }
+
+        private var formatter: NumberFormatter {
+            let formatter = NumberFormatter()
+            formatter.numberStyle = .decimal
+            return formatter
+        }
+
+        private var glucoseFormatter: NumberFormatter {
+            let formatter = NumberFormatter()
+            formatter.numberStyle = .decimal
+            if state.unit == .mmolL {
+                formatter.maximumFractionDigits = 1
+            } else { formatter.maximumFractionDigits = 0 }
+            formatter.roundingMode = .halfUp
+            return formatter
+        }
+
+        var body: some View {
+            Form {
+                Section {
+                    HStack {
+                        Toggle("Activate Dynamic Sensitivity (ISF)", isOn: $state.useNewFormula)
+                    }
+                    if state.useNewFormula {
+                        HStack {
+                            Toggle("Activate Dynamic Carb Ratio (CR)", isOn: $state.enableDynamicCR)
+                        }
+                    }
+                } header: { Text("Enable") }
+
+                if state.useNewFormula {
+                    Section {
+                        HStack {
+                            Toggle("Use Sigmoid Formula", isOn: $state.sigmoid)
+                        }
+                    } header: { Text("Formula") }
+
+                    Section {
+                        HStack {
+                            Text("Adjustment Factor")
+                            Spacer()
+                            DecimalTextField("0", value: $state.adjustmentFactor, formatter: formatter)
+                        }
+
+                        HStack {
+                            Text("Weighted Average of TDD. Weight of past 24 hours:")
+                            Spacer()
+                            DecimalTextField("0", value: $state.weightPercentage, formatter: formatter)
+                        }
+
+                        HStack {
+                            Toggle("Adjust basal", isOn: $state.tddAdjBasal)
+                        }
+                    } header: { Text("Settings") }
+
+                    Section {
+                        HStack {
+                            Text("Threshold Setting")
+                            Spacer()
+                            DecimalTextField("0", value: $state.threshold_setting, formatter: glucoseFormatter)
+                            Text(state.unit.rawValue)
+                        }
+                    } header: { Text("Safety") }
+                }
+            }
+            .onAppear(perform: configureView)
+            .navigationBarTitle("Dynamic ISF")
+            .navigationBarTitleDisplayMode(.automatic)
+            .onDisappear {
+                state.saveIfChanged()
+            }
+        }
+    }
+}

+ 2 - 0
FreeAPS/Sources/Modules/NightscoutConfig/NightscoutConfigStateModel.swift

@@ -32,6 +32,7 @@ extension NightscoutConfig {
         @Published var dia: Decimal = 6
         @Published var maxBasal: Decimal = 2
         @Published var maxBolus: Decimal = 10
+        @Published var allowAnnouncements: Bool = false
 
         override func subscribe() {
             url = keychain.getValue(String.self, forKey: Config.urlKey) ?? ""
@@ -41,6 +42,7 @@ extension NightscoutConfig {
             maxBasal = settingsManager.pumpSettings.maxBasal
             maxBolus = settingsManager.pumpSettings.maxBolus
 
+            subscribeSetting(\.allowAnnouncements, on: $allowAnnouncements) { allowAnnouncements = $0 }
             subscribeSetting(\.isUploadEnabled, on: $isUploadEnabled) { isUploadEnabled = $0 }
             subscribeSetting(\.useLocalGlucoseSource, on: $useLocalSource) { useLocalSource = $0 }
             subscribeSetting(\.localGlucosePort, on: $localPort.map(Int.init)) { localPort = Decimal($0) }

+ 4 - 0
FreeAPS/Sources/Modules/NightscoutConfig/View/NightscoutConfigRootView.swift

@@ -119,6 +119,10 @@ extension NightscoutConfig {
                     Button("Backfill glucose") { state.backfillGlucose() }
                         .disabled(state.url.isEmpty || state.connecting || state.backfilling)
                 }
+
+                Section {
+                    Toggle("Remote control", isOn: $state.allowAnnouncements)
+                } header: { Text("Allow Remote control of iAPS") }
             }
             .onAppear(perform: configureView)
             .navigationBarTitle("Nightscout Config")

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 2 - 78
FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorStateModel.swift


+ 0 - 11
FreeAPS/Sources/Modules/PreferencesEditor/View/PreferencesEditorRootView.swift

@@ -27,17 +27,6 @@ extension PreferencesEditor {
                         Text("mg/dL").tag(0)
                         Text("mmol/L").tag(1)
                     }
-
-                    Toggle("Remote control", isOn: $state.allowAnnouncements)
-
-                    if !state.useAlternativeBolusCalc {
-                        HStack {
-                            Text("Recommended Bolus Percentage")
-                            DecimalTextField("", value: $state.insulinReqPercentage, formatter: formatter)
-                        }
-                    }
-
-                    Toggle("Skip Bolus screen after carbs", isOn: $state.skipBolusScreenAfterCarbs)
                 }
 
                 ForEach(state.sections.indexed(), id: \.1.id) { sectionIndex, section in

+ 23 - 16
FreeAPS/Sources/Modules/Settings/View/SettingsRootView.swift

@@ -10,43 +10,50 @@ extension Settings {
 
         var body: some View {
             Form {
-                Section(
-                    header: Text(
+                Section {
+                    Toggle("Closed loop", isOn: $state.closedLoop)
+                } header: {
+                    Text(
                         "iAPS v\(state.versionNumber) (\(state.buildNumber))\nBranch: \(state.branch) \(state.copyrightNotice) "
                     ).textCase(nil)
-                ) {
-                    Toggle("Closed loop", isOn: $state.closedLoop)
                 }
 
-                Section(header: Text("Devices")) {
+                Section {
                     Text("Pump").navigationLink(to: .pumpConfig, from: self)
                     Text("CGM").navigationLink(to: .cgm, from: self)
                     Text("Watch").navigationLink(to: .watch, from: self)
-                }
+                } header: { Text("Devices") }
 
-                Section(header: Text("Services")) {
+                Section {
                     Text("Nightscout").navigationLink(to: .nighscoutConfig, from: self)
                     if HKHealthStore.isHealthDataAvailable() {
                         Text("Apple Health").navigationLink(to: .healthkit, from: self)
                     }
                     Text("Notifications").navigationLink(to: .notificationsConfig, from: self)
-                    Text("Fat And Protein Conversion").navigationLink(to: .fpuConfig, from: self)
-                    Text("App Icons").navigationLink(to: .iconConfig, from: self)
-                    Text("Statistics and Home View").navigationLink(to: .statisticsConfig, from: self)
-                }
+                } header: { Text("Services") }
 
-                Section(header: Text("Configuration")) {
-                    Text("Preferences").navigationLink(to: .preferencesEditor, from: self)
+                Section {
                     Text("Pump Settings").navigationLink(to: .pumpSettingsEditor, from: self)
                     Text("Basal Profile").navigationLink(to: .basalProfileEditor, from: self)
                     Text("Insulin Sensitivities").navigationLink(to: .isfEditor, from: self)
                     Text("Carb Ratios").navigationLink(to: .crEditor, from: self)
                     Text("Target Glucose").navigationLink(to: .targetsEditor, from: self)
+                } header: { Text("Configuration") }
+
+                Section {
+                    Text("OpenAPS").navigationLink(to: .preferencesEditor, from: self)
                     Text("Autotune").navigationLink(to: .autotuneConfig, from: self)
+                } header: { Text("OpenAPS") }
+
+                Section {
+                    Text("UI/UX").navigationLink(to: .statisticsConfig, from: self)
+                    Text("App Icons").navigationLink(to: .iconConfig, from: self)
                     Text("Bolus Calculator").navigationLink(to: .bolusCalculatorConfig, from: self)
-                }
+                    Text("Fat And Protein Conversion").navigationLink(to: .fpuConfig, from: self)
+                    Text("Dynamic ISF").navigationLink(to: .dynamicISF, from: self)
+                } header: { Text("Extra Features") }
 
-                Section(header: Text("Developer")) {
+                Section {
                     Toggle("Debug options", isOn: $state.debugOptions)
                     if state.debugOptions {
                         Group {
@@ -108,7 +115,7 @@ extension Settings {
                                 .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.settings), from: self)
                         }
                     }
-                }
+                } header: { Text("Developer") }
 
                 Section {
                     Toggle("Animated Background", isOn: $state.animatedBackground)

+ 4 - 2
FreeAPS/Sources/Modules/StatConfig/StatConfigStateModel.swift

@@ -10,7 +10,8 @@ extension StatConfig {
         @Published var yGridLines: Bool = false
         @Published var oneDimensionalGraph = false
         @Published var rulerMarks: Bool = false
-
+        @Published var skipBolusScreenAfterCarbs: Bool = false
+        @Published var useFPUconversion: Bool = true
         var units: GlucoseUnits = .mmolL
 
         override func subscribe() {
@@ -21,7 +22,8 @@ extension StatConfig {
             subscribeSetting(\.xGridLines, on: $xGridLines) { xGridLines = $0 }
             subscribeSetting(\.yGridLines, on: $yGridLines) { yGridLines = $0 }
             subscribeSetting(\.rulerMarks, on: $rulerMarks) { rulerMarks = $0 }
-            subscribeSetting(\.oneDimensionalGraph, on: $oneDimensionalGraph) { oneDimensionalGraph = $0 }
+            subscribeSetting(\.useFPUconversion, on: $useFPUconversion) { useFPUconversion = $0 }
+            subscribeSetting(\.skipBolusScreenAfterCarbs, on: $skipBolusScreenAfterCarbs) { skipBolusScreenAfterCarbs = $0 }
 
             subscribeSetting(\.low, on: $low, initial: {
                 let value = max(min($0, 90), 40)

+ 12 - 6
FreeAPS/Sources/Modules/StatConfig/View/StatConfigRootView.swift

@@ -26,37 +26,43 @@ extension StatConfig {
 
         var body: some View {
             Form {
-                Section(header: Text("Settings")) {
-                    Toggle("Change HbA1c Unit", isOn: $state.overrideHbA1cUnit)
+                Section {
                     Toggle("Display Chart X - Grid lines", isOn: $state.xGridLines)
                     Toggle("Display Chart Y - Grid lines", isOn: $state.yGridLines)
                     Toggle("Display Chart Threshold lines for Low and High", isOn: $state.rulerMarks)
                     Toggle("Standing / Laying TIR Chart", isOn: $state.oneDimensionalGraph)
-
                     HStack {
                         Text("Hours X-Axis (6 default)")
                         Spacer()
                         DecimalTextField("6", value: $state.hours, formatter: carbsFormatter)
                         Text("hours").foregroundColor(.secondary)
                     }
+                } header: { Text("Home Chart settings ") }
 
+                Section {
                     HStack {
                         Text("Low")
                         Spacer()
                         DecimalTextField("0", value: $state.low, formatter: glucoseFormatter)
                         Text(state.units.rawValue).foregroundColor(.secondary)
                     }
-
                     HStack {
                         Text("High")
                         Spacer()
                         DecimalTextField("0", value: $state.high, formatter: glucoseFormatter)
                         Text(state.units.rawValue).foregroundColor(.secondary)
                     }
-                }
+                    Toggle("Override HbA1c Unit", isOn: $state.overrideHbA1cUnit)
+
+                } header: { Text("Statistics settings ") }
+
+                Section {
+                    Toggle("Skip Bolus screen after carbs", isOn: $state.skipBolusScreenAfterCarbs)
+                    Toggle("Display and allow Fat and Protein entries", isOn: $state.useFPUconversion)
+                } header: { Text("Add Meal View settings ") }
             }
             .onAppear(perform: configureView)
-            .navigationBarTitle("Statistics")
+            .navigationBarTitle("UI/UX Settings")
             .navigationBarTitleDisplayMode(.automatic)
         }
     }

+ 3 - 0
FreeAPS/Sources/Router/Screen.swift

@@ -33,6 +33,7 @@ enum Screen: Identifiable, Hashable {
     case watch
     case statisticsConfig
     case bolusCalculatorConfig
+    case dynamicISF
 
     var id: Int { String(reflecting: self).hashValue }
 }
@@ -102,6 +103,8 @@ extension Screen {
             StatConfig.RootView(resolver: resolver)
         case .bolusCalculatorConfig:
             BolusCalculatorConfig.RootView(resolver: resolver)
+        case .dynamicISF:
+            Dynamic.RootView(resolver: resolver)
         }
     }
 

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

@@ -186,7 +186,7 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsObserver, P
         else { return }
 
         let carbsWithId = carbs.filter { c in
-            guard c.id != nil else { return false }
+            guard c.collectionID != nil else { return false }
             return true
         }
 
@@ -203,8 +203,8 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsObserver, P
                         start: $0.createdAt,
                         end: $0.createdAt,
                         metadata: [
-                            HKMetadataKeyExternalUUID: $0.id ?? "_id",
-                            HKMetadataKeySyncIdentifier: $0.id ?? "_id",
+                            HKMetadataKeyExternalUUID: $0.collectionID ?? "_id",
+                            HKMetadataKeySyncIdentifier: $0.collectionID ?? "_id",
                             HKMetadataKeySyncVersion: 1,
                             Config.freeAPSMetaKey: true
                         ]