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 propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1 propVersionCode = 1
propVersionName = '5.2.19' propVersionName = '5.3.0'
kotlin_version = '1.3.0' kotlin_version = '1.3.0'
} }

View file

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

View file

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

View file

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

View file

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