Browse Source

Display profile

Jonas Björkert 2 năm trước cách đây
mục cha
commit
6eef9e8b51

+ 2 - 1
LoopFollow/Controllers/NightScout.swift

@@ -39,6 +39,7 @@ extension MainViewController {
         }
         
         let store: [String: Store]
+        let defaultProfile: String
     }
     
     //NS Basal Data  Struct
@@ -130,4 +131,4 @@ extension MainViewController {
         noteGraphData.removeAll()
         updateNotes()
     }
-}
+}

+ 4 - 1
LoopFollow/Controllers/Nightscout/Profile.swift

@@ -27,7 +27,10 @@ extension MainViewController {
         guard let store = profileData.store["default"] ?? profileData.store["Default"] else {
             return
         }
-        
+                
+        tableData[12].value = profileData.defaultProfile
+        infoTable.reloadData()
+
         basalProfile.removeAll()
         for basalEntry in store.basal {
             let entry = basalProfileStruct(value: basalEntry.value, time: basalEntry.time, timeAsSeconds: basalEntry.timeAsSeconds)

+ 2 - 1
LoopFollow/ViewControllers/MainViewController.swift

@@ -165,7 +165,8 @@ class MainViewController: UIViewController, UITableViewDataSource, ChartViewDele
         UserDefaultsRepository.infoNames.value.append("Pred.")
         UserDefaultsRepository.infoNames.value.append("Carbs today")
         UserDefaultsRepository.infoNames.value.append("Autosens")
-        
+        UserDefaultsRepository.infoNames.value.append("Profile")
+
         // Reset deprecated settings
         UserDefaultsRepository.debugLog.value = false;
         UserDefaultsRepository.alwaysDownloadAllBG.value = true;

+ 4 - 3
LoopFollow/repository/UserDefaults.swift

@@ -31,9 +31,10 @@ class UserDefaultsRepository {
         "Rec. Bolus",
         "Pred.",
         "Carbs today",
-        "Autosens"])
-    static let infoSort = UserDefaultsValue<[Int]>(key: "infoSort", default: [0,1,2,3,4,5,6,7,8,9,10,11])
-    static let infoVisible = UserDefaultsValue<[Bool]>(key: "infoVisible", default: [true,true,true,true,true,true,true,true,true,true,true,false])
+        "Autosens",
+        "Profile"])
+    static let infoSort = UserDefaultsValue<[Int]>(key: "infoSort", default: [0,1,2,3,4,5,6,7,8,9,10,11,12])
+    static let infoVisible = UserDefaultsValue<[Bool]>(key: "infoVisible", default: [true,true,true,true,true,true,true,true,true,true,true,false,false])
     static let hideInfoTable = UserDefaultsValue<Bool>(key: "hideInfoTable", default: false)
     
     // Nightscout Settings