@@ -560,7 +560,10 @@ class RefreshController @Inject constructor(
560
560
}
561
561
}
562
562
563
- private inline fun <reified T : MessageFlags > getMessagesUidsDelta (folderId : String , previousCursor : String ): ActivitiesResult <T >? {
563
+ private inline fun <reified T : MessageFlags > getMessagesUidsDelta (
564
+ folderId : String ,
565
+ previousCursor : String ,
566
+ ): ActivitiesResult <T >? {
564
567
return with (ApiRepository .getMessagesUidsDelta<T >(mailbox.uuid, folderId, previousCursor, okHttpClient)) {
565
568
if (! isSuccess()) throwErrorAsException()
566
569
return @with data
@@ -650,18 +653,23 @@ class RefreshController @Inject constructor(
650
653
651
654
getUpToDateFolder(folderId).let { currentFolder ->
652
655
currentFolder.threads.replaceContent(list = allCurrentFolderThreads)
653
- if (currentFolder.role == FolderRole .SCHEDULED_DRAFTS ) currentFolder.isDisplayed = currentFolder.threads.isNotEmpty()
656
+ if (currentFolderRefreshStrategy.shouldHideEmptyFolder()) {
657
+ currentFolder.isDisplayed = currentFolder.threads.isNotEmpty()
658
+ }
654
659
extraFolderUpdates?.invoke(currentFolder)
655
660
}
656
661
657
662
// Some folders such as inbox and snooze require to query again the other folder's threads as well. For example, if a
658
663
// message uid is returned as "added" or "deleted" in the snooze folder, it should disappear or appear from inbox as well.
659
664
currentFolderRefreshStrategy.otherFolderRolesToQueryThreads().forEach { folderRole ->
660
665
getUpToDateFolder(folderRole)?.let { otherFolder ->
661
- val allOtherFolderThreads = otherFolder.refreshStrategy().queryFolderThreads(folderId, realm = this )
666
+ val otherFolderRefreshStrategy = otherFolder.refreshStrategy()
667
+ val allOtherFolderThreads = otherFolderRefreshStrategy.queryFolderThreads(folderId, realm = this )
662
668
otherFolder.threads.replaceContent(list = allOtherFolderThreads)
663
669
664
- if (otherFolder.role == FolderRole .SCHEDULED_DRAFTS ) otherFolder.isDisplayed = otherFolder.threads.isNotEmpty()
670
+ if (otherFolderRefreshStrategy.shouldHideEmptyFolder()) {
671
+ otherFolder.isDisplayed = otherFolder.threads.isNotEmpty()
672
+ }
665
673
}
666
674
}
667
675
}
0 commit comments