Преглед изворни кода

Merge pull request #384 from deltachat/streamline-login

streamline login
cyBerta пре 5 година
родитељ
комит
07e4b07f5b

+ 0 - 4
deltachat-ios.xcodeproj/project.pbxproj

@@ -112,7 +112,6 @@
 		7AE0A5491FC42F65005ECB4B /* NewChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE0A5481FC42F65005ECB4B /* NewChatViewController.swift */; };
 		7AE0A5491FC42F65005ECB4B /* NewChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE0A5481FC42F65005ECB4B /* NewChatViewController.swift */; };
 		8B6D425BC604F7C43B65D436 /* Pods_deltachat_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6241BE1534A653E79AD5D01D /* Pods_deltachat_ios.framework */; };
 		8B6D425BC604F7C43B65D436 /* Pods_deltachat_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6241BE1534A653E79AD5D01D /* Pods_deltachat_ios.framework */; };
 		AE0D26FD1FB1FE88002FAFCE /* ChatListController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE0D26FC1FB1FE88002FAFCE /* ChatListController.swift */; };
 		AE0D26FD1FB1FE88002FAFCE /* ChatListController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE0D26FC1FB1FE88002FAFCE /* ChatListController.swift */; };
-		AE18F292228C17BC0007B1BE /* PortSettingsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE18F291228C17BC0007B1BE /* PortSettingsController.swift */; };
 		AE18F294228C602A0007B1BE /* SecuritySettingsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE18F293228C602A0007B1BE /* SecuritySettingsController.swift */; };
 		AE18F294228C602A0007B1BE /* SecuritySettingsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE18F293228C602A0007B1BE /* SecuritySettingsController.swift */; };
 		AE25F09022807AD800CDEA66 /* GroupNameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE25F08F22807AD800CDEA66 /* GroupNameCell.swift */; };
 		AE25F09022807AD800CDEA66 /* GroupNameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE25F08F22807AD800CDEA66 /* GroupNameCell.swift */; };
 		AE38B31822672DFC00EC37A1 /* ActionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE38B31722672DFC00EC37A1 /* ActionCell.swift */; };
 		AE38B31822672DFC00EC37A1 /* ActionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE38B31722672DFC00EC37A1 /* ActionCell.swift */; };
@@ -327,7 +326,6 @@
 		8DE110C607A0E4485C43B5FA /* Pods-deltachat-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-deltachat-ios.debug.xcconfig"; path = "Pods/Target Support Files/Pods-deltachat-ios/Pods-deltachat-ios.debug.xcconfig"; sourceTree = "<group>"; };
 		8DE110C607A0E4485C43B5FA /* Pods-deltachat-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-deltachat-ios.debug.xcconfig"; path = "Pods/Target Support Files/Pods-deltachat-ios/Pods-deltachat-ios.debug.xcconfig"; sourceTree = "<group>"; };
 		A8615D4600859851E53CAA9C /* Pods-deltachat-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-deltachat-ios.release.xcconfig"; path = "Pods/Target Support Files/Pods-deltachat-ios/Pods-deltachat-ios.release.xcconfig"; sourceTree = "<group>"; };
 		A8615D4600859851E53CAA9C /* Pods-deltachat-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-deltachat-ios.release.xcconfig"; path = "Pods/Target Support Files/Pods-deltachat-ios/Pods-deltachat-ios.release.xcconfig"; sourceTree = "<group>"; };
 		AE0D26FC1FB1FE88002FAFCE /* ChatListController.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = ChatListController.swift; sourceTree = "<group>"; tabWidth = 4; };
 		AE0D26FC1FB1FE88002FAFCE /* ChatListController.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = ChatListController.swift; sourceTree = "<group>"; tabWidth = 4; };
-		AE18F291228C17BC0007B1BE /* PortSettingsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PortSettingsController.swift; sourceTree = "<group>"; };
 		AE18F293228C602A0007B1BE /* SecuritySettingsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecuritySettingsController.swift; sourceTree = "<group>"; };
 		AE18F293228C602A0007B1BE /* SecuritySettingsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecuritySettingsController.swift; sourceTree = "<group>"; };
 		AE25F08F22807AD800CDEA66 /* GroupNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupNameCell.swift; sourceTree = "<group>"; };
 		AE25F08F22807AD800CDEA66 /* GroupNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupNameCell.swift; sourceTree = "<group>"; };
 		AE38B31722672DFC00EC37A1 /* ActionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionCell.swift; sourceTree = "<group>"; };
 		AE38B31722672DFC00EC37A1 /* ActionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionCell.swift; sourceTree = "<group>"; };
@@ -622,7 +620,6 @@
 		AE18F28B228C17630007B1BE /* AccountSetup */ = {
 		AE18F28B228C17630007B1BE /* AccountSetup */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
-				AE18F291228C17BC0007B1BE /* PortSettingsController.swift */,
 				30C0D49C237C4908008E2A0E /* CertificateCheckController.swift */,
 				30C0D49C237C4908008E2A0E /* CertificateCheckController.swift */,
 				AE18F293228C602A0007B1BE /* SecuritySettingsController.swift */,
 				AE18F293228C602A0007B1BE /* SecuritySettingsController.swift */,
 			);
 			);
@@ -1123,7 +1120,6 @@
 				305961FB2346125100C80F33 /* TypingIndicator.swift in Sources */,
 				305961FB2346125100C80F33 /* TypingIndicator.swift in Sources */,
 				7092474120B3869500AF8799 /* ContactDetailViewController.swift in Sources */,
 				7092474120B3869500AF8799 /* ContactDetailViewController.swift in Sources */,
 				300C50A1234BDAB800F8AE22 /* TextMediaMessageSizeCalculator.swift in Sources */,
 				300C50A1234BDAB800F8AE22 /* TextMediaMessageSizeCalculator.swift in Sources */,
-				AE18F292228C17BC0007B1BE /* PortSettingsController.swift in Sources */,
 				30F9B9EC235F2116006E7ACF /* MessageCounter.swift in Sources */,
 				30F9B9EC235F2116006E7ACF /* MessageCounter.swift in Sources */,
 				305961F12346125100C80F33 /* ContactMessageCell.swift in Sources */,
 				305961F12346125100C80F33 /* ContactMessageCell.swift in Sources */,
 				AE851AD0227DF50900ED86F0 /* GroupChatDetailViewController.swift in Sources */,
 				AE851AD0227DF50900ED86F0 /* GroupChatDetailViewController.swift in Sources */,

+ 0 - 148
deltachat-ios/Controller/AccountSetup/PortSettingsController.swift

@@ -1,148 +0,0 @@
-import UIKit
-
-class PortSettingsController: UITableViewController {
-
-    var ports: [Int]
-
-    private var sectionTitle: String?
-
-    var onSave: ((String) -> Void)?
-
-    var okButton: UIBarButtonItem {
-        let button =  UIBarButtonItem(title: String.localized("ok"), style: .done, target: self, action: #selector(okButtonPressed))
-        return button
-    }
-
-    var cancelButton: UIBarButtonItem {
-        let button =  UIBarButtonItem(title: String.localized("cancel"), style: .plain, target: self, action: #selector(cancelButtonPressed))
-        return button
-    }
-
-    var currentPort: Int
-    var selectedIndex: Int?
-
-    var staticCells: [UITableViewCell] {
-        return ports.map({
-            let cell = UITableViewCell(style: .default, reuseIdentifier: nil)
-            cell.textLabel?.text = "\($0)"
-            cell.selectionStyle = .none
-            return cell
-        })
-    }
-
-    lazy var customCell: TextFieldCell = {
-        let cell = TextFieldCell(description: "", placeholder: "\(self.currentPort)")
-        cell.selectionStyle = .none
-        cell.textLabel?.text = nil
-        cell.textField.keyboardType = .numberPad
-        cell.onTextFieldChange = textFieldDidChange
-        return cell
-    }()
-
-    init(sectionTitle: String?, ports: [Int], currentPort: Int?) {
-        self.ports = ports
-        self.sectionTitle = sectionTitle
-        self.currentPort = currentPort ?? 0
-        for (index, port) in ports.enumerated() where currentPort == port {
-            selectedIndex = index
-        }
-        super.init(style: .grouped)
-        self.title = sectionTitle
-    }
-
-    required init?(coder aDecoder: NSCoder) {
-        fatalError("init(coder:) has not been implemented")
-    }
-
-    override func viewDidLoad() {
-        super.viewDidLoad()
-
-        navigationItem.rightBarButtonItem = okButton
-        navigationItem.leftBarButtonItem = cancelButton
-    }
-
-    // MARK: - Table view data source
-
-    override func numberOfSections(in tableView: UITableView) -> Int {
-        return 2
-    }
-
-    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-        if section == 0 {
-            return ports.count
-        } else {
-            return 1
-        }
-    }
-
-    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
-        if indexPath.section == 0 {
-            let row = indexPath.row
-            selectItem(at: row)
-        }
-    }
-
-    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
-
-        let section = indexPath.section
-        let row = indexPath.row
-        if section == 0 {
-            let cell = staticCells[row]
-            if row == selectedIndex || cell.textLabel?.text == "\(currentPort)" {
-                cell.accessoryType = .checkmark
-            } else {
-                cell.accessoryType = .none
-            }
-            return cell
-        } else {
-            // section == 1
-            return customCell
-        }
-    }
-
-    override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
-        if section == 0 {
-            return sectionTitle
-        } else {
-            return String.localized("custom_port")
-        }
-    }
-
-    private func textFieldDidChange(_ textField: UITextField) {
-        selectItem(at: nil)
-        if let text = textField.text, let port = Int(text) {
-            self.currentPort = port
-        }
-    }
-
-    private func selectItem(at index: Int? ) {
-        // unselect old cell
-        // select new cell
-        // update port
-        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
-            currentPort = ports[newIndex]
-            // update customCell
-            customCell.textField.placeholder = "\(currentPort)"
-            customCell.textField.resignFirstResponder()
-            customCell.textField.text = nil // will display currentValue as placeholder
-        }
-        selectedIndex = index
-    }
-
-    @objc private func okButtonPressed() {
-           onSave?("\(currentPort)")
-           navigationController?.popViewController(animated: true)
-       }
-
-    @objc private func cancelButtonPressed() {
-        navigationController?.popViewController(animated: true)
-    }
-
-}

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

@@ -106,19 +106,19 @@ enum SecurityType {
 class SecurityConverter {
 class SecurityConverter {
     static func convertHexToString(type: SecurityType, hex value: Int) -> String {
     static func convertHexToString(type: SecurityType, hex value: Int) -> String {
         switch value {
         switch value {
-        case 0x00:
+        case 0x0:
             return String.localized("automatic")
             return String.localized("automatic")
         case 0x100:
         case 0x100:
             return "StartTLS"
             return "StartTLS"
         case 0x200:
         case 0x200:
             return "SSL/TLS"
             return "SSL/TLS"
-        case  0x400:
+        case 0x400:
             return String.localized("off")
             return String.localized("off")
         case 0x10000:
         case 0x10000:
             return "StartTLS"
             return "StartTLS"
         case 0x20000:
         case 0x20000:
             return "SSL/TLS"
             return "SSL/TLS"
-        case  0x40000:
+        case 0x40000:
             return String.localized("off")
             return String.localized("off")
         default:
         default:
             return "Undefined"
             return "Undefined"

+ 66 - 41
deltachat-ios/Controller/AccountSetupController.swift

@@ -50,15 +50,15 @@ class AccountSetupController: UITableViewController {
     private lazy var restoreCells: [UITableViewCell] = [restoreCell]
     private lazy var restoreCells: [UITableViewCell] = [restoreCell]
     private lazy var advancedSectionCells: [UITableViewCell] = [
     private lazy var advancedSectionCells: [UITableViewCell] = [
         advancedShowCell,
         advancedShowCell,
-        imapServerCell,
+        imapSecurityCell,
         imapUserCell,
         imapUserCell,
+        imapServerCell,
         imapPortCell,
         imapPortCell,
-        imapSecurityCell,
-        smtpServerCell,
+        smtpSecurityCell,
         smtpUserCell,
         smtpUserCell,
-        smtpPortCell,
         smtpPasswordCell,
         smtpPasswordCell,
-        smtpSecurityCell,
+        smtpServerCell,
+        smtpPortCell,
         certCheckCell
         certCheckCell
     ]
     ]
     private lazy var folderCells: [UITableViewCell] = [inboxWatchCell, sentboxWatchCell, mvboxWatchCell, sendCopyToSelfCell, mvboxMoveCell]
     private lazy var folderCells: [UITableViewCell] = [inboxWatchCell, sentboxWatchCell, mvboxWatchCell, sendCopyToSelfCell, mvboxMoveCell]
@@ -189,9 +189,10 @@ class AccountSetupController: UITableViewController {
 
 
     lazy var imapServerCell: TextFieldCell = {
     lazy var imapServerCell: TextFieldCell = {
         let cell = TextFieldCell(descriptionID: "login_imap_server",
         let cell = TextFieldCell(descriptionID: "login_imap_server",
-                                 placeholder: DcConfig.mailServer ?? DcConfig.configuredMailServer,
+                                 placeholder: String.localized("automatic"),
                                  delegate: self)
                                  delegate: self)
         cell.tag = tagImapServerCell
         cell.tag = tagImapServerCell
+        cell.setText(text: DcConfig.mailServer ?? nil)
         cell.textField.tag = tagTextFieldImapServer
         cell.textField.tag = tagTextFieldImapServer
         cell.textField.autocorrectionType = .no
         cell.textField.autocorrectionType = .no
         cell.textField.spellCheckingType = .no
         cell.textField.spellCheckingType = .no
@@ -200,19 +201,32 @@ class AccountSetupController: UITableViewController {
     }()
     }()
 
 
     lazy var imapUserCell: TextFieldCell = {
     lazy var imapUserCell: TextFieldCell = {
-        let cell = TextFieldCell(descriptionID: "login_imap_login", placeholder: DcConfig.mailUser ?? DcConfig.configuredMailUser, delegate: self)
+        let cell = TextFieldCell(descriptionID: "login_imap_login", placeholder: String.localized("automatic"), delegate: self)
+        cell.setText(text: DcConfig.mailUser ?? nil)
         cell.textField.tag = tagTextFieldImapLogin
         cell.textField.tag = tagTextFieldImapLogin
         cell.tag = tagImapUserCell
         cell.tag = tagImapUserCell
         return cell
         return cell
     }()
     }()
 
 
-    lazy var imapPortCell: UITableViewCell = {
-        let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
-        cell.textLabel?.text = String.localized("login_imap_port")
-        cell.accessoryType = .disclosureIndicator
-        cell.detailTextLabel?.text = DcConfig.mailPort ?? DcConfig.configuredMailPort
+    func editablePort(port: String?) -> String {
+        if let port = port {
+            if Int(port) == 0 {
+                return ""
+            }
+            return port
+        } else {
+            return ""
+        }
+    }
+
+    lazy var imapPortCell: TextFieldCell = {
+        let cell = TextFieldCell(descriptionID: "login_imap_port",
+                                 placeholder: String.localized("automatic"),
+                                 delegate: self)
         cell.tag = tagImapPortCell
         cell.tag = tagImapPortCell
-        cell.selectionStyle = .none
+        cell.setText(text: editablePort(port: DcConfig.mailPort))
+        cell.textField.tag = tagImapPortCell
+        cell.textField.keyboardType = .numberPad
         return cell
         return cell
     }()
     }()
 
 
@@ -229,9 +243,10 @@ class AccountSetupController: UITableViewController {
 
 
     lazy var smtpServerCell: TextFieldCell = {
     lazy var smtpServerCell: TextFieldCell = {
         let cell = TextFieldCell(descriptionID: "login_smtp_server",
         let cell = TextFieldCell(descriptionID: "login_smtp_server",
-                                 placeholder: DcConfig.sendServer ?? DcConfig.configuredSendServer,
+                                 placeholder: String.localized("automatic"),
                                  delegate: self)
                                  delegate: self)
         cell.textField.tag = tagTextFieldSmtpServer
         cell.textField.tag = tagTextFieldSmtpServer
+        cell.setText(text: DcConfig.sendServer ?? nil)
         cell.tag = tagSmtpServerCell
         cell.tag = tagSmtpServerCell
         cell.textField.autocorrectionType = .no
         cell.textField.autocorrectionType = .no
         cell.textField.spellCheckingType = .no
         cell.textField.spellCheckingType = .no
@@ -240,25 +255,28 @@ class AccountSetupController: UITableViewController {
     }()
     }()
 
 
     lazy var smtpUserCell: TextFieldCell = {
     lazy var smtpUserCell: TextFieldCell = {
-        let cell = TextFieldCell(descriptionID: "login_smtp_login", placeholder: DcConfig.sendUser ?? DcConfig.configuredSendUser, delegate: self)
+        let cell = TextFieldCell(descriptionID: "login_smtp_login", placeholder: String.localized("automatic"), delegate: self)
         cell.textField.tag = tagTextFieldSmtpUser
         cell.textField.tag = tagTextFieldSmtpUser
+        cell.setText(text: DcConfig.sendUser ?? nil)
         cell.tag = tagSmtpUserCell
         cell.tag = tagSmtpUserCell
         return cell
         return cell
     }()
     }()
 
 
-    lazy var smtpPortCell: UITableViewCell = {
-        let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
-        cell.textLabel?.text = String.localized("login_smtp_port")
-        cell.accessoryType = .disclosureIndicator
-        cell.detailTextLabel?.text = DcConfig.sendPort ?? DcConfig.configuredSendPort
-        cell.selectionStyle = .none
+    lazy var smtpPortCell: TextFieldCell = {
+        let cell = TextFieldCell(descriptionID: "login_smtp_port",
+                                 placeholder: String.localized("automatic"),
+                                 delegate: self)
         cell.tag = tagSmtpPortCell
         cell.tag = tagSmtpPortCell
+        cell.setText(text: editablePort(port: DcConfig.sendPort))
+        cell.textField.tag = tagSmtpPortCell
+        cell.textField.keyboardType = .numberPad
         return cell
         return cell
     }()
     }()
 
 
     lazy var smtpPasswordCell: TextFieldCell = {
     lazy var smtpPasswordCell: TextFieldCell = {
-        let cell = TextFieldCell(descriptionID: "login_smtp_password", placeholder: "*************", delegate: self)
+        let cell = TextFieldCell(descriptionID: "login_smtp_password", placeholder: String.localized("automatic"), delegate: self)
         cell.textField.textContentType = UITextContentType.password
         cell.textField.textContentType = UITextContentType.password
+        cell.setText(text: DcConfig.sendPw ?? nil)
         cell.textField.isSecureTextEntry = true
         cell.textField.isSecureTextEntry = true
         cell.textField.tag = tagTextFieldSmtpPassword
         cell.textField.tag = tagTextFieldSmtpPassword
         cell.tag = tagSmtpPasswordCell
         cell.tag = tagSmtpPasswordCell
@@ -429,7 +447,24 @@ class AccountSetupController: UITableViewController {
         if sections[section] == basicSection {
         if sections[section] == basicSection {
             return String.localized("login_no_servers_hint")
             return String.localized("login_no_servers_hint")
         } else if sections[section] == advancedSection {
         } else if sections[section] == advancedSection {
-            return String.localized("login_subheader")
+            if advancedSectionShowing && dcContext.isConfigured() {
+                var info = "Current settings:\n"
+                let serverFlags = Int(dcContext.getConfig("configured_server_flags") ?? "") ?? 0
+                info += "IMAP "
+                info += SecurityConverter.convertHexToString(type: .IMAPSecurity, hex: serverFlags&0x700) + " "
+                info += (dcContext.getConfig("configured_mail_user") ?? "unset") + ":***@"
+                info += (dcContext.getConfig("configured_mail_server") ?? "unset") + ":"
+                info += (dcContext.getConfig("configured_mail_port") ?? "unset") + "\n"
+                info += "SMTP "
+                info += SecurityConverter.convertHexToString(type: .SMTPSecurity, hex: serverFlags&0x70000) + " "
+                info += (dcContext.getConfig("configured_send_user") ?? "unset") + ":***@"
+                info += (dcContext.getConfig("configured_send_server") ?? "unset") +  ":"
+                info += (dcContext.getConfig("configured_send_port") ?? "unset") + "\n\n"
+                info += String.localized("login_subheader")
+                return info
+            } else {
+                return String.localized("login_subheader")
+            }
         } else if sections[section] == folderSection {
         } else if sections[section] == folderSection {
             return String.localized("pref_auto_folder_moves_explain")
             return String.localized("pref_auto_folder_moves_explain")
         } else {
         } else {
@@ -473,10 +508,6 @@ class AccountSetupController: UITableViewController {
             deleteAccount()
             deleteAccount()
         case tagAdvancedCell:
         case tagAdvancedCell:
             toggleAdvancedSection()
             toggleAdvancedSection()
-        case tagImapPortCell:
-            coordinator?.showImapPortOptions()
-        case tagSmtpPortCell:
-            coordinator?.showSmtpPortsOptions()
         case tagImapSecurityCell:
         case tagImapSecurityCell:
             coordinator?.showImapSecurityOptions()
             coordinator?.showImapSecurityOptions()
         case tagSmtpSecurityCell:
         case tagSmtpSecurityCell:
@@ -495,6 +526,10 @@ class AccountSetupController: UITableViewController {
         var advancedIndexPaths: [IndexPath] = advancedSectionCells.indices.map { IndexPath(row: $0, section: advancedSectionIndex) }
         var advancedIndexPaths: [IndexPath] = advancedSectionCells.indices.map { IndexPath(row: $0, section: advancedSectionIndex) }
         advancedIndexPaths.removeFirst() // do not touch the first item that is the switch itself
         advancedIndexPaths.removeFirst() // do not touch the first item that is the switch itself
 
 
+        // on expansion, replace the disclosureIndicator by an n-dash
+        advancedShowCell.accessoryType = willShow ? .none : .disclosureIndicator
+        advancedShowCell.detailTextLabel?.text = willShow ? "\u{2013}" : nil
+
         advancedSectionShowing = willShow // set flag before delete/insert, because cellForRowAt will be triggered and uses this flag
         advancedSectionShowing = willShow // set flag before delete/insert, because cellForRowAt will be triggered and uses this flag
 
 
         if willShow {
         if willShow {
@@ -644,10 +679,14 @@ class AccountSetupController: UITableViewController {
                 switch  textFieldCell.tag {
                 switch  textFieldCell.tag {
                 case tagImapServerCell:
                 case tagImapServerCell:
                     DcConfig.mailServer = textFieldCell.getText() ?? nil
                     DcConfig.mailServer = textFieldCell.getText() ?? nil
+                case tagImapPortCell:
+                    DcConfig.mailPort = textFieldCell.getText() ?? nil
                 case tagImapUserCell:
                 case tagImapUserCell:
                     DcConfig.mailUser = textFieldCell.getText() ?? nil
                     DcConfig.mailUser = textFieldCell.getText() ?? nil
                 case tagSmtpServerCell:
                 case tagSmtpServerCell:
                     DcConfig.sendServer = textFieldCell.getText() ?? nil
                     DcConfig.sendServer = textFieldCell.getText() ?? nil
+                case tagSmtpPortCell:
+                    DcConfig.sendPort = textFieldCell.getText() ?? nil
                 case tagSmtpUserCell:
                 case tagSmtpUserCell:
                     DcConfig.sendUser = textFieldCell.getText() ?? nil
                     DcConfig.sendUser = textFieldCell.getText() ?? nil
                 case tagSmtpPasswordCell:
                 case tagSmtpPasswordCell:
@@ -749,24 +788,10 @@ class AccountSetupController: UITableViewController {
         dismiss(animated: true, completion: nil)
         dismiss(animated: true, completion: nil)
         let appDelegate = UIApplication.shared.delegate as! AppDelegate
         let appDelegate = UIApplication.shared.delegate as! AppDelegate
         appDelegate.registerForPushNotifications()
         appDelegate.registerForPushNotifications()
-        if (!DcConfig.configuredMailPort.isEmpty) {
-            DcConfig.mailPort = DcConfig.configuredMailPort
-        }
-        if (!DcConfig.configuredMailServer.isEmpty) {
-            DcConfig.mailServer = DcConfig.configuredMailServer
-        }
-        if (!DcConfig.configuredSendPort.isEmpty) {
-            DcConfig.sendPort = DcConfig.configuredSendPort
-        }
-        if (!DcConfig.configuredSendServer.isEmpty) {
-            DcConfig.sendServer = DcConfig.configuredSendServer
-        }
         initSelectionCells();
         initSelectionCells();
     }
     }
 
 
     private func initSelectionCells() {
     private func initSelectionCells() {
-        smtpPortCell.detailTextLabel?.text = DcConfig.sendPort ?? DcConfig.configuredSendPort
-        imapPortCell.detailTextLabel?.text = DcConfig.mailPort ?? DcConfig.configuredMailPort
         smtpSecurityCell.detailTextLabel?.text = SecurityConverter.convertHexToString(type: .SMTPSecurity, hex: DcConfig.getSmtpSecurity())
         smtpSecurityCell.detailTextLabel?.text = SecurityConverter.convertHexToString(type: .SMTPSecurity, hex: DcConfig.getSmtpSecurity())
         imapSecurityCell.detailTextLabel?.text = SecurityConverter.convertHexToString(type: .IMAPSecurity, hex: DcConfig.getImapSecurity())
         imapSecurityCell.detailTextLabel?.text = SecurityConverter.convertHexToString(type: .IMAPSecurity, hex: DcConfig.getImapSecurity())
         certCheckCell.detailTextLabel?.text = CertificateCheckController.ValueConverter.convertHexToString(value: DcConfig.certificateChecks)
         certCheckCell.detailTextLabel?.text = CertificateCheckController.ValueConverter.convertHexToString(value: DcConfig.certificateChecks)

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

@@ -203,38 +203,12 @@ class AccountSetupCoordinator: Coordinator {
         navigationController.pushViewController(certificateCheckController, animated: true)
         navigationController.pushViewController(certificateCheckController, animated: true)
     }
     }
 
 
-    func showImapPortOptions() {
-        let currentMailPort = DcConfig.mailPort ?? DcConfig.configuredMailPort
-        let currentPort = Int(currentMailPort)
-        let portSettingsController = PortSettingsController(sectionTitle: String.localized("login_imap_port"),
-                                                            ports: [143, 993],
-                                                            currentPort: currentPort)
-        portSettingsController.onSave = {
-            port in
-            DcConfig.mailPort = port
-        }
-        navigationController.pushViewController(portSettingsController, animated: true)
-    }
-
     func showImapSecurityOptions() {
     func showImapSecurityOptions() {
         let securitySettingsController = SecuritySettingsController(title: String.localized("login_imap_security"),
         let securitySettingsController = SecuritySettingsController(title: String.localized("login_imap_security"),
                                                                     type: SecurityType.IMAPSecurity)
                                                                     type: SecurityType.IMAPSecurity)
         navigationController.pushViewController(securitySettingsController, animated: true)
         navigationController.pushViewController(securitySettingsController, animated: true)
     }
     }
 
 
-    func showSmtpPortsOptions() {
-        let currentMailPort = DcConfig.sendPort ?? DcConfig.configuredSendPort
-        let currentPort = Int(currentMailPort)
-        let portSettingsController = PortSettingsController(sectionTitle: String.localized("login_smtp_port"),
-                                                            ports: [25, 465, 587],
-                                                            currentPort: currentPort)
-        portSettingsController.onSave = {
-            port in
-            DcConfig.sendPort = port
-        }
-        navigationController.pushViewController(portSettingsController, animated: true)
-    }
-
     func showSmptpSecurityOptions() {
     func showSmptpSecurityOptions() {
         let securitySettingsController = SecuritySettingsController(title: String.localized("login_imap_security"), type: SecurityType.SMTPSecurity)
         let securitySettingsController = SecuritySettingsController(title: String.localized("login_imap_security"), type: SecurityType.SMTPSecurity)
         navigationController.pushViewController(securitySettingsController, animated: true)
         navigationController.pushViewController(securitySettingsController, animated: true)

+ 5 - 40
deltachat-ios/DC/Wrapper.swift

@@ -129,6 +129,10 @@ class DcContext {
     func emptyServer(flags: Int) {
     func emptyServer(flags: Int) {
         dc_empty_server(contextPointer, UInt32(flags))
         dc_empty_server(contextPointer, UInt32(flags))
     }
     }
+
+    func isConfigured() -> Bool {
+        return dc_is_configured(contextPointer) != 0
+    }
 }
 }
 
 
 class DcConfig {
 class DcConfig {
@@ -329,46 +333,7 @@ class DcConfig {
         get { return getConfigInt("show_emails") }
         get { return getConfigInt("show_emails") }
     }
     }
 
 
-    class var configuredEmail: String {
-        return getConfig("configured_addr") ?? ""
-    }
-
-    class var configuredMailServer: String {
-        return getConfig("configured_mail_server") ?? ""
-    }
-
-    class var configuredMailUser: String {
-        return getConfig("configured_mail_user") ?? ""
-    }
-
-    class var configuredMailPw: String {
-        return getConfig("configured_mail_pw") ?? ""
-    }
-
-    class var configuredMailPort: String {
-        return getConfig("configured_mail_port") ?? ""
-    }
-
-    class var configuredSendServer: String {
-        return getConfig("configured_send_server") ?? ""
-    }
-
-    class var configuredSendUser: String {
-        return getConfig("configured_send_user") ?? ""
-    }
-
-    class var configuredSendPw: String {
-        return getConfig("configured_send_pw") ?? ""
-    }
-
-    class var configuredSendPort: String {
-        return getConfig("configured_send_port") ?? ""
-    }
-
-    class var configuredServerFlags: String {
-        return getConfig("configured_server_flags") ?? ""
-    }
-
+    // do not use. use DcContext::isConfigured() instead
     class var configured: Bool {
     class var configured: Bool {
         return getConfigBool("configured")
         return getConfigBool("configured")
     }
     }