Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BlossomRepository.clear()was wipingwisp_prefs_{pubkey}— the same fileKeyRepositoryuses forlocal_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.reload(newPubkey)repointsprefsto the incoming account's file.Test plan
./gradlew assembleDebugpasses.