From 5d22cae20bf789e72912c11faa865126c38c62b3 Mon Sep 17 00:00:00 2001 From: ArtemHryhorovGeniusee Date: Thu, 23 Jun 2022 17:23:53 +0300 Subject: [PATCH 1/4] Added additional check that ID was already loaded before payment process --- .../vpn/ui/top/up/summary/PaymentSummaryActivity.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/updated/mysterium/vpn/ui/top/up/summary/PaymentSummaryActivity.kt b/android/app/src/main/java/updated/mysterium/vpn/ui/top/up/summary/PaymentSummaryActivity.kt index da1304017..af630d0d7 100644 --- a/android/app/src/main/java/updated/mysterium/vpn/ui/top/up/summary/PaymentSummaryActivity.kt +++ b/android/app/src/main/java/updated/mysterium/vpn/ui/top/up/summary/PaymentSummaryActivity.kt @@ -63,7 +63,9 @@ class PaymentSummaryActivity : BaseActivity() { finish() } binding.confirmButton.setOnClickListener { - launchPlayBillingPayment() + if (topUpPriceCardItem?.id?.isNotEmpty() == true) { + launchPlayBillingPayment() + } } binding.cancelButton.setOnClickListener { navigateToHome() @@ -89,7 +91,13 @@ class PaymentSummaryActivity : BaseActivity() { paymentStatusViewModel.getPayment(price).observe(this) { it.onSuccess { order -> topUpPriceCardItem = topUpPriceCardItem?.copy(id = order.id) + if (topUpPriceCardItem?.id?.isEmpty() == true) { + showNoAmountPopUp { getPayment(price) } + setButtonAvailability(false) + return@onSuccess + } inflateOrderData(order) + setButtonAvailability(true) } it.onFailure { error -> Log.e(TAG, error.message ?: error.toString()) From ff293effc9d2d92f18b4f749d9e0d0b24edca30c Mon Sep 17 00:00:00 2001 From: ArtemHryhorovGeniusee Date: Thu, 23 Jun 2022 17:25:26 +0300 Subject: [PATCH 2/4] Increase android_version_code --- fastlane/android_version_code | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/android_version_code b/fastlane/android_version_code index 4146ba56c..b9185e6e7 100644 --- a/fastlane/android_version_code +++ b/fastlane/android_version_code @@ -1 +1 @@ -107147 \ No newline at end of file +107148 \ No newline at end of file From ce4036c9ef483b4399c8c948dda5dfd82eac4189 Mon Sep 17 00:00:00 2001 From: ArtemHryhorovGeniusee Date: Thu, 23 Jun 2022 17:28:17 +0300 Subject: [PATCH 3/4] Remove button availability --- .../mysterium/vpn/ui/top/up/summary/PaymentSummaryActivity.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/android/app/src/main/java/updated/mysterium/vpn/ui/top/up/summary/PaymentSummaryActivity.kt b/android/app/src/main/java/updated/mysterium/vpn/ui/top/up/summary/PaymentSummaryActivity.kt index af630d0d7..187fa960f 100644 --- a/android/app/src/main/java/updated/mysterium/vpn/ui/top/up/summary/PaymentSummaryActivity.kt +++ b/android/app/src/main/java/updated/mysterium/vpn/ui/top/up/summary/PaymentSummaryActivity.kt @@ -93,11 +93,9 @@ class PaymentSummaryActivity : BaseActivity() { topUpPriceCardItem = topUpPriceCardItem?.copy(id = order.id) if (topUpPriceCardItem?.id?.isEmpty() == true) { showNoAmountPopUp { getPayment(price) } - setButtonAvailability(false) return@onSuccess } inflateOrderData(order) - setButtonAvailability(true) } it.onFailure { error -> Log.e(TAG, error.message ?: error.toString()) From f07ef56419477a10440546d67fe08b6e6c7561e4 Mon Sep 17 00:00:00 2001 From: ArtemHryhorovGeniusee Date: Thu, 23 Jun 2022 17:37:44 +0300 Subject: [PATCH 4/4] Refactor code --- .../vpn/ui/top/up/summary/PaymentSummaryActivity.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android/app/src/main/java/updated/mysterium/vpn/ui/top/up/summary/PaymentSummaryActivity.kt b/android/app/src/main/java/updated/mysterium/vpn/ui/top/up/summary/PaymentSummaryActivity.kt index 187fa960f..fc02b469b 100644 --- a/android/app/src/main/java/updated/mysterium/vpn/ui/top/up/summary/PaymentSummaryActivity.kt +++ b/android/app/src/main/java/updated/mysterium/vpn/ui/top/up/summary/PaymentSummaryActivity.kt @@ -63,9 +63,7 @@ class PaymentSummaryActivity : BaseActivity() { finish() } binding.confirmButton.setOnClickListener { - if (topUpPriceCardItem?.id?.isNotEmpty() == true) { - launchPlayBillingPayment() - } + launchPlayBillingPayment() } binding.cancelButton.setOnClickListener { navigateToHome() @@ -117,6 +115,8 @@ class PaymentSummaryActivity : BaseActivity() { } private fun launchPlayBillingPayment() { + if (topUpPriceCardItem?.id?.isEmpty() == true) return + topUpPriceCardItem?.let { paymentViewModel.billingDataSource.launchBillingFlow( this@PaymentSummaryActivity,