Confirm identity server disconnection in all cases, as Riot-Web does

This commit is contained in:
Benoit Marty 2020-05-11 14:11:07 +02:00
parent 4b2f8e9174
commit 84a3754c9f
2 changed files with 11 additions and 9 deletions

View File

@ -158,17 +158,18 @@ class DiscoverySettingsFragment @Inject constructor(
val pidList = state.emailList().orEmpty() + state.phoneNumbersList().orEmpty() val pidList = state.emailList().orEmpty() + state.phoneNumbersList().orEmpty()
val hasBoundIds = pidList.any { it.isShared() == SharedState.SHARED } val hasBoundIds = pidList.any { it.isShared() == SharedState.SHARED }
if (hasBoundIds) { val message = if (hasBoundIds) {
// we should prompt getString(R.string.settings_discovery_disconnect_with_bound_pid, state.identityServer(), state.identityServer())
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()
} else { } 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()
} }
} }

View File

@ -2404,4 +2404,5 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming
<string name="choose_locale_loading_locales">Loading available languages…</string> <string name="choose_locale_loading_locales">Loading available languages…</string>
<string name="open_terms_of">Open terms of %s</string> <string name="open_terms_of">Open terms of %s</string>
<string name="disconnect_identity_server_dialog_content">Disconnect from the identity server %s?</string>
</resources> </resources>