feat: 다국어 지원 및 다중 통화 환율 변환 기능 확대
- ExchangeRateService에 JPY, CNY 환율 지원 추가 - 구독 서비스별 다국어 표시 이름 지원 - 분석 화면 차트 및 UI/UX 개선 - 설정 화면 전면 리팩토링 - SMS 스캔 기능 사용성 개선 - 전체 앱 다국어 번역 확대 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,10 +2,12 @@ import 'package:flutter/material.dart';
|
||||
import '../services/sms_scanner.dart';
|
||||
import '../providers/subscription_provider.dart';
|
||||
import '../providers/navigation_provider.dart';
|
||||
import '../providers/locale_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../models/subscription.dart';
|
||||
import '../models/subscription_model.dart';
|
||||
import '../services/subscription_url_matcher.dart';
|
||||
import '../services/currency_util.dart';
|
||||
import 'package:intl/intl.dart'; // NumberFormat을 사용하기 위한 import 추가
|
||||
import '../widgets/glassmorphism_card.dart';
|
||||
import '../widgets/themed_text.dart';
|
||||
@@ -18,6 +20,7 @@ import '../providers/category_provider.dart';
|
||||
import '../models/category_model.dart';
|
||||
import '../widgets/common/form_fields/category_selector.dart';
|
||||
import '../widgets/native_ad_widget.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
|
||||
class SmsScanScreen extends StatefulWidget {
|
||||
const SmsScanScreen({super.key});
|
||||
@@ -75,7 +78,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
if (scannedSubscriptionModels.isEmpty) {
|
||||
print('스캔된 구독이 없음');
|
||||
setState(() {
|
||||
_errorMessage = '구독 정보를 찾을 수 없습니다.';
|
||||
_errorMessage = AppLocalizations.of(context).subscriptionNotFound;
|
||||
_isLoading = false;
|
||||
});
|
||||
return;
|
||||
@@ -98,7 +101,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
if (repeatSubscriptions.isEmpty) {
|
||||
print('반복 결제된 구독이 없음');
|
||||
setState(() {
|
||||
_errorMessage = '반복 결제된 구독 정보를 찾을 수 없습니다.';
|
||||
_errorMessage = AppLocalizations.of(context).repeatSubscriptionNotFound;
|
||||
_isLoading = false;
|
||||
});
|
||||
return;
|
||||
@@ -131,7 +134,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
if (mounted) {
|
||||
AppSnackBar.showInfo(
|
||||
context: context,
|
||||
message: '신규 구독 관련 SMS를 찾을 수 없습니다',
|
||||
message: AppLocalizations.of(context).newSubscriptionNotFound,
|
||||
icon: Icons.search_off_rounded,
|
||||
);
|
||||
}
|
||||
@@ -148,7 +151,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
print('SMS 스캔 중 오류 발생: $e');
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_errorMessage = 'SMS 스캔 중 오류가 발생했습니다: $e';
|
||||
_errorMessage = AppLocalizations.of(context).smsScanErrorWithMessage(e.toString());
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
@@ -389,7 +392,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
if (mounted) {
|
||||
AppSnackBar.showSuccess(
|
||||
context: context,
|
||||
message: '${subscription.serviceName} 구독이 추가되었습니다.',
|
||||
message: AppLocalizations.of(context).subscriptionAddedWithName(subscription.serviceName),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -400,7 +403,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
if (mounted) {
|
||||
AppSnackBar.showError(
|
||||
context: context,
|
||||
message: '구독 추가 중 오류가 발생했습니다: $e',
|
||||
message: AppLocalizations.of(context).subscriptionAddErrorWithMessage(e.toString()),
|
||||
);
|
||||
|
||||
// 오류가 있어도 다음 구독으로 이동
|
||||
@@ -416,7 +419,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
if (mounted) {
|
||||
AppSnackBar.showInfo(
|
||||
context: context,
|
||||
message: '${subscription.serviceName} 구독을 건너뛰었습니다.',
|
||||
message: AppLocalizations.of(context).subscriptionSkipped(subscription.serviceName),
|
||||
icon: Icons.skip_next_rounded,
|
||||
);
|
||||
}
|
||||
@@ -447,7 +450,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
// 완료 메시지 표시
|
||||
AppSnackBar.showSuccess(
|
||||
context: context,
|
||||
message: '모든 구독이 처리되었습니다.',
|
||||
message: AppLocalizations.of(context).allSubscriptionsProcessed,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -482,7 +485,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
}
|
||||
|
||||
final daysUntil = adjusted.difference(now).inDays;
|
||||
return '다음 예상 결제일: ${_formatDate(adjusted)} ($daysUntil일 후)';
|
||||
return AppLocalizations.of(context).nextBillingDateEstimated(AppLocalizations.of(context).formatDate(adjusted), daysUntil);
|
||||
} else if (subscription.billingCycle == '연간') {
|
||||
// 올해 또는 내년 같은 날짜
|
||||
int day = date.day;
|
||||
@@ -503,14 +506,14 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
}
|
||||
|
||||
final daysUntil = adjusted.difference(now).inDays;
|
||||
return '다음 예상 결제일: ${_formatDate(adjusted)} ($daysUntil일 후)';
|
||||
return AppLocalizations.of(context).nextBillingDateEstimated(AppLocalizations.of(context).formatDate(adjusted), daysUntil);
|
||||
} else {
|
||||
return '다음 결제일 확인 필요 (과거 날짜)';
|
||||
}
|
||||
} else {
|
||||
// 미래 날짜인 경우
|
||||
final daysUntil = date.difference(now).inDays;
|
||||
return '다음 결제일: ${_formatDate(date)} ($daysUntil일 후)';
|
||||
return AppLocalizations.of(context).nextBillingDateInfo(AppLocalizations.of(context).formatDate(date), daysUntil);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,7 +524,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
|
||||
// 결제 반복 횟수 텍스트
|
||||
String _getRepeatCountText(int count) {
|
||||
return '$count회 결제 감지됨';
|
||||
return AppLocalizations.of(context).repeatCountDetected(count);
|
||||
}
|
||||
|
||||
// 카테고리 칩 빌드
|
||||
@@ -532,7 +535,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
|
||||
// 카테고리가 없으면 기타 카테고리 찾기
|
||||
final defaultCategory = category ?? categoryProvider.categories.firstWhere(
|
||||
(cat) => cat.name == '기타',
|
||||
(cat) => cat.name == 'other',
|
||||
orElse: () => categoryProvider.categories.first,
|
||||
);
|
||||
|
||||
@@ -553,7 +556,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
ThemedText(
|
||||
defaultCategory.name,
|
||||
categoryProvider.getLocalizedCategoryName(context, defaultCategory.name),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
forceDark: true,
|
||||
@@ -567,25 +570,25 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
// 카테고리 아이콘 반환
|
||||
IconData _getCategoryIcon(CategoryModel category) {
|
||||
switch (category.name) {
|
||||
case '음악':
|
||||
case 'music':
|
||||
return Icons.music_note_rounded;
|
||||
case 'OTT(동영상)':
|
||||
case 'ottVideo':
|
||||
return Icons.movie_filter_rounded;
|
||||
case '저장/클라우드':
|
||||
case 'storageCloud':
|
||||
return Icons.cloud_outlined;
|
||||
case '통신 · 인터넷 · TV':
|
||||
case 'telecomInternetTv':
|
||||
return Icons.wifi_rounded;
|
||||
case '생활/라이프스타일':
|
||||
case 'lifestyle':
|
||||
return Icons.home_outlined;
|
||||
case '쇼핑/이커머스':
|
||||
case 'shoppingEcommerce':
|
||||
return Icons.shopping_cart_outlined;
|
||||
case '프로그래밍':
|
||||
case 'programming':
|
||||
return Icons.code_rounded;
|
||||
case '협업/오피스':
|
||||
case 'collaborationOffice':
|
||||
return Icons.business_center_outlined;
|
||||
case 'AI 서비스':
|
||||
case 'aiService':
|
||||
return Icons.smart_toy_outlined;
|
||||
case '기타':
|
||||
case 'other':
|
||||
default:
|
||||
return Icons.category_outlined;
|
||||
}
|
||||
@@ -595,7 +598,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
String _getDefaultCategoryId() {
|
||||
final categoryProvider = Provider.of<CategoryProvider>(context, listen: false);
|
||||
final otherCategory = categoryProvider.categories.firstWhere(
|
||||
(cat) => cat.name == '기타',
|
||||
(cat) => cat.name == 'other',
|
||||
orElse: () => categoryProvider.categories.first, // 만약 "기타"가 없으면 첫 번째 카테고리
|
||||
);
|
||||
print('기본 카테고리 설정: ${otherCategory.name} (ID: ${otherCategory.id})');
|
||||
@@ -638,9 +641,9 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
valueColor: AlwaysStoppedAnimation<Color>(AppColors.primaryColor),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const ThemedText('SMS 메시지를 스캔 중입니다...', forceDark: true),
|
||||
ThemedText(AppLocalizations.of(context).scanningMessages, forceDark: true),
|
||||
const SizedBox(height: 8),
|
||||
const ThemedText('구독 서비스를 찾고 있습니다', opacity: 0.7, forceDark: true),
|
||||
ThemedText(AppLocalizations.of(context).findingSubscriptions, opacity: 0.7, forceDark: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -668,17 +671,17 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
const ThemedText(
|
||||
'2회 이상 결제된 구독 서비스 찾기',
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).findRepeatSubscriptions,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
forceDark: true,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.0),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: ThemedText(
|
||||
'문자 메시지를 스캔하여 반복적으로 결제된 구독 서비스를 자동으로 찾습니다. 서비스명과 금액을 추출하여 쉽게 구독을 추가할 수 있습니다.',
|
||||
AppLocalizations.of(context).scanTextMessages,
|
||||
textAlign: TextAlign.center,
|
||||
opacity: 0.7,
|
||||
forceDark: true,
|
||||
@@ -686,7 +689,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
PrimaryButton(
|
||||
text: '스캔 시작하기',
|
||||
text: AppLocalizations.of(context).startScanning,
|
||||
icon: Icons.search_rounded,
|
||||
onPressed: _scanSms,
|
||||
width: 200,
|
||||
@@ -751,16 +754,16 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const ThemedText(
|
||||
'다음 구독을 찾았습니다',
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).foundSubscription,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
forceDark: true,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
// 서비스명
|
||||
const ThemedText(
|
||||
'서비스명',
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).serviceName,
|
||||
fontWeight: FontWeight.w500,
|
||||
opacity: 0.7,
|
||||
forceDark: true,
|
||||
@@ -781,28 +784,28 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const ThemedText(
|
||||
'월 비용',
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).monthlyCost,
|
||||
fontWeight: FontWeight.w500,
|
||||
opacity: 0.7,
|
||||
forceDark: true,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
ThemedText(
|
||||
subscription.currency == 'USD'
|
||||
? NumberFormat.currency(
|
||||
locale: 'en_US',
|
||||
symbol: '\$',
|
||||
decimalDigits: 2,
|
||||
).format(subscription.monthlyCost)
|
||||
: NumberFormat.currency(
|
||||
locale: 'ko_KR',
|
||||
symbol: '₩',
|
||||
decimalDigits: 0,
|
||||
).format(subscription.monthlyCost),
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
forceDark: true,
|
||||
// 언어별 통화 표시
|
||||
FutureBuilder<String>(
|
||||
future: CurrencyUtil.formatAmountWithLocale(
|
||||
subscription.monthlyCost,
|
||||
subscription.currency,
|
||||
context.read<LocaleProvider>().locale.languageCode,
|
||||
),
|
||||
builder: (context, snapshot) {
|
||||
return ThemedText(
|
||||
snapshot.data ?? '-',
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
forceDark: true,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -811,8 +814,8 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const ThemedText(
|
||||
'결제 주기',
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).billingCycle,
|
||||
fontWeight: FontWeight.w500,
|
||||
opacity: 0.7,
|
||||
forceDark: true,
|
||||
@@ -832,8 +835,8 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 다음 결제일
|
||||
const ThemedText(
|
||||
'다음 결제일',
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).nextBillingDateLabel,
|
||||
fontWeight: FontWeight.w500,
|
||||
opacity: 0.7,
|
||||
forceDark: true,
|
||||
@@ -848,8 +851,8 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 카테고리 선택
|
||||
const ThemedText(
|
||||
'카테고리',
|
||||
ThemedText(
|
||||
AppLocalizations.of(context).category,
|
||||
fontWeight: FontWeight.w500,
|
||||
opacity: 0.7,
|
||||
forceDark: true,
|
||||
@@ -877,8 +880,8 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
// 웹사이트 URL 입력 필드 추가/수정
|
||||
BaseTextField(
|
||||
controller: _websiteUrlController,
|
||||
label: '웹사이트 URL (자동 추출됨)',
|
||||
hintText: '웹사이트 URL을 수정하거나 비워두세요',
|
||||
label: AppLocalizations.of(context).websiteUrlAuto,
|
||||
hintText: AppLocalizations.of(context).websiteUrlHint,
|
||||
prefixIcon: Icon(
|
||||
Icons.language,
|
||||
color: AppColors.navyGray,
|
||||
@@ -895,7 +898,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: SecondaryButton(
|
||||
text: '건너뛰기',
|
||||
text: AppLocalizations.of(context).skip,
|
||||
onPressed: _skipCurrentSubscription,
|
||||
height: 48,
|
||||
),
|
||||
@@ -903,7 +906,7 @@ class _SmsScanScreenState extends State<SmsScanScreen> {
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: PrimaryButton(
|
||||
text: '추가하기',
|
||||
text: AppLocalizations.of(context).add,
|
||||
onPressed: _addCurrentSubscription,
|
||||
height: 48,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user