From 84a3754c9f84c35e7a74bd2723ac2a941c34f45d Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 11 May 2020 14:11:07 +0200 Subject: [PATCH] Confirm identity server disconnection in all cases, as Riot-Web does --- .../discovery/DiscoverySettingsFragment.kt | 19 ++++++++++--------- vector/src/main/res/values/strings.xml | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/discovery/DiscoverySettingsFragment.kt b/vector/src/main/java/im/vector/riotx/features/discovery/DiscoverySettingsFragment.kt index 0c148a3538..d4a45b0908 100644 --- a/vector/src/main/java/im/vector/riotx/features/discovery/DiscoverySettingsFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/discovery/DiscoverySettingsFragment.kt @@ -158,17 +158,18 @@ class DiscoverySettingsFragment @Inject constructor( val pidList = state.emailList().orEmpty() + state.phoneNumbersList().orEmpty() val hasBoundIds = pidList.any { it.isShared() == SharedState.SHARED } - if (hasBoundIds) { - // we should prompt - AlertDialog.Builder(requireActivity()) - .setTitle(R.string.disconnect_identity_server) - .setMessage(getString(R.string.settings_discovery_disconnect_with_bound_pid, state.identityServer(), state.identityServer())) - .setPositiveButton(R.string._continue) { _, _ -> viewModel.handle(DiscoverySettingsAction.ChangeIdentityServer(null)) } - .setNegativeButton(R.string.cancel, null) - .show() + val message = if (hasBoundIds) { + getString(R.string.settings_discovery_disconnect_with_bound_pid, state.identityServer(), state.identityServer()) } else { - viewModel.handle(DiscoverySettingsAction.ChangeIdentityServer(null)) + getString(R.string.disconnect_identity_server_dialog_content, state.identityServer()) } + + AlertDialog.Builder(requireActivity()) + .setTitle(R.string.disconnect_identity_server) + .setMessage(message) + .setPositiveButton(R.string.disconnect) { _, _ -> viewModel.handle(DiscoverySettingsAction.ChangeIdentityServer(null)) } + .setNegativeButton(R.string.cancel, null) + .show() } } diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 3d40fd0c61..5a4c200a2d 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -2404,4 +2404,5 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming Loading available languages… Open terms of %s + Disconnect from the identity server %s?