feat(ads): 네이티브 광고 적용 및 디버그 스위치 이동
This commit is contained in:
@@ -5,6 +5,8 @@ import 'package:adaptive_theme/adaptive_theme.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import '../../../core/constants/app_colors.dart';
|
||||
import '../../../core/constants/app_typography.dart';
|
||||
import '../../providers/debug_share_preview_provider.dart';
|
||||
import '../../providers/debug_test_data_provider.dart';
|
||||
import '../../providers/settings_provider.dart';
|
||||
import '../../providers/notification_provider.dart';
|
||||
|
||||
@@ -24,6 +26,11 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadSettings();
|
||||
if (kDebugMode) {
|
||||
Future.microtask(
|
||||
() => ref.read(debugTestDataNotifierProvider.notifier).initialize(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _loadSettings() async {
|
||||
@@ -343,6 +350,7 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (kDebugMode) _buildDebugToolsCard(isDark),
|
||||
], isDark),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
@@ -444,6 +452,81 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildDebugToolsCard(bool isDark) {
|
||||
final sharePreviewEnabled = ref.watch(debugSharePreviewProvider);
|
||||
final testDataState = ref.watch(debugTestDataNotifierProvider);
|
||||
final testDataNotifier = ref.read(debugTestDataNotifierProvider.notifier);
|
||||
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
color: isDark ? AppColors.darkSurface : AppColors.lightSurface,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
child: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(
|
||||
Icons.wifi_tethering,
|
||||
color: AppColors.lightPrimary,
|
||||
),
|
||||
title: const Text('공유 테스트 모드'),
|
||||
subtitle: const Text('광고·권한 없이 디버그 샘플 코드/기기를 표시'),
|
||||
trailing: Switch.adaptive(
|
||||
value: sharePreviewEnabled,
|
||||
onChanged: (value) {
|
||||
ref.read(debugSharePreviewProvider.notifier).state = value;
|
||||
},
|
||||
activeColor: AppColors.lightPrimary,
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: const Icon(
|
||||
Icons.science_outlined,
|
||||
color: AppColors.lightPrimary,
|
||||
),
|
||||
title: const Text('기록/통계 테스트 데이터'),
|
||||
subtitle: Text(
|
||||
testDataState.isEnabled
|
||||
? '테스트 데이터가 적용되었습니다 (디버그 전용)'
|
||||
: '디버그 빌드에서만 사용 가능합니다.',
|
||||
),
|
||||
trailing: testDataState.isProcessing
|
||||
? const SizedBox(
|
||||
width: 22,
|
||||
height: 22,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: Switch.adaptive(
|
||||
value: testDataState.isEnabled,
|
||||
onChanged: (value) async {
|
||||
if (value) {
|
||||
await testDataNotifier.enableTestData();
|
||||
} else {
|
||||
await testDataNotifier.disableTestData();
|
||||
}
|
||||
},
|
||||
activeColor: AppColors.lightPrimary,
|
||||
),
|
||||
),
|
||||
if (testDataState.errorMessage != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 12),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
testDataState.errorMessage!,
|
||||
style: AppTypography.caption(isDark).copyWith(
|
||||
color: AppColors.lightError,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showPermissionDialog(String permissionName) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user