aboutsummaryrefslogtreecommitdiff
path: root/app
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 /app
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
Diffstat (limited to 'app')
-rw-r--r--app/build.gradle2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt24
2 files changed, 11 insertions, 15 deletions
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