feat(settings): SMS 읽기 권한 상태/요청 위젯 추가 (Android)
- 설정 화면에 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 권한 온보딩/설정 문구 현지화 키 추가
This commit is contained in:
27
lib/utils/logger.dart
Normal file
27
lib/utils/logger.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
/// 단순 로거 헬퍼
|
||||
/// - 디버그/프로파일 모드에서만 상세 로그 출력
|
||||
/// - 릴리스 모드에서는 중요한 경고/에러만 축약 출력
|
||||
class Log {
|
||||
static bool get _verbose => !kReleaseMode;
|
||||
|
||||
static void d(String message) {
|
||||
if (_verbose) debugPrint(message);
|
||||
}
|
||||
|
||||
static void i(String message) {
|
||||
if (_verbose) debugPrint('ℹ️ $message');
|
||||
}
|
||||
|
||||
static void w(String message) {
|
||||
// 경고는 릴리스에서도 간단히 남김
|
||||
debugPrint('⚠️ $message');
|
||||
}
|
||||
|
||||
static void e(String message, [Object? error, StackTrace? stack]) {
|
||||
final suffix = error != null ? ' | $error' : '';
|
||||
debugPrint('❌ $message$suffix');
|
||||
if (_verbose && stack != null) debugPrint(stack.toString());
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'logger.dart';
|
||||
import 'dart:async';
|
||||
|
||||
/// 메모리 관리를 위한 헬퍼 클래스
|
||||
@@ -57,7 +58,7 @@ class MemoryManager {
|
||||
void clearCache() {
|
||||
_cache.clear();
|
||||
if (kDebugMode) {
|
||||
print('🧹 메모리 캐시가 비워졌습니다.');
|
||||
Log.d('🧹 메모리 캐시가 비워졌습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +123,7 @@ class MemoryManager {
|
||||
PaintingBinding.instance.imageCache.clear();
|
||||
PaintingBinding.instance.imageCache.clearLiveImages();
|
||||
if (kDebugMode) {
|
||||
print('🖼️ 이미지 캐시가 비워졌습니다.');
|
||||
Log.d('🖼️ 이미지 캐시가 비워졌습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +156,7 @@ class MemoryManager {
|
||||
imageCache.maximumSizeBytes = maxImageCacheSize ~/ 2;
|
||||
|
||||
if (kDebugMode) {
|
||||
print('⚠️ 메모리 압박 대응: 캐시 크기 감소');
|
||||
Log.w('메모리 압박 대응: 캐시 크기 감소');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'logger.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'dart:async';
|
||||
@@ -141,12 +142,12 @@ class PerformanceOptimizer {
|
||||
/// 빌드 최적화를 위한 const 위젯 권장사항 체크
|
||||
static void checkConstOptimization() {
|
||||
if (kDebugMode) {
|
||||
print('💡 성능 최적화 팁:');
|
||||
print('1. 가능한 모든 위젯에 const 사용');
|
||||
print('2. StatelessWidget 대신 const 생성자 사용');
|
||||
print('3. 큰 리스트는 ListView.builder 사용');
|
||||
print('4. 이미지는 캐싱과 함께 적절한 크기로 로드');
|
||||
print('5. 애니메이션은 AnimatedBuilder 사용');
|
||||
Log.i('💡 성능 최적화 팁:\n'
|
||||
'1. 가능한 모든 위젯에 const 사용\n'
|
||||
'2. StatelessWidget 대신 const 생성자 사용\n'
|
||||
'3. 큰 리스트는 ListView.builder 사용\n'
|
||||
'4. 이미지는 캐싱과 함께 적절한 크기로 로드\n'
|
||||
'5. 애니메이션은 AnimatedBuilder 사용');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +162,7 @@ class PerformanceOptimizer {
|
||||
|
||||
// 위젯이 비정상적으로 많이 생성되면 경고
|
||||
if ((_widgetCounts[widgetName] ?? 0) > 100) {
|
||||
print('⚠️ 경고: $widgetName 위젯이 100개 이상 생성됨. 메모리 누수 가능성!');
|
||||
Log.w('경고: $widgetName 위젯이 100개 이상 생성됨. 메모리 누수 가능성!');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,11 +197,11 @@ class PerformanceMeasure {
|
||||
try {
|
||||
final result = await operation();
|
||||
stopwatch.stop();
|
||||
print('✅ $name 완료: ${stopwatch.elapsedMilliseconds}ms');
|
||||
Log.d('✅ $name 완료: ${stopwatch.elapsedMilliseconds}ms');
|
||||
return result;
|
||||
} catch (e) {
|
||||
stopwatch.stop();
|
||||
print('❌ $name 실패: ${stopwatch.elapsedMilliseconds}ms - $e');
|
||||
Log.e('❌ $name 실패: ${stopwatch.elapsedMilliseconds}ms', e);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../models/subscription_model.dart';
|
||||
import '../providers/category_provider.dart';
|
||||
import '../services/subscription_url_matcher.dart';
|
||||
import '../services/url_matcher/data/legacy_service_data.dart';
|
||||
|
||||
/// 구독 서비스를 카테고리별로 구분하는 도우미 클래스
|
||||
|
||||
Reference in New Issue
Block a user