Przeglądaj źródła

updates from bdb_dev (#559)

* New slim format

* Better format for Apple Watch Home View.
Have same size for HR as other items. Longpress the Heart for 1 seconds to make the heart and HR font bigger size. Long press again to reduce to before.
Align Loop Circle and min ago with BG and delta BG horisontally.

* Change on tap
Change display of  Average --> Median and CV --> SD when tapping text

* Switch between Loops and Errors when tapping

* Revert to deafault filterTooFrequentGlucose min interval t0 4.5 minutes

* Crowdin updates
Jon B Mårtensson 3 lat temu
rodzic
commit
38e7817b98
31 zmienionych plików z 345 dodań i 205 usunięć
  1. 1 1
      Config.xcconfig
  2. 1 1
      FreeAPS/Resources/sv.lproj/InfoPlist.strings
  3. 1 1
      FreeAPS/Sources/APS/Storage/GlucoseStorage.swift
  4. 7 4
      FreeAPS/Sources/Localizations/Main/ar.lproj/Localizable.strings
  5. 7 4
      FreeAPS/Sources/Localizations/Main/ca.lproj/Localizable.strings
  6. 7 4
      FreeAPS/Sources/Localizations/Main/da.lproj/Localizable.strings
  7. 8 5
      FreeAPS/Sources/Localizations/Main/de.lproj/Localizable.strings
  8. 10 4
      FreeAPS/Sources/Localizations/Main/en.lproj/Localizable.strings
  9. 8 5
      FreeAPS/Sources/Localizations/Main/es.lproj/Localizable.strings
  10. 7 4
      FreeAPS/Sources/Localizations/Main/fi.lproj/Localizable.strings
  11. 8 5
      FreeAPS/Sources/Localizations/Main/fr.lproj/Localizable.strings
  12. 7 4
      FreeAPS/Sources/Localizations/Main/he.lproj/Localizable.strings
  13. 8 5
      FreeAPS/Sources/Localizations/Main/it.lproj/Localizable.strings
  14. 8 5
      FreeAPS/Sources/Localizations/Main/nb.lproj/Localizable.strings
  15. 8 5
      FreeAPS/Sources/Localizations/Main/nl.lproj/Localizable.strings
  16. 7 4
      FreeAPS/Sources/Localizations/Main/pl.lproj/Localizable.strings
  17. 7 4
      FreeAPS/Sources/Localizations/Main/pt-BR.lproj/Localizable.strings
  18. 7 4
      FreeAPS/Sources/Localizations/Main/pt-PT.lproj/Localizable.strings
  19. 8 5
      FreeAPS/Sources/Localizations/Main/ru.lproj/Localizable.strings
  20. 7 4
      FreeAPS/Sources/Localizations/Main/sk.lproj/Localizable.strings
  21. 11 5
      FreeAPS/Sources/Localizations/Main/sv.lproj/Localizable.strings
  22. 8 5
      FreeAPS/Sources/Localizations/Main/tr.lproj/Localizable.strings
  23. 8 5
      FreeAPS/Sources/Localizations/Main/uk.lproj/Localizable.strings
  24. 8 5
      FreeAPS/Sources/Localizations/Main/zh-Hans.lproj/Localizable.strings
  25. 0 2
      FreeAPS/Sources/Models/Preferences.swift
  26. 4 1
      FreeAPS/Sources/Modules/Home/DurationButton.swift
  27. 0 3
      FreeAPS/Sources/Modules/Home/HomeStateModel.swift
  28. 131 83
      FreeAPS/Sources/Modules/Home/View/HomeRootView.swift
  29. 0 12
      FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorStateModel.swift
  30. 1 1
      FreeAPS/Sources/Services/WatchManager/WatchManager.swift
  31. 42 5
      FreeAPSWatch WatchKit Extension/Views/MainView.swift

+ 1 - 1
Config.xcconfig

@@ -1,5 +1,5 @@
 APP_DISPLAY_NAME = FreeAPS X
-APP_VERSION = 0.6.3
+APP_VERSION = 0.6.4
 APP_BUILD_NUMBER = 1
 COPYRIGHT_NOTICE = 
 DEVELOPER_TEAM = ##TEAM_ID##

+ 1 - 1
FreeAPS/Resources/sv.lproj/InfoPlist.strings

@@ -1,5 +1,5 @@
 /* Privacy - NFC Scan Usage Description */
-"NFCReaderUsageDescription" = "NFC används för att skanna Libre-sensorer.";
+"NFCReaderUsageDescription" = "NFC behövs för att skanna Libre-sensorn vid uppstart.";
 
 /* Privacy - Bluetooth Always Usage Description */
 "NSBluetoothAlwaysUsageDescription" = "Bluetooth används för att kommunicera med insulinpumpen och kontinuerlig glukosmätare";

+ 1 - 1
FreeAPS/Sources/APS/Storage/GlucoseStorage.swift

@@ -25,7 +25,7 @@ final class BaseGlucoseStorage: GlucoseStorage, Injectable {
     @Injected() private var settingsManager: SettingsManager!
 
     private enum Config {
-        static let filterTime: TimeInterval = 1 * 60
+        static let filterTime: TimeInterval = 4.5 * 60
     }
 
     init(resolver: Resolver) {

+ 7 - 4
FreeAPS/Sources/Localizations/Main/ar.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "days";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Avgerage Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "Duration";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";

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

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "days";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Avgerage Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "Duration";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";

+ 7 - 4
FreeAPS/Sources/Localizations/Main/da.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "days";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Avgerage Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "Duration";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";

+ 8 - 5
FreeAPS/Sources/Localizations/Main/de.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "Tage";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Fehler";
+
 /* Average loop interval */
-"Average Interval" = "Intervall in Min";
+"Interval" = "Intervall";
 
 /* Median loop interval */
-"Median Duration" = "Berechnungszeit";
+"Duration" = "Dauer";
 
 /* "Display SD */
 "Display SD instead of CV" = "Zeige die Standardabweichung (SD) statt des Variationskoeffizienten (CV)";
@@ -1487,7 +1490,7 @@ Enact a temp Basal or a temp target */
 "SMB Interval" = "SMB-Intervall";
 
 /* "SMB Interval" */
-"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Minimaler Abstand (in Minuten), der zwischen zwei SMBs liegen muss";
+"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Minimum duration in minutes for new SMB since last SMB or manual bolus";
 
 /* Headline "Bolus Increment" */
 "Bolus Increment" = "Bolus-Erhöhung";

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

@@ -1229,7 +1229,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1238,14 +1238,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "days";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Average Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "Duration";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";
@@ -1286,6 +1289,9 @@ Enact a temp Basal or a temp target */
 /* Description for Override HbA1c unit */
 "Change default HbA1c unit in statPanlel. The unit in statPanel will be updateded with next statistics.json update" = "Change default HbA1c unit in statPanlel. The unit in statPanel will be updateded with next statistics.json update";
 
+/* HbA1c for all glucose storage days */
+"all" = "all";
+
  /* --------------------------------------
 
   Infotexts from openaps.docs and androidaps.docs

+ 8 - 5
FreeAPS/Sources/Localizations/Main/es.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "days";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Avgerage Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "Duración";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";
@@ -1493,7 +1496,7 @@ Un 1.0 de valor permite un ajuste completo con el nuevo factor de sensibilidad d
 "SMB Interval" = "SMB Interval";
 
 /* "SMB Interval" */
-"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Duración mínima en minutos entre dos SMBs aprobados";
+"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Minimum duration in minutes for new SMB since last SMB or manual bolus";
 
 /* Headline "Bolus Increment" */
 "Bolus Increment" = "Bolus Increment";

+ 7 - 4
FreeAPS/Sources/Localizations/Main/fi.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "days";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Avgerage Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "Duration";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";

+ 8 - 5
FreeAPS/Sources/Localizations/Main/fr.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "days";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Avgerage Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "Durée";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";
@@ -1487,7 +1490,7 @@ Enact a temp Basal or a temp target */
 "SMB Interval" = "SMB Interval";
 
 /* "SMB Interval" */
-"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Durée minimale en minutes entre deux SMB injectés";
+"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Minimum duration in minutes for new SMB since last SMB or manual bolus";
 
 /* Headline "Bolus Increment" */
 "Bolus Increment" = "Bolus Increment";

+ 7 - 4
FreeAPS/Sources/Localizations/Main/he.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "days";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Avgerage Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "Duration";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";

+ 8 - 5
FreeAPS/Sources/Localizations/Main/it.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "giorni";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Avgerage Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "Durata";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";
@@ -1487,7 +1490,7 @@ Enact a temp Basal or a temp target */
 "SMB Interval" = "SMB Interval";
 
 /* "SMB Interval" */
-"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Durata minima in minuti tra due SMB sommimistrati";
+"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Minimum duration in minutes for new SMB since last SMB or manual bolus";
 
 /* Headline "Bolus Increment" */
 "Bolus Increment" = "Bolus Increment";

+ 8 - 5
FreeAPS/Sources/Localizations/Main/nb.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "dager";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Feil";
+
 /* Average loop interval */
-"Average Interval" = "Gj.snitt intervall";
+"Interval" = "Intervall";
 
 /* Median loop interval */
-"Median Duration" = "Median varighet";
+"Duration" = "Varighet";
 
 /* "Display SD */
 "Display SD instead of CV" = "Vis SD i stedet for CV";
@@ -1487,7 +1490,7 @@ Enact a temp Basal or a temp target */
 "SMB Interval" = "SMB-intervall";
 
 /* "SMB Interval" */
-"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Minimum varighet i minutter mellom to SMB'er";
+"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Minimum varighet i minutter for ny SMB, etter siste SMB eller manuell bolus";
 
 /* Headline "Bolus Increment" */
 "Bolus Increment" = "Bolus-økning";

+ 8 - 5
FreeAPS/Sources/Localizations/Main/nl.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "dagen";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median duur";
+"Duration" = "Duur";
 
 /* "Display SD */
 "Display SD instead of CV" = "Toon SD in plaats van CV";
@@ -1487,7 +1490,7 @@ Enact a temp Basal or a temp target */
 "SMB Interval" = "SMB interval";
 
 /* "SMB Interval" */
-"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Minimale duur in minuten tussen twee uitgevoerde SMBs";
+"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Minimum duration in minutes for new SMB since last SMB or manual bolus";
 
 /* Headline "Bolus Increment" */
 "Bolus Increment" = "Bolusverhoging";

+ 7 - 4
FreeAPS/Sources/Localizations/Main/pl.lproj/Localizable.strings

@@ -1227,7 +1227,7 @@ Połączono z Nightscout!";
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1236,14 +1236,17 @@ Połączono z Nightscout!";
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "days";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Avgerage Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "Czas trwania";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";

+ 7 - 4
FreeAPS/Sources/Localizations/Main/pt-BR.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "days";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Avgerage Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "Duração";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";

+ 7 - 4
FreeAPS/Sources/Localizations/Main/pt-PT.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "days";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Avgerage Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "Duração";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";

+ 8 - 5
FreeAPS/Sources/Localizations/Main/ru.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "дней";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Петли";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Интервал";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Длительность";
+"Duration" = "Длительность";
 
 /* "Display SD */
 "Display SD instead of CV" = "Отображать SD вместо CV";
@@ -1487,7 +1490,7 @@ Enact a temp Basal or a temp target */
 "SMB Interval" = "Интервал между SMB";
 
 /* "SMB Interval" */
-"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Минимальная продолжительность в минутах между подачей болюсов";
+"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Minimum duration in minutes for new SMB since last SMB or manual bolus";
 
 /* Headline "Bolus Increment" */
 "Bolus Increment" = "Прирост болюса";

+ 7 - 4
FreeAPS/Sources/Localizations/Main/sk.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "days";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Avgerage Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "Duration";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";

+ 11 - 5
FreeAPS/Sources/Localizations/Main/sv.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "dagar";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loopar";
 
+/* Loop Errors in statPanel */
+"Errors" = "Fel";
+
 /* Average loop interval */
-"Average Interval" = "Medelintervall";
+"Interval" = "Intervall";
 
 /* Median loop interval */
-"Median Duration" = "Medianduration";
+"Duration" = "Duration";
 
 /* "Display SD */
 "Display SD instead of CV" = "Visa SD istället för CV";
@@ -1282,6 +1285,9 @@ Enact a temp Basal or a temp target */
 /* Description for Override HbA1c unit */
 "Change default HbA1c unit in statPanlel. The unit in statPanel will be updateded with next statistics.json update" = "Ändra HbA1c-enhet. Enheten kommer att uppdateras nästa gång filen statistics.json uppdateras";
 
+/* HbA1c for all glucose storage days */
+"all" = "alla";
+
 /* --------------------------------------
 
   Infotexts from openaps.docs and androidaps.docs
@@ -1487,7 +1493,7 @@ Enact a temp Basal or a temp target */
 "SMB Interval" = "SMB-intervall (minuter)";
 
 /* "SMB Interval" */
-"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Minsta tidsintervall mellan två supermikrobolusar.";
+"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Minsta tid i minuter för ny automatisk bolus sedan senaste bolus eller automatisk bolus";
 
 /* Headline "Bolus Increment" */
 "Bolus Increment" = "Minsta bolusmångd";

+ 8 - 5
FreeAPS/Sources/Localizations/Main/tr.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "gün";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Avgerage Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "Süre";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";
@@ -1487,7 +1490,7 @@ Enact a temp Basal or a temp target */
 "SMB Interval" = "SMB Aralığı";
 
 /* "SMB Interval" */
-"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Yürürlüğe giren iki SMB arasındaki dakika cinsinden minimum süre";
+"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Minimum duration in minutes for new SMB since last SMB or manual bolus";
 
 /* Headline "Bolus Increment" */
 "Bolus Increment" = "Bolus Artırımı";

+ 8 - 5
FreeAPS/Sources/Localizations/Main/uk.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "дні";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Петлі";
 
+/* Loop Errors in statPanel */
+"Errors" = "Помилки";
+
 /* Average loop interval */
-"Average Interval" = "Середній інтервал";
+"Interval" = "Інтервал";
 
 /* Median loop interval */
-"Median Duration" = "Середня тривалість";
+"Duration" = "Тривалість";
 
 /* "Display SD */
 "Display SD instead of CV" = "Показати SD замість CV";
@@ -1487,7 +1490,7 @@ Enact a temp Basal or a temp target */
 "SMB Interval" = "Інтервал між SMB";
 
 /* "SMB Interval" */
-"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Мінімальна тривалість у хвилинах між двома подачами SMB";
+"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Мінімальна тривалість у хвилинах для нового SMB після останнього SMB або ручного болюсу";
 
 /* Headline "Bolus Increment" */
 "Bolus Increment" = "Приріст болюсу";

+ 8 - 5
FreeAPS/Sources/Localizations/Main/zh-Hans.lproj/Localizable.strings

@@ -1225,7 +1225,7 @@ Enact a temp Basal or a temp target */
 /* CV */
 "CV" = "CV";
 
-/* HbA1c estimation for one day of data */
+/* Estimated HbA1c */
 "HbA1c" = "HbA1c";
 
 /* Total number of days of data for HbA1c estimation, part 1/2*/
@@ -1234,14 +1234,17 @@ Enact a temp Basal or a temp target */
 /* Total number of days of data for HbA1c estimation, part 2/2*/
 "days" = "days";
 
-/* Nr of loops last 24 hours */
+/* Nr of Loops in statPanel */
 "Loops" = "Loops";
 
+/* Loop Errors in statPanel */
+"Errors" = "Errors";
+
 /* Average loop interval */
-"Average Interval" = "Avgerage Interval";
+"Interval" = "Interval";
 
 /* Median loop interval */
-"Median Duration" = "Median Duration";
+"Duration" = "持续时间";
 
 /* "Display SD */
 "Display SD instead of CV" = "Display SD instead of CV";
@@ -1489,7 +1492,7 @@ Enact a temp Basal or a temp target */
 "SMB Interval" = "SMB Interval";
 
 /* "SMB Interval" */
-"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "两次自动大剂量的最短时间";
+"Minimum duration in minutes for new SMB since last SMB or manual bolus" = "Minimum duration in minutes for new SMB since last SMB or manual bolus";
 
 /* Headline "Bolus Increment" */
 "Bolus Increment" = "Bolus Increment";

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

@@ -56,7 +56,6 @@ struct Preferences: JSON {
     var high: Decimal = 10
     var low: Decimal = 4
     var updateInterval: Decimal = 30
-    var displaySD: Bool = false
     var overrideHbA1cUnit: Bool = false
     var displayLoops: Bool = false
 }
@@ -117,7 +116,6 @@ extension Preferences {
         case high
         case low
         case updateInterval
-        case displaySD
         case overrideHbA1cUnit
         case displayLoops
     }

+ 4 - 1
FreeAPS/Sources/Modules/Home/DurationButton.swift

@@ -28,12 +28,15 @@ struct durationButton<T: DurationButton>: View {
             currentIndex = currentIndex < states.count - 1 ? currentIndex + 1 : 0
             selectedState = states[currentIndex]
         } label: {
-            Text(NSLocalizedString(states[currentIndex].title, comment: "Duration displayed in statPanel")).font(.caption2)
+            Text(NSLocalizedString(states[currentIndex].title, comment: "Duration displayed in statPanel"))
+                .font(.caption2)
                 .foregroundColor(.secondary)
         }
 
         .buttonBorderShape(.automatic)
         .controlSize(.mini)
         .buttonStyle(.bordered)
+        // .padding([.trailing], 15)
+        // .frame(maxWidth: .infinity, alignment: .trailing)
     }
 }

+ 0 - 3
FreeAPS/Sources/Modules/Home/HomeStateModel.swift

@@ -48,7 +48,6 @@ extension Home {
         @Published var units: GlucoseUnits = .mmolL
         @Published var low: Decimal = 4
         @Published var high: Decimal = 10
-        @Published var displaySD = false
         @Published var displayLoops = false
         @Published var pumpDisplayState: PumpDisplayState?
         @Published var alarm: GlucoseAlarm?
@@ -73,7 +72,6 @@ extension Home {
             displayStatistics = settingsManager.settings.displayStatistics
             low = settingsManager.preferences.low
             high = settingsManager.preferences.high
-            displaySD = settingsManager.preferences.displaySD
             displayLoops = settingsManager.preferences.displayLoops
             enactedSuggestion = provider.enactedSuggestion
             units = settingsManager.settings.units
@@ -384,7 +382,6 @@ extension Home.StateModel:
         closedLoop = settingsManager.settings.closedLoop
         low = settingsManager.preferences.low
         high = settingsManager.preferences.high
-        displaySD = settingsManager.preferences.displaySD
         displayLoops = settingsManager.preferences.displayLoops
         units = settingsManager.settings.units
         animatedBackground = settingsManager.settings.animatedBackground

+ 131 - 83
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -11,6 +11,21 @@ extension Home {
         @State var isStatusPopupPresented = false
         @State var selectedState: durationState
 
+        // Average/Median and CV/SD titles and values switches when you click them
+        @State var averageOrMedianTitle = NSLocalizedString("Average", comment: "")
+        @State var median_ = ""
+        @State var average_ = ""
+        @State var averageOrmedian = ""
+        @State var CV_or_SD_Title = NSLocalizedString("CV", comment: "CV")
+        @State var cv_ = ""
+        @State var sd_ = ""
+        @State var CVorSD = ""
+        // Switch between Loops and Errors when tapping in ststPanel
+        @State var loopStatTitle = NSLocalizedString("Loops", comment: "Nr of Loops in statPanel")
+        @State var loopsOrerrors = ""
+
+        public let paddingSpace: CGFloat = 15
+
         private var numberFormatter: NumberFormatter {
             let formatter = NumberFormatter()
             formatter.numberStyle = .decimal
@@ -227,15 +242,8 @@ extension Home {
 
         @ViewBuilder private func statPanel() -> some View {
             if state.displayStatistics {
-                VStack(alignment: .center, spacing: 5) {
-                    HStack {
-                        Group {
-                            durationButton(states: durationState.allCases, selectedState: $selectedState)
-
-                            Text("Updated").font(.caption2).foregroundColor(.secondary)
-                            Text(dateFormatter.string(from: state.statistics?.created_at ?? Date())).font(.system(size: 12))
-                        }
-                    }
+                VStack(spacing: 8) {
+                    durationButton(states: durationState.allCases, selectedState: $selectedState)
 
                     switch selectedState {
                     case .day:
@@ -360,7 +368,8 @@ extension Home {
                         averageTIRhca1c(hba1c_all, average_, median_, tir_low, tir_high, tir_, hba1c_, sd_, cv_)
                     }
                 }
-                .frame(maxWidth: .infinity, maxHeight: 130, alignment: .center)
+                .frame(maxWidth: .infinity)
+                .padding([.bottom], 20)
             }
         }
 
@@ -377,98 +386,136 @@ extension Home {
         ) -> some View {
             HStack {
                 Group {
-                    Text(NSLocalizedString("Average", comment: "")).font(.caption2).foregroundColor(.secondary)
-
-                    Text(average_).font(.footnote)
-
-                    Text("Median")
-                        .font(.caption2).foregroundColor(.secondary)
-
-                    Text(median_).font(.footnote)
+                    if selectedState != .total {
+                        HStack {
+                            Text("HbA1c").font(.footnote).foregroundColor(.secondary)
+                            Text(hba1c_).font(.footnote)
+                        }
+                    } else {
+                        HStack {
+                            Text(
+                                "\(NSLocalizedString("HbA1c", comment: "")) (\(targetFormatter.string(from: (state.statistics?.GlucoseStorage_Days ?? 0) as NSNumber) ?? "") \(NSLocalizedString("days", comment: "")))"
+                            )
+                            .font(.footnote).foregroundColor(.secondary)
+                            Text(hba1c_all).font(.footnote)
+                        }
+                    }
+                    // Average as default. Changes to Median when clicking.
+                    let textAverageTitle = NSLocalizedString("Average", comment: "")
+                    let textMedianTitle = NSLocalizedString("Median", comment: "")
 
-                    if !state.settingsManager.preferences.displaySD {
-                        Text(
-                            NSLocalizedString("CV", comment: "CV")
-                        ).font(.caption2).foregroundColor(.secondary)
+                    HStack {
+                        Text(averageOrMedianTitle).font(.footnote).foregroundColor(.secondary)
+                        if averageOrMedianTitle == textAverageTitle {
+                            Text(averageOrmedian == "" ? average_ : average_).font(.footnote)
+                        } else {
+                            Text(averageOrmedian == "" ? median_ : median_).font(.footnote)
+                        }
+                    }.onTapGesture {
+                        if averageOrMedianTitle == textAverageTitle {
+                            averageOrMedianTitle = textMedianTitle
+                            averageOrmedian = median_
+                        } else {
+                            averageOrMedianTitle = textAverageTitle
+                            averageOrmedian = average_
+                        }
+                    }
+                    .frame(minWidth: 110)
+                    // CV as default. Changes to SD when clicking
+                    let text_CV_Title = NSLocalizedString("CV", comment: "")
+                    let text_SD_Title = NSLocalizedString("SD", comment: "")
 
-                        Text(cv_).font(.footnote)
-                    } else {
-                        Text(
-                            NSLocalizedString("SD", comment: "SD")
-                        ).font(.caption2).foregroundColor(.secondary)
-                        Text(sd_).font(.footnote)
+                    HStack {
+                        Text(CV_or_SD_Title).font(.footnote).foregroundColor(.secondary)
+                        if CV_or_SD_Title == text_CV_Title {
+                            Text(CVorSD == "" ? cv_ : cv_).font(.footnote)
+                        } else {
+                            Text(CVorSD == "" ? sd_ : sd_).font(.footnote)
+                        }
+                    }.onTapGesture {
+                        if CV_or_SD_Title == text_CV_Title {
+                            CV_or_SD_Title = text_SD_Title
+                            CVorSD = sd_
+                        } else {
+                            CV_or_SD_Title = text_CV_Title
+                            CVorSD = cv_
+                        }
                     }
                 }
             }
             HStack {
                 Group {
-                    Text(
-                        NSLocalizedString("Low (<", comment: " ") +
-                            (
-                                targetFormatter
-                                    .string(from: state.settingsManager.preferences.low as NSNumber) ?? ""
-                            ) + ")"
-                    ).font(.caption2)
+                    HStack {
+                        Text(
+                            NSLocalizedString("Low", comment: " ")
+                        )
+                        .font(.footnote)
                         .foregroundColor(.secondary)
 
-                    Text(tir_low + " %").font(.footnote).foregroundColor(.loopRed)
-
-                    Text("Normal").font(.caption2).foregroundColor(.secondary)
-
-                    Text(tir_ + " %").font(.footnote).foregroundColor(.loopGreen)
-
-                    Text(
-                        NSLocalizedString("High (>", comment: " ") +
-                            (
-                                targetFormatter
-                                    .string(from: state.settingsManager.preferences.high as NSNumber) ?? ""
-                            ) + ")"
-                    )
-                    .font(.caption2).foregroundColor(.secondary)
-
-                    Text(tir_high + " %").font(.footnote).foregroundColor(.loopYellow)
-                }
-            }
-            HStack {
-                Group {
-                    Text("HbA1c").font(.caption2).foregroundColor(.secondary)
+                        Text(tir_low + " %").font(.footnote).foregroundColor(.loopRed)
+                    }
 
-                    if selectedState != .total {
-                        Text(hba1c_).font(.footnote)
+                    HStack {
+                        Text("Normal").font(.footnote).foregroundColor(.secondary)
+                        Text(tir_ + " %").font(.footnote).foregroundColor(.loopGreen)
                     }
 
-                    Text(
-                        "\(NSLocalizedString("All", comment: "")) \(targetFormatter.string(from: (state.statistics?.GlucoseStorage_Days ?? 0) as NSNumber) ?? "") \(NSLocalizedString("days", comment: ""))"
-                    )
-                    .font(.caption2).foregroundColor(.secondary)
+                    HStack {
+                        Text(
+                            NSLocalizedString("High", comment: " ")
+                        )
+                        .font(.footnote).foregroundColor(.secondary)
 
-                    Text(hba1c_all).font(.footnote)
+                        Text(tir_high + " %").font(.footnote).foregroundColor(.loopYellow)
+                    }
                 }
             }
 
             if state.settingsManager.preferences.displayLoops {
                 HStack {
                     Group {
-                        Text("Loops").font(.caption2).foregroundColor(.secondary)
-                        Text(
-                            tirFormatter
-                                .string(from: (state.statistics?.Statistics.LoopCycles.loops ?? 0) as NSNumber) ?? ""
-                        ).font(.footnote)
-                        Text("Average Interval").font(.caption2)
-                            .foregroundColor(.secondary)
-                        Text(
-                            targetFormatter
-                                .string(from: (state.statistics?.Statistics.LoopCycles.avg_interval ?? 0) as NSNumber) ??
-                                ""
-                        ).font(.footnote)
-                        Text("Median Duration").font(.caption2)
-                            .foregroundColor(.secondary)
-                        Text(
-                            numberFormatter
-                                .string(
-                                    from: (state.statistics?.Statistics.LoopCycles.median_duration ?? 0) as NSNumber
-                                ) ?? ""
-                        ).font(.footnote)
+                        let loopTitle = NSLocalizedString("Loops", comment: "Nr of Loops in statPanel")
+                        let errorTitle = NSLocalizedString("Errors", comment: "Loop Errors in statPanel")
+
+                        HStack {
+                            Text(loopStatTitle).font(.footnote).foregroundColor(.secondary)
+                            Text(
+                                loopsOrerrors == "" ? tirFormatter
+                                    .string(from: (state.statistics?.Statistics.LoopCycles.loops ?? 0) as NSNumber) ?? "" :
+                                    loopsOrerrors
+                            ).font(.footnote)
+                        }.onTapGesture {
+                            if loopStatTitle == loopTitle {
+                                loopStatTitle = errorTitle
+                                loopsOrerrors = tirFormatter
+                                    .string(from: (state.statistics?.Statistics.LoopCycles.errors ?? 0) as NSNumber) ?? ""
+                            } else if loopStatTitle == errorTitle {
+                                loopStatTitle = loopTitle
+                                loopsOrerrors = tirFormatter
+                                    .string(from: (state.statistics?.Statistics.LoopCycles.loops ?? 0) as NSNumber) ?? ""
+                            }
+                        }
+
+                        HStack {
+                            Text("Interval").font(.footnote)
+                                .foregroundColor(.secondary)
+                            Text(
+                                targetFormatter
+                                    .string(from: (state.statistics?.Statistics.LoopCycles.avg_interval ?? 0) as NSNumber) ??
+                                    ""
+                            ).font(.footnote)
+                        }
+
+                        HStack {
+                            Text("Duration").font(.footnote)
+                                .foregroundColor(.secondary)
+                            Text(
+                                numberFormatter
+                                    .string(
+                                        from: (state.statistics?.Statistics.LoopCycles.median_duration ?? 0) as NSNumber
+                                    ) ?? ""
+                            ).font(.footnote)
+                        }
                     }
                 }
             }
@@ -517,6 +564,7 @@ extension Home {
                     }
                 }
                 .frame(maxWidth: .infinity)
+                .padding([.bottom], 20)
             }
         }
 

+ 0 - 12
FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorStateModel.swift

@@ -67,18 +67,6 @@ extension PreferencesEditor {
                 ),
                 Field(
                     displayName: NSLocalizedString(
-                        "Display SD instead of CV",
-                        comment: "Display SD"
-                    ),
-                    type: .boolean(keypath: \.displaySD),
-                    infoText: NSLocalizedString(
-                        "Display Standard Deviation (SD) instead of Coefficient of Variation (CV) in statPanel",
-                        comment: "Description for display SD"
-                    ),
-                    settable: self
-                ),
-                Field(
-                    displayName: NSLocalizedString(
                         "Display Loop Cycle statistics",
                         comment: "Display Display Loop Cycle statistics in statPanel"
                     ),

+ 1 - 1
FreeAPS/Sources/Services/WatchManager/WatchManager.swift

@@ -80,7 +80,7 @@ final class BaseWatchManager: NSObject, WatchManager, Injectable {
                 }
             self.state.bolusAfterCarbs = !self.settingsManager.settings.skipBolusScreenAfterCarbs
 
-            self.state.displayHR = !self.settingsManager.settings.displayHR
+            self.state.displayHR = self.settingsManager.settings.displayHR
 
             self.state.eventualBG = self.evetualBGStraing()
 

+ 42 - 5
FreeAPSWatch WatchKit Extension/Views/MainView.swift

@@ -14,6 +14,9 @@ struct MainView: View {
     @State var isBolusActive = false
     @State private var pulse = 0
 
+    @GestureState var isDetectingLongPress = false
+    @State var completedLongPress = false
+
     private var healthStore = HKHealthStore()
     let heartRateQuantity = HKUnit(from: "count/min")
 
@@ -73,7 +76,7 @@ struct MainView: View {
 
                 VStack(spacing: 0) {
                     HStack {
-                        Circle().stroke(color, lineWidth: 6).frame(width: 30, height: 30).padding(10)
+                        Circle().stroke(color, lineWidth: 5).frame(width: 26, height: 26).padding(10)
                     }
 
                     if state.lastLoopDate != nil {
@@ -108,12 +111,33 @@ struct MainView: View {
                     .foregroundColor(.loopGreen)
                     .minimumScaleFactor(0.5)
 
-                if !state.displayHR {
+                if state.displayHR {
                     Spacer()
                     HStack {
-                        Text("❤️" + " \(pulse)")
-                            .fontWeight(.regular)
-                            .font(.system(size: 18)).foregroundColor(Color.white)
+                        if completedLongPress {
+                            HStack {
+                                Text("❤️" + " \(pulse)")
+                                    .fontWeight(.regular)
+                                    .font(.custom("activated", size: 20))
+                                    .scaledToFill()
+                                    .foregroundColor(.white)
+                                    .minimumScaleFactor(0.5)
+                            }
+                            .scaleEffect(isDetectingLongPress ? 3 : 1)
+                            .gesture(longPress)
+
+                        } else {
+                            HStack {
+                                Text("❤️" + " \(pulse)")
+                                    .fontWeight(.regular)
+                                    .font(.caption2)
+                                    .scaledToFill()
+                                    .foregroundColor(.white)
+                                    .minimumScaleFactor(0.5)
+                            }
+                            .scaleEffect(isDetectingLongPress ? 3 : 1)
+                            .gesture(longPress)
+                        }
                     }
 
                 } else if let eventualBG = state.eventualBG.nonEmpty {
@@ -132,6 +156,19 @@ struct MainView: View {
         }.padding()
     }
 
+    var longPress: some Gesture {
+        LongPressGesture(minimumDuration: 1)
+            .updating($isDetectingLongPress) { currentState, gestureState,
+                _ in
+                gestureState = currentState
+            }
+            .onEnded { _ in
+                if completedLongPress {
+                    completedLongPress = false
+                } else { completedLongPress = true }
+            }
+    }
+
     var buttons: some View {
         HStack(alignment: .center) {
             NavigationLink(isActive: $state.isCarbsViewActive) {