mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-11-08 20:12:39 +01:00
Test tags
This commit is contained in:
parent
0018677886
commit
b148feff51
@ -1,3 +1,7 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.gladed.androidgitversion' version '0.3.4'
|
||||||
|
}
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
@ -11,8 +15,8 @@ android {
|
|||||||
applicationId "${project.APP_GROUP}." + project.APP_ID.toLowerCase()
|
applicationId "${project.APP_GROUP}." + project.APP_ID.toLowerCase()
|
||||||
minSdkVersion Integer.parseInt(project.MIN_SDK)
|
minSdkVersion Integer.parseInt(project.MIN_SDK)
|
||||||
targetSdkVersion Integer.parseInt(project.TARGET_SDK)
|
targetSdkVersion Integer.parseInt(project.TARGET_SDK)
|
||||||
versionCode Integer.parseInt(project.VERSION_CODE)
|
versionCode androidGitVersion.code()
|
||||||
versionName project.VERSION_NAME
|
versionName androidGitVersion.name()
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
@ -125,3 +129,7 @@ dependencies {
|
|||||||
transitive = true;
|
transitive = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
androidGitVersion {
|
||||||
|
prefix 'v'
|
||||||
|
}
|
||||||
|
@ -15,10 +15,7 @@ import com.mikepenz.community_material_typeface_library.CommunityMaterial
|
|||||||
import com.mikepenz.google_material_typeface_library.GoogleMaterial
|
import com.mikepenz.google_material_typeface_library.GoogleMaterial
|
||||||
import com.pitchedapps.frost.settings.*
|
import com.pitchedapps.frost.settings.*
|
||||||
import com.pitchedapps.frost.utils.*
|
import com.pitchedapps.frost.utils.*
|
||||||
import com.pitchedapps.frost.utils.iab.IAB
|
import com.pitchedapps.frost.utils.iab.*
|
||||||
import com.pitchedapps.frost.utils.iab.IS_FROST_PRO
|
|
||||||
import com.pitchedapps.frost.utils.iab.IabBroadcastReceiver
|
|
||||||
import com.pitchedapps.frost.utils.iab.openPlayProPurchase
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +25,8 @@ class SettingsActivity : KPrefActivity(), IabBroadcastReceiver.IabBroadcastListe
|
|||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
if (!(IAB.helper?.handleActivityResult(requestCode, resultCode, data) ?: false))
|
if (!(IAB.helper?.handleActivityResult(requestCode, resultCode, data) ?: false))
|
||||||
super.onActivityReenter(resultCode, data)
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -67,6 +65,12 @@ class SettingsActivity : KPrefActivity(), IabBroadcastReceiver.IabBroadcastListe
|
|||||||
iicon = CommunityMaterial.Icon.cmd_flask_outline
|
iicon = CommunityMaterial.Icon.cmd_flask_outline
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plainText(R.string.restore_purchases) {
|
||||||
|
descRes = R.string.restore_purchases
|
||||||
|
iicon = GoogleMaterial.Icon.gmd_refresh
|
||||||
|
onClick = { this@SettingsActivity.restorePurchases(); true }
|
||||||
|
}
|
||||||
|
|
||||||
plainText(R.string.about_frost) {
|
plainText(R.string.about_frost) {
|
||||||
iicon = GoogleMaterial.Icon.gmd_info
|
iicon = GoogleMaterial.Icon.gmd_info
|
||||||
onClick = {
|
onClick = {
|
||||||
|
@ -3,11 +3,13 @@ package com.pitchedapps.frost.utils.iab
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import ca.allanwang.kau.utils.isFromGooglePlay
|
import ca.allanwang.kau.utils.isFromGooglePlay
|
||||||
import ca.allanwang.kau.utils.startPlayStoreLink
|
|
||||||
import com.crashlytics.android.answers.PurchaseEvent
|
import com.crashlytics.android.answers.PurchaseEvent
|
||||||
import com.pitchedapps.frost.BuildConfig
|
import com.pitchedapps.frost.BuildConfig
|
||||||
import com.pitchedapps.frost.R
|
import com.pitchedapps.frost.SettingsActivity
|
||||||
import com.pitchedapps.frost.utils.*
|
import com.pitchedapps.frost.utils.L
|
||||||
|
import com.pitchedapps.frost.utils.Prefs
|
||||||
|
import com.pitchedapps.frost.utils.frostAnswers
|
||||||
|
import com.pitchedapps.frost.utils.frostAnswersCustom
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Allan Wang on 2017-06-23.
|
* Created by Allan Wang on 2017-06-23.
|
||||||
@ -48,23 +50,20 @@ private const val FROST_PRO = "frost_pro"
|
|||||||
val IS_FROST_PRO: Boolean
|
val IS_FROST_PRO: Boolean
|
||||||
get() = (BuildConfig.DEBUG && Prefs.debugPro) || Prefs.previouslyPro
|
get() = (BuildConfig.DEBUG && Prefs.debugPro) || Prefs.previouslyPro
|
||||||
|
|
||||||
private fun Context.checkFromPlay(): Boolean {
|
private val Context.isFrostPlay: Boolean
|
||||||
val isPlay = isFromGooglePlay || BuildConfig.DEBUG
|
get() = isFromGooglePlay || BuildConfig.DEBUG
|
||||||
if (!isPlay) materialDialogThemed {
|
|
||||||
title(R.string.uh_oh)
|
fun SettingsActivity.restorePurchases() {
|
||||||
content(R.string.play_store_not_found)
|
|
||||||
positiveText(R.string.kau_ok)
|
|
||||||
neutralText(R.string.kau_play_store)
|
|
||||||
onNeutral { _, _ -> startPlayStoreLink(R.string.play_store_package_id) }
|
|
||||||
}
|
|
||||||
return isPlay
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Activity.openPlayProPurchase(code: Int) = openPlayPurchase(FROST_PRO, code)
|
fun Activity.openPlayProPurchase(code: Int) = openPlayPurchase(FROST_PRO, code) {
|
||||||
|
Prefs.previouslyPro = true
|
||||||
|
}
|
||||||
|
|
||||||
fun Activity.openPlayPurchase(key: String, code: Int) {
|
fun Activity.openPlayPurchase(key: String, code: Int, onSuccess: (key: String) -> Unit) {
|
||||||
L.d("Open play purchase $key $code")
|
L.d("Open play purchase $key $code")
|
||||||
if (!checkFromPlay()) return
|
if (!isFrostPlay) return playStoreNotFound()
|
||||||
frostAnswersCustom("PLAY_PURCHASE") {
|
frostAnswersCustom("PLAY_PURCHASE") {
|
||||||
putCustomAttribute("Key", key)
|
putCustomAttribute("Key", key)
|
||||||
}
|
}
|
||||||
@ -79,7 +78,10 @@ fun Activity.openPlayPurchase(key: String, code: Int) {
|
|||||||
L.d("IAB: inventory ${inv.allOwnedSkus}")
|
L.d("IAB: inventory ${inv.allOwnedSkus}")
|
||||||
IAB.helper!!.launchPurchaseFlow(this@openPlayPurchase, key, code) {
|
IAB.helper!!.launchPurchaseFlow(this@openPlayPurchase, key, code) {
|
||||||
result, _ ->
|
result, _ ->
|
||||||
if (result.isSuccess) playStorePurchasedSuccessfully(key)
|
if (result.isSuccess) {
|
||||||
|
onSuccess(key)
|
||||||
|
playStorePurchasedSuccessfully(key)
|
||||||
|
}
|
||||||
frostAnswers {
|
frostAnswers {
|
||||||
logPurchase(PurchaseEvent()
|
logPurchase(PurchaseEvent()
|
||||||
.putItemId(key)
|
.putItemId(key)
|
||||||
|
@ -40,8 +40,19 @@ fun Activity.playStoreNoLongerPro() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Activity.playStoreNotAvailable() {
|
fun Activity.playStoreNotFound() {
|
||||||
playStoreLog("Store not available")
|
L.d("Play store not found")
|
||||||
|
materialDialogThemed {
|
||||||
|
title(R.string.uh_oh)
|
||||||
|
content(R.string.play_store_not_found)
|
||||||
|
positiveText(R.string.kau_ok)
|
||||||
|
neutralText(R.string.kau_play_store)
|
||||||
|
onNeutral { _, _ -> startPlayStoreLink(R.string.play_store_package_id) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Activity.playStoreProNotAvailable() {
|
||||||
|
playStoreLog("Pro found; store not available")
|
||||||
materialDialogThemed {
|
materialDialogThemed {
|
||||||
title(R.string.uh_oh)
|
title(R.string.uh_oh)
|
||||||
content(R.string.play_store_not_found)
|
content(R.string.play_store_not_found)
|
||||||
|
@ -57,4 +57,7 @@
|
|||||||
<string name="restart_frost">Restart Frost</string>
|
<string name="restart_frost">Restart Frost</string>
|
||||||
<string name="restart_frost_desc">Crashlytics will only submit logs when a crash occurs or if errors are found and the app is restarted. Clicking here will restart the app and flush whatever issues are currently found.</string>
|
<string name="restart_frost_desc">Crashlytics will only submit logs when a crash occurs or if errors are found and the app is restarted. Clicking here will restart the app and flush whatever issues are currently found.</string>
|
||||||
|
|
||||||
|
<string name="restore_purchases">Restore Purchases</string>
|
||||||
|
<string name="restore_purchases_desc">Restore any previous purchases from the Play Store</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -17,7 +17,6 @@ MIN_SDK=21
|
|||||||
TARGET_SDK=26
|
TARGET_SDK=26
|
||||||
BUILD_TOOLS=26.0.0
|
BUILD_TOOLS=26.0.0
|
||||||
VERSION_CODE=11
|
VERSION_CODE=11
|
||||||
VERSION_NAME=1.1
|
|
||||||
|
|
||||||
KAU=e1e3b37000
|
KAU=e1e3b37000
|
||||||
KOTLIN=1.1.3
|
KOTLIN=1.1.3
|
||||||
|
Loading…
Reference in New Issue
Block a user