Skip to content

Commit

Permalink
Move newPillSheetNotification
Browse files Browse the repository at this point in the history
  • Loading branch information
bannzai committed Jan 28, 2025
1 parent 7a8e493 commit ed0e790
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lib/utils/local_notification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,6 @@ class RegisterReminderLocalNotification {
if (pillSheetGroup.lastActiveRestDuration != null) {
return;
}
try {
// NOTE: 本来であれば各ユースケース毎に通知を登録するが、99%のケースで同じ通知を登録するのでここで登録してしまう
// ただ、重要な服用通知のスケジューリング処理を邪魔しないため、awaitもしないしエラーハンドリングもしない
final newPillSheetNotification = NewPillSheetNotification();
unawaited(newPillSheetNotification.call(pillSheetGroup: pillSheetGroup, setting: setting));
} catch (e, st) {
// 通知の登録に失敗しても、服用記録には影響がないのでエラーログだけ残す
errorLogger.recordError(e, st);
}

analytics.debug(name: 'run_register_reminder_notification', parameters: {
'todayPillNumber': activePillSheet.todayPillNumber,
'todayPillIsAlreadyTaken': activePillSheet.todayPillIsAlreadyTaken,
Expand Down Expand Up @@ -516,6 +506,15 @@ class RegisterReminderLocalNotification {
analytics.debug(name: 'rrrn_e_end_run', parameters: {
'notificationCount': futures.length,
});

try {
// NOTE: 本来であれば各ユースケース毎に通知を登録するが、99%のケースで同じ通知を登録するのでここで登録してしまう
final newPillSheetNotification = NewPillSheetNotification();
await newPillSheetNotification.call(pillSheetGroup: pillSheetGroup, setting: setting);
} catch (e, st) {
// 通知の登録に失敗しても、服用記録には影響がないのでエラーログだけ残す
errorLogger.recordError(e, st);
}
}

// reminder time id is 10{groupIndex:2}{hour:2}{minute:2}{pillNumberInPillSheet:2}
Expand Down

0 comments on commit ed0e790

Please sign in to comment.