From ad364a25ea8d145cdb2572906cadb934e25e3afc Mon Sep 17 00:00:00 2001 From: Yasin <6695727+yasin-ce@users.noreply.github.com> Date: Thu, 2 Jan 2025 17:50:26 +0100 Subject: [PATCH] PERA-1334 :: Fix coinbase asset transfer via qr issue --- .../android/usecase/AssetTransferAmountPreviewUseCase.kt | 7 +++---- .../usecase/SenderAccountSelectionPreviewUseCase.kt | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/algorand/android/usecase/AssetTransferAmountPreviewUseCase.kt b/app/src/main/java/com/algorand/android/usecase/AssetTransferAmountPreviewUseCase.kt index 6c281a88b..f30ae6d8c 100644 --- a/app/src/main/java/com/algorand/android/usecase/AssetTransferAmountPreviewUseCase.kt +++ b/app/src/main/java/com/algorand/android/usecase/AssetTransferAmountPreviewUseCase.kt @@ -54,9 +54,8 @@ class AssetTransferAmountPreviewUseCase @Inject constructor( assetTransaction: AssetTransaction ): TransactionData.Send? { val senderAccountDetail = accountDetailUseCase.getCachedAccountDetail(accountAddress)?.data ?: return null - val receiverAccountDetail = accountDetailUseCase.getCachedAccountDetail( - assetTransaction.receiverUser?.publicKey.orEmpty() - )?.data ?: return null + val receiverAccountInfo = accountDetailUseCase.getCachedAccountDetail(accountAddress)?.data?.accountInformation + return TransactionData.Send( senderAccountAddress = senderAccountDetail.account.address, senderAccountDetail = senderAccountDetail.account.detail, @@ -74,7 +73,7 @@ class AssetTransferAmountPreviewUseCase @Inject constructor( publicKey = assetTransaction.receiverUser?.publicKey.orEmpty(), accountIconDrawablePreview = createAccountIconDrawableUseCase.invoke(accountAddress) ), - isArc59Transaction = !receiverAccountDetail.accountInformation.hasAsset(selectedAsset.assetId) + isArc59Transaction = receiverAccountInfo?.hasAsset(selectedAsset.assetId)?.not() ?: false ) } diff --git a/app/src/main/java/com/algorand/android/usecase/SenderAccountSelectionPreviewUseCase.kt b/app/src/main/java/com/algorand/android/usecase/SenderAccountSelectionPreviewUseCase.kt index 539cfcc34..36edacded 100644 --- a/app/src/main/java/com/algorand/android/usecase/SenderAccountSelectionPreviewUseCase.kt +++ b/app/src/main/java/com/algorand/android/usecase/SenderAccountSelectionPreviewUseCase.kt @@ -44,7 +44,7 @@ class SenderAccountSelectionPreviewUseCase @Inject constructor( assetTransaction: AssetTransaction ): TransactionData.Send? { val senderAccountDetail = accountDetailUseCase.getCachedAccountDetail(accountAddress)?.data ?: return null - val receiverAccountDetail = accountDetailUseCase.getCachedAccountDetail(accountAddress)?.data ?: return null + val receiverAccountInfo = accountDetailUseCase.getCachedAccountDetail(accountAddress)?.data?.accountInformation return TransactionData.Send( senderAccountAddress = senderAccountDetail.account.address, senderAccountDetail = senderAccountDetail.account.detail, @@ -62,7 +62,7 @@ class SenderAccountSelectionPreviewUseCase @Inject constructor( publicKey = assetTransaction.receiverUser?.publicKey.orEmpty(), accountIconDrawablePreview = createAccountIconDrawableUseCase.invoke(accountAddress) ), - isArc59Transaction = !receiverAccountDetail.accountInformation.hasAsset(selectedAsset.assetId) + isArc59Transaction = receiverAccountInfo?.hasAsset(selectedAsset.assetId)?.not() ?: false ) }