From b8cf0cc1be6ec84d1f6a6c5aeb702e708e134b16 Mon Sep 17 00:00:00 2001 From: Alex Hart Date: Mon, 1 Nov 2021 09:45:31 -0300 Subject: [PATCH] Always clear LevelUpdateOperation if an error occurs. After speaking with the server team, it's been made clear that the idempotency key should only ever be reutilized if we never heard back from the server. Since we do not employ an automatic retry mechanism for setting a user's subscription level (we simply notify the user of the failure) it is less error-prone to simply never reuse an idempotency key. --- .../settings/app/subscription/DonationPaymentRepository.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/DonationPaymentRepository.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/DonationPaymentRepository.kt index b19ac4bdee..78e53d0636 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/DonationPaymentRepository.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/DonationPaymentRepository.kt @@ -168,6 +168,7 @@ class DonationPaymentRepository(activity: Activity) : StripeApi.PaymentIntentFet } } }.doOnError { + SignalStore.donationsValues().clearLevelOperation() LevelUpdate.updateProcessingState(false) }.subscribeOn(Schedulers.io()) }