i8n과 광고 수정
This commit is contained in:
@@ -10,6 +10,8 @@ import '../utils/platform_helper.dart';
|
||||
import '../utils/business_day_util.dart';
|
||||
import '../services/sms_scan/sms_scan_result.dart';
|
||||
import '../models/payment_card_suggestion.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../navigator_key.dart';
|
||||
|
||||
class SmsScanner {
|
||||
final SmsQuery _query = SmsQuery();
|
||||
@@ -82,7 +84,9 @@ class SmsScanner {
|
||||
return subscriptions;
|
||||
} catch (e) {
|
||||
Log.e('SmsScanner: 예외 발생', e);
|
||||
throw Exception('SMS 스캔 중 오류 발생: $e');
|
||||
final loc = _loc();
|
||||
throw Exception(loc?.smsScanErrorWithMessage(e.toString()) ??
|
||||
'Error occurred during SMS scan: $e');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +120,13 @@ class SmsScanner {
|
||||
|
||||
SmsScanResult? _parseSms(Map<String, dynamic> sms, int repeatCount) {
|
||||
try {
|
||||
final serviceName = sms['serviceName'] as String? ?? '알 수 없는 서비스';
|
||||
final loc = _loc();
|
||||
final unknownLabel = loc?.unknownService ?? 'Unknown service';
|
||||
final serviceNameRaw = sms['serviceName'] as String?;
|
||||
final serviceName =
|
||||
(serviceNameRaw == null || serviceNameRaw.trim().isEmpty)
|
||||
? unknownLabel
|
||||
: serviceNameRaw;
|
||||
final monthlyCost = (sms['monthlyCost'] as num?)?.toDouble() ?? 0.0;
|
||||
final billingCycle = SubscriptionModel.normalizeBillingCycle(
|
||||
sms['billingCycle'] as String? ?? 'monthly');
|
||||
@@ -196,8 +206,9 @@ class SmsScanner {
|
||||
if (issuer == null && last4 == null) {
|
||||
return null;
|
||||
}
|
||||
final loc = _loc();
|
||||
return PaymentCardSuggestion(
|
||||
issuerName: issuer ?? '결제수단',
|
||||
issuerName: issuer ?? loc?.paymentCard ?? 'Payment card',
|
||||
last4: last4,
|
||||
source: 'sms',
|
||||
);
|
||||
@@ -366,6 +377,12 @@ class SmsScanner {
|
||||
// 기본값은 원화
|
||||
return 'KRW';
|
||||
}
|
||||
|
||||
AppLocalizations? _loc() {
|
||||
final ctx = navigatorKey.currentContext;
|
||||
if (ctx == null) return null;
|
||||
return AppLocalizations.of(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
const List<String> _paymentLikeKeywords = [
|
||||
@@ -501,7 +518,7 @@ String _isoExtractServiceName(String body, String sender) {
|
||||
|
||||
String _isoExtractServiceNameFromSender(String sender) {
|
||||
if (RegExp(r'^\d+$').hasMatch(sender)) {
|
||||
return '알 수 없는 서비스';
|
||||
return _unknownServiceLabel();
|
||||
}
|
||||
return sender.replaceAll(RegExp(r'[^\w\s가-힣]'), '').trim();
|
||||
}
|
||||
@@ -576,13 +593,14 @@ Map<String, List<Map<String, dynamic>>> _groupMessagesByIdentifier(
|
||||
final address = (sms['address'] as String?)?.trim();
|
||||
final sender = (sms['sender'] as String?)?.trim();
|
||||
|
||||
final unknownLabel = _unknownServiceLabel();
|
||||
String key = (serviceName != null &&
|
||||
serviceName.isNotEmpty &&
|
||||
serviceName != '알 수 없는 서비스')
|
||||
serviceName != unknownLabel)
|
||||
? serviceName
|
||||
: (address?.isNotEmpty == true
|
||||
? address!
|
||||
: (sender?.isNotEmpty == true ? sender! : 'unknown'));
|
||||
: (sender?.isNotEmpty == true ? sender! : unknownLabel));
|
||||
|
||||
groups.putIfAbsent(key, () => []).add(sms);
|
||||
}
|
||||
@@ -602,6 +620,12 @@ class _RepeatDetectionResult {
|
||||
|
||||
enum _MatchType { none, monthly, yearly, identical }
|
||||
|
||||
String _unknownServiceLabel() {
|
||||
final ctx = navigatorKey.currentContext;
|
||||
if (ctx == null) return 'Unknown service';
|
||||
return AppLocalizations.of(ctx).unknownService;
|
||||
}
|
||||
|
||||
class _MatchedPair {
|
||||
_MatchedPair(this.first, this.second, this.type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user