Refresh OpenPGP provider setting onResume, and small cosmetic changes

This commit is contained in:
Vincent Breitmoser 2018-11-21 14:25:34 +01:00
parent 0f7d0963f5
commit 81f496b7f3
3 changed files with 15 additions and 6 deletions

View file

@ -144,8 +144,8 @@ public class MessageLoaderHelper {
cancelAndClearCryptoOperation();
cancelAndClearDecodeLoader();
if (account.isOpenPgpProviderConfigured()) {
String openPgpProvider = account.getOpenPgpProvider();
String openPgpProvider = account.getOpenPgpProvider();
if (openPgpProvider != null) {
startOrResumeCryptoOperation(openPgpProvider);
} else {
startOrResumeDecodeMessage();
@ -232,8 +232,8 @@ public class MessageLoaderHelper {
return;
}
if (account.isOpenPgpProviderConfigured()) {
String openPgpProvider = account.getOpenPgpProvider();
String openPgpProvider = account.getOpenPgpProvider();
if (openPgpProvider != null) {
startOrResumeCryptoOperation(openPgpProvider);
return;
}

View file

@ -72,6 +72,14 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
requireActivity().title = title
}
override fun onResume() {
super.onResume()
// we might be returning from OpenPgpAppSelectDialog, make sure settings are up to date
val account = getAccount()
initializeCryptoSettings(account)
}
private fun initializeIncomingServer() {
findPreference(PREFERENCE_INCOMING_SERVER)?.onClick {
AccountSetupIncoming.actionEditIncomingSettings(requireActivity(), accountUuid)
@ -163,7 +171,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
private fun configureCryptoPreferences(account: Account) {
var pgpProviderName: String? = null
var pgpProvider = account.openPgpProvider
var isPgpConfigured = account.isOpenPgpProviderConfigured
val isPgpConfigured = pgpProvider != null
if (isPgpConfigured) {
pgpProviderName = getOpenPgpProviderName(pgpProvider)
@ -172,7 +180,6 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
account.openPgpProvider = null
pgpProvider = null
isPgpConfigured = false
}
}
@ -198,6 +205,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
account.openPgpProvider = openPgpProviderPackages[0]
configureCryptoPreferences(account)
} else {
summary = getString(R.string.account_settings_crypto_summary_config)
OpenPgpAppSelectDialog.startOpenPgpChooserActivity(requireActivity(), account)
}
}

View file

@ -603,6 +603,7 @@ Please submit bug reports, contribute new features and ask questions at
<string name="account_settings_crypto_key">Configure end-to-end key</string>
<string name="account_settings_crypto_summary_off">No OpenPGP app configured</string>
<string name="account_settings_crypto_summary_on">Connected to %s</string>
<string name="account_settings_crypto_summary_config">Configuring…</string>
<string name="account_settings_no_openpgp_provider_configured">No OpenPGP app configured</string>
<string name="account_settings_no_openpgp_provider_installed">No OpenPGP app found - click to install</string>