주요 구현 완료 기능: - 구독 관리 (추가/편집/삭제/카테고리 분류) - 이벤트 할인 시스템 (기본값 자동 설정) - SMS 자동 스캔 및 구독 정보 추출 - 알림 시스템 (타임존 처리 안정화) - 환율 변환 지원 (KRW/USD) - 반응형 UI 및 애니메이션 - 다국어 지원 (한국어/영어) 버그 수정: - NotificationService tz.local 초기화 오류 해결 - MainScreenSummaryCard 레이아웃 오버플로우 수정 - 구독 추가 시 LateInitializationError 완전 해결 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
36 lines
1.1 KiB
Dart
36 lines
1.1 KiB
Dart
import 'package:flutter/foundation.dart' show kIsWeb;
|
|
import 'package:flutter/services.dart';
|
|
import 'package:permission_handler/permission_handler.dart' as permission;
|
|
|
|
class SMSService {
|
|
static const platform = MethodChannel('com.submanager/sms');
|
|
|
|
static Future<bool> requestSMSPermission() async {
|
|
if (kIsWeb) return false;
|
|
final status = await permission.Permission.sms.request();
|
|
return status.isGranted;
|
|
}
|
|
|
|
static Future<bool> hasSMSPermission() async {
|
|
if (kIsWeb) return false;
|
|
final status = await permission.Permission.sms.status;
|
|
return status.isGranted;
|
|
}
|
|
|
|
static Future<List<Map<String, dynamic>>> scanSubscriptions() async {
|
|
if (kIsWeb) return [];
|
|
|
|
try {
|
|
if (!await hasSMSPermission()) {
|
|
throw Exception('SMS 권한이 없습니다.');
|
|
}
|
|
|
|
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}');
|
|
}
|
|
}
|
|
}
|