Skip to content

Commit

Permalink
Restore build number!
Browse files Browse the repository at this point in the history
  • Loading branch information
io7m committed Nov 15, 2024
1 parent 12a55d2 commit 268d812
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,27 @@ class SettingsMainFragment3 : PreferenceFragmentCompat() {
this.configureVersionCore(this.settingsVersionCore)
}

private fun formatVersion(): String {
return try {
val context =
this.requireContext()
val pkgManager =
context.packageManager
val pkgInfo =
pkgManager.getPackageInfo(context.packageName, 0)
val versionName =
SettingsModel.buildConfig.simplifiedVersion

"$versionName (${pkgInfo.versionCode})"
} catch (e: Throwable) {
"Unknown"
}
}

private fun configureVersion(
preference: Preference
) {
preference.setSummaryProvider { SettingsModel.buildConfig.simplifiedVersion }
preference.setSummaryProvider { this.formatVersion() }
}

private fun configureVersionCore(
Expand Down

0 comments on commit 268d812

Please sign in to comment.