From 6eef9e8b51ac537e92b12963e1a00506119ace47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bj=C3=B6rkert?= Date: Mon, 15 Jan 2024 15:11:05 +0100 Subject: [PATCH] Display profile --- LoopFollow/Controllers/NightScout.swift | 3 ++- LoopFollow/Controllers/Nightscout/Profile.swift | 5 ++++- LoopFollow/ViewControllers/MainViewController.swift | 3 ++- LoopFollow/repository/UserDefaults.swift | 7 ++++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/LoopFollow/Controllers/NightScout.swift b/LoopFollow/Controllers/NightScout.swift index bdaa67bba..bdc66022a 100644 --- a/LoopFollow/Controllers/NightScout.swift +++ b/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() } -} \ No newline at end of file +} diff --git a/LoopFollow/Controllers/Nightscout/Profile.swift b/LoopFollow/Controllers/Nightscout/Profile.swift index 2c010ec02..96a3eac1c 100644 --- a/LoopFollow/Controllers/Nightscout/Profile.swift +++ b/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) diff --git a/LoopFollow/ViewControllers/MainViewController.swift b/LoopFollow/ViewControllers/MainViewController.swift index 6f89f79dc..16384d833 100644 --- a/LoopFollow/ViewControllers/MainViewController.swift +++ b/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; diff --git a/LoopFollow/repository/UserDefaults.swift b/LoopFollow/repository/UserDefaults.swift index c16778e9f..2c161b005 100644 --- a/LoopFollow/repository/UserDefaults.swift +++ b/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(key: "hideInfoTable", default: false) // Nightscout Settings