Merge branch 'show-environment' into 'dev'

Show environment

See merge request sminnovations/hpos!25
This commit is contained in:
Pritimay Sarkar
2024-01-08 15:15:08 +00:00
3 changed files with 14 additions and 5 deletions

View File

@@ -16,11 +16,11 @@ android {
// prod - production, preprod - preproduction, quality - qc
defaultConfig {
applicationId "in.sminnovations.hpostesting"
applicationId "in.sminnovations.hpostesting.dev"
minSdk 21
targetSdk 34
versionCode 68
versionName "2.1.68"
versionCode 75
versionName "2.1.75"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@@ -282,7 +282,7 @@ object Constants {
const val INCUBATION_TIME_MIN = 0
const val INCUBATION_TIME_MAX = 1400
const val BATTERY_LEVEL_MIN = 0
const val BATTERY_LEVEL_MIN = Int.MIN_VALUE
const val READINGS_PER_SAMPLE = 3
const val MINIMUM_BATTERY_LEVEL = 0

View File

@@ -37,7 +37,7 @@ class SlideshowFragment : PreferenceFragmentCompat() {
// App Version Preference
val appVersionPreference = Preference(requireContext())
appVersionPreference.title = "App Version"
appVersionPreference.summary = getAppVersion(requireContext())
appVersionPreference.summary = getAppVersion(requireContext()) + " [ " + getAppEnvironment(requireContext()) + " ]"
preferenceScreen.addPreference(languagePreference)
preferenceScreen.addPreference(appVersionPreference)
@@ -63,4 +63,13 @@ class SlideshowFragment : PreferenceFragmentCompat() {
"N/A"
}
}
private fun getAppEnvironment(context: Context): String {
return try {
val pInfo = context.packageManager.getPackageInfo(context.packageName, 0)
pInfo.packageName.substringAfterLast('.')
} catch (e: PackageManager.NameNotFoundException) {
"N/A"
}
}
}