Skip to content

Commit

Permalink
Merge pull request #79 from akshaaatt/migrate-v5
Browse files Browse the repository at this point in the history
Migrate to v5 of Google Play Billing Library
  • Loading branch information
akshaaatt authored Jun 12, 2022
2 parents 3972758 + 52219c6 commit 56e8d1a
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 194 deletions.
71 changes: 37 additions & 34 deletions app/src/main/java/com/aemerse/iapsample/KotlinSampleActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class KotlinSampleActivity : AppCompatActivity() {
})

iapConnector.addPurchaseListener(object : PurchaseServiceListener {
override fun onPricesUpdated(iapKeyPrices: Map<String, DataWrappers.SkuDetails>) {
override fun onPricesUpdated(iapKeyPrices: Map<String, DataWrappers.ProductDetails>) {
// list of available products will be received here, so you can update UI with prices if needed
}

Expand Down Expand Up @@ -92,50 +92,53 @@ class KotlinSampleActivity : AppCompatActivity() {
}
}

override fun onPricesUpdated(iapKeyPrices: Map<String, DataWrappers.SkuDetails>) {
override fun onPricesUpdated(iapKeyPrices: Map<String, DataWrappers.ProductDetails>) {
// list of available products will be received here, so you can update UI with prices if needed
}
})

isBillingClientConnected.observe(this) {
Log.d("KSA", "This is the new billing client status $it")
if (it) {
binding.btPurchaseCons.isEnabled = true
binding.btnMonthly.isEnabled = true
binding.btnYearly.isEnabled = true
binding.btnQuite.isEnabled = true
binding.btnModerate.isEnabled = true
binding.btnUltimate.isEnabled = true

binding.btPurchaseCons.setOnClickListener {
iapConnector.purchase(this, "base")
}
binding.btnMonthly.setOnClickListener {
iapConnector.subscribe(this, "subscription")
}
when {
it -> {
binding.btPurchaseCons.isEnabled = true
binding.btnMonthly.isEnabled = true
binding.btnYearly.isEnabled = true
binding.btnQuite.isEnabled = true
binding.btnModerate.isEnabled = true
binding.btnUltimate.isEnabled = true

binding.btPurchaseCons.setOnClickListener {
iapConnector.purchase(this, "base")
}
binding.btnMonthly.setOnClickListener {
iapConnector.subscribe(this, "subscription")
}

binding.btnYearly.setOnClickListener {
iapConnector.purchase(this, "yearly")
}
binding.btnQuite.setOnClickListener {
iapConnector.purchase(this, "quite")
binding.btnYearly.setOnClickListener {
iapConnector.purchase(this, "yearly")
}
binding.btnQuite.setOnClickListener {
iapConnector.purchase(this, "quite")

}
binding.btnModerate.setOnClickListener {
iapConnector.purchase(this, "moderate")
}
}
binding.btnModerate.setOnClickListener {
iapConnector.purchase(this, "moderate")
}

binding.btnUltimate.setOnClickListener {
iapConnector.purchase(this, "plenty")
binding.btnUltimate.setOnClickListener {
iapConnector.purchase(this, "plenty")

}
}
else -> {
binding.btPurchaseCons.isEnabled = false
binding.btnMonthly.isEnabled = false
binding.btnYearly.isEnabled = false
binding.btnQuite.isEnabled = false
binding.btnModerate.isEnabled = false
binding.btnUltimate.isEnabled = false
}
} else {
binding.btPurchaseCons.isEnabled = false
binding.btnMonthly.isEnabled = false
binding.btnYearly.isEnabled = false
binding.btnQuite.isEnabled = false
binding.btnModerate.isEnabled = false
binding.btnUltimate.isEnabled = false
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext{
kotlin_version = '1.6.21'
kotlin_version = '1.7.0'
kotlin_coroutines_version = '1.6.2'
compose_version = '1.2.0-beta03'
}
repositories {
google()
Expand Down
2 changes: 1 addition & 1 deletion iap/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ afterEvaluate {
// You can then customize attributes of the publication as shown below.
groupId = 'com.aemerse'
artifactId = 'Google-IAP'
version = '1.2.3'
version = '1.2.4'
}
}
}
Expand Down
Loading

0 comments on commit 56e8d1a

Please sign in to comment.