mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-11-08 12:02:33 +01:00
Fix purchase recognition (#12)
* Update travis * Update bad billing booleans * Remove empty cancel fun
This commit is contained in:
parent
a6f725d8ca
commit
01250f9382
@ -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">
|
||||
|
@ -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"
|
||||
|
@ -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'
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user