Skip to content

fix: preserve local relay and emoji frequency across account switches#486

Merged
barrydeen merged 1 commit intomainfrom
fix/persist-settings-across-account-switch
Apr 23, 2026
Merged

fix: preserve local relay and emoji frequency across account switches#486
barrydeen merged 1 commit intomainfrom
fix/persist-settings-across-account-switch

Conversation

@barrydeen
Copy link
Copy Markdown
Owner

Summary

  • BlossomRepository.clear() was wiping wisp_prefs_{pubkey} — the same file KeyRepository uses for local_relay, relays, dm_relays, etc. On every account switch, resetForAccountSwitch() called this against the outgoing account's file, erasing the local relay config (the only key with no relay-side mirror to restore it).
  • CustomEmojiRepository.clear() did the same to its own per-pubkey file, erasing the "most used" emoji frequency map.
  • Both now leave disk untouched; the subsequent reload(newPubkey) repoints prefs to the incoming account's file.

Test plan

  • Configure local relay on account A, switch to B, switch back to A — local relay config persists.
  • React with emojis on account A, switch to B, switch back — "most used" ordering preserved for both accounts independently.
  • ./gradlew assembleDebug passes.

Two repos called clear() during resetForAccountSwitch() were doing
`prefs.edit().clear().apply()` on their SharedPreferences files while
those files were still pointing at the outgoing account:

- CustomEmojiRepository wipes its own per-pubkey file, erasing the
  "most used" emoji frequency map. No relay mirror, so the data was
  lost for good.
- BlossomRepository shares `wisp_prefs_{pubkey}` with KeyRepository, so
  its full-file wipe also took out local_relay, relays, dm_relays, etc.
  Most of those keys came back via replaceable-event refetches, but
  local_relay has no network source and stayed null.

Drop the disk wipe from both clear() methods. The subsequent
reload(newPubkey) already repoints prefs to the incoming account's file.
@barrydeen barrydeen merged commit ebeebcc into main Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant