feat: 알림 재예약 개선과 패키지 업그레이드

This commit is contained in:
JiWoong Sul
2025-09-19 18:10:47 +09:00
parent e909ba59a4
commit 87f82546a4
24 changed files with 210 additions and 122 deletions

View File

@@ -103,6 +103,14 @@ class SubscriptionProvider extends ChangeNotifier {
}
}
Future<void> _reschedulePaymentNotifications() async {
try {
await NotificationService.reschedulAllNotifications(_subscriptions);
} catch (e) {
debugPrint('결제 알림 재예약 중 오류 발생: $e');
}
}
Future<void> addSubscription({
required String serviceName,
required double monthlyCost,
@@ -145,6 +153,8 @@ class SubscriptionProvider extends ChangeNotifier {
if (isEventActive && eventEndDate != null) {
await _scheduleEventEndNotification(subscription);
}
await _reschedulePaymentNotifications();
} catch (e) {
debugPrint('구독 추가 중 오류 발생: $e');
rethrow;
@@ -176,6 +186,8 @@ class SubscriptionProvider extends ChangeNotifier {
debugPrint('[SubscriptionProvider] 구독 업데이트 완료, '
'현재 총 월간 지출: ${totalMonthlyExpense.toStringAsFixed(2)}');
notifyListeners();
await _reschedulePaymentNotifications();
} catch (e) {
debugPrint('구독 업데이트 중 오류 발생: $e');
rethrow;
@@ -186,6 +198,8 @@ class SubscriptionProvider extends ChangeNotifier {
try {
await _subscriptionBox.delete(id);
await refreshSubscriptions();
await _reschedulePaymentNotifications();
} catch (e) {
debugPrint('구독 삭제 중 오류 발생: $e');
rethrow;
@@ -213,6 +227,8 @@ class SubscriptionProvider extends ChangeNotifier {
} finally {
_isLoading = false;
notifyListeners();
await _reschedulePaymentNotifications();
}
}
@@ -226,6 +242,7 @@ class SubscriptionProvider extends ChangeNotifier {
title: '이벤트 종료 알림',
body: '${subscription.serviceName}의 할인 이벤트가 종료되었습니다.',
scheduledDate: subscription.eventEndDate!,
channelId: NotificationService.expirationChannelId,
);
}
}