Selaa lähdekoodia

add visual feedback to imap- and smtp-selections

B. Petersen 4 vuotta sitten
vanhempi
commit
1061761d2e

+ 1 - 5
deltachat-ios/Controller/AccountSetup/CertificateCheckController.swift

@@ -25,7 +25,6 @@ class CertificateCheckController: UITableViewController {
         return options.map({
             let cell = UITableViewCell(style: .default, reuseIdentifier: nil)
             cell.textLabel?.text =  ValueConverter.convertHexToString(value: $0)
-            cell.selectionStyle = .none
             return cell
         })
     }
@@ -62,6 +61,7 @@ class CertificateCheckController: UITableViewController {
     }
 
     override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+        tableView.deselectRow(at: indexPath, animated: true) // animated as no other elements pop up
         if indexPath.section == 0 {
             let row = indexPath.row
             selectItem(at: row)
@@ -80,15 +80,11 @@ class CertificateCheckController: UITableViewController {
     }
 
     private func selectItem(at index: Int? ) {
-        // unselect old cell
-        // select new cell
-        // update value
         if let oldIndex = selectedIndex {
             let cell = tableView.cellForRow(at: IndexPath.init(row: oldIndex, section: 0))
             cell?.accessoryType = .none
         }
         if let newIndex = index {
-            // activate accesoryType on selected cell
             let cell = tableView.cellForRow(at: IndexPath.init(row: newIndex, section: 0))
             cell?.accessoryType = .checkmark
             currentValue = options[newIndex]

+ 1 - 3
deltachat-ios/Controller/AccountSetup/SecuritySettingsController.swift

@@ -24,7 +24,6 @@ class SecuritySettingsController: UITableViewController {
         return options.map {
             let cell = UITableViewCell(style: .default, reuseIdentifier: nil)
             cell.textLabel?.text = SecurityConverter.getSocketName(value: $0)
-            cell.selectionStyle = .none
             return cell
         }
     }
@@ -73,11 +72,10 @@ class SecuritySettingsController: UITableViewController {
     }
 
     override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
-        // uselect old
+        tableView.deselectRow(at: indexPath, animated: true) // animated as no other elements pop up
         if let cell = tableView.cellForRow(at: IndexPath(item: selectedIndex, section: 0)) {
             cell.accessoryType = .none
         }
-        // select new
         if let cell = tableView.cellForRow(at: indexPath) {
             cell.accessoryType = .checkmark
         }

+ 0 - 3
deltachat-ios/Controller/AccountSetupController.swift

@@ -187,7 +187,6 @@ class AccountSetupController: UITableViewController, ProgressAlertHandler {
         let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
         cell.textLabel?.text = String.localized("login_imap_security")
         cell.accessoryType = .disclosureIndicator
-        cell.selectionStyle = .none
         cell.tag = tagImapSecurityCell
         return cell
     }()
@@ -253,7 +252,6 @@ class AccountSetupController: UITableViewController, ProgressAlertHandler {
         cell.textLabel?.text = String.localized("login_smtp_security")
         cell.tag = tagSmtpSecurityCell
         cell.accessoryType = .disclosureIndicator
-        cell.selectionStyle = .none
         return cell
     }()
 
@@ -264,7 +262,6 @@ class AccountSetupController: UITableViewController, ProgressAlertHandler {
         cell.detailTextLabel?.text = certCheckType
         cell.tag = tagCertCheckCell
         cell.accessoryType = .disclosureIndicator
-        cell.selectionStyle = .none
         return cell
     }()