Sfoglia il codice sorgente

show permanent-notification hint in set-autodel-view-controller

B. Petersen 4 anni fa
parent
commit
54dddccf07

+ 9 - 0
deltachat-ios/Controller/SettingsAutodelSetController.swift

@@ -128,6 +128,7 @@ class SettingsAutodelSetController: UITableViewController {
                 oldSelectedCell?.accessoryType = .none
                 newSelectedCell?.accessoryType = .checkmark
                 self.currVal = newVal
+                self.tableView.reloadData() // needed to update footer
             }))
             alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel))
             present(alert, animated: true, completion: nil)
@@ -135,6 +136,7 @@ class SettingsAutodelSetController: UITableViewController {
             oldSelectedCell?.accessoryType = .none
             newSelectedCell?.accessoryType = .checkmark
             currVal = newVal
+            self.tableView.reloadData() // needed to update footer
         }
     }
 
@@ -146,6 +148,13 @@ class SettingsAutodelSetController: UITableViewController {
         return String.localized(fromServer ? "autodel_server_title" : "autodel_device_title")
     }
 
+    override func tableView(_: UITableView, titleForFooterInSection section: Int) -> String? {
+        if fromServer && currVal != 0 {
+            return String.localized("autodel_server_enabled_hint")
+        }
+        return nil
+    }
+
     // MARK: - actions
 
     @objc private func cancelButtonPressed() {