diff --git a/vector/src/main/java/im/vector/riotx/features/discovery/DiscoverySettingsController.kt b/vector/src/main/java/im/vector/riotx/features/discovery/DiscoverySettingsController.kt
index fb344662d7..4cadea911e 100644
--- a/vector/src/main/java/im/vector/riotx/features/discovery/DiscoverySettingsController.kt
+++ b/vector/src/main/java/im/vector/riotx/features/discovery/DiscoverySettingsController.kt
@@ -86,13 +86,22 @@ class DiscoverySettingsController @Inject constructor(
title(identityServer)
}
- settingsInfoItem {
- id("idServerFooter")
- if (data.termsNotSigned) {
+ if (data.identityServer() != null && data.termsNotSigned) {
+ settingsInfoItem {
+ id("idServerFooter")
helperText(stringProvider.getString(R.string.settings_agree_to_terms, identityServer))
showCompoundDrawable(true)
itemClickListener(View.OnClickListener { listener?.openIdentityServerTerms() })
- } else {
+ }
+ settingsButtonItem {
+ id("seeTerms")
+ colorProvider(colorProvider)
+ buttonTitle(stringProvider.getString(R.string.open_terms_of, identityServer))
+ buttonClickListener { listener?.openIdentityServerTerms() }
+ }
+ } else {
+ settingsInfoItem {
+ id("idServerFooter")
showCompoundDrawable(false)
if (data.identityServer() != null) {
helperText(stringProvider.getString(R.string.settings_discovery_identity_server_info, identityServer))
diff --git a/vector/src/main/java/im/vector/riotx/features/discovery/DiscoverySettingsViewModel.kt b/vector/src/main/java/im/vector/riotx/features/discovery/DiscoverySettingsViewModel.kt
index a33c9313ac..547c74fe2e 100644
--- a/vector/src/main/java/im/vector/riotx/features/discovery/DiscoverySettingsViewModel.kt
+++ b/vector/src/main/java/im/vector/riotx/features/discovery/DiscoverySettingsViewModel.kt
@@ -321,24 +321,22 @@ class DiscoverySettingsViewModel @AssistedInject constructor(
setState {
copy(
emailList = Success(data.filter { it.key is ThreePid.Email }.toPidInfoList()),
- phoneNumbersList = Success(data.filter { it.key is ThreePid.Msisdn }.toPidInfoList())
+ phoneNumbersList = Success(data.filter { it.key is ThreePid.Msisdn }.toPidInfoList()),
+ termsNotSigned = false
)
}
}
override fun onFailure(failure: Throwable) {
- if (failure is IdentityServiceError.TermsNotSignedException) {
- setState {
- copy(termsNotSigned = true)
- }
+ if (failure !is IdentityServiceError.TermsNotSignedException) {
+ _viewEvents.post(DiscoverySettingsViewEvents.Failure(failure))
}
- _viewEvents.post(DiscoverySettingsViewEvents.Failure(failure))
-
setState {
copy(
emailList = Success(emails.map { PidInfo(it, Fail(failure)) }),
- phoneNumbersList = Success(msisdns.map { PidInfo(it, Fail(failure)) })
+ phoneNumbersList = Success(msisdns.map { PidInfo(it, Fail(failure)) }),
+ termsNotSigned = failure is IdentityServiceError.TermsNotSignedException
)
}
}
diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml
index ac32011a77..c5169d55a4 100644
--- a/vector/src/main/res/values/strings.xml
+++ b/vector/src/main/res/values/strings.xml
@@ -2402,4 +2402,5 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming
Other available languages
Loading available languages…
-
\ No newline at end of file
+ Open terms of %s
+