aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt11
1 files changed, 9 insertions, 2 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt
index 99e5ace..646c0dd 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt
@@ -31,7 +31,14 @@ val buildIsLollipopAndUp: Boolean
val buildIsMarshmallowAndUp: Boolean
get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
-const val KAU_GOOGLE_PLAY_INSTALLER = "com.android.vending"
+const val INSTALLER_GOOGLE_PLAY_VENDING = "com.android.vending"
+const val INSTALLER_GOOGLE_PLAY_FEEDBACK = "com.google.android.feedback"
val Context.installerPackageName: String?
- get() = packageManager.getInstallerPackageName(packageName) \ No newline at end of file
+ get() = packageManager.getInstallerPackageName(packageName)
+
+val Context.isFromGooglePlay: Boolean
+ get() {
+ val installer = installerPackageName
+ return arrayOf(INSTALLER_GOOGLE_PLAY_FEEDBACK, INSTALLER_GOOGLE_PLAY_VENDING).any { it == installer }
+ } \ No newline at end of file