MOB-08 — Push notifications foundation
Firebase projects per flavor, FCM token registration, foreground/background handling, notification → deep-link routing.
| Field | Details |
|---|---|
| Task code | MOB-08 |
| Phase | P0 — Foundations (cadrage, UX/UI, architecture & contract) |
| Product scope | V1 |
| Status | Planned |
| Start | Thu 29 Oct 2026 |
| Due | Thu 29 Oct 2026 |
| Responsible | Imad — Mobile developer (Flutter) |
| Co-responsible | — |
| Effort | 0.75 person-day(s) planned · 3 from scratch · size S |
| Area · app | Mobile foundation · mobile |
| Depends on | MOB-06 |
| Unblocks | MRA-08 |
| Milestones | — |
Summary
Firebase projects per flavor, FCM token registration, foreground/background handling, notification → deep-link routing.
Description
Order status changes, assisted-order confirmations, follow-ups and announcements reach users through FCM push with deep links (NOT-02, INT-02), and device registration also carries the app version the server checks (AUTH-09). Scope: Firebase configuration per flavor for both apps, FCM token registration and refresh through me.devices.register, unregistration on sign-out, notification channels per NotificationCategory, foreground display, background and terminated-state taps routed to the MOB-05 deep-link registry, and the unread badge. The inbox UI is MRA-08 / MDA-11. It needs from Anis the push payload format (type, entity id, deep link) and the FCM sender wired in SRV-08; nothing new from Akram beyond the notification icon. MRA-05, MRA-08, MRA-10 and MDA-11 consume these events.
Subtasks
| # | Subtask | Owner |
|---|---|---|
| 1 | Firebase projects/apps per flavor (dev, staging, prod) for dz.hoco.reseller and dz.hoco.delegate; google-services.json under android/app/src/<flavor>/; flutterfire config documented | Imad |
| 2 | PushService: request POST_NOTIFICATIONS on Android 13+ after sign-in (not at first launch), get the FCM token, call me.devices.register (deviceId, fcmToken, platform, appVersion) with an Idempotency-Key, re-register on onTokenRefresh and app upgrade | Imad |
| 3 | Unregister on sign-out (auth.logout or me.devices.remove) and on account switch | Imad |
| 4 | Android notification channels mapped to NotificationCategory: « Commandes et compte », « Sécurité », « Activité terrain », « Offres et promotions », « Annonces »; small icon and accent colour from DQA assets | Imad |
| 5 | Foreground display with flutter_local_notifications (suppressed when the user is already on the target screen), background handler, getInitialMessage for taps from a killed app | Imad |
| 6 | Payload contract { type, entityId, deepLink } parsed into a route of the MOB-05 registry (/orders/:id, /tickets/:id, /returns/:id, /tasks, /notifications…); unknown types open the inbox | Imad |
| 7 | Unread badge provider refreshed from notifications.unreadCount on push receipt and app resume | Imad |
| 8 | Agree the payload format and template keys with Anis and send test pushes from staging | Anis |
Deliverables
- packages/hoco_core/lib/src/push/push_service.dart and deep_link_parser.dart
- apps/*/android/app/src/{dev,staging,prod}/google-services.json (prod injected in CI)
- Firebase projects per flavor with FCM enabled and the server key/service account shared with Anis
Acceptance criteria
- After sign-in the device appears in the user's devices with its app version; a token refresh updates it (AUTH-09)
- A push for order CMD-2026-000158 tapped from a killed, backgrounded or foregrounded app opens that order's detail (NOT-02)
- After sign-out the device no longer receives pushes for that user
- Denying the notification permission does not block the app; the inbox still works
- Promotional notifications use their own channel so the user can mute them without losing order updates
Requirements covered
| Requirement | Title | Release |
|---|---|---|
| NOT-02 | Push notifications (FCM) with deep links | V1 |
| AUTH-09 | Device registration for push and minimum-app-version enforcement | V1 |
| INT-02 | Firebase Cloud Messaging | V1 |
API surface
| Endpoint group | Operations |
|---|---|
| Me, devices, app config & reference data | 9 |
| Notifications & announcements | 10 |
Test measures
- Unit tests of the payload → route parser for every notification type
- Manual device matrix: killed / background / foreground taps on Android 10, 13 and 14 with test pushes from the Firebase console and from staging
- Widget test of the badge update on a simulated push
Risks
- Aggressive OEM battery savers (Xiaomi, Oppo, Samsung) delay or drop pushes — high-priority messages for transactional types and the SSE/inbox refresh on resume as a backstop
KPI
- Delivered by Thu 29 Oct 2026 within 0.75 person-day(s).
- Every acceptance criterion above demonstrated before hand-off; linked requirements' acceptance criteria pass.
- Zero open critical defects, permission gaps or data-integrity regressions at sign-off.
Generated from content/plan/tasks.json by scripts/generate-team-tasks.mjs. Dates are computed by the scheduler (Sunday–Thursday weeks, holidays excluded) — change the plan, not this page.
MOB-06 — Authentication flows (both apps)
Guest mode (browse without prices), reseller welcome, sign-up with OTP, customer type and account claim, pending-validation screen, sign-in, forgot password; delegate sign-in and reset; session restore and status gating.
MOB-09 — Offline foundation for the delegate app (local DB + outbox sync)
hoco_offline: drift database for tours/visits/resellers/tasks, outbox of idempotent mutations with ordered replay through /sync/batch, delta pulls, conflict surfacing, sync status stream.