Refactor screens to MVC architecture with modular widgets
- Extract business logic from screens into dedicated controllers - Split large screen files into smaller, reusable widget components - Add controllers for AddSubscriptionScreen and DetailScreen - Create modular widgets for subscription and detail features - Improve code organization and maintainability - Remove duplicated code and improve reusability 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import '../services/notification_service.dart';
|
||||
|
||||
@@ -4,9 +4,6 @@ import 'package:hive/hive.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import '../models/subscription_model.dart';
|
||||
import '../services/notification_service.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'notification_provider.dart';
|
||||
import '../navigator_key.dart';
|
||||
|
||||
class SubscriptionProvider extends ChangeNotifier {
|
||||
late Box<SubscriptionModel> _subscriptionBox;
|
||||
@@ -156,35 +153,6 @@ class SubscriptionProvider extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _scheduleNotifications() async {
|
||||
final BuildContext? context = navigatorKey.currentContext;
|
||||
if (context == null) return;
|
||||
|
||||
final notificationProvider = Provider.of<NotificationProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
|
||||
if (!notificationProvider.isEnabled ||
|
||||
!notificationProvider.isPaymentEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (final subscription in _subscriptions) {
|
||||
final notificationDate = subscription.nextBillingDate.subtract(
|
||||
const Duration(days: 3),
|
||||
);
|
||||
|
||||
if (notificationDate.isAfter(DateTime.now())) {
|
||||
await NotificationService.scheduleNotification(
|
||||
id: subscription.id.hashCode,
|
||||
title: '구독 결제 예정 알림',
|
||||
body: '${subscription.serviceName}의 결제가 3일 후 예정되어 있습니다.',
|
||||
scheduledDate: notificationDate,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> clearAllSubscriptions() async {
|
||||
_isLoading = true;
|
||||
|
||||
Reference in New Issue
Block a user