Просмотр исходного кода

Add setting to hide Information Table

jonfawcett 3 лет назад
Родитель
Сommit
70d082df10

+ 10 - 0
LoopFollow/ViewControllers/InfoDisplaySettingsViewController.swift

@@ -27,6 +27,16 @@ class InfoDisplaySettingsViewController: FormViewController {
     
     private func createForm() {
         form
+        +++ Section("General")
+        <<< SwitchRow("hideInfoTable"){ row in
+            row.title = "Hide Information Table"
+            row.tag = "hideInfoTable"
+            row.value = UserDefaultsRepository.hideInfoTable.value
+        }.onChange { [weak self] row in
+                    guard let value = row.value else { return }
+                    UserDefaultsRepository.hideInfoTable.value = value           
+        }
+        
         +++ MultivaluedSection(multivaluedOptions: .Reorder, header: "Information Display Settings", footer: "Arrage/Enable Information Desired") {
         
            // TODO: add the other display values

+ 4 - 0
LoopFollow/ViewControllers/MainViewController.swift

@@ -398,6 +398,10 @@ class MainViewController: UIViewController, UITableViewDataSource, ChartViewDele
         PredictionLabel.isHidden = isHidden
         infoTable.isHidden = isHidden
         
+        if UserDefaultsRepository.hideInfoTable.value {
+            infoTable.isHidden = true
+        }
+        
         if UserDefaultsRepository.url.value != "" {
             isEnabled = true
         }

+ 1 - 0
LoopFollow/repository/UserDefaults.swift

@@ -32,6 +32,7 @@ class UserDefaultsRepository {
         "Pred."])
     static let infoSort = UserDefaultsValue<[Int]>(key: "infoSort", default: [0,1,2,3,4,5,6,7,8,9])
     static let infoVisible = UserDefaultsValue<[Bool]>(key: "infoVisible", default: [true,true,true,true,true,true,true,true,true,true])
+    static let hideInfoTable = UserDefaultsValue<Bool>(key: "hideInfoTable", default: false)
     
     // Nightscout Settings
     static let showNS = UserDefaultsValue<Bool>(key: "showNS", default: false)