IOS-663 fixes: unified inbox appears as target folder IOS-663
authorbuff <andreas@pep-project.org>
Wed, 16 May 2018 16:06:46 +0200
branchIOS-663
changeset 47091d607e5898c4
parent 4708 ebe8da58422d
child 4711 d28d85152244
IOS-663 fixes: unified inbox appears as target folder
pEpForiOS/UI/Folder/ViewModel/FolderViewModel.swift
pEpForiOS/UI/MoveToFolder/MoveToFolderViewController.swift
     1.1 --- a/pEpForiOS/UI/Folder/ViewModel/FolderViewModel.swift	Wed May 16 15:06:03 2018 +0200
     1.2 +++ b/pEpForiOS/UI/Folder/ViewModel/FolderViewModel.swift	Wed May 16 16:06:46 2018 +0200
     1.3 @@ -18,7 +18,7 @@
     1.4      /// One row per folder
     1.5      /// If no account is given, all accounts found in the store are taken into account.
     1.6      /// - Parameter accounts: accounts to to create folder hierarchy view model for.
     1.7 -    public init(withFordersIn accounts: [Account]? = nil) {
     1.8 +    public init(withFordersIn accounts: [Account]? = nil, includeUnifiedInbox: Bool = true) {
     1.9          items = [FolderSectionViewModel]()
    1.10          let accountsToUse: [Account]
    1.11          if let safeAccounts = accounts {
    1.12 @@ -26,11 +26,13 @@
    1.13          } else {
    1.14              accountsToUse = Account.all()
    1.15          }
    1.16 -        generateSections(accounts: accountsToUse)
    1.17 +        generateSections(accounts: accountsToUse, includeUnifiedInbox: includeUnifiedInbox)
    1.18      }
    1.19  
    1.20 -    private func generateSections(accounts: [Account]) {
    1.21 -        items.append(FolderSectionViewModel(account: nil, Unified: true))
    1.22 +    private func generateSections(accounts: [Account], includeUnifiedInbox: Bool = true) {
    1.23 +        if includeUnifiedInbox {
    1.24 +            items.append(FolderSectionViewModel(account: nil, Unified: true))
    1.25 +        }
    1.26          for acc in accounts {
    1.27              items.append(FolderSectionViewModel(account: acc, Unified: false))
    1.28          }
     2.1 --- a/pEpForiOS/UI/MoveToFolder/MoveToFolderViewController.swift	Wed May 16 15:06:03 2018 +0200
     2.2 +++ b/pEpForiOS/UI/MoveToFolder/MoveToFolderViewController.swift	Wed May 16 16:06:46 2018 +0200
     2.3 @@ -69,7 +69,7 @@
     2.4                                       errorString: "What are we supposed to display?")
     2.5              return
     2.6          }
     2.7 -        viewModel = FolderViewModel(withFordersIn: [acc])
     2.8 +        viewModel = FolderViewModel(withFordersIn: [acc],  includeUnifiedInbox: false)
     2.9      }
    2.10  
    2.11      // MARK: - ACTION