Updated on 2026-08-14

This commit is contained in:
Tangem 2025-09-30 16:48:26 +03:00
parent acf110dbcc
commit 6910f74fd9
242 changed files with 866 additions and 732 deletions

View file

@ -122,10 +122,10 @@ internal class DefaultWalletAccountsFetcher @Inject constructor(
responseBody
},
onError = {
onError = { throwable ->
// pushWalletAccounts and storeWalletAccounts help to avoid cyclic dependency
fetchWalletAccountsErrorHandler.handle(
error = it,
error = throwable,
userWalletId = userWalletId,
savedAccountsResponse = savedAccountsResponse,
pushWalletAccounts = ::push,

View file

@ -50,7 +50,7 @@ internal class WalletAccountListFlowFactory @Inject constructor(
val currencies = if (isSingleWalletWithToken) {
cardCryptoCurrencyFactory.createCurrenciesForSingleCurrencyCardWithToken(userWallet = userWallet).toSet()
} else {
cardCryptoCurrencyFactory.createPrimaryCurrencyForSingleCurrencyCard(userWallet = userWallet).let(::setOf)
setOf(cardCryptoCurrencyFactory.createPrimaryCurrencyForSingleCurrencyCard(userWallet = userWallet))
}
return AccountList.empty(userWallet = userWallet, cryptoCurrencies = currencies)

View file

@ -20,8 +20,8 @@ class DefaultDeviceFlipDetector @Inject constructor(
) : DeviceFlipDetector, DefaultLifecycleObserver {
private val sensorManager = context.getSystemService(Context.SENSOR_SERVICE) as SensorManager
private var gravitySensor = sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY)
private var isResumedState = AtomicBoolean(false)
private val gravitySensor = sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY)
private val isResumedState = AtomicBoolean(false)
override fun onPause(owner: LifecycleOwner) {
isResumedState.set(false)

View file

@ -17,9 +17,9 @@ internal class FlipListener(private val action: () -> Unit) : SensorEventListene
}
override fun onSensorChanged(event: SensorEvent?) {
event?.let {
if (event != null) {
val currentTime = SystemClock.elapsedRealtime()
val zAxisValue = it.values[2]
val zAxisValue = event.values[2]
if (zAxisValue < zAxisThreshold && !isScreenDown) {
isScreenDown = true

View file

@ -47,7 +47,7 @@ suspend inline fun <T> safeApiCallWithTimeout(
): T = safeApiCall(
call = {
withTimeoutOrNull(timeoutMillis) { call() }
?: raise(ApiResponseError.TimeoutException)
?: raise(ApiResponseError.TimeoutException())
},
onError = onError,
)

View file

@ -30,13 +30,22 @@ internal class DefaultAppRatingRepository(
override fun isReadyToShow(): Flow<Boolean> {
// TODO: [REDACTED_JIRA]
return combine(
appPreferencesStore.get(key = PreferencesKeys.USER_WAS_INTERACT_WITH_RATING_KEY, default = false),
appPreferencesStore.get(
flow = appPreferencesStore.get(
key = PreferencesKeys.USER_WAS_INTERACT_WITH_RATING_KEY,
default = false,
),
flow2 = appPreferencesStore.get(
key = PreferencesKeys.SHOW_RATING_DIALOG_AT_LAUNCH_COUNT_KEY,
default = FIRST_SHOWING_COUNT,
),
appPreferencesStore.get(key = PreferencesKeys.APP_LAUNCH_COUNT_KEY, default = DEFAULT_APP_LAUNCH_COUNT),
appPreferencesStore.get(key = PreferencesKeys.FUNDS_FOUND_DATE_KEY, default = FUNDS_FOUND_DATE_UNDEFINED),
flow3 = appPreferencesStore.get(
key = PreferencesKeys.APP_LAUNCH_COUNT_KEY,
default = DEFAULT_APP_LAUNCH_COUNT,
),
flow4 = appPreferencesStore.get(
key = PreferencesKeys.FUNDS_FOUND_DATE_KEY,
default = FUNDS_FOUND_DATE_UNDEFINED,
),
) { isInteracting, ratingShowingCount, appLaunchCount, fundsFoundDate ->
if (!isInteracting) {
val diff = Calendar.getInstance().timeInMillis - fundsFoundDate

View file

@ -101,12 +101,12 @@ class DefaultTxHistoryRepository(
userWalletId: UserWalletId,
currency: CryptoCurrency,
pageSize: Int,
refresh: Boolean,
shouldRefresh: Boolean,
): List<TxInfo> = withContext(dispatchers.io) {
try {
cacheRegistry.invokeOnExpire(
key = getTxHistoryPageKey(currency, userWalletId, Page.Initial),
skipCache = refresh,
skipCache = shouldRefresh,
block = { fetchFixedSizeTxHistoryItems(userWalletId, currency, pageSize) },
)
val txs = txHistoryItemsStore.getSyncOrNull(

View file

@ -55,7 +55,7 @@ internal class RefactoredTxHistoryRepository(
): PaginationWrapper<TxInfo> {
cacheRegistry.invokeOnExpire(
key = getTxHistoryPageKey(request.page, request.params),
skipCache = request.params.refresh,
skipCache = request.params.shouldRefresh,
block = { fetch(request, batchSize) },
)

View file

@ -100,7 +100,7 @@ internal class DefaultVisaRepository @Inject constructor(
)
}
override suspend fun getTxHistory(
override fun getTxHistory(
userWalletId: UserWalletId,
pageSize: Int,
isRefresh: Boolean,
@ -218,7 +218,7 @@ internal class DefaultVisaRepository @Inject constructor(
return cardWallet.publicKey.toHexString()
}
private suspend fun findVisaUserWallet(userWalletId: UserWalletId): UserWallet {
private fun findVisaUserWallet(userWalletId: UserWalletId): UserWallet {
val userWallet = requireNotNull(userWalletsStore.getSyncOrNull(userWalletId)) {
"No user wallet found: $userWalletId"
}

View file

@ -15,7 +15,7 @@ internal class MockVisaRepository @Inject constructor() : VisaRepository {
TODO("Not implemented for this build type")
}
override suspend fun getTxHistory(
override fun getTxHistory(
userWalletId: UserWalletId,
pageSize: Int,
isRefresh: Boolean,