Updated on 2026-08-14
This commit is contained in:
parent
8b576c6492
commit
d9bbb09aef
8 changed files with 35 additions and 19 deletions
|
|
@ -54,8 +54,8 @@ private class CoilTimberLogger : Logger {
|
|||
|
||||
override fun log(tag: String, priority: Int, message: String?, throwable: Throwable?) {
|
||||
with(Timber.tag(COIL_LOG_TAG)) {
|
||||
throwable?.let { e -> e(e, message) }
|
||||
message?.let { msg -> d(msg) }
|
||||
if (throwable != null) e(throwable, message)
|
||||
if (message != null) d(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -41,8 +41,8 @@ object SimpleCancelableAlertDialog {
|
|||
context: Context,
|
||||
): AlertDialog {
|
||||
return MaterialAlertDialogBuilder(context, R.style.CustomMaterialDialog).apply {
|
||||
setTitle(titleRes?.let { context.getString(it) } ?: title)
|
||||
setMessage(messageRes?.let { context.getString(it) } ?: message)
|
||||
setTitle(if (titleRes != null) context.getString(titleRes) else title)
|
||||
setMessage(if (messageRes != null) context.getString(messageRes) else message)
|
||||
setPositiveButton(context.getText(primaryButtonRes)) { _, _ -> primaryButtonAction() }
|
||||
if (secondaryButtonRes != null) {
|
||||
setNegativeButton(context.getText(secondaryButtonRes)) { _, _ -> secondaryButtonAction() }
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.tangem.tap.domain.userWalletList.utils.toUserWallets
|
|||
import com.tangem.tap.domain.userWalletList.utils.updateWith
|
||||
import com.tangem.utils.Provider
|
||||
import com.tangem.utils.ProviderSuspend
|
||||
import com.tangem.utils.coroutines.runSuspendCatching
|
||||
import com.tangem.utils.extensions.indexOfFirstOrNull
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
|
|
@ -149,7 +150,7 @@ internal class DefaultUserWalletsListRepository(
|
|||
val encryptionKey = userWallet.encryptionKey
|
||||
?: raise(SetLockError.UserWalletLocked)
|
||||
|
||||
runCatching {
|
||||
runSuspendCatching {
|
||||
userWalletEncryptionKeysRepository.save(
|
||||
encryptionKey = UserWalletEncryptionKey(
|
||||
walletId = userWalletId,
|
||||
|
|
@ -232,7 +233,7 @@ internal class DefaultUserWalletsListRepository(
|
|||
val encryptionKey = requestPasswordRecursive(
|
||||
hotWalletId = userWallet.hotWalletId,
|
||||
block = { password ->
|
||||
runCatching {
|
||||
runSuspendCatching {
|
||||
userWalletEncryptionKeysRepository.getEncryptedWithPassword(userWalletId, password)
|
||||
}.onFailure {
|
||||
raise(UnlockWalletError.UnableToUnlock)
|
||||
|
|
@ -288,7 +289,7 @@ internal class DefaultUserWalletsListRepository(
|
|||
|
||||
override suspend fun unlockAllWallets(): Either<UnlockWalletError, Unit> = either {
|
||||
val userWallets = userWalletsSync()
|
||||
val biometricKeys = runCatching {
|
||||
val biometricKeys = runSuspendCatching {
|
||||
userWalletEncryptionKeysRepository.getAllBiometric()
|
||||
}.getOrElse {
|
||||
// TODO handle error properly [REDACTED_TASK_KEY]
|
||||
|
|
|
|||
|
|
@ -77,9 +77,13 @@ internal class WelcomeModel @Inject constructor(
|
|||
warning = warning,
|
||||
error = state.error
|
||||
?.takeIf { !it.silent && warning == null }
|
||||
?.let { e ->
|
||||
e.messageResId?.let { TextReference.Res(it) }
|
||||
?: TextReference.Str(e.customMessage)
|
||||
?.let { error ->
|
||||
val messageResId = error.messageResId
|
||||
if (messageResId != null) {
|
||||
TextReference.Res(messageResId)
|
||||
} else {
|
||||
TextReference.Str(error.customMessage)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import com.tangem.domain.transaction.models.AssetRequirementsCondition
|
|||
import com.tangem.utils.Provider
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import com.tangem.utils.coroutines.runCatching
|
||||
import com.tangem.utils.coroutines.runSuspendCatching
|
||||
import com.tangem.utils.isNullOrZero
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.firstOrNull
|
||||
|
|
@ -35,7 +36,7 @@ internal class DefaultRampManager(
|
|||
userWallet: UserWallet,
|
||||
cryptoCurrency: CryptoCurrency,
|
||||
): ScenarioUnavailabilityReason {
|
||||
val availabilityState = runCatching { getOnrampAvailableState(userWallet.walletId, cryptoCurrency) }
|
||||
val availabilityState = runSuspendCatching { getOnrampAvailableState(userWallet.walletId, cryptoCurrency) }
|
||||
.getOrNull()
|
||||
?: ExpressAvailabilityState.Error
|
||||
|
||||
|
|
@ -84,7 +85,7 @@ internal class DefaultRampManager(
|
|||
userWalletId: UserWalletId,
|
||||
cryptoCurrency: CryptoCurrency,
|
||||
): ScenarioUnavailabilityReason {
|
||||
val availabilityState = runCatching {
|
||||
val availabilityState = runSuspendCatching {
|
||||
getExchangeableState(userWalletId, cryptoCurrency)
|
||||
}.getOrNull() ?: ExpressAvailabilityState.Error
|
||||
return availabilityState.toReason(cryptoCurrency.name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue