From b4d07face4a580307aa061d0642e4432db8756d6 Mon Sep 17 00:00:00 2001 From: Aleksandar Ilic Date: Fri, 6 Dec 2024 23:18:25 +0100 Subject: [PATCH] Add retry network call when fetching legendary payment instructions --- .../android/premium/repository/PremiumRepository.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/net/primal/android/premium/repository/PremiumRepository.kt b/app/src/main/kotlin/net/primal/android/premium/repository/PremiumRepository.kt index ac6715c82..31163fcff 100644 --- a/app/src/main/kotlin/net/primal/android/premium/repository/PremiumRepository.kt +++ b/app/src/main/kotlin/net/primal/android/premium/repository/PremiumRepository.kt @@ -3,6 +3,7 @@ package net.primal.android.premium.repository import javax.inject.Inject import kotlinx.coroutines.withContext import net.primal.android.core.coroutines.CoroutineDispatcherProvider +import net.primal.android.networking.primal.retryNetworkCall import net.primal.android.premium.api.PremiumApi import net.primal.android.premium.api.model.CancelMembershipRequest import net.primal.android.premium.api.model.MembershipStatusResponse @@ -83,10 +84,12 @@ class PremiumRepository @Inject constructor( suspend fun fetchPrimalLegendPaymentInstructions(userId: String, primalName: String) = withContext(dispatchers.io()) { - premiumApi.getPrimalLegendPaymentInstructions( - userId = userId, - primalName = primalName, - ) + retryNetworkCall(retries = 2) { + premiumApi.getPrimalLegendPaymentInstructions( + userId = userId, + primalName = primalName, + ) + } } suspend fun fetchOrderHistory(userId: String) =