IOS-615 stops trying to save unified inbox IOS-615-duplicated-first-mail
authorbuff <andreas@pep-project.org>
Wed, 09 Aug 2017 13:46:51 +0200
branchIOS-615-duplicated-first-mail
changeset 2683ef2249f630b0
parent 2682 c3a3244bae8c
child 2684 7685b4951343
IOS-615 stops trying to save unified inbox
pEpForiOS/UI/EmailDisplay/EmailListViewController.swift
     1.1 --- a/pEpForiOS/UI/EmailDisplay/EmailListViewController.swift	Wed Aug 09 13:42:19 2017 +0200
     1.2 +++ b/pEpForiOS/UI/EmailDisplay/EmailListViewController.swift	Wed Aug 09 13:46:51 2017 +0200
     1.3 @@ -65,12 +65,12 @@
     1.4          }
     1.5  
     1.6          setDefaultColors()
     1.7 -        initialConfig()
     1.8 +        setupConfig()
     1.9          updateModel()
    1.10  
    1.11          // Mark this folder as having been looked at by the user
    1.12 -        if let fol = config?.folder {
    1.13 -            fol.updateLastLookAt()
    1.14 +        if let folder = config?.folder {
    1.15 +            updateLastLookAt(on: folder)
    1.16          }
    1.17          if viewModel == nil {
    1.18              viewModel = EmailListViewModel(config: config, delegate: self)
    1.19 @@ -85,14 +85,23 @@
    1.20          
    1.21      }
    1.22  
    1.23 +    private func updateLastLookAt(on folder: Folder) {
    1.24 +        if folder.isUnified {
    1.25 +            folder.updateLastLookAt()
    1.26 +        } else {
    1.27 +            folder.updateLastLookAtAndSave()
    1.28 +        }
    1.29 +    }
    1.30  
    1.31      override func viewWillDisappear(_ animated: Bool) {
    1.32          super.viewWillDisappear(animated)
    1.33          MessageModelConfig.messageFolderDelegate = nil
    1.34      }
    1.35  
    1.36 -    func initialConfig() {
    1.37 +    //BUFF: folder without account!
    1.38 +    func setupConfig() {
    1.39          guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
    1.40 +            Log.shared.errorAndCrash(component: #function, errorString: "No AppDelegate?")
    1.41              return
    1.42          }
    1.43          if config == nil {
    1.44 @@ -103,6 +112,7 @@
    1.45          if Account.all().isEmpty {
    1.46              performSegue(withIdentifier:.segueAddNewAccount, sender: self)
    1.47          }
    1.48 +
    1.49          self.title = config?.folder?.realName
    1.50      }
    1.51