Skip to content

Commit

Permalink
Fix crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
furenster committed Dec 1, 2024
1 parent ffeba86 commit 23fd672
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ class AmountViewModel @Inject constructor(
memo = memo,
isMax = maxAmount.value,
)
TransactionType.StakeDelegate -> builder.delegate(validator?.id!!)
TransactionType.StakeUndelegate -> builder.undelegate(delegation!!)
TransactionType.StakeDelegate -> builder.delegate(validator?.id ?: return@launch) // TODO: Add error showing
TransactionType.StakeUndelegate -> builder.undelegate(delegation ?: return@launch) // TODO: Add error showing
TransactionType.StakeRewards -> builder.rewards(
stakeRepository.getRewards(asset.id, state.assetInfo.owner.address).map { it.validator.id }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private fun SwapError(state: SwapState) {
SwapError.NotSupportedAsset -> stringResource(com.gemwallet.android.localize.R.string.errors_swap_not_supported_asset)
SwapError.NotSupportedChain -> stringResource(com.gemwallet.android.localize.R.string.errors_swap_not_supported_chain)
SwapError.NotSupportedPair -> stringResource(com.gemwallet.android.localize.R.string.errors_swap_not_supported_pair)
is SwapError.Unknown -> TODO()
is SwapError.Unknown -> "${stringResource(com.gemwallet.android.localize.R.string.errors_unknown_try_again)}: ${state.error.message}"
},
style = MaterialTheme.typography.bodyMedium,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,12 @@ class AssetsRepository @Inject constructor(
assetsDao.getAll().map { it.id }.toSet().mapNotNull { it.toAssetId() }.toList()
}
.map { it.toIdentifier() }
val prices = gemApi.prices(AssetPricesRequest(currency.string, ids))
.getOrNull()?.prices ?: emptyList()
// TODO: java.lang.ClassCastException:
// at com.gemwallet.android.data.repositoreis.assets.AssetsRepository$updatePrices$2.invokeSuspend (AssetsRepository.kt:388)
val prices = try {
gemApi.prices(AssetPricesRequest(currency.string, ids))
.getOrNull()?.prices ?: emptyList()
} catch (_: Throwable) { emptyList() }
pricesDao.insert(
prices.map {
price -> DbPrice(price.assetId, price.price, price.priceChangePercentage24h, currency.string)
Expand Down

0 comments on commit 23fd672

Please sign in to comment.