Skip to content

Commit

Permalink
move 'show classic email' to advanced
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed May 7, 2024
1 parent 7ed965c commit babd9cb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
19 changes: 18 additions & 1 deletion deltachat-ios/Controller/Settings/AdvancedViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ internal final class AdvancedViewController: UITableViewController, ProgressAler
}

private enum CellTags: Int {
case showEmails
case autocryptPreferences
case sendAutocryptMessage
case manageKeys
Expand All @@ -30,6 +31,15 @@ internal final class AdvancedViewController: UITableViewController, ProgressAler
var progressObserver: NSObjectProtocol?

// MARK: - cells
private lazy var showEmailsCell: UITableViewCell = {
let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
cell.tag = CellTags.showEmails.rawValue
cell.textLabel?.text = String.localized("pref_show_emails")
cell.accessoryType = .disclosureIndicator
cell.detailTextLabel?.text = EmailOptionsViewController.getValString(val: dcContext.showEmails)
return cell
}()

private lazy var autocryptSwitch: UISwitch = {
let switchControl = UISwitch()
switchControl.isOn = dcContext.e2eeEnabled
Expand Down Expand Up @@ -204,7 +214,7 @@ internal final class AdvancedViewController: UITableViewController, ProgressAler
let viewLogSection = SectionConfigs(
headerTitle: nil,
footerTitle: nil,
cells: [viewLogCell])
cells: [showEmailsCell, viewLogCell])
let experimentalSection = SectionConfigs(
headerTitle: String.localized("pref_experimental_features"),
footerTitle: nil,
Expand Down Expand Up @@ -284,6 +294,7 @@ internal final class AdvancedViewController: UITableViewController, ProgressAler
tableView.deselectRow(at: indexPath, animated: false)

switch cellTag {
case .showEmails: showClassicMailController()
case .autocryptPreferences: break
case .sendAutocryptMessage: sendAutocryptSetupMessage()
case .manageKeys: showManageKeysDialog()
Expand Down Expand Up @@ -343,6 +354,11 @@ internal final class AdvancedViewController: UITableViewController, ProgressAler
navigationController?.pushViewController(controller, animated: true)
}

private func showClassicMailController() {
let controller = EmailOptionsViewController(dcContext: dcContext)
navigationController?.pushViewController(controller, animated: true)
}

private func showAccountSettingsController() {
let controller = AccountSetupController(dcAccounts: dcAccounts, editView: true)
navigationController?.pushViewController(controller, animated: true)
Expand Down Expand Up @@ -396,6 +412,7 @@ internal final class AdvancedViewController: UITableViewController, ProgressAler

// MARK: - updates
private func updateCells() {
showEmailsCell.detailTextLabel?.text = EmailOptionsViewController.getValString(val: dcContext.showEmails)
videoChatInstanceCell.detailTextLabel?.text = VideoChatInstanceViewController.getValString(val: dcContext.getConfig("webrtc_instance") ?? "")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ internal final class ChatsAndMediaViewController: UITableViewController, Progres
}

private enum CellTags: Int {
case showEmails
case blockedContacts
case receiptConfirmation
case exportBackup
Expand All @@ -28,14 +27,7 @@ internal final class ChatsAndMediaViewController: UITableViewController, Progres
var progressObserver: NSObjectProtocol?

// MARK: - cells
private lazy var showEmailsCell: UITableViewCell = {
let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
cell.tag = CellTags.showEmails.rawValue
cell.textLabel?.text = String.localized("pref_show_emails")
cell.accessoryType = .disclosureIndicator
cell.detailTextLabel?.text = EmailOptionsViewController.getValString(val: dcContext.showEmails)
return cell
}()


private lazy var blockedContactsCell: UITableViewCell = {
let cell = UITableViewCell(style: .default, reuseIdentifier: nil)
Expand Down Expand Up @@ -109,7 +101,7 @@ internal final class ChatsAndMediaViewController: UITableViewController, Progres
let preferencesSection = SectionConfigs(
headerTitle: nil,
footerTitle: String.localized("pref_read_receipts_explain"),
cells: [showEmailsCell, blockedContactsCell, mediaQualityCell, downloadOnDemandCell,
cells: [blockedContactsCell, mediaQualityCell, downloadOnDemandCell,
autodelCell, receiptConfirmationCell]
)
let exportBackupSection = SectionConfigs(
Expand Down Expand Up @@ -188,7 +180,6 @@ internal final class ChatsAndMediaViewController: UITableViewController, Progres
tableView.deselectRow(at: indexPath, animated: false)

switch cellTag {
case .showEmails: showClassicMail()
case .blockedContacts: showBlockedContacts()
case .autodel: showAutodelOptions()
case .mediaQuality: showMediaQuality()
Expand Down Expand Up @@ -237,19 +228,13 @@ internal final class ChatsAndMediaViewController: UITableViewController, Progres
}

private func updateCells() {
showEmailsCell.detailTextLabel?.text = EmailOptionsViewController.getValString(val: dcContext.showEmails)
mediaQualityCell.detailTextLabel?.text = MediaQualityViewController.getValString(val: dcContext.getConfigInt("media_quality"))
downloadOnDemandCell.detailTextLabel?.text = DownloadOnDemandViewController.getValString(
val: dcContext.getConfigInt("download_limit"))
autodelCell.detailTextLabel?.text = autodelSummary()
}

// MARK: - coordinator
private func showClassicMail() {
let settingsClassicViewController = EmailOptionsViewController(dcContext: dcContext)
navigationController?.pushViewController(settingsClassicViewController, animated: true)
}

private func showMediaQuality() {
let mediaQualityController = MediaQualityViewController(dcContext: dcContext)
navigationController?.pushViewController(mediaQualityController, animated: true)
Expand Down

0 comments on commit babd9cb

Please sign in to comment.