mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-28 16:59:01 +03:00
Identity: correctly handle terms update
This commit is contained in:
parent
b659cb60a2
commit
af3fc22e2d
4 changed files with 8 additions and 8 deletions
.idea/dictionaries
vector/src/main/java/im/vector/riotx/features/discovery
2
.idea/dictionaries/bmarty.xml
generated
2
.idea/dictionaries/bmarty.xml
generated
|
@ -18,7 +18,9 @@
|
||||||
<w>linkify</w>
|
<w>linkify</w>
|
||||||
<w>megolm</w>
|
<w>megolm</w>
|
||||||
<w>msisdn</w>
|
<w>msisdn</w>
|
||||||
|
<w>msisdns</w>
|
||||||
<w>pbkdf</w>
|
<w>pbkdf</w>
|
||||||
|
<w>pids</w>
|
||||||
<w>pkcs</w>
|
<w>pkcs</w>
|
||||||
<w>riotx</w>
|
<w>riotx</w>
|
||||||
<w>signin</w>
|
<w>signin</w>
|
||||||
|
|
|
@ -65,7 +65,7 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
is Success -> {
|
is Success -> {
|
||||||
buildIdentityServerSection(data)
|
buildIdentityServerSection(data)
|
||||||
val hasIdentityServer = data.identityServer().isNullOrBlank().not()
|
val hasIdentityServer = data.identityServer().isNullOrBlank().not()
|
||||||
if (hasIdentityServer) {
|
if (hasIdentityServer && !data.termsNotSigned) {
|
||||||
buildEmailsSection(data.emailList)
|
buildEmailsSection(data.emailList)
|
||||||
buildMsisdnSection(data.phoneNumbersList)
|
buildMsisdnSection(data.phoneNumbersList)
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
val identityServer = data.identityServer() ?: stringProvider.getString(R.string.none)
|
val identityServer = data.identityServer() ?: stringProvider.getString(R.string.none)
|
||||||
|
|
||||||
settingsSectionTitleItem {
|
settingsSectionTitleItem {
|
||||||
id("idsTitle")
|
id("idServerTitle")
|
||||||
titleResId(R.string.identity_server)
|
titleResId(R.string.identity_server)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
if (data.termsNotSigned) {
|
if (data.termsNotSigned) {
|
||||||
helperText(stringProvider.getString(R.string.settings_agree_to_terms, identityServer))
|
helperText(stringProvider.getString(R.string.settings_agree_to_terms, identityServer))
|
||||||
showCompoundDrawable(true)
|
showCompoundDrawable(true)
|
||||||
itemClickListener(View.OnClickListener { listener?.onSelectIdentityServer() })
|
itemClickListener(View.OnClickListener { listener?.openIdentityServerTerms() })
|
||||||
} else {
|
} else {
|
||||||
showCompoundDrawable(false)
|
showCompoundDrawable(false)
|
||||||
if (data.identityServer() != null) {
|
if (data.identityServer() != null) {
|
||||||
|
@ -357,7 +357,7 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Listener {
|
interface Listener {
|
||||||
fun onSelectIdentityServer()
|
fun openIdentityServerTerms()
|
||||||
fun onTapRevoke(threePid: ThreePid)
|
fun onTapRevoke(threePid: ThreePid)
|
||||||
fun onTapShare(threePid: ThreePid)
|
fun onTapShare(threePid: ThreePid)
|
||||||
fun checkEmailVerification(threePid: ThreePid.Email)
|
fun checkEmailVerification(threePid: ThreePid.Email)
|
||||||
|
|
|
@ -103,9 +103,8 @@ class DiscoverySettingsFragment @Inject constructor(
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSelectIdentityServer() = withState(viewModel) { state ->
|
override fun openIdentityServerTerms() = withState(viewModel) { state ->
|
||||||
if (state.termsNotSigned) {
|
if (state.termsNotSigned) {
|
||||||
// TODO Use ViewEvents?
|
|
||||||
navigator.openTerms(
|
navigator.openTerms(
|
||||||
this,
|
this,
|
||||||
TermsService.ServiceType.IdentityService,
|
TermsService.ServiceType.IdentityService,
|
||||||
|
|
|
@ -52,7 +52,7 @@ data class DiscoverySettingsState(
|
||||||
val identityServer: Async<String?> = Uninitialized,
|
val identityServer: Async<String?> = Uninitialized,
|
||||||
val emailList: Async<List<PidInfo>> = Uninitialized,
|
val emailList: Async<List<PidInfo>> = Uninitialized,
|
||||||
val phoneNumbersList: Async<List<PidInfo>> = Uninitialized,
|
val phoneNumbersList: Async<List<PidInfo>> = Uninitialized,
|
||||||
// TODO Use ViewEvents?
|
// Can be true if terms are updated
|
||||||
val termsNotSigned: Boolean = false
|
val termsNotSigned: Boolean = false
|
||||||
) : MvRxState
|
) : MvRxState
|
||||||
|
|
||||||
|
@ -329,7 +329,6 @@ class DiscoverySettingsViewModel @AssistedInject constructor(
|
||||||
override fun onFailure(failure: Throwable) {
|
override fun onFailure(failure: Throwable) {
|
||||||
if (failure is IdentityServiceError.TermsNotSignedException) {
|
if (failure is IdentityServiceError.TermsNotSignedException) {
|
||||||
setState {
|
setState {
|
||||||
// TODO Use ViewEvent ?
|
|
||||||
copy(termsNotSigned = true)
|
copy(termsNotSigned = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue