We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6e60bbf commit 22c2068Copy full SHA for 22c2068
app/src/main/java/fr/free/nrw/commons/utils/ConfigUtils.java
app/src/main/java/fr/free/nrw/commons/utils/ConfigUtils.kt
@@ -0,0 +1,24 @@
1
+package fr.free.nrw.commons.utils
2
+
3
+import android.content.Context
4
+import android.content.pm.PackageManager
5
+import fr.free.nrw.commons.BuildConfig
6
7
+object ConfigUtils {
8
+ @JvmStatic
9
+ val isBetaFlavour: Boolean = BuildConfig.FLAVOR == "beta"
10
11
12
+ private fun Context.getVersionName(): String {
13
+ return try {
14
+ packageManager.getPackageInfo(packageName, 0).versionName
15
+ } catch (e: PackageManager.NameNotFoundException) {
16
+ BuildConfig.VERSION_NAME
17
+ }
18
19
20
21
+ fun Context.getVersionNameWithSha(): String {
22
+ return "${getVersionName()}~${BuildConfig.COMMIT_SHA}"
23
24
+}
0 commit comments