Conversation
… and wallet reliability
Feed:
- Gate eventRepo.addEvent() on feed-related subscription IDs only (feed,
loadmore, feed-backfill) in processRelayEvent; other subs use cacheEvent()
so user profile, thread, and bookmark events don't leak into the follow feed
- Fix inflated new-note count caused by profile/thread events incrementing
the counter via binaryInsert
- UserProfileViewModel now uses cacheEvent() for kind 0/1/6 events instead
of addEvent(), preventing viewed profiles from contaminating the global feed
- Chunk follow-profile requests into batches of 50 with proper sub cleanup
- Remove initNwc() — wallet connects lazily on tab open or on-demand via zap
Relay:
- Reconnect on non-normal WebSocket close (code != 1000) and null out the
socket reference on close to prevent sends to dead connections
Notifications:
- Persist last-read timestamp in SharedPreferences per account so unread
badge state survives app restarts
- Only mark notifications as unread if they're newer than the last-read time
Wallet:
- Rewrite connection flow: initial connect uses a proper timeout with
first{}, then a persistent monitor handles disconnect/reconnect
- Pass coroutine scope to NWC relay for proper lifecycle management
- Track connection string in state for UI consistency
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
Fix feed contamination: Events from user profile, thread, and bookmark subscriptions were being added to the follow feed via
addEvent()in the catch-all else block ofprocessRelayEvent. This caused posts from non-followed users to appear in the feed after viewing their profiles, and inflated the "new posts" counter (the count included every post loaded on profile screens). Now only feed-related subscriptions (feed,loadmore,feed-backfill) calladdEvent()— everything else usescacheEvent()which stores events for lookups without inserting into the feed list.Fix UserProfileViewModel feed leakage: The profile screen was also calling
eventRepo.addEvent()for kind 0/1/6 events, which inserted viewed users' posts into the global feed. Changed tocacheEvent()since the profile screen maintains its own local lists. Also chunked follow-profile requests into batches of 50 with proper subscription cleanup.Persist notification read state: Unread notification badge now survives app restarts by persisting the last-read timestamp in SharedPreferences (per account). Notifications are only marked unread if they're newer than the stored timestamp.
Fix relay reconnection: WebSocket
onClosedwith non-normal close codes (anything other than 1000) now triggers reconnection. The socket reference is also nulled on close to prevent sends to dead connections.Improve wallet connection reliability: Rewrote the NWC connection flow — initial connect uses a proper coroutine timeout, then a persistent monitor handles disconnect/reconnect state transitions. The NWC relay now receives a coroutine scope for proper lifecycle management. Removed
initNwc()since wallet connects lazily when the tab is opened or on-demand when sending a zap.Test plan