i8n과 광고 수정
This commit is contained in:
@@ -2,6 +2,8 @@ import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:permission_handler/permission_handler.dart' as permission;
|
||||
import '../utils/platform_helper.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../navigator_key.dart';
|
||||
|
||||
class SMSService {
|
||||
static const platform = MethodChannel('com.submanager/sms');
|
||||
@@ -37,14 +39,24 @@ class SMSService {
|
||||
|
||||
try {
|
||||
if (!await hasSMSPermission()) {
|
||||
throw Exception('SMS 권한이 없습니다.');
|
||||
final loc = _loc();
|
||||
throw Exception(
|
||||
loc?.smsPermissionRequired ?? 'SMS permission required.');
|
||||
}
|
||||
|
||||
final List<dynamic> result =
|
||||
await platform.invokeMethod('scanSubscriptions');
|
||||
return result.map((item) => item as Map<String, dynamic>).toList();
|
||||
} on PlatformException catch (e) {
|
||||
throw Exception('SMS 스캔 중 오류 발생: ${e.message}');
|
||||
final loc = _loc();
|
||||
throw Exception(loc?.smsScanErrorWithMessage(e.message ?? '') ??
|
||||
'Error occurred during SMS scan: ${e.message}');
|
||||
}
|
||||
}
|
||||
|
||||
static AppLocalizations? _loc() {
|
||||
final ctx = navigatorKey.currentContext;
|
||||
if (ctx == null) return null;
|
||||
return AppLocalizations.of(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user