Skip to content

Commit

Permalink
feat: update dependencies and gradle, update in-app-billing implement…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
jahirfiquitiva committed Jun 30, 2024
1 parent a6a331e commit 95479de
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/Frames.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

object Frames {
const val appId = "dev.jahir.frames.app"
const val version = 361
const val versionName = "3.6.1"
const val version = 362
const val versionName = "3.6.2"
}
24 changes: 12 additions & 12 deletions buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@

object Versions {
// Plugins
const val gradle = "8.3.0"
const val kotlin = "1.9.23"
const val gradle = "8.5.0"
const val kotlin = "2.0.0"
const val sonatype = "1.3.0"
const val ksp = "$kotlin-1.0.20"
const val ksp = "$kotlin-1.0.22"

// OneSignal
const val oneSignal = "4.8.8"
const val oneSignal = "4.8.10"

// App
const val minSdk = 21
const val targetSdk = 34
const val buildTools = "34.0.0"

// Coroutines
const val coroutines = "1.8.0"
const val coroutines = "1.8.1"

// Android UI
const val appcompat = "1.6.1"
const val appcompat = "1.7.0"
const val cardView = "1.0.0"
const val recyclerView = "1.3.2"
const val swipeRefreshLayout = "1.1.0"
const val palette = "1.0.0"
const val preference = "1.2.1"
const val materialComponents = "1.11.0"
const val materialComponents = "1.12.0"
const val activityKtx = "1.9.0"
const val fragmentKtx = "1.6.2"
const val fragmentKtx = "1.8.1"

// ViewModel and LiveData
const val lifecycle = "2.7.0"
const val lifecycle = "2.8.2"
const val lifecycleExt = "2.2.0"

// Room Database
Expand All @@ -40,7 +40,7 @@ object Versions {
const val work = "2.9.0"

// Network & Serialization
const val gson = "2.10.1"
const val gson = "2.11.0"
const val retrofit = "2.11.0"

// Image loading and Touch Image View
Expand All @@ -63,11 +63,11 @@ object Versions {
const val licenseChecker = "1.2.8"

// In-App Billing
const val inAppBilling = "6.2.1"
const val inAppBilling = "7.0.0"

// MultiDex
const val multidex = "2.0.1"

// Muzei
const val muzei = "3.4.1"
const val muzei = "3.4.2"
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Jul 19 11:05:13 CEST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import com.android.billingclient.api.BillingClientStateListener
import com.android.billingclient.api.BillingFlowParams
import com.android.billingclient.api.BillingResult
import com.android.billingclient.api.ConsumeParams
import com.android.billingclient.api.PendingPurchasesParams
import com.android.billingclient.api.ProductDetails
import com.android.billingclient.api.Purchase
import com.android.billingclient.api.PurchasesUpdatedListener
import com.android.billingclient.api.QueryProductDetailsParams
import com.android.billingclient.api.QueryPurchaseHistoryParams
import com.android.billingclient.api.QueryPurchasesParams
import com.android.billingclient.api.consumePurchase
import com.android.billingclient.api.queryPurchasesAsync
import dev.jahir.frames.data.listeners.BillingProcessesListener
import dev.jahir.frames.data.models.DetailedPurchaseRecord
import dev.jahir.frames.extensions.utils.asDetailedPurchase
Expand Down Expand Up @@ -61,7 +63,10 @@ class BillingViewModel(application: Application) : AndroidViewModel(application)
billingClient = BillingClient
.newBuilder(context)
.setListener(this)
.enablePendingPurchases()
.enablePendingPurchases(
PendingPurchasesParams.newBuilder()
.enableOneTimeProducts().build()
)
.build()
billingClient?.startConnection(this)
}
Expand Down Expand Up @@ -94,6 +99,7 @@ class BillingViewModel(application: Application) : AndroidViewModel(application)
BillingClient.ProductType.INAPP -> {
inAppProductDetailsData.postValue(details)
}

BillingClient.ProductType.SUBS -> {
subscriptionsProductDetailsData.postValue(details)
}
Expand Down Expand Up @@ -147,6 +153,7 @@ class BillingViewModel(application: Application) : AndroidViewModel(application)
actualPurchases.sortedByDescending { it.purchaseTime }
)
}

BillingClient.ProductType.SUBS -> {
subscriptionsPurchasesHistoryData.postValue(
actualPurchases.sortedByDescending { it.purchaseTime }
Expand All @@ -170,9 +177,9 @@ class BillingViewModel(application: Application) : AndroidViewModel(application)

private suspend fun queryPurchasesHistory(@BillingClient.ProductType productType: String) {
if (!isBillingClientReady) return
val params = QueryPurchaseHistoryParams.newBuilder().setProductType(productType).build()
val params = QueryPurchasesParams.newBuilder().setProductType(productType).build()
withContext(IO) {
billingClient?.queryPurchaseHistoryAsync(params) { billingResult, purchaseHistoryRecordList ->
billingClient?.queryPurchasesAsync(params) { billingResult, purchaseHistoryRecordList ->
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
postPurchasesHistory(productType,
purchaseHistoryRecordList.orEmpty()
Expand Down

0 comments on commit 95479de

Please sign in to comment.