import 'dart:io' show Platform; import 'package:android_intent_plus/android_intent.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter/foundation.dart' show kIsWeb; import 'package:package_info_plus/package_info_plus.dart'; import '../../features/web/application/mall_web_host_controller.dart'; import '../storage/storage_service.dart'; /// Clears only disposable presentation data. Credentials and user preferences /// deliberately remain outside this service. class CacheClearService { const CacheClearService._(); static Future clear() async { await DefaultCacheManager().emptyCache(); await MallWebHostController.instance.clear(); await SplashAdControllerPlaceholder.clear(); } static bool get requiresSystemSettings => !kIsWeb && Platform.isAndroid; static Future openAndroidSystemSettings() async { final packageName = (await PackageInfo.fromPlatform()).packageName; await AndroidIntent( action: 'android.settings.APPLICATION_DETAILS_SETTINGS', data: 'package:$packageName', ).launch(); } } /// CacheClearService is used outside Riverpod; the splash entry itself lives /// in SharedPreferences and is removed here without touching user data. abstract final class SplashAdControllerPlaceholder { static Future clear() async { await StorageService.to.preferences.remove('ads.splash.entry'); await StorageService.to.preferences.remove('ads.splash.daily'); } }