} else {
appBarLayout.setBackgroundResource(R.color.dark_blue_30);
}
+ // Get the package manager.
+ PackageManager packageManager = getPackageManager();
// Check to see if I2P is installed.
try {
- // Get the package manager.
- PackageManager packageManager = getPackageManager();
-
- // Check to see if I2P is in the list. This will throw an error and drop to the catch section if it isn't installed.
+ // Check to see if the F-Droid flavor is installed. This will throw an error and drop to the catch section if it isn't installed.
packageManager.getPackageInfo("net.i2p.android.router", 0);
- } catch (PackageManager.NameNotFoundException exception) { // I2P is not installed.
- // Sow the I2P not installed dialog if it is not already displayed.
- if (getSupportFragmentManager().findFragmentByTag(getString(R.string.proxy_not_installed_dialog)) == null) {
- // Get a handle for the waiting for proxy alert dialog.
- DialogFragment i2pNotInstalledDialogFragment = ProxyNotInstalledDialog.displayDialog(proxyMode);
+ } catch (PackageManager.NameNotFoundException fdroidException) { // The F-Droid flavor is not installed.
+ try {
+ // Check to see if the Google Play flavor is installed. This will throw an error and drop to the catch section if it isn't installed.
+ packageManager.getPackageInfo("net.i2p.android", 0);
+ } catch (PackageManager.NameNotFoundException googlePlayException) { // The Google Play flavor is not installed.
+ // Sow the I2P not installed dialog if it is not already displayed.
+ if (getSupportFragmentManager().findFragmentByTag(getString(R.string.proxy_not_installed_dialog)) == null) {
+ // Get a handle for the waiting for proxy alert dialog.
+ DialogFragment i2pNotInstalledDialogFragment = ProxyNotInstalledDialog.displayDialog(proxyMode);
- // Try to show the dialog. Sometimes the window is not yet active if returning from Settings.
- try {
- // Display the I2P not installed alert dialog.
- i2pNotInstalledDialogFragment.show(getSupportFragmentManager(), getString(R.string.proxy_not_installed_dialog));
- } catch (Exception i2pNotInstalledException) {
- // Add the dialog to the pending dialog array list. It will be displayed in `onStart()`.
- pendingDialogsArrayList.add(new PendingDialog(i2pNotInstalledDialogFragment, getString(R.string.proxy_not_installed_dialog)));
+ // Try to show the dialog. Sometimes the window is not yet active if returning from Settings.
+ try {
+ // Display the I2P not installed alert dialog.
+ i2pNotInstalledDialogFragment.show(getSupportFragmentManager(), getString(R.string.proxy_not_installed_dialog));
+ } catch (Exception i2pNotInstalledException) {
+ // Add the dialog to the pending dialog array list. It will be displayed in `onStart()`.
+ pendingDialogsArrayList.add(new PendingDialog(i2pNotInstalledDialogFragment, getString(R.string.proxy_not_installed_dialog)));
+ }
}
}
}
// Get the I2P version name if I2P is installed.
val i2p: String = try {
- // Store the version name. The newer `getPackageInfo()` may be used once the minimum API >= 33.
+ // Check to see if the F-Droid flavor is installed. The newer `getPackageInfo()` may be used once the minimum API >= 33.
@Suppress("DEPRECATION")
- requireContext().packageManager.getPackageInfo("net.i2p.android.router", 0).versionName
- } catch (exception: PackageManager.NameNotFoundException) { // I2P is not installed.
- // Store an empty string.
- ""
+ requireContext().packageManager.getPackageInfo("net.i2p.android.router", 0).versionName + " " + requireContext().getString(R.string.fdroid_flavor)
+ } 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().packageManager.getPackageInfo("net.i2p.android", 0).versionName + " " + requireContext().getString(R.string.google_play_flavor)
+ } catch (exception: PackageManager.NameNotFoundException) { // The Google Play flavor is not installed either.
+ // Store an empty string.
+ ""
+ }
}
// Get the OpenKeychain version name if it is installed.
<string name="webview_version">WebView Version:</string>
<string name="orbot">Orbot:</string>
<string name="i2p">I2P:</string>
+ <string name="fdroid_flavor">(F-Droid flavor)</string>
+ <string name="google_play_flavor">(Google Play flavor)</string>
<string name="openkeychain">OpenKeychain:</string>
<string name="memory_usage">Memory Usage</string>
<string name="app_consumed_memory">App Consumed Memory:</string>