This commit is contained in:
Milan Cerovsky 2025-04-25 11:44:22 +02:00
parent 616f4cce13
commit b54a09dcff
4 changed files with 13 additions and 17 deletions

View File

@ -4,7 +4,9 @@ import co.electriccoin.zcash.preference.model.entry.BooleanPreferenceDefault
import co.electriccoin.zcash.preference.model.entry.NullableBooleanPreferenceDefault import co.electriccoin.zcash.preference.model.entry.NullableBooleanPreferenceDefault
import co.electriccoin.zcash.preference.model.entry.PreferenceKey import co.electriccoin.zcash.preference.model.entry.PreferenceKey
interface BooleanStorageProvider : StorageProvider<Boolean> interface BooleanStorageProvider : StorageProvider<Boolean> {
suspend fun flip()
}
interface NullableBooleanStorageProvider : NullableStorageProvider<Boolean> interface NullableBooleanStorageProvider : NullableStorageProvider<Boolean>
@ -14,6 +16,10 @@ abstract class BaseBooleanStorageProvider(
) : BaseStorageProvider<Boolean>(), ) : BaseStorageProvider<Boolean>(),
BooleanStorageProvider { BooleanStorageProvider {
override val default = BooleanPreferenceDefault(key = key, defaultValue = default) override val default = BooleanPreferenceDefault(key = key, defaultValue = default)
override suspend fun flip() {
store(!get())
}
} }
abstract class BaseNullableBooleanStorageProvider( abstract class BaseNullableBooleanStorageProvider(

View File

@ -1,30 +1,22 @@
package co.electriccoin.zcash.ui.common.usecase package co.electriccoin.zcash.ui.common.usecase
import co.electriccoin.zcash.ui.common.datasource.AccountDataSource
import co.electriccoin.zcash.ui.common.repository.ConfigurationRepository import co.electriccoin.zcash.ui.common.repository.ConfigurationRepository
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
class GetCoinbaseStatusUseCase( class GetCoinbaseStatusUseCase(
private val configurationRepository: ConfigurationRepository, private val configurationRepository: ConfigurationRepository,
private val accountDataSource: AccountDataSource,
) { ) {
@OptIn(ExperimentalCoroutinesApi::class)
fun observe() = fun observe() =
configurationRepository configurationRepository
.isCoinbaseAvailable .isCoinbaseAvailable
.filterNotNull() .filterNotNull()
.flatMapLatest { isAvailable -> .map { isAvailable ->
if (isAvailable) { if (isAvailable) {
accountDataSource.selectedAccount.map { Status.ENABLED
Status.ENABLED
}
} else { } else {
flowOf(Status.UNAVAILABLE) Status.UNAVAILABLE
} }
}.distinctUntilChanged() }.distinctUntilChanged()
} }

View File

@ -55,9 +55,7 @@ class ShieldFundsInfoViewModel(
initialValue = null initialValue = null
) )
private fun onCheckboxClick() = viewModelScope.launch { private fun onCheckboxClick() = viewModelScope.launch { shieldFundsInfoProvider.flip() }
shieldFundsInfoProvider.store(!shieldFundsInfoProvider.get())
}
private fun onNotNowClick() = navigationRouter.back() private fun onNotNowClick() = navigationRouter.back()

View File

@ -34,8 +34,8 @@
<string name="home_info_backup_message_1">Si pierdes acceso a la app o a tu dispositivo, conocer la Frase Secreta de Recuperación es la única forma de recuperar tus fondos. Nosotros no podemos verla ni ayudarte a recuperarla.</string> <string name="home_info_backup_message_1">Si pierdes acceso a la app o a tu dispositivo, conocer la Frase Secreta de Recuperación es la única forma de recuperar tus fondos. Nosotros no podemos verla ni ayudarte a recuperarla.</string>
<string name="home_info_backup_message_2">Cualquiera que tenga acceso a tu Frase Secreta de Recuperación tendrá control total de tu billetera, así que mantenla segura y no la compartas con nadie.</string> <string name="home_info_backup_message_2">Cualquiera que tenga acceso a tu Frase Secreta de Recuperación tendrá control total de tu billetera, así que mantenla segura y no la compartas con nadie.</string>
<string name="home_info_backup_checkbox">He leído y entiendo los riesgos de no respaldar mi billetera.</string> <string name="home_info_backup_checkbox">He leído y entiendo los riesgos de no respaldar mi billetera.</string>
<string name="home_info_transparent_not_now">Not now</string> <string name="home_info_transparent_not_now">Ahora no</string>
<string name="home_info_transparent_checkbox">Do not show this message again.</string> <string name="home_info_transparent_checkbox">No mostrar este mensaje de nuevo.</string>
<string name="home_info_transparent_balance_shield">Proteger</string> <string name="home_info_transparent_balance_shield">Proteger</string>
<string name="home_info_transparent_title">Siempre proteger fondos transparentes</string> <string name="home_info_transparent_title">Siempre proteger fondos transparentes</string>
<string name="home_info_transparent_subtitle">Para proteger la privacidad del usuario, Zashi no permite gastar ZEC transparentes. Toca el botón "Proteger" para hacer que tus fondos transparentes se puedan usar y mantener tu saldo de Zashi privado.</string> <string name="home_info_transparent_subtitle">Para proteger la privacidad del usuario, Zashi no permite gastar ZEC transparentes. Toca el botón "Proteger" para hacer que tus fondos transparentes se puedan usar y mantener tu saldo de Zashi privado.</string>