Skip to content

Commit

Permalink
Billing: update billing library [5.2.1 -> 6.0.1]
Browse files Browse the repository at this point in the history
  • Loading branch information
UweTrottmann committed Oct 12, 2023
1 parent 214b815 commit 5066999
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion billing/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Google Play Billing

* https://developer.android.com/google/play/billing/billing_library_overview
* https://developer.android.com/google/play/billing/integrate
* https://github.com/googlesamples/android-play-billing
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ class BillingRepository private constructor(
val (billingResult, availableProducts) = playStoreBillingClient.queryProductDetails(params)
when (billingResult.responseCode) {
BillingClient.BillingResponseCode.OK -> {
if (availableProducts != null && availableProducts.isNotEmpty()) {
if (!availableProducts.isNullOrEmpty()) {
// Update in the background to avoid blocking the main thread.
coroutineScope.launch(Dispatchers.IO) {
_productDetails.update { supportedProducts ->
Expand Down Expand Up @@ -378,7 +378,7 @@ class BillingRepository private constructor(
val productId = augmentedProductDetails.productId
val productDetails = augmentedProductDetails.productDetails
val offers = productDetails.subscriptionOfferDetails
if (offers == null || offers.isEmpty()) {
if (offers.isNullOrEmpty()) {
Timber.e("No offers for $productId, can not purchase.")
return
}
Expand Down Expand Up @@ -420,15 +420,15 @@ class BillingRepository private constructor(
&& productId == SeriesGuideSku.X_SUB_ALL_ACCESS)
) {
// Downgrade immediately, bill new price once renewed.
BillingFlowParams.ProrationMode.IMMEDIATE_WITHOUT_PRORATION
BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.WITHOUT_PRORATION
} else {
// Upgrade immediately, credit existing purchase.
BillingFlowParams.ProrationMode.IMMEDIATE_WITH_TIME_PRORATION
BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.WITH_TIME_PRORATION
}
setSubscriptionUpdateParams(
BillingFlowParams.SubscriptionUpdateParams.newBuilder()
.setOldPurchaseToken(oldPurchaseToken)
.setReplaceProrationMode(prorationMode)
.setSubscriptionReplacementMode(prorationMode)
.build()
)
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ androidx-test-runner = "androidx.test:runner:1.5.2"
androidx-viewpager = "androidx.viewpager:viewpager:1.0.0"
# https://developer.android.com/jetpack/androidx/releases/viewpager2
androidx-viewpager2 = "androidx.viewpager2:viewpager2:1.1.0-beta02"
billing = "com.android.billingclient:billing-ktx:5.2.1" # https://developer.android.com/google/play/billing/billing_library_releases_notes
billing = "com.android.billingclient:billing-ktx:6.0.1" # https://developer.android.com/google/play/billing/billing_library_releases_notes
# https://github.com/google/dagger/releases
dagger = "com.google.dagger:dagger:2.47"
dagger-compiler = "com.google.dagger:dagger-compiler:2.47"
Expand Down

0 comments on commit 5066999

Please sign in to comment.