pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift
branchIOS-1064
changeset 4550 c04fe6d5c76b
parent 4496 0c419fcb3d7f
equal deleted inserted replaced
4549:fa6fb82b2eaa 4550:c04fe6d5c76b
     9 import UIKit
     9 import UIKit
    10 import MessageModel
    10 import MessageModel
    11 import SwipeCellKit
    11 import SwipeCellKit
    12 
    12 
    13 class EmailListViewController: BaseTableViewController, SwipeTableViewCellDelegate {
    13 class EmailListViewController: BaseTableViewController, SwipeTableViewCellDelegate {
    14     var folderToShow: Folder?
    14     var folderToShow: Folder? //-> se ha de mover al vm
       
    15     private var model: EmailListViewModel?
    15 
    16 
    16     func updateLastLookAt() {
    17     func updateLastLookAt() {
    17         guard let saveFolder = folderToShow else {
    18         guard let saveFolder = folderToShow else {
    18             return
    19             return
    19         }
    20         }
    20         saveFolder.updateLastLookAt()
    21         saveFolder.updateLastLookAt()
    21     }
    22     }
    22     
       
    23     private var model: EmailListViewModel?
       
    24     
    23     
    25     private let queue: OperationQueue = {
    24     private let queue: OperationQueue = {
    26         let createe = OperationQueue()
    25         let createe = OperationQueue()
    27         createe.qualityOfService = .userInteractive
    26         createe.qualityOfService = .userInteractive
    28         createe.maxConcurrentOperationCount = 5
    27         createe.maxConcurrentOperationCount = 5
   106         tableView.tableHeaderView = nil
   105         tableView.tableHeaderView = nil
   107     }
   106     }
   108     
   107     
   109     override func viewWillAppear(_ animated: Bool) {
   108     override func viewWillAppear(_ animated: Bool) {
   110         super.viewWillAppear(animated)
   109         super.viewWillAppear(animated)
       
   110         guard let vm = model else {
       
   111             Log.shared.errorAndCrash(component: #function,
       
   112                                      errorString: "ViewModel can not be nil!")
       
   113             return
       
   114         }
   111         self.navigationController?.setToolbarHidden(false, animated: true)
   115         self.navigationController?.setToolbarHidden(false, animated: true)
   112         if MiscUtil.isUnitTest() {
   116         if MiscUtil.isUnitTest() {
   113             return
   117             return
   114         }
   118         }
   115 
   119 
   116         setDefaultColors()
   120         setDefaultColors()
   117         setup()
   121         setup()
   118         
   122         
   119         // Mark this folder as having been looked at by the user
   123         // Mark this folder as having been looked at by the user
   120         updateLastLookAt()
   124         vm.updateLastLookAt()
   121         setupFoldersBarButton()
   125         setupFoldersBarButton()
   122         if model != nil {
   126         if model != nil {
   123             updateFilterButtonView()
   127             updateFilterButtonView()
   124         }
   128         }
   125     }
   129     }