IOS-1495 delete action will be never disabled IOS-1521+IOS-1495
authorXavier Algarra <xavier@pep-project.org>
Wed, 15 May 2019 13:12:11 +0200
branchIOS-1521+IOS-1495
changeset 8624d25425528e65
parent 8623 6af6c7564b3b
child 8625 455df939d9be
IOS-1495 delete action will be never disabled
pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift
pEpForiOS/UI/EmailDisplayList/EmailListViewModel+MessageQueryResultsDelegate.swift
pEpForiOS/UI/EmailDisplayList/EmailListViewModel.swift
     1.1 --- a/pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift	Tue May 14 16:16:52 2019 +0200
     1.2 +++ b/pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift	Wed May 15 13:12:11 2019 +0200
     1.3 @@ -535,14 +535,14 @@
     1.4          let archiveAction =
     1.5              SwipeAction(style: .destructive,
     1.6                          title: destructiveAction.title(forDisplayMode: .titleAndImage)) {
     1.7 -                [weak self] action, indexPath in
     1.8 -                guard let me = self else {
     1.9 -                    Log.shared.errorAndCrash("Lost MySelf")
    1.10 -                    return
    1.11 -                }
    1.12 -
    1.13 -                me.deleteAction(forCellAt: indexPath)
    1.14 -                me.swipeDelete = action
    1.15 +                            [weak self] action, indexPath in
    1.16 +                            guard let me = self else {
    1.17 +                                Log.shared.errorAndCrash("Lost MySelf")
    1.18 +                                return
    1.19 +                            }
    1.20 +                            me.deleteAction(forCellAt: indexPath)
    1.21 +                            me.swipeDelete = action
    1.22 +                            //action.fulfill(with: .delete)
    1.23          }
    1.24          configure(action: archiveAction, with: destructiveAction)
    1.25          swipeActions.append(archiveAction)
     2.1 --- a/pEpForiOS/UI/EmailDisplayList/EmailListViewModel+MessageQueryResultsDelegate.swift	Tue May 14 16:16:52 2019 +0200
     2.2 +++ b/pEpForiOS/UI/EmailDisplayList/EmailListViewModel+MessageQueryResultsDelegate.swift	Wed May 15 13:12:11 2019 +0200
     2.3 @@ -24,9 +24,7 @@
     2.4      }
     2.5  
     2.6      func didDelete(indexPath: IndexPath) {
     2.7 -        if !deleteDisabled {
     2.8              emailListViewModelDelegate?.emailListViewModel(viewModel: self, didRemoveDataAt: [indexPath])
     2.9 -        }
    2.10      }
    2.11  
    2.12      func didMove(from: IndexPath, to: IndexPath) {
     3.1 --- a/pEpForiOS/UI/EmailDisplayList/EmailListViewModel.swift	Tue May 14 16:16:52 2019 +0200
     3.2 +++ b/pEpForiOS/UI/EmailDisplayList/EmailListViewModel.swift	Wed May 15 13:12:11 2019 +0200
     3.3 @@ -51,7 +51,6 @@
     3.4  
     3.5      var lastSearchTerm = ""
     3.6      var updatesEnabled = true
     3.7 -    var deleteDisabled = false
     3.8  
     3.9      public var emailListViewModelDelegate: EmailListViewModelDelegate?
    3.10  
    3.11 @@ -172,7 +171,6 @@
    3.12              // EmailListView without having an account.
    3.13              return 0
    3.14          }
    3.15 -
    3.16          do {
    3.17              return try messageQueryResults.count()
    3.18          } catch {
    3.19 @@ -297,7 +295,6 @@
    3.20      }
    3.21  
    3.22      func delete(forIndexPath indexPath: IndexPath) {
    3.23 -        deleteDisabled = true
    3.24          let _ = deleteMessage(at: indexPath)
    3.25      }
    3.26