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:
parent
913a7e0570
commit
1dce31a5b7
@ -7,7 +7,7 @@ interface DomainContract {
|
||||
|
||||
interface UseCase {
|
||||
fun interface GetDisplayAccounts {
|
||||
fun execute(): Flow<List<DisplayAccount>>
|
||||
operator fun invoke(): Flow<List<DisplayAccount>>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 ->
|
||||
|
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user