ソースを参照

oref0 variables descriptions. (#74)

* Descriptive alerts for preferences.

Descriptions. Commit 2. Header of descriptions now with the variable name

Descriptions. Commit 3. Remove ⓘ character

Descriptiion. Commit 4. Refactoring.

Description. Commit 5. No console errors now.

Descriptions. Commit 6.  Better formatting of description alerts.

(cherry picked from commit e1f645afa813d901236e7ce9df4e35bf1731cea3)

* InfoText (Alerts) will now be localized when translations exists

(cherry picked from commit fc712d38e53438f01fb5f2ab4af8fa8d61bb784b)

* Remove some test experimental fields

* Adding Localizable.strings.

* English source files was hidden... Is now back.

* Update Max IOB description

* Some typos in descriptions, added complete Swedish translations for descriptions, edited "Skip Neutral temp" description to make it clear that this is an old setting for OpenAPS rigs.
Jon B Mårtensson 4 年 前
コミット
4d07a9fca3
22 ファイル変更9319 行追加11 行削除
  1. 84 0
      FreeAPS.xcodeproj/project.pbxproj
  2. 504 0
      FreeAPS/Sources/Localizations/Main/ar.lproj/Localizable.strings
  3. 504 0
      FreeAPS/Sources/Localizations/Main/ca.lproj/Localizable.strings
  4. 504 0
      FreeAPS/Sources/Localizations/Main/da.lproj/Localizable.strings
  5. 504 0
      FreeAPS/Sources/Localizations/Main/de.lproj/Localizable.strings
  6. 504 0
      FreeAPS/Sources/Localizations/Main/el.lproj/Localizable.strings
  7. 504 0
      FreeAPS/Sources/Localizations/Main/en.lproj/Localizable.strings
  8. 504 0
      FreeAPS/Sources/Localizations/Main/es.lproj/Localizable.strings
  9. 504 0
      FreeAPS/Sources/Localizations/Main/fi.lproj/Localizable.strings
  10. 504 0
      FreeAPS/Sources/Localizations/Main/fr.lproj/Localizable.strings
  11. 504 0
      FreeAPS/Sources/Localizations/Main/he.lproj/Localizable.strings
  12. 504 0
      FreeAPS/Sources/Localizations/Main/it.lproj/Localizable.strings
  13. 504 0
      FreeAPS/Sources/Localizations/Main/nb.lproj/Localizable.strings
  14. 504 0
      FreeAPS/Sources/Localizations/Main/nl.lproj/Localizable.strings
  15. 504 0
      FreeAPS/Sources/Localizations/Main/pl.lproj/Localizable.strings
  16. 504 0
      FreeAPS/Sources/Localizations/Main/ru.lproj/Localizable.strings
  17. 486 0
      FreeAPS/Sources/Localizations/Main/sv.lproj/Localizable.strings
  18. 504 0
      FreeAPS/Sources/Localizations/Main/uk.lproj/Localizable.strings
  19. 504 0
      FreeAPS/Sources/Localizations/Main/zh-Hans.lproj/Localizable.strings
  20. 9 1
      FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorDataFlow.swift
  21. 148 8
      FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorViewModel.swift
  22. 24 2
      FreeAPS/Sources/Modules/PreferencesEditor/View/PreferencesEditorRootView.swift

+ 84 - 0
FreeAPS.xcodeproj/project.pbxproj

@@ -12,6 +12,7 @@
 		0D9A5E34A899219C5C4CDFAF /* DataTableViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9455FA2D92E77A6C4AFED8A3 /* DataTableViewModel.swift */; };
 		17A9D0899046B45E87834820 /* CREditorProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D5F457B5AFF763F8CF3DF /* CREditorProvider.swift */; };
 		19434C14DF3F4816F4E4BF2E /* BolusBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77FAEF7B34EEC71B3A7B800C /* BolusBuilder.swift */; };
+		19BE6CBA2674132500624F4A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 19BE6CBC2674132500624F4A /* Localizable.strings */; };
 		1BBB001DAD60F3B8CEA4B1C7 /* ISFEditorViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 505E09DC17A0C3D0AF4B66FE /* ISFEditorViewModel.swift */; };
 		1D086541F369D339A74893AC /* BasalProfileEditorBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BA56D2DCAB9E0A8AF24D984 /* BasalProfileEditorBuilder.swift */; };
 		1D845DF2E3324130E1D95E67 /* DataTableProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60744C3E9BB3652895C908CC /* DataTableProvider.swift */; };
@@ -314,6 +315,24 @@
 		10CAE3534904CDCA0F367017 /* PumpSettingsEditorBuilder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PumpSettingsEditorBuilder.swift; sourceTree = "<group>"; };
 		111579A6E3AC6BFA79C4DD43 /* NightscoutConfigBuilder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NightscoutConfigBuilder.swift; sourceTree = "<group>"; };
 		12204445D7632AF09264A979 /* PreferencesEditorDataFlow.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PreferencesEditorDataFlow.swift; sourceTree = "<group>"; };
+		19BE6CBD2674152700624F4A /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CBE2674152D00624F4A /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CBF2674153200624F4A /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
+		19BE6CC02674153800624F4A /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CC12674153C00624F4A /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CC22674154300624F4A /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CC42674155000624F4A /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CC52674155A00624F4A /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CC62674156100624F4A /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CC72674156600624F4A /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CC82674156E00624F4A /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CC92674157400624F4A /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CCA2674158400624F4A /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CCB2674158900624F4A /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CCC2674158F00624F4A /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CCD2674159600624F4A /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CCE2674159C00624F4A /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
+		19BE6CCF267559A100624F4A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
 		223EC0494F55A91E3EA69EF4 /* BolusViewModel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = BolusViewModel.swift; sourceTree = "<group>"; };
 		2AD22C985B79A2F0D2EA3D9D /* PumpConfigRootView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PumpConfigRootView.swift; sourceTree = "<group>"; };
 		2F2A13DF0EDEEEDC4106AA2A /* NightscoutConfigDataFlow.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NightscoutConfigDataFlow.swift; sourceTree = "<group>"; };
@@ -624,6 +643,22 @@
 			path = View;
 			sourceTree = "<group>";
 		};
+		19BE6CB6267412C200624F4A /* Localizations */ = {
+			isa = PBXGroup;
+			children = (
+				19BE6CB7267412CF00624F4A /* Main */,
+			);
+			path = Localizations;
+			sourceTree = "<group>";
+		};
+		19BE6CB7267412CF00624F4A /* Main */ = {
+			isa = PBXGroup;
+			children = (
+				19BE6CBC2674132500624F4A /* Localizable.strings */,
+			);
+			path = Main;
+			sourceTree = "<group>";
+		};
 		34CA4DF169B53D67EF18ED8A /* View */ = {
 			isa = PBXGroup;
 			children = (
@@ -676,6 +711,7 @@
 		3811DE1325C9D39E00A708ED /* Sources */ = {
 			isa = PBXGroup;
 			children = (
+				19BE6CB6267412C200624F4A /* Localizations */,
 				3811DEDE25C9E2DD00A708ED /* Application */,
 				3811DF0A25CAAAA500A708ED /* APS */,
 				38E98A3225F5300800C0CED0 /* Config */,
@@ -1556,6 +1592,23 @@
 			knownRegions = (
 				en,
 				Base,
+				ar,
+				ca,
+				"zh-Hans",
+				da,
+				nl,
+				fr,
+				fi,
+				de,
+				el,
+				he,
+				it,
+				nb,
+				pl,
+				ru,
+				sv,
+				uk,
+				es,
 			);
 			mainGroup = 388E594F25AD948C0019842D;
 			packageReferences = (
@@ -1581,6 +1634,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				388E596025AD948E0019842D /* Assets.xcassets in Resources */,
+				19BE6CBA2674132500624F4A /* Localizable.strings in Resources */,
 				388E597225AD9CF10019842D /* json in Resources */,
 				388E596F25AD96040019842D /* javascript in Resources */,
 			);
@@ -1865,12 +1919,41 @@
 		};
 /* End PBXTargetDependency section */
 
+/* Begin PBXVariantGroup section */
+		19BE6CBC2674132500624F4A /* Localizable.strings */ = {
+			isa = PBXVariantGroup;
+			children = (
+				19BE6CBD2674152700624F4A /* ar */,
+				19BE6CBE2674152D00624F4A /* ca */,
+				19BE6CBF2674153200624F4A /* zh-Hans */,
+				19BE6CC02674153800624F4A /* da */,
+				19BE6CC12674153C00624F4A /* nl */,
+				19BE6CC22674154300624F4A /* fr */,
+				19BE6CC42674155000624F4A /* fi */,
+				19BE6CC52674155A00624F4A /* de */,
+				19BE6CC62674156100624F4A /* el */,
+				19BE6CC72674156600624F4A /* he */,
+				19BE6CC82674156E00624F4A /* it */,
+				19BE6CC92674157400624F4A /* nb */,
+				19BE6CCA2674158400624F4A /* pl */,
+				19BE6CCB2674158900624F4A /* ru */,
+				19BE6CCC2674158F00624F4A /* sv */,
+				19BE6CCD2674159600624F4A /* uk */,
+				19BE6CCE2674159C00624F4A /* es */,
+				19BE6CCF267559A100624F4A /* en */,
+			);
+			name = Localizable.strings;
+			sourceTree = "<group>";
+		};
+/* End PBXVariantGroup section */
+
 /* Begin XCBuildConfiguration section */
 		388E596525AD948E0019842D /* Debug */ = {
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = 38F3783A2613555C009DB701 /* Config.xcconfig */;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
 				CLANG_ANALYZER_NONNULL = YES;
 				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
 				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
@@ -1934,6 +2017,7 @@
 			baseConfigurationReference = 38F3783A2613555C009DB701 /* Config.xcconfig */;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
 				CLANG_ANALYZER_NONNULL = YES;
 				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
 				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";

ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/ar.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/ca.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/da.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/de.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/el.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/en.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/es.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/fi.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/fr.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/he.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/it.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/nb.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/nl.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/pl.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/ru.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 486 - 0
FreeAPS/Sources/Localizations/Main/sv.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/uk.lproj/Localizable.strings


ファイルの差分が大きいため隠しています
+ 504 - 0
FreeAPS/Sources/Localizations/Main/zh-Hans.lproj/Localizable.strings


+ 9 - 1
FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorDataFlow.swift

@@ -6,6 +6,7 @@ enum PreferencesEditor {
     class Field<T>: Identifiable {
         var displayName: String
         var keypath: WritableKeyPath<Preferences, T>
+        var infoText: String
         var value: T {
             didSet {
                 settable?.onSet(keypath, value: value)
@@ -14,10 +15,17 @@ enum PreferencesEditor {
 
         weak var settable: PreferencesSettable?
 
-        init(displayName: String, keypath: WritableKeyPath<Preferences, T>, value: T, settable: PreferencesSettable? = nil) {
+        init(
+            displayName: String,
+            keypath: WritableKeyPath<Preferences, T>,
+            value: T,
+            infoText: String,
+            settable: PreferencesSettable? = nil
+        ) {
             self.displayName = displayName
             self.keypath = keypath
             self.value = value
+            self.infoText = infoText
             self.settable = settable
         }
 

ファイルの差分が大きいため隠しています
+ 148 - 8
FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorViewModel.swift


+ 24 - 2
FreeAPS/Sources/Modules/PreferencesEditor/View/PreferencesEditorRootView.swift

@@ -1,5 +1,11 @@
 import SwiftUI
 
+struct InfoText: Identifiable {
+    var id: String { description }
+    let description: String
+    let oref0Variable: String
+}
+
 extension PreferencesEditor {
     struct RootView: BaseView {
         @EnvironmentObject var viewModel: ViewModel<Provider>
@@ -10,6 +16,8 @@ extension PreferencesEditor {
             return formatter
         }
 
+        @State private var infoButtonPressed: InfoText?
+
         var body: some View {
             Form {
                 Section(header: Text("FreeAPS X")) {
@@ -36,17 +44,24 @@ extension PreferencesEditor {
                     }
 
                     ForEach(viewModel.boolFields.indexed(), id: \.1.id) { index, field in
-                        Toggle(field.displayName, isOn: self.$viewModel.boolFields[index].value)
+                        HStack {
+                            Button("", action: {
+                                infoButtonPressed = InfoText(description: field.infoText, oref0Variable: field.displayName)
+                            })
+                            Toggle(field.displayName, isOn: self.$viewModel.boolFields[index].value)
+                        }
                     }
 
                     ForEach(viewModel.decimalFields.indexed(), id: \.1.id) { index, field in
                         HStack {
+                            Button("", action: {
+                                infoButtonPressed = InfoText(description: field.infoText, oref0Variable: field.displayName)
+                            })
                             Text(field.displayName)
                             DecimalTextField("0", value: self.$viewModel.decimalFields[index].value, formatter: formatter)
                         }
                     }
                 }
-
                 Section {
                     Text("Edit settings json").chevronCell()
                         .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.settings), from: self)
@@ -54,6 +69,13 @@ extension PreferencesEditor {
             }
             .navigationTitle("Preferences")
             .navigationBarTitleDisplayMode(.automatic)
+            .alert(item: $infoButtonPressed) { infoButton in
+                Alert(
+                    title: Text("\(infoButton.oref0Variable)"),
+                    message: Text("\(infoButton.description)"),
+                    dismissButton: .default(Text("OK"))
+                )
+            }
         }
     }
 }