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

Change use case to operator function for easier use

This commit is contained in:
Wolf-Martell Montwé 2024-09-11 11:43:20 +02:00
parent 913a7e0570
commit 1dce31a5b7
No known key found for this signature in database
GPG Key ID: 6D45B21512ACBF72
3 changed files with 3 additions and 3 deletions

View File

@ -7,7 +7,7 @@ interface DomainContract {
interface UseCase {
fun interface GetDisplayAccounts {
fun execute(): Flow<List<DisplayAccount>>
operator fun invoke(): Flow<List<DisplayAccount>>
}
}
}

View File

@ -27,7 +27,7 @@ class GetDisplayAccounts(
) : UseCase.GetDisplayAccounts {
@OptIn(ExperimentalCoroutinesApi::class)
override fun execute(): Flow<List<DisplayAccount>> {
override fun invoke(): Flow<List<DisplayAccount>> {
return accountManager.getAccountsFlow()
.flatMapLatest { accounts ->
val messageCountsFlows: List<Flow<MessageCounts>> = accounts.map { account ->

View File

@ -9,5 +9,5 @@ import app.k9mail.feature.navigation.drawer.domain.entity.DisplayAccount
class AccountsViewModel(
getDisplayAccounts: UseCase.GetDisplayAccounts,
) : ViewModel() {
val displayAccountsLiveData: LiveData<List<DisplayAccount>> = getDisplayAccounts.execute().asLiveData()
val displayAccountsLiveData: LiveData<List<DisplayAccount>> = getDisplayAccounts().asLiveData()
}