- // Store the version name.
- requireContext().packageManager.getPackageInfo("net.i2p.android.router", 0).versionName
- } catch (exception: PackageManager.NameNotFoundException) { // I2P is not installed.
- // Store an empty string.
- ""
+ // Check to see if the F-Droid flavor is installed. The newer `getPackageInfo()` may be used once the minimum API >= 33.
+ @Suppress("DEPRECATION")
+ requireContext().getString(R.string.fdroid_flavor, requireContext().packageManager.getPackageInfo("net.i2p.android.router", 0).versionName)
+ } catch (exception: PackageManager.NameNotFoundException) { // The F-Droid flavor is not installed.
+ try {
+ // Check to see if the F-Droid flavor is installed. The newer `getPackageInfo()` may be used once the minimum API >= 33.
+ @Suppress("DEPRECATION")
+ requireContext().getString(R.string.google_play_flavor, requireContext().packageManager.getPackageInfo("net.i2p.android", 0).versionName)
+ } catch (exception: PackageManager.NameNotFoundException) { // The Google Play flavor is not installed either.
+ // Store an empty string.
+ ""
+ }