IOS-1064 some changes IOS-1064
authorXavier Algarra <xavier@pep-project.org>
Mon, 07 May 2018 11:11:24 +0200
branchIOS-1064
changeset 4550c04fe6d5c76b
parent 4549 fa6fb82b2eaa
IOS-1064 some changes
pEpForiOS.xcodeproj/project.pbxproj
pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift
pEpForiOS/UI/EmailDisplayList/EmailListViewModel.swift
     1.1 --- a/pEpForiOS.xcodeproj/project.pbxproj	Thu Apr 26 12:36:11 2018 +0200
     1.2 +++ b/pEpForiOS.xcodeproj/project.pbxproj	Mon May 07 11:11:24 2018 +0200
     1.3 @@ -413,6 +413,7 @@
     1.4  		B741D5031F26234A00DFD93A /* EmailAddressValidation.swift in Sources */ = {isa = PBXBuildFile; fileRef = B741D5021F26234A00DFD93A /* EmailAddressValidation.swift */; };
     1.5  		B74940031ECB3BEB001A710B /* UILabel+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B74940021ECB3BEB001A710B /* UILabel+Extension.swift */; };
     1.6  		B74F81021EB0E20000519FCC /* LoginViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B74F81011EB0E20000519FCC /* LoginViewModel.swift */; };
     1.7 +		B7500CD62099B90400830AA9 /* EmailListCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7500CD52099B90400830AA9 /* EmailListCellViewModel.swift */; };
     1.8  		B75FF00B1EFD420F00C57289 /* EmailListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B75FF00A1EFD420F00C57289 /* EmailListViewModel.swift */; };
     1.9  		B78309C81EAA09040051A2E0 /* AccountCreation.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B78309C61EAA09040051A2E0 /* AccountCreation.storyboard */; };
    1.10  		B78CF8251E76D706008C1739 /* FilterTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B78CF8241E76D706008C1739 /* FilterTableViewController.swift */; };
    1.11 @@ -889,6 +890,7 @@
    1.12  		B741D5021F26234A00DFD93A /* EmailAddressValidation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmailAddressValidation.swift; sourceTree = "<group>"; };
    1.13  		B74940021ECB3BEB001A710B /* UILabel+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UILabel+Extension.swift"; sourceTree = "<group>"; };
    1.14  		B74F81011EB0E20000519FCC /* LoginViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginViewModel.swift; sourceTree = "<group>"; };
    1.15 +		B7500CD52099B90400830AA9 /* EmailListCellViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmailListCellViewModel.swift; sourceTree = "<group>"; };
    1.16  		B75FF00A1EFD420F00C57289 /* EmailListViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmailListViewModel.swift; sourceTree = "<group>"; };
    1.17  		B78309C71EAA09040051A2E0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/AccountCreation.storyboard; sourceTree = "<group>"; };
    1.18  		B78CF8241E76D706008C1739 /* FilterTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FilterTableViewController.swift; path = Filter/FilterTableViewController.swift; sourceTree = "<group>"; };
    1.19 @@ -1984,6 +1986,7 @@
    1.20  			children = (
    1.21  				B75FF00A1EFD420F00C57289 /* EmailListViewModel.swift */,
    1.22  				15C5F2431F822560007DE086 /* PreviewMessage.swift */,
    1.23 +				B7500CD52099B90400830AA9 /* EmailListCellViewModel.swift */,
    1.24  			);
    1.25  			name = ViewModel;
    1.26  			sourceTree = "<group>";
    1.27 @@ -2350,6 +2353,7 @@
    1.28  				43ED53791CC77F95006AB156 /* UserInfoTableViewController.swift in Sources */,
    1.29  				43200D9D1F0CBC4000FFDE56 /* FetchMessagesService.swift in Sources */,
    1.30  				43C322101EA91764005073FB /* UIImage+Extension.swift in Sources */,
    1.31 +				B7500CD62099B90400830AA9 /* EmailListCellViewModel.swift in Sources */,
    1.32  				15865A8920319ADC00F7A4B5 /* Folder+pEp.swift in Sources */,
    1.33  				1547509A1FE7C0B4000D8004 /* FetchNumberOfNewMailsOperation.swift in Sources */,
    1.34  				43C6F35B1CBE7496006A2A18 /* ConnectionManager.swift in Sources */,
     2.1 --- a/pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift	Thu Apr 26 12:36:11 2018 +0200
     2.2 +++ b/pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift	Mon May 07 11:11:24 2018 +0200
     2.3 @@ -11,7 +11,8 @@
     2.4  import SwipeCellKit
     2.5  
     2.6  class EmailListViewController: BaseTableViewController, SwipeTableViewCellDelegate {
     2.7 -    var folderToShow: Folder?
     2.8 +    var folderToShow: Folder? //-> se ha de mover al vm
     2.9 +    private var model: EmailListViewModel?
    2.10  
    2.11      func updateLastLookAt() {
    2.12          guard let saveFolder = folderToShow else {
    2.13 @@ -20,8 +21,6 @@
    2.14          saveFolder.updateLastLookAt()
    2.15      }
    2.16      
    2.17 -    private var model: EmailListViewModel?
    2.18 -    
    2.19      private let queue: OperationQueue = {
    2.20          let createe = OperationQueue()
    2.21          createe.qualityOfService = .userInteractive
    2.22 @@ -108,6 +107,11 @@
    2.23      
    2.24      override func viewWillAppear(_ animated: Bool) {
    2.25          super.viewWillAppear(animated)
    2.26 +        guard let vm = model else {
    2.27 +            Log.shared.errorAndCrash(component: #function,
    2.28 +                                     errorString: "ViewModel can not be nil!")
    2.29 +            return
    2.30 +        }
    2.31          self.navigationController?.setToolbarHidden(false, animated: true)
    2.32          if MiscUtil.isUnitTest() {
    2.33              return
    2.34 @@ -117,7 +121,7 @@
    2.35          setup()
    2.36          
    2.37          // Mark this folder as having been looked at by the user
    2.38 -        updateLastLookAt()
    2.39 +        vm.updateLastLookAt()
    2.40          setupFoldersBarButton()
    2.41          if model != nil {
    2.42              updateFilterButtonView()
     3.1 --- a/pEpForiOS/UI/EmailDisplayList/EmailListViewModel.swift	Thu Apr 26 12:36:11 2018 +0200
     3.2 +++ b/pEpForiOS/UI/EmailDisplayList/EmailListViewModel.swift	Mon May 07 11:11:24 2018 +0200
     3.3 @@ -154,6 +154,8 @@
     3.4      var rowCount: Int {
     3.5          return messages?.count ?? 0
     3.6      }
     3.7 +
     3.8 +    func updateLastLookAt() {}
     3.9      
    3.10      /// Returns the senders contact image to display.
    3.11      /// This is a possibly time consuming process and shold not be called from the main thread.