Merge pull request #8618 from vector-im/feature/bma/3pidCapability

Hide setting entry point to manage 3Pid if homeserver capability `m.3pid_changes` is set to `false`.
This commit is contained in:
Benoit Marty 2023-08-22 15:10:12 +02:00 committed by GitHub
commit 87e5900dcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

1
changelog.d/8615.misc Normal file
View File

@ -0,0 +1 @@
Use 3PID capability to show / hide email UI in settings

View File

@ -101,6 +101,9 @@ class VectorSettingsGeneralFragment :
private val mPasswordPreference by lazy { private val mPasswordPreference by lazy {
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CHANGE_PASSWORD_PREFERENCE_KEY)!! findPreference<VectorPreference>(VectorPreferences.SETTINGS_CHANGE_PASSWORD_PREFERENCE_KEY)!!
} }
private val mManage3pidsPreference by lazy {
findPreference<VectorPreference>(VectorPreferences.SETTINGS_EMAILS_AND_PHONE_NUMBERS_PREFERENCE_KEY)!!
}
private val mIdentityServerPreference by lazy { private val mIdentityServerPreference by lazy {
findPreference<VectorPreference>(VectorPreferences.SETTINGS_IDENTITY_SERVER_PREFERENCE_KEY)!! findPreference<VectorPreference>(VectorPreferences.SETTINGS_IDENTITY_SERVER_PREFERENCE_KEY)!!
} }
@ -197,6 +200,10 @@ class VectorSettingsGeneralFragment :
mPasswordPreference.isVisible = false mPasswordPreference.isVisible = false
} }
// Manage 3Pid
// Hide the preference if 3pids can not be updated
mManage3pidsPreference.isVisible = homeServerCapabilities.canChange3pid
val openDiscoveryScreenPreferenceClickListener = Preference.OnPreferenceClickListener { val openDiscoveryScreenPreferenceClickListener = Preference.OnPreferenceClickListener {
(requireActivity() as VectorSettingsActivity).navigateTo( (requireActivity() as VectorSettingsActivity).navigateTo(
DiscoverySettingsFragment::class.java, DiscoverySettingsFragment::class.java,