浏览代码

Merge pull request #857 from deltachat/fix_disappearing_profile_cell

Fix disappearing profile cell
nayooti 5 年之前
父节点
当前提交
bd79b76fd8
共有 2 个文件被更改,包括 11 次插入11 次删除
  1. 10 10
      deltachat-ios/Controller/SettingsController.swift
  2. 1 1
      deltachat-ios/ViewModel/ContactCellViewModel.swift

+ 10 - 10
deltachat-ios/Controller/SettingsController.swift

@@ -37,15 +37,15 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
     // MARK: - cells
 
     private lazy var profileCell: ContactCell = {
-        let cell = ContactCell(style: .default, reuseIdentifier: "profile_cell")
-        let cellViewModel = ProfileViewModell(context: dcContext)
+        let cell = ContactCell(style: .default, reuseIdentifier: nil)
+        let cellViewModel = ProfileViewModel(context: dcContext)
         cell.updateCell(cellViewModel: cellViewModel)
         cell.tag = CellTags.profile.rawValue
         cell.accessoryType = .disclosureIndicator
         return cell
     }()
 
-    private var contactRequestCell: UITableViewCell = {
+    private lazy var contactRequestCell: UITableViewCell = {
         let cell = UITableViewCell(style: .default, reuseIdentifier: nil)
         cell.tag = CellTags.contactRequest.rawValue
         cell.textLabel?.text = String.localized("menu_deaddrop")
@@ -62,7 +62,7 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
         return cell
     }()
 
-    private var blockedContactsCell: UITableViewCell = {
+    private lazy var blockedContactsCell: UITableViewCell = {
         let cell = UITableViewCell(style: .default, reuseIdentifier: nil)
         cell.tag = CellTags.blockedContacts.rawValue
         cell.textLabel?.text = String.localized("pref_blocked_contacts")
@@ -98,7 +98,7 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
         return cell
     }()
 
-    private var notificationSwitch: UISwitch = {
+    private lazy var notificationSwitch: UISwitch = {
         let switchControl = UISwitch()
         switchControl.isOn = !UserDefaults.standard.bool(forKey: "notifications_disabled")
         switchControl.addTarget(self, action: #selector(handleNotificationToggle(_:)), for: .valueChanged)
@@ -146,7 +146,7 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
         return cell
     }()
 
-    private var sendAutocryptMessageCell: ActionCell = {
+    private lazy var sendAutocryptMessageCell: ActionCell = {
         let cell = ActionCell()
         cell.tag = CellTags.sendAutocryptMessage.rawValue
         cell.actionTitle = String.localized("autocrypt_send_asm_title")
@@ -154,7 +154,7 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
         return cell
     }()
 
-    private var exportBackupCell: ActionCell = {
+    private lazy var exportBackupCell: ActionCell = {
         let cell = ActionCell()
         cell.tag = CellTags.exportBackup.rawValue
         cell.actionTitle = String.localized("export_backup_desktop")
@@ -162,7 +162,7 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
         return cell
     }()
 
-    private var advancedCell: ActionCell = {
+    private lazy var advancedCell: ActionCell = {
         let cell = ActionCell()
         cell.tag = CellTags.advanced.rawValue
         cell.actionTitle = String.localized("menu_advanced")
@@ -170,7 +170,7 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
         return cell
     }()
 
-    private var helpCell: ActionCell = {
+    private lazy var helpCell: ActionCell = {
         let cell = ActionCell()
         cell.tag = CellTags.help.rawValue
         cell.actionTitle = String.localized("menu_help")
@@ -436,7 +436,7 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
 
     // MARK: - updates
     private func updateCells() {
-        profileCell.updateCell(cellViewModel: ProfileViewModell(context: dcContext))
+        profileCell.updateCell(cellViewModel: ProfileViewModel(context: dcContext))
         showEmailsCell.detailTextLabel?.text = SettingsClassicViewController.getValString(val: dcContext.showEmails)
         mediaQualityCell.detailTextLabel?.text = MediaQualityController.getValString(val: dcContext.getConfigInt("media_quality"))
         autodelCell.detailTextLabel?.text = autodelSummary()

+ 1 - 1
deltachat-ios/ViewModel/ContactCellViewModel.swift

@@ -60,7 +60,7 @@ class ContactCellViewModel: AvatarCellViewModel {
     }
 }
 
-class ProfileViewModell: AvatarCellViewModel {
+class ProfileViewModel: AvatarCellViewModel {
     var type: CellModel {
         return CellModel.profile
     }