|
@@ -206,13 +206,25 @@ class AccountSetupController: UITableViewController {
|
|
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
|
|
}()
|
|
}()
|
|
|
|
|
|
@@ -246,13 +258,14 @@ class AccountSetupController: UITableViewController {
|
|
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
|
|
}()
|
|
}()
|
|
|
|
|
|
@@ -473,10 +486,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:
|
|
@@ -644,10 +653,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:
|
|
@@ -765,8 +778,6 @@ class AccountSetupController: UITableViewController {
|
|
}
|
|
}
|
|
|
|
|
|
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)
|