Sort list of folders in account settings

This commit is contained in:
cketti 2022-12-09 12:56:12 +01:00
parent 3665deef61
commit e71b4bcb90

View file

@ -70,6 +70,11 @@ class AccountSettingsViewModel(
viewModelScope.launch {
val remoteFolderInfo = withContext(backgroundDispatcher) {
val folders = folderRepository.getRemoteFolders(account)
.sortedWith(
compareByDescending<RemoteFolder> { it.type == FolderType.INBOX }
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name }
)
val automaticSpecialFolders = getAutomaticSpecialFolders(folders)
RemoteFolderInfo(folders, automaticSpecialFolders)
}