Forráskód Böngészése

Additional info for CGM types

Ivan Valkou 4 éve
szülő
commit
1365051d8c

+ 28 - 0
FreeAPS/Sources/APS/CGM/CGMType.swift

@@ -43,4 +43,32 @@ enum CGMType: String, JSON, CaseIterable, Identifiable {
             return URL(string: "freeaps-x://libre-transmitter")!
         }
     }
+
+    var externalLink: URL? {
+        switch self {
+        case .xdrip:
+            return URL(string: "https://github.com/JohanDegraeve/xdripswift")!
+        default: return nil
+        }
+    }
+
+    var subtitle: String {
+        switch self {
+        case .nightscout:
+            return NSLocalizedString("Online or internal server", comment: "Online or internal server")
+        case .xdrip:
+            return NSLocalizedString("Shared app group", comment: "Shared app group")
+        case .dexcomG6:
+            return NSLocalizedString("Native G6 app", comment: "Native G6 app")
+        case .dexcomG5:
+            return NSLocalizedString("Native G5 app", comment: "Native G5 app")
+        case .simulator:
+            return NSLocalizedString("Simple simulator", comment: "Simple simulator")
+        case .libreTransmitter:
+            return NSLocalizedString(
+                "Direct connection with Libre 1 transmiters or Libre 2",
+                comment: "Direct connection with Libre 1 transmiters or Libre 2"
+            )
+        }
+    }
 }

+ 10 - 2
FreeAPS/Sources/Modules/CGM/View/CGMRootView.swift

@@ -10,8 +10,16 @@ extension CGM {
             Form {
                 Section {
                     Picker("Type", selection: $state.cgm) {
-                        ForEach(CGMType.allCases) {
-                            Text($0.displayName).tag($0)
+                        ForEach(CGMType.allCases) { type in
+                            VStack(alignment: .leading) {
+                                Text(type.displayName)
+                                Text(type.subtitle).font(.caption).foregroundColor(.secondary)
+                            }.tag(type)
+                        }
+                    }
+                    if let link = state.cgm.externalLink {
+                        Button("About this source") {
+                            UIApplication.shared.open(link, options: [:], completionHandler: nil)
                         }
                     }
                 }

+ 1 - 1
FreeAPS/Sources/Modules/HealthKit/HealthKitStateModel.swift

@@ -23,7 +23,7 @@ extension AppleHealthKit {
                     return
                 }
 
-                self.healthKitManager.requestPermission { status, error in
+                self.healthKitManager.requestPermission { _, error in
                     guard error == nil else {
                         return
                     }