- 설정 화면에 SMS 권한 카드 추가: 상태 표시(허용/미허용/영구 거부), 권한 요청/설정 이동 지원\n- 기존 알림 권한 카드 스타일과 일관성 유지 feat(permissions): 최초 실행 시 SMS 권한 온보딩 화면 추가 및 Splash에서 라우팅 (Android) - 권한 필요 이유/수집 범위 현지화 문구 추가\n- 거부/영구거부 케이스 처리 및 설정 이동 chore(codex): AGENTS.md/체크 스크립트/CI/프롬프트 템플릿 추가 - AGENTS.md, scripts/check.sh, scripts/fix.sh, .github/workflows/flutter_ci.yml, .claude/agents/codex.md, 문서 템플릿 추가 refactor(logging): 경로별 print 제거 후 경량 로거(Log) 도입 - SMS 스캐너/컨트롤러, URL 매처, 데이터 리포지토리, 내비게이션, 메모리/성능 유틸 등 핵심 경로 치환 feat(exchange): 환율 API URL을 --dart-define로 오버라이드 가능 + 폴백 로깅 강화 test: URL 매처/환율 스모크 테스트 추가 chore(android): RECEIVE_SMS 권한 제거 (READ_SMS만 유지) fix(lints): dart fix + 수동 정리로 경고 대폭 감소, 비동기 context(mounted) 보강 fix(deprecations):\n- flutter_local_notifications의 androidAllowWhileIdle → androidScheduleMode 전환\n- WillPopScope → PopScope 교체 i18n: SMS 권한 온보딩/설정 문구 현지화 키 추가
85 lines
2.4 KiB
Dart
85 lines
2.4 KiB
Dart
import '../../models/subscription.dart';
|
|
import '../../models/subscription_model.dart';
|
|
|
|
class SubscriptionConverter {
|
|
// SubscriptionModel 리스트를 Subscription 리스트로 변환
|
|
List<Subscription> convertModelsToSubscriptions(
|
|
List<SubscriptionModel> models) {
|
|
final result = <Subscription>[];
|
|
|
|
for (var model in models) {
|
|
try {
|
|
final subscription = _convertSingle(model);
|
|
result.add(subscription);
|
|
|
|
// 개발 편의를 위한 디버그 로그
|
|
// ignore: avoid_print
|
|
print(
|
|
'모델 변환 성공: ${model.serviceName}, 카테고리ID: ${model.categoryId}, URL: ${model.websiteUrl}, 통화: ${model.currency}');
|
|
} catch (e) {
|
|
// ignore: avoid_print
|
|
print('모델 변환 중 오류 발생: $e');
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
// 단일 모델 변환
|
|
Subscription _convertSingle(SubscriptionModel model) {
|
|
return Subscription(
|
|
id: model.id,
|
|
serviceName: model.serviceName,
|
|
monthlyCost: model.monthlyCost,
|
|
billingCycle: _denormalizeBillingCycle(model.billingCycle), // 영어 -> 한국어
|
|
nextBillingDate: model.nextBillingDate,
|
|
category: model.categoryId, // categoryId를 category로 매핑
|
|
repeatCount: model.repeatCount > 0 ? model.repeatCount : 1,
|
|
lastPaymentDate: model.lastPaymentDate,
|
|
websiteUrl: model.websiteUrl,
|
|
currency: model.currency,
|
|
);
|
|
}
|
|
|
|
// billingCycle 역정규화 (영어 -> 한국어)
|
|
String _denormalizeBillingCycle(String cycle) {
|
|
switch (cycle.toLowerCase()) {
|
|
case 'monthly':
|
|
return '월간';
|
|
case 'yearly':
|
|
case 'annually':
|
|
return '연간';
|
|
case 'weekly':
|
|
return '주간';
|
|
case 'daily':
|
|
return '일간';
|
|
case 'quarterly':
|
|
return '분기별';
|
|
case 'semi-annually':
|
|
return '반기별';
|
|
default:
|
|
return cycle; // 알 수 없는 형식은 그대로 반환
|
|
}
|
|
}
|
|
|
|
// billingCycle 정규화 (한국어 -> 영어)
|
|
String normalizeBillingCycle(String cycle) {
|
|
switch (cycle) {
|
|
case '월간':
|
|
return 'monthly';
|
|
case '연간':
|
|
return 'yearly';
|
|
case '주간':
|
|
return 'weekly';
|
|
case '일간':
|
|
return 'daily';
|
|
case '분기별':
|
|
return 'quarterly';
|
|
case '반기별':
|
|
return 'semi-annually';
|
|
default:
|
|
return 'monthly'; // 기본값
|
|
}
|
|
}
|
|
}
|