Skip to content

Commit

Permalink
Add retry network call when fetching legendary payment instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandarIlic committed Dec 6, 2024
1 parent 500bab6 commit b4d07fa
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) =
Expand Down

0 comments on commit b4d07fa

Please sign in to comment.