fix:第一轮跑

This commit is contained in:
jingyun committed 2026-08-24 19:07:31 +08:00
1 parent e834ec7586
commit 33235f450b
56 files changed
+4357 -210

No files matched your search

@@ -0,0 +1,38 @@
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 '../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 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');
}
}
@@ -185,6 +185,12 @@ class DeviceHeaderService {
await StorageService.to.setBool(storagePrivacyAgreed, true);
}
/// ATT 授权后写入 IDFA;后续请求通过 platformIdentityHeaders 自动带上。
Future<void> saveIosIdfa(String value) async {
if (value.trim().isEmpty) return;
await StorageService.to.setString(storageIosIdfa, value.trim());
}
/// 是否需要首启隐私合规确认。**仅 Android**(合规要求:同意前不得采集设备
/// 标识)。由 go_router redirect 调用,未同意则强制跳隐私页。
bool get privacyConsentRequired => requiresAndroidPrivacyConsent(