Make user displayName live in the setting, it should fix #1926
This commit is contained in:
parent
20e2b3beb8
commit
bd238dcbfa
|
@ -8,7 +8,7 @@ Improvements 🙌:
|
||||||
-
|
-
|
||||||
|
|
||||||
Bugfix 🐛:
|
Bugfix 🐛:
|
||||||
-
|
- Display name not shown under Settings/General (#1926)
|
||||||
|
|
||||||
Translations 🗣:
|
Translations 🗣:
|
||||||
-
|
-
|
||||||
|
|
|
@ -128,6 +128,7 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
observeUserAvatar()
|
observeUserAvatar()
|
||||||
|
observeUserDisplayName()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeUserAvatar() {
|
private fun observeUserAvatar() {
|
||||||
|
@ -140,6 +141,21 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
|
||||||
.disposeOnDestroyView()
|
.disposeOnDestroyView()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun observeUserDisplayName() {
|
||||||
|
session.rx()
|
||||||
|
.liveUser(session.myUserId)
|
||||||
|
.unwrap()
|
||||||
|
.distinctUntilChanged { user -> user.displayName }
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe { user ->
|
||||||
|
mDisplayNamePreference.let {
|
||||||
|
it.summary = user.displayName ?: ""
|
||||||
|
it.text = user.displayName ?: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.disposeOnDestroyView()
|
||||||
|
}
|
||||||
|
|
||||||
override fun bindPref() {
|
override fun bindPref() {
|
||||||
// Avatar
|
// Avatar
|
||||||
mUserAvatarPreference.let {
|
mUserAvatarPreference.let {
|
||||||
|
@ -151,8 +167,6 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
|
||||||
|
|
||||||
// Display name
|
// Display name
|
||||||
mDisplayNamePreference.let {
|
mDisplayNamePreference.let {
|
||||||
it.summary = session.getUser(session.myUserId)?.displayName ?: ""
|
|
||||||
it.text = it.summary.toString()
|
|
||||||
it.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
|
it.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
|
||||||
newValue
|
newValue
|
||||||
?.let { value -> (value as? String)?.trim() }
|
?.let { value -> (value as? String)?.trim() }
|
||||||
|
|
Loading…
Reference in New Issue