@@ -503,26 +503,22 @@ class MainViewModel @Inject constructor(
503
503
504
504
deleteThreadOrMessageTrigger.postValue(Unit )
505
505
506
- when {
507
- apiResponses.atLeastOneSucceeded() -> {
508
- if (shouldAutoAdvance(message, threadsUids)) autoAdvanceThreadsUids.postValue(threadsUids)
509
-
510
- refreshFoldersAsync(
511
- mailbox = mailbox,
512
- messagesFoldersIds = messages.getFoldersIds(exception = trashId),
513
- destinationFolderId = trashId,
514
- callbacks = RefreshCallbacks (::onDownloadStart, ::onDownloadStop),
515
- )
516
- }
517
- ! apiResponses.atLeastOneSucceeded() -> {
518
- threadController.updateIsMovedOutLocally(threadsUids, hasBeenMovedOut = false )
519
- }
520
- isSwipe -> {
521
- // We need to make the swiped Thread come back, so we reassign the LiveData with Realm values
522
- reassignCurrentThreadsLive()
523
- }
506
+ if (apiResponses.atLeastOneSucceeded()) {
507
+ if (shouldAutoAdvance(message, threadsUids)) autoAdvanceThreadsUids.postValue(threadsUids)
508
+
509
+ refreshFoldersAsync(
510
+ mailbox = mailbox,
511
+ messagesFoldersIds = messages.getFoldersIds(exception = trashId),
512
+ destinationFolderId = trashId,
513
+ callbacks = RefreshCallbacks (onStart = { onDownloadStart() }, onStop = { onDownloadStop(threadsUids) }),
514
+ )
515
+ } else if (isSwipe) {
516
+ // We need to make the swiped Thread come back, so we reassign the LiveData with Realm values
517
+ reassignCurrentThreadsLive()
524
518
}
525
519
520
+ threadController.updateIsMovedOutLocally(threadsUids, hasBeenMovedOut = false )
521
+
526
522
val undoDestinationId = message?.folderId ? : threads.first().folderId
527
523
val undoFoldersIds = (messages.getFoldersIds(exception = undoDestinationId) + trashId).filterNotNull()
528
524
showDeleteSnackbar(
@@ -618,10 +614,10 @@ class MainViewModel @Inject constructor(
618
614
destinationFolderId = destinationFolder.id,
619
615
callbacks = RefreshCallbacks (onStart = { onDownloadStart() }, onStop = { onDownloadStop(threadsUids) }),
620
616
)
621
- } else {
622
- threadController.updateIsMovedOutLocally(threadsUids, hasBeenMovedOut = false )
623
617
}
624
618
619
+ threadController.updateIsMovedOutLocally(threadsUids, hasBeenMovedOut = false )
620
+
625
621
showMoveSnackbar(threads, message, messages, apiResponses, destinationFolder)
626
622
}
627
623
0 commit comments