fix default post privacy setting sometimes showing the value of the wrong account (#4564)

Without the `isPersistent = false` flag the preference is saved to
SharedPreferences in addition to the account and overrides the shown
value. So it would always show the value of the last account it was set
to. It was working fine though, only the shown value was wrong.

https://social.sitedethib.com/@Claire/112769984398891581
This commit is contained in:
Konrad Pozniak 2024-07-12 11:06:53 +02:00 committed by GitHub
parent 235b55d8d6
commit a8202d8a41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -185,6 +185,7 @@ class AccountPreferencesFragment : PreferenceFragmentCompat() {
val visibility = accountManager.activeAccount?.defaultPostPrivacy ?: Status.Visibility.PUBLIC
value = visibility.serverString
setIcon(getIconForVisibility(visibility))
isPersistent = false // its saved to the account and shouldn't be in shared preferences
setOnPreferenceChangeListener { _, newValue ->
setIcon(
getIconForVisibility(Status.Visibility.byString(newValue as String))
@ -206,6 +207,7 @@ class AccountPreferencesFragment : PreferenceFragmentCompat() {
val visibility = activeAccount.defaultReplyPrivacy
value = visibility.serverString
setIcon(getIconForVisibility(visibility))
isPersistent = false // its saved to the account and shouldn't be in shared preferences
setOnPreferenceChangeListener { _, newValue ->
val newVisibility = Status.Visibility.byString(newValue as String)
setIcon(getIconForVisibility(newVisibility))