aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-03 16:57:00 -0400
committerGitHub <noreply@github.com>2017-07-03 16:57:00 -0400
commit01250f93826b24bd53b46426999e9cdea17fecd8 (patch)
tree85285331bed08aa072017b2010c9862515c6f835
parenta6f725d8caa56771770351f78e34e6cf22ecf840 (diff)
downloadfrost-01250f93826b24bd53b46426999e9cdea17fecd8.tar.gz
frost-01250f93826b24bd53b46426999e9cdea17fecd8.tar.bz2
frost-01250f93826b24bd53b46426999e9cdea17fecd8.zip
Fix purchase recognition (#12)
* Update travis * Update bad billing booleans * Remove empty cancel fun
-rw-r--r--.idea/misc.xml2
-rw-r--r--.travis.yml4
-rw-r--r--app/build.gradle2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt24
4 files changed, 14 insertions, 18 deletions
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 7319f021..085136f8 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -53,7 +53,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
diff --git a/.travis.yml b/.travis.yml
index 6f2f6392..cda20a80 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,8 +19,8 @@ before_install:
- chmod +x gradlew
after_success:
- chmod +x ./generate-apk-release.sh
-- "./generate-apk-release.sh"
-- if [[ "$TRAVIS_BRANCH" == "master" ]]; then ./gradlew app:publishApkRelease; fi
+# Do one or the other
+- if [[ "$TRAVIS_BRANCH" == "master" ]]; then ./gradlew app:publishApkRelease; else ./generate-apk-release.sh; fi
script:
- cd $TRAVIS_BUILD_DIR/
- "./gradlew assembleReleaseTest"
diff --git a/app/build.gradle b/app/build.gradle
index 3de0e84e..13060352 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -25,7 +25,7 @@ android {
baseCode offset
codeFormat = 'MMNNPPXX'
//since we use travis, all builds will be dirty
- format = '%tag%%.count%%<commit>%'
+ format = '%tag%%.count%%-commit%'
prefix 'v'
}
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 b4f8af64..ec9d8af1 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
@@ -66,10 +66,6 @@ object IAB {
fun handleActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean
= helper?.handleActivityResult(requestCode, resultCode, data) ?: false
- fun cancel() {
-
- }
-
/**
* Call this after any execution to dispose the helper
* Ensure that async calls have already finished beforehand
@@ -93,30 +89,30 @@ private val Context.isFrostPlay: Boolean
fun SettingsActivity.restorePurchases() {
//like validate, but with a snackbar and without other prompts
- var restore: Snackbar? = null
- restore = container.snackbar(R.string.restoring_purchases, Snackbar.LENGTH_INDEFINITE) {
- setAction(R.string.kau_close) { restore?.dismiss() }
- }
+ val restore = container.snackbar(R.string.restoring_purchases, Snackbar.LENGTH_INDEFINITE)
+ restore.setAction(R.string.kau_close) { restore.dismiss() }
//called if inventory is not properly retrieved
val reset = {
+ L.d("Restore reset")
if (Prefs.pro) {
Prefs.pro = false
Prefs.theme = Theme.DEFAULT.ordinal
}
- finishRestore(restore)
+ finishRestore(restore, false)
}
getInventory(false, true, reset) {
val proSku = it.getSkuDetails(FROST_PRO)
Prefs.pro = proSku != null
- finishRestore(restore)
+ L.d("Restore found: ${Prefs.pro}")
+ finishRestore(restore, Prefs.pro)
}
}
-private fun SettingsActivity.finishRestore(snackbar: Snackbar?) {
- snackbar?.dismiss()
+private fun SettingsActivity.finishRestore(snackbar: Snackbar, hasPro: Boolean) {
+ snackbar.dismiss()
materialDialogThemed {
title(R.string.purchases_restored)
- content(if (Prefs.pro) R.string.purchases_restored_with_pro else R.string.purchases_restored_without_pro)
+ content(if (hasPro) R.string.purchases_restored_with_pro else R.string.purchases_restored_without_pro)
positiveText(R.string.reload)
dismissListener { adapter.notifyAdapterDataSetChanged() }
}
@@ -150,7 +146,7 @@ fun Activity.getInventory(
}
fun Activity.openPlayProPurchase(code: Int) {
- if (!IS_FROST_PRO)
+ if (!isFrostPlay)
playStoreProNotAvailable()
else openPlayPurchase(FROST_PRO, code) {
Prefs.pro = true