improve the package name check at detecting Pro apps

This commit is contained in:
tibbi 2018-11-01 22:47:45 +01:00
parent 7f1b1b4f08
commit 8f3ac3791a
5 changed files with 7 additions and 7 deletions

View file

@ -7,7 +7,7 @@ buildscript {
propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '5.2.19'
propVersionName = '5.3.0'
kotlin_version = '1.3.0'
}

View file

@ -4,7 +4,7 @@ import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.simplemobiletools.commons.extensions.baseConfig
import com.simplemobiletools.commons.extensions.getSharedTheme
import com.simplemobiletools.commons.extensions.isProApp
import com.simplemobiletools.commons.extensions.isAProApp
import com.simplemobiletools.commons.extensions.isThankYouInstalled
abstract class BaseSplashActivity : AppCompatActivity() {
@ -13,7 +13,7 @@ abstract class BaseSplashActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (!isProApp() && isThankYouInstalled() && (baseConfig.appRunCount == 0 || !baseConfig.wasSharedThemeAfterUpdateChecked)) {
if (!isAProApp() && isThankYouInstalled() && (baseConfig.appRunCount == 0 || !baseConfig.wasSharedThemeAfterUpdateChecked)) {
baseConfig.wasSharedThemeAfterUpdateChecked = true
getSharedTheme {
if (it != null) {

View file

@ -47,7 +47,7 @@ class CustomizationActivity : BaseSimpleActivity() {
initColorVariables()
setupColorsPickers()
if (!isProApp() && isThankYouInstalled()) {
if (!isAProApp() && isThankYouInstalled()) {
val cursorLoader = getMyContentProviderCursorLoader()
Thread {
try {

View file

@ -110,7 +110,7 @@ fun Activity.appLaunched(appId: String) {
baseConfig.appRunCount++
if (!baseConfig.hadThankYouInstalled) {
if (isProApp() || isThankYouInstalled()) {
if (isAProApp() || isThankYouInstalled()) {
baseConfig.hadThankYouInstalled = true
} else if (baseConfig.appRunCount % 50 == 0) {
DonateDialog(this)

View file

@ -323,7 +323,7 @@ fun Context.getFilenameFromContentUri(uri: Uri): String? {
}
fun Context.getSharedTheme(callback: (sharedTheme: SharedTheme?) -> Unit) {
if (isProApp() || !isThankYouInstalled()) {
if (isAProApp() || !isThankYouInstalled()) {
callback(null)
} else {
val cursorLoader = getMyContentProviderCursorLoader()
@ -377,7 +377,7 @@ fun Context.getUriMimeType(path: String, newUri: Uri): String {
fun Context.isThankYouInstalled() = isPackageInstalled("com.simplemobiletools.thankyou")
fun Context.isProApp() = packageName.removeSuffix(".debug").endsWith(".pro")
fun Context.isAProApp() = packageName.startsWith("com.simplemobiletools.") && packageName.removeSuffix(".debug").endsWith(".pro")
fun Context.isPackageInstalled(pkgName: String): Boolean {
return try {