-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1309 from radixdlt/feature/ABW-4050-change-main-d…
…evice-factor-source [ABW-4050] Change main device factor source
- Loading branch information
Showing
18 changed files
with
566 additions
and
192 deletions.
There are no files selected for viewing
13 changes: 4 additions & 9 deletions
13
...com/babylon/wallet/android/domain/usecases/factorsources/GetFactorSourcesOfTypeUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
package com.babylon.wallet.android.domain.usecases.factorsources | ||
|
||
import com.radixdlt.sargon.FactorSource | ||
import kotlinx.coroutines.ExperimentalCoroutinesApi | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.asFlow | ||
import kotlinx.coroutines.flow.filterIsInstance | ||
import kotlinx.coroutines.flow.flatMapConcat | ||
import kotlinx.coroutines.flow.map | ||
import rdx.works.profile.domain.GetProfileUseCase | ||
import javax.inject.Inject | ||
|
||
class GetFactorSourcesOfTypeUseCase @Inject constructor( | ||
val getProfileUseCase: GetProfileUseCase | ||
) { | ||
|
||
@OptIn(ExperimentalCoroutinesApi::class) | ||
inline operator fun <reified T : FactorSource> invoke(): Flow<T> { | ||
inline operator fun <reified T : FactorSource> invoke(): Flow<List<T>> { | ||
return getProfileUseCase.flow | ||
.flatMapConcat { profile -> | ||
profile.factorSources.asFlow() | ||
.map { profile -> | ||
profile.factorSources.filterIsInstance<T>() | ||
} | ||
.filterIsInstance<T>() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.