Add P2P chat background notifications (Phase 2)#529
Add P2P chat background notifications (Phase 2)#529AndreaDiazCorreia wants to merge 8 commits intomainfrom
Conversation
Add detection for admin/dispute DM messages in background service by checking
for {"dm": {...}} format before standard MostroMessage parsing. Return synthetic
MostroMessage with sendDm action to trigger notification flow.
Part of chat notifications implementation (Phase 1: Admin DM background notifications).
…load
Extract duplicate DM format detection logic (`item is Map && item.containsKey('dm')`)
into shared `NostrUtils.isDmPayload()` method. Replace inline checks in
DisputeChatNotifier, BackgroundNotificationService, and MostroService with calls
to the new utility.
Update tests to exercise NostrUtils.isDmPayload directly instead of testing
detection logic in isolation. Add edge case coverage for non-Map types.
…xtractor Add explicit case handlers for Action.sendDm and Action.cooperativeCancelAccepted in NotificationDataExtractor to ensure they generate non-temporary notifications. Both actions require no payload extraction (empty values map). Expand test coverage to validate three layers of the admin/dispute DM notification pipeline: NostrUtils.isDmPayload detection, MostroMessage construction with sendDm action, and NotificationDataExtractor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can get early access to new features in CodeRabbit.Enable the |
Summary
_handleTradeKeyEvent()for clarity_decryptAndProcessEvent()so P2P chat messages arriving in background are detected_handleP2PChatEvent()that decrypts viap2pUnwrap(sharedKey)and triggers a generic "New message" notificationHow it works
Previously,
_decryptAndProcessEvent()only matched events bytradeKey.public, so P2P chat messages (which arrive atsharedKey.public) were silently dropped. Now, when no tradeKey match is found, sessions are checked bysharedKey.public. Matched events are decrypted withp2pUnwrapand produce the same generic chat notification used for admin DMs.Test plan
flutter analyze— zero issues expected