Updated on 2026-08-14
This commit is contained in:
parent
cef6a7b372
commit
f394a5b57b
4 changed files with 11 additions and 5 deletions
|
|
@ -14,8 +14,6 @@ class ListenToFlipsUseCase(
|
|||
private val balanceHidingRepository: BalanceHidingRepository,
|
||||
) {
|
||||
|
||||
var isEnabled: Boolean = true
|
||||
|
||||
operator fun invoke(): Flow<Either<HideBalancesError, Unit>> = channelFlow {
|
||||
flipDetector.getDeviceFlipFlow().collectLatest {
|
||||
val balanceHidingSettings = catch(
|
||||
|
|
@ -26,7 +24,7 @@ class ListenToFlipsUseCase(
|
|||
},
|
||||
)
|
||||
|
||||
if (balanceHidingSettings.isHidingEnabledInSettings && isEnabled) {
|
||||
if (balanceHidingSettings.isHidingEnabledInSettings && balanceHidingRepository.isUpdateEnabled) {
|
||||
catch(
|
||||
block = {
|
||||
balanceHidingRepository.storeBalanceHidingSettings(
|
||||
|
|
@ -43,4 +41,8 @@ class ListenToFlipsUseCase(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun changeUpdateEnabled(isUpdateEnabled: Boolean) {
|
||||
balanceHidingRepository.isUpdateEnabled = isUpdateEnabled
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,8 @@ import kotlinx.coroutines.flow.Flow
|
|||
|
||||
interface BalanceHidingRepository {
|
||||
|
||||
var isUpdateEnabled: Boolean
|
||||
|
||||
fun getBalanceHidingSettingsFlow(): Flow<BalanceHidingSettings>
|
||||
|
||||
suspend fun storeBalanceHidingSettings(isBalanceHidden: BalanceHidingSettings)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue