- 同步商城 H5 登录态与原生 token - 完善商城/原生 tab 切换、动画及返回交互 - 修复七鱼客服键盘避让和状态栏恢复 - 调整开屏跳过按钮与登录入口交互
41 lines
1.5 KiB
Dart
41 lines
1.5 KiB
Dart
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<void> clear() async {
|
|
await DefaultCacheManager().emptyCache();
|
|
await MallWebHostController.instance.clear();
|
|
await SplashAdControllerPlaceholder.clear();
|
|
}
|
|
|
|
static bool get requiresSystemSettings => !kIsWeb && Platform.isAndroid;
|
|
|
|
static Future<void> 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<void> clear() async {
|
|
await StorageService.to.preferences.remove('ads.splash.entry');
|
|
await StorageService.to.preferences.remove('ads.splash.daily');
|
|
}
|
|
}
|