pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift
branchIOS-1064
changeset 4550 c04fe6d5c76b
parent 4496 0c419fcb3d7f
     1.1 --- a/pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift	Thu Apr 26 12:36:11 2018 +0200
     1.2 +++ b/pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift	Mon May 07 11:11:24 2018 +0200
     1.3 @@ -11,7 +11,8 @@
     1.4  import SwipeCellKit
     1.5  
     1.6  class EmailListViewController: BaseTableViewController, SwipeTableViewCellDelegate {
     1.7 -    var folderToShow: Folder?
     1.8 +    var folderToShow: Folder? //-> se ha de mover al vm
     1.9 +    private var model: EmailListViewModel?
    1.10  
    1.11      func updateLastLookAt() {
    1.12          guard let saveFolder = folderToShow else {
    1.13 @@ -20,8 +21,6 @@
    1.14          saveFolder.updateLastLookAt()
    1.15      }
    1.16      
    1.17 -    private var model: EmailListViewModel?
    1.18 -    
    1.19      private let queue: OperationQueue = {
    1.20          let createe = OperationQueue()
    1.21          createe.qualityOfService = .userInteractive
    1.22 @@ -108,6 +107,11 @@
    1.23      
    1.24      override func viewWillAppear(_ animated: Bool) {
    1.25          super.viewWillAppear(animated)
    1.26 +        guard let vm = model else {
    1.27 +            Log.shared.errorAndCrash(component: #function,
    1.28 +                                     errorString: "ViewModel can not be nil!")
    1.29 +            return
    1.30 +        }
    1.31          self.navigationController?.setToolbarHidden(false, animated: true)
    1.32          if MiscUtil.isUnitTest() {
    1.33              return
    1.34 @@ -117,7 +121,7 @@
    1.35          setup()
    1.36          
    1.37          // Mark this folder as having been looked at by the user
    1.38 -        updateLastLookAt()
    1.39 +        vm.updateLastLookAt()
    1.40          setupFoldersBarButton()
    1.41          if model != nil {
    1.42              updateFilterButtonView()