Disable subscription requirement for bebugging

csv
Laurent 6 years ago
parent 4e758d3731
commit ceb9fb40ff
  1. 23
      app/src/main/java/net/pokeranalytics/android/util/billing/AppGuard.kt

@ -3,6 +3,7 @@ package net.pokeranalytics.android.util.billing
import android.app.Activity
import android.content.Context
import com.android.billingclient.api.*
import net.pokeranalytics.android.BuildConfig
import net.pokeranalytics.android.R
import timber.log.Timber
import java.io.IOException
@ -40,11 +41,23 @@ object AppGuard : PurchasesUpdatedListener {
*/
private var billingClientAvailable: Boolean = false
/**
* Returns the true state of the user's pro subscription
*/
private var _isProUser: Boolean = false
/**
* Returns whether the user has the pro subscription
* Always true for debugging
*/
var isProUser: Boolean = false
private set
val isProUser: Boolean
get() {
return if (BuildConfig.DEBUG) {
true
} else {
this._isProUser
}
}
/**
* A delegate to notify when the purchase has succeeded
@ -118,7 +131,7 @@ object AppGuard : PurchasesUpdatedListener {
* This is done before restoring in order to ensure that subscriptions stops
*/
private fun resetPurchases() {
this.isProUser = false
this._isProUser = false
}
/**
@ -191,9 +204,9 @@ object AppGuard : PurchasesUpdatedListener {
val date = Date(purchase.purchaseTime)
Timber.d("*** Auto renewing = ${purchase.isAutoRenewing}")
Timber.d("*** purchaseTime = ${date}")
Timber.d("*** purchaseTime = $date")
this.isProUser = true
this._isProUser = true
this.purchaseDelegate?.let {
it.purchaseDidSucceed(purchase)
this.purchaseDelegate = null

Loading…
Cancel
Save