Notification system audit: fix 6 defects, close 5 gaps, add rich notifications (v1.1.0)

Defects fixed:
- D1: Fix notification ID range collision (report reminders 700k→2M+)
- D2: Streak risk now checks both dzikir pagi & petang
- D3: _cancelPrayerPending no longer kills non-prayer notifications
- D4: Push notifications carry deeplink in payload for proper routing
- D5: Add reconfigureTimeZoneIfNeeded() for TZ change detection
- D6: Defer launch notification routing until widget tree is ready

Gaps closed:
- G1: Add streak risk + weekly summary toggles to settings UI
- G2: Verified boot reschedule already in place (flutter_local_notifications v21)
- G3: Remove unused mirrorAdzanToInbox field and legacy cleanup calls
- G4: Add notif_push_opened analytics tracking
- G5: Add notif_settings_changed analytics tracking

Enhancements:
- O1: Rich notification with Sudah Sholat action button on report reminders
- O2: Permission check on app resume via WidgetsBindingObserver (30s throttle)
- O2b: Fix stretched notification icon (white crescent moon vector drawable)
- O3: Expired inbox cleanup in background sync
- O4: Haptic feedback on notification bell quick actions

Bump version 1.0.8+9 → 1.1.0+10
This commit is contained in:
Dwindi Ramadhana
2026-06-06 22:38:02 +07:00
parent 2bd8e3666a
commit 4badfb6521
13 changed files with 420 additions and 37 deletions

View File

@@ -158,8 +158,6 @@ class NotificationEventProducerService {
if (log == null) return;
final tilawahRisk = log.tilawahLog != null && !log.tilawahLog!.isCompleted;
final dzikirRisk =
settings.trackDzikir && log.dzikirLog != null && !log.dzikirLog!.petang;
if (tilawahRisk) {
final title = 'Streak Tilawah berisiko terputus';
@@ -180,13 +178,14 @@ class NotificationEventProducerService {
dedupeSeed: 'push.$dedupe',
title: title,
body: body,
deeplink: '/quran',
);
}
if (dzikirRisk) {
final title = 'Dzikir petang belum tercatat';
const body = 'Lengkapi dzikir petang untuk menjaga streak amalan harian.';
final dedupe = 'streak.dzikir.$dateKey';
if (settings.trackDzikir && log.dzikirLog != null && !log.dzikirLog!.pagi) {
final title = 'Dzikir pagi belum tercatat';
const body = 'Lengkapi dzikir pagi untuk menjaga streak amalan harian.';
final dedupe = 'streak.dzikir.pagi.$dateKey';
await _inbox.addItem(
title: title,
body: body,
@@ -201,6 +200,29 @@ class NotificationEventProducerService {
dedupeSeed: 'push.$dedupe',
title: title,
body: body,
deeplink: '/tools/dzikir',
);
}
if (settings.trackDzikir && log.dzikirLog != null && !log.dzikirLog!.petang) {
final title = 'Dzikir petang belum tercatat';
const body = 'Lengkapi dzikir petang untuk menjaga streak amalan harian.';
final dedupe = 'streak.dzikir.petang.$dateKey';
await _inbox.addItem(
title: title,
body: body,
type: 'streak_risk',
source: 'local',
deeplink: '/tools/dzikir',
dedupeKey: dedupe,
expiresAt: DateTime(now.year, now.month, now.day, 23, 59),
);
await _pushHabitIfAllowed(
settings: settings,
dedupeSeed: 'push.$dedupe',
title: title,
body: body,
deeplink: '/tools/dzikir',
);
}
}
@@ -266,6 +288,7 @@ class NotificationEventProducerService {
required String dedupeSeed,
required String title,
required String body,
String? deeplink,
}) async {
await _pushNonPrayer(
settings: settings,
@@ -274,6 +297,7 @@ class NotificationEventProducerService {
body: body,
payloadType: 'streak_risk',
silent: false,
deeplink: deeplink,
);
}
@@ -284,6 +308,7 @@ class NotificationEventProducerService {
required String body,
required String payloadType,
required bool silent,
String? deeplink,
}) async {
if (!settings.alertsEnabled) return;
final notif = NotificationService.instance;
@@ -294,6 +319,7 @@ class NotificationEventProducerService {
body: body,
payloadType: payloadType,
silent: silent,
deeplink: deeplink,
);
}
}