diff --git a/app/src/main/java/com/tangem/tap/features/send/redux/SendMiddleware.kt b/app/src/main/java/com/tangem/tap/features/send/redux/SendMiddleware.kt index f2f52398e3..d18531b7b2 100644 --- a/app/src/main/java/com/tangem/tap/features/send/redux/SendMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/send/redux/SendMiddleware.kt @@ -50,7 +50,7 @@ internal class AddressPayIdHandler { verifyPayId(data, walletManager) } else { val supposedAddress = extractAddressFromShareUri(data) - store.dispatch(PayIdVerification.Failed(supposedAddress, FailReason.IS_NOT_PAY_ID)) + store.dispatch(PayIdVerification.SetError(supposedAddress, FailReason.IS_NOT_PAY_ID)) verifyAddress(walletManager, supposedAddress) } } @@ -58,7 +58,7 @@ internal class AddressPayIdHandler { private fun verifyPayId(payId: String, walletManager: WalletManager) { val blockchain = walletManager.wallet.blockchain if (!blockchain.isPayIdSupported()) { - store.dispatch(PayIdVerification.Failed(payId, FailReason.PAY_ID_UNSUPPORTED_BY_BLOCKCHAIN)) + store.dispatch(PayIdVerification.SetError(payId, FailReason.PAY_ID_UNSUPPORTED_BY_BLOCKCHAIN)) return } @@ -69,17 +69,17 @@ internal class AddressPayIdHandler { is Result.Success -> { val address = result.data.getAddress() if (address == null) { - store.dispatch(PayIdVerification.Failed(payId, FailReason.PAY_ID_NOT_REGISTERED)) + store.dispatch(PayIdVerification.SetError(payId, FailReason.PAY_ID_NOT_REGISTERED)) return@withContext } val failReason = isValidBlockchainAddressAndNotTheSameAsWallet(walletManager.wallet, address) - val actionToSend = if (failReason == FailReason.NONE) PayIdVerification.Success(payId, address) - else AddressVerification.Failed(payId, failReason) + val actionToSend = if (failReason == FailReason.NONE) PayIdVerification.SetPayIdWalletAddress(payId, address) + else AddressVerification.SetError(payId, failReason) store.dispatch(actionToSend) } is Result.Failure -> { - store.dispatch(PayIdVerification.Failed(payId, FailReason.PAY_ID_REQUEST_FAILED)) + store.dispatch(PayIdVerification.SetError(payId, FailReason.PAY_ID_REQUEST_FAILED)) } } @@ -89,8 +89,8 @@ internal class AddressPayIdHandler { private fun verifyAddress(walletManager: WalletManager, supposedAddress: String) { val failReason = isValidBlockchainAddressAndNotTheSameAsWallet(walletManager.wallet, supposedAddress) - val actionToSend = if (failReason == FailReason.NONE) AddressVerification.Success(supposedAddress) - else AddressVerification.Failed(supposedAddress, failReason) + val actionToSend = if (failReason == FailReason.NONE) AddressVerification.SetWalletAddress(supposedAddress) + else AddressVerification.SetError(supposedAddress, failReason) store.dispatch(actionToSend) } diff --git a/app/src/main/java/com/tangem/tap/features/send/redux/SendReducer.kt b/app/src/main/java/com/tangem/tap/features/send/redux/SendReducer.kt index dc9e216301..1d8b36f02a 100644 --- a/app/src/main/java/com/tangem/tap/features/send/redux/SendReducer.kt +++ b/app/src/main/java/com/tangem/tap/features/send/redux/SendReducer.kt @@ -57,10 +57,10 @@ private fun handleAddressPayIdAction( state: AddressPayIDState ): SendState { val result = when (action) { - is PayIdVerification.Success -> state.copyPayIdWalletAddress(action.payId, action.payIdWalletAddress) - is PayIdVerification.Failed -> state.copyPaiIdError(action.payId, action.reason) - is AddressVerification.Success -> state.copyWalletAddress(action.address) - is AddressVerification.Failed -> state.copyError(action.address, action.reason) + is PayIdVerification.SetPayIdWalletAddress -> state.copyPayIdWalletAddress(action.payId, action.payIdWalletAddress) + is PayIdVerification.SetError -> state.copyPaiIdError(action.payId, action.reason) + is AddressVerification.SetWalletAddress -> state.copyWalletAddress(action.address) + is AddressVerification.SetError -> state.copyError(action.address, action.reason) } return updateLastState(sendState.copy(addressPayIDState = result), result) } diff --git a/app/src/main/java/com/tangem/tap/features/send/redux/SendScreenAction.kt b/app/src/main/java/com/tangem/tap/features/send/redux/SendScreenAction.kt index 3ea66b87d5..300dc34a78 100644 --- a/app/src/main/java/com/tangem/tap/features/send/redux/SendScreenAction.kt +++ b/app/src/main/java/com/tangem/tap/features/send/redux/SendScreenAction.kt @@ -35,12 +35,12 @@ sealed class AddressPayIdVerifyAction : SendScreenAction { } sealed class PayIdVerification : AddressPayIdVerifyAction() { - data class Failed(val payId: String, val reason: FailReason) : PayIdVerification() - data class Success(val payId: String, val payIdWalletAddress: String) : PayIdVerification() + data class SetError(val payId: String, val reason: FailReason) : PayIdVerification() + data class SetPayIdWalletAddress(val payId: String, val payIdWalletAddress: String) : PayIdVerification() } sealed class AddressVerification : AddressPayIdVerifyAction() { - data class Failed(val address: String, val reason: FailReason) : AddressVerification() - data class Success(val address: String) : AddressVerification() + data class SetError(val address: String, val reason: FailReason) : AddressVerification() + data class SetWalletAddress(val address: String) : AddressVerification() } } \ No newline at end of file