0
0
mirror of https://github.com/thunderbird/thunderbird-android.git synced 2024-09-19 19:52:14 +02:00

Remove FoldersViewModel on K9

This commit is contained in:
Wolf-Martell Montwé 2024-08-05 12:41:48 +02:00
parent 737a85cdf1
commit cf54189fe9
No known key found for this signature in database
GPG Key ID: 6D45B21512ACBF72
2 changed files with 10 additions and 3 deletions

View File

@ -7,7 +7,6 @@ import androidx.lifecycle.viewModelScope
import app.k9mail.legacy.account.Account
import app.k9mail.legacy.ui.folder.DisplayUnifiedInbox
import app.k9mail.legacy.ui.folder.FolderList
import com.fsck.k9.K9
import com.fsck.k9.controller.MessageCountsProvider
import com.fsck.k9.mailstore.FolderRepository
import com.fsck.k9.search.SearchAccount
@ -25,6 +24,7 @@ import kotlinx.coroutines.launch
class FoldersViewModel(
private val folderRepository: FolderRepository,
private val messageCountsProvider: MessageCountsProvider,
private val isShowUnifiedInbox: () -> Boolean,
backgroundDispatcher: CoroutineDispatcher = Dispatchers.IO,
) : ViewModel() {
private val inputFlow = MutableSharedFlow<Account?>(replay = 1)
@ -56,7 +56,7 @@ class FoldersViewModel(
}
private fun getUnifiedInboxAccount(): SearchAccount? {
return if (K9.isShowUnifiedInbox) SearchAccount.createUnifiedInboxAccount() else null
return if (isShowUnifiedInbox()) SearchAccount.createUnifiedInboxAccount() else null
}
fun getFolderListLiveData(): LiveData<FolderList> {

View File

@ -2,11 +2,18 @@ package com.fsck.k9.ui.folders
import app.k9mail.legacy.ui.folder.FolderIconProvider
import app.k9mail.legacy.ui.folder.FolderNameFormatter
import com.fsck.k9.K9
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.dsl.module
val foldersUiModule = module {
factory { FolderNameFormatter(resources = get()) }
viewModel { FoldersViewModel(folderRepository = get(), messageCountsProvider = get()) }
viewModel {
FoldersViewModel(
folderRepository = get(),
messageCountsProvider = get(),
isShowUnifiedInbox = { K9.isShowUnifiedInbox },
)
}
factory { FolderIconProvider() }
}