mirror of
https://github.com/thunderbird/thunderbird-android.git
synced 2024-09-20 04:02:14 +02:00
Remove FoldersViewModel
on K9
This commit is contained in:
parent
737a85cdf1
commit
cf54189fe9
@ -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> {
|
||||
|
@ -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() }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user