In-App Notification System #18
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ben/LovePlate#18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
Implement an in-app notification system that keeps users informed of relevant changes — new dishes and partner favorites — in a bundled, non-annoying way. Notifications appear either as a summary when opening the app, or live when the app is already open.
Goal
Users should never be overwhelmed by individual notifications. Instead, changes are grouped into single summary notifications.
Example: If the partner swipes right on 10 dishes in the Tinder page, the user sees one notification: "vanda hat 10 Gerichte gelikt" — not 10 separate ones.
Delivery Modes
Architecture
Backend (PocketBase)
New collection:
notification_eventscreatedtypenew_dish,partner_fav,partner_fav_removeddish_idby_user_iddeliveredPocketBase JS hooks (
pb_hooks/):dishes.afterCreate→ inserts anew_dishevent for the linked partnerusers.afterUpdate→ detects changes to thefavoritesfield on a partner record, insertspartner_favevents (comparing old vs new favorites to determine which dishes were added/removed)Client — New Files
lib/data/models/notification_event.dart— Isar model mirroring remote events locallylib/data/services/notification_service.dart— Pulls remote events, upserts locally, marks delivered, clears old eventslib/logic/providers.dart— Riverpod providers:notificationEventsProvider— Isar stream of unread eventsnotificationStateProvider—StateNotifierthat batches events intoNotificationGroupnotificationCountProvider— unread count for badge displaylib/ui/screens/notification_page.dart— Notification list/history pagelib/ui/widgets/notification_banner.dart— Live toast/snackbar for immediate notificationspb_hooks/notifications.pb.js— PocketBase hook logicpb_hooks/notification_utils.js— Shared hook utilitiesClient — Modified Files
lib/logic/providers.dart— Add notification providers + integrate intoRealtimeSyncNotifierandperformFullSync()lib/ui/screens/home_page.dart— Add notification bell icon with badge counter to app barlib/data/services/sync_service.dart— Add notification pull into delta sync flowlib/ui/widgets/dish_card.dart— May need UI adjustments for notification badgeBundling Logic (
NotificationStateNotifier)Integration Points
RealtimeSyncNotifier._onEventdishestrigger notification pullRealtimeSyncNotifier._periodicTimer(30s)performFullSync()TinderPageusers.afterUpdatehookDishRepositorydishes.afterCreatehookImplementation Order
notification_eventscollection + JS hooks on VPSNotificationEventIsar model with.g.dartgenerationNotificationService— pull, mark delivered, cleanupNotificationStateNotifier+ Riverpod providersRealtimeSyncNotifierandperformFullSync()Edge Cases
deliveredflag is server-side → cross-device consistentpartner_id)Design Decisions
dishes.afterCreatehookusers.afterUpdatehook