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 | |
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')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt | 13 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/utils/iab/Key.kt | 33 |
2 files changed, 39 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 diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/Key.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/Key.kt new file mode 100644 index 00000000..a21d8670 --- /dev/null +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/Key.kt @@ -0,0 +1,33 @@ +package com.pitchedapps.frost.utils.iab + +/** + * Created by Allan Wang on 2017-06-23. + * + * NOTE + * + * Since this is an open source project and all other components are essentially public, + * I have decided to add the keys here too; + * they can be reverse engineered relatively easily since they are constants anyways. + * This is the public billing key from the play store + */ +private const val play_key_1 = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgyTZS" +private const val play_key_2 = "K9Bd3ALpr9KJUsVGczP9CcPelWkdnJfNrrzu1EztJyrHRsGQ4" +private const val play_key_3 = "QVWY9NZwc6Nrk9qdJlEdr8AJAxJ+JiwUqsj3/TxxUYm/G7q8Z" +private const val play_key_4 = "7zo8jSkYZyzqwoAl2PDx2kleI4sZLkhCRLyE6dGQEZQmvJ6kk" +private const val play_key_5 = "W12Gz3FagAM5luRGsoWZj40pJItUrGJA9euMWq4rMhVZv4mVk" +private const val play_key_6 = "KFJB9/vhF/XGz7txpYlFxMESzXuKsbEDKmKCHzvySLq8Ki4N9" +private const val play_key_7 = "DzbgUiw+VzA2KpSVp66JH3GEU8egO8i9SvAWeCPikuolooRVh" +private const val play_key_8 = "jwfBV7gDxZztoLuvmQU6kXvCwRnRa+mkfUnBKKLkH1QIDAQAB" + +internal val PUBLIC_BILLING_KEY: String by lazy { + StringBuilder() + .append(play_key_1) + .append(play_key_2) + .append(play_key_3) + .append(play_key_4) + .append(play_key_5) + .append(play_key_6) + .append(play_key_7) + .append(play_key_8) + .toString() +}
\ No newline at end of file |