瀏覽代碼

add basic autodelete options to settings

B. Petersen 5 年之前
父節點
當前提交
f687c27aae
共有 2 個文件被更改,包括 27 次插入1 次删除
  1. 24 1
      deltachat-ios/Controller/SettingsController.swift
  2. 3 0
      deltachat-ios/Coordinator/AppCoordinator.swift

+ 24 - 1
deltachat-ios/Controller/SettingsController.swift

@@ -21,6 +21,7 @@ internal final class SettingsViewController: UITableViewController {
         case exportBackup = 8
         case advanced = 9
         case help = 10
+        case autodel = 11
     }
 
     weak var coordinator: SettingsCoordinator?
@@ -76,6 +77,25 @@ internal final class SettingsViewController: UITableViewController {
         return cell
     }()
 
+    func autodelSummary() -> String {
+        let delDeviceAfter = dcContext.getConfigInt("delete_device_after")
+        let delServerAfter = dcContext.getConfigInt("delete_server_after")
+        if delDeviceAfter==0 && delServerAfter==0 {
+            return String.localized("off")
+        } else {
+            return String.localized("on")
+        }
+    }
+
+    private lazy var autodelCell: UITableViewCell = {
+        let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
+        cell.tag = CellTags.autodel.rawValue
+        cell.textLabel?.text = String.localized("autodel_title")
+        cell.accessoryType = .disclosureIndicator
+        cell.detailTextLabel?.text = autodelSummary()
+        return cell
+    }()
+
     private var notificationSwitch: UISwitch = {
         let switchControl = UISwitch()
         switchControl.isUserInteractionEnabled = false // toggled by cell tap
@@ -166,7 +186,7 @@ internal final class SettingsViewController: UITableViewController {
         let preferencesSection = SectionConfigs(
             headerTitle: nil,
             footerTitle: String.localized("pref_read_receipts_explain"),
-            cells: [contactRequestCell, chatPreferenceCell, blockedContactsCell, notificationCell, receiptConfirmationCell]
+            cells: [contactRequestCell, chatPreferenceCell, blockedContactsCell, autodelCell, notificationCell, receiptConfirmationCell]
         )
         let autocryptSection = SectionConfigs(
             headerTitle: String.localized("autocrypt"),
@@ -282,6 +302,7 @@ internal final class SettingsViewController: UITableViewController {
         case .contactRequest: self.coordinator?.showContactRequests()
         case .preferences: coordinator?.showClassicMail()
         case .blockedContacts: coordinator?.showBlockedContacts()
+        case .autodel: coordinator?.showAutodelOptions()
         case .notifications: handleNotificationToggle()
         case .receiptConfirmation: handleReceiptConfirmationToggle()
         case .autocryptPreferences: handleAutocryptPreferencesToggle()
@@ -415,5 +436,7 @@ internal final class SettingsViewController: UITableViewController {
         profileCell.update(contact: selfContact, displayName: displayName, address: email)
 
         chatPreferenceCell.detailTextLabel?.text = SettingsClassicViewController.getValString(val: dcContext.showEmails)
+
+        autodelCell.detailTextLabel?.text = autodelSummary()
     }
 }

+ 3 - 0
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -300,6 +300,9 @@ class SettingsCoordinator: Coordinator {
         navigationController.pushViewController(blockedContactsController, animated: true)
     }
 
+    func showAutodelOptions() {
+    }
+
     func showContactRequests() {
         let deaddropViewController = MailboxViewController(dcContext: dcContext, chatId: Int(DC_CHAT_ID_DEADDROP))
         let deaddropCoordinator = MailboxCoordinator(dcContext: dcContext, navigationController: navigationController)