remember if Simple Thank You has ever been installed

This commit is contained in:
tibbi 2020-12-28 17:55:08 +01:00
parent 810fd50152
commit 9af81e97c2
3 changed files with 12 additions and 3 deletions

View file

@ -6,7 +6,7 @@ buildscript {
propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '5.32.14'
propVersionName = '5.32.15'
kotlin_version = '1.4.21'
}

View file

@ -89,7 +89,7 @@ fun Activity.appLaunched(appId: String) {
fun Activity.showDonateOrUpgradeDialog() {
if (getCanAppBeUpgraded()) {
UpgradeToProDialog(this)
} else if (!baseConfig.hadThankYouInstalled && !isThankYouInstalled()) {
} else if (!isOrWasThankYouInstalled()) {
DonateDialog(this)
}
}

View file

@ -466,7 +466,16 @@ fun Context.getUriMimeType(path: String, newUri: Uri): String {
fun Context.isThankYouInstalled() = isPackageInstalled("com.simplemobiletools.thankyou")
fun Context.isOrWasThankYouInstalled() = baseConfig.hadThankYouInstalled || isThankYouInstalled()
fun Context.isOrWasThankYouInstalled(): Boolean {
return when {
baseConfig.hadThankYouInstalled -> true
isThankYouInstalled() -> {
baseConfig.hadThankYouInstalled = true
true
}
else -> false
}
}
fun Context.isAProApp() = packageName.startsWith("com.simplemobiletools.") && packageName.removeSuffix(".debug").endsWith(".pro")