diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-23 21:53:50 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-23 21:53:50 -0700 |
commit | 0aac77d2bbce0629f9522d0854bd7c8068ec5e8b (patch) | |
tree | f01e5efa38be6858feec44cc8e697a12a812fd38 /app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt | |
parent | 8c1ff3e546e205e85a0d7e7df0ca5d11bd167582 (diff) | |
download | frost-0aac77d2bbce0629f9522d0854bd7c8068ec5e8b.tar.gz frost-0aac77d2bbce0629f9522d0854bd7c8068ec5e8b.tar.bz2 frost-0aac77d2bbce0629f9522d0854bd7c8068ec5e8b.zip |
Add keys and header reload
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt index 007611c5..11fa1c4b 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt @@ -7,10 +7,7 @@ import ca.allanwang.kau.utils.startPlayStoreLink import com.crashlytics.android.answers.PurchaseEvent import com.pitchedapps.frost.BuildConfig import com.pitchedapps.frost.R -import com.pitchedapps.frost.utils.L -import com.pitchedapps.frost.utils.frostAnswers -import com.pitchedapps.frost.utils.frostAnswersCustom -import com.pitchedapps.frost.utils.materialDialogThemed +import com.pitchedapps.frost.utils.* import org.jetbrains.anko.doAsync /** @@ -38,8 +35,10 @@ object IAB { } } -val Context.isFrostPro: Boolean - get() = BuildConfig.DEBUG || isFromGooglePlay +private const val FROST_PRO = "frost_pro" + +val IS_FROST_PRO: Boolean + get() = (BuildConfig.DEBUG && Prefs.debugPro) || (IAB.helper?.queryInventory()?.getSkuDetails(FROST_PRO) != null) private fun Context.checkFromPlay(): Boolean { val isPlay = isFromGooglePlay @@ -53,7 +52,7 @@ private fun Context.checkFromPlay(): Boolean { return isPlay } -fun Activity.openPlayProPurchase(code: Int) = openPlayPurchase("frost_pro", code) +fun Activity.openPlayProPurchase(code: Int) = openPlayPurchase(FROST_PRO, code) fun Activity.openPlayPurchase(key: String, code: Int) { if (!checkFromPlay()) return |