feat: phase1 UI prep — 设备ID系统传递 + 国家本地化展示 + 继续观看直进播放页

设备标识: Android SSAID/ iOS IDFV 原生通道 → Dart DeviceIdProvider
国家解析: 注册/登录从后端 IP → 国家/语言/时区/币种 自动落库
账号资料: 全部本地化展示 (account_display.dart)
我的页: 继续观看卡片点击直接进播放页
This commit is contained in:
Vicky authored and trae-solo-agent committed 2026-10-27 15:45:20 +08:00
1 parent 1b19513efb
commit a3f3481f4f
15 files changed
+468 -25

No files matched your search

@@ -48,6 +48,7 @@ class AuthController extends ChangeNotifier {
email: email,
password: password,
deviceId: await _store.deviceId(),
countryCode: await _store.deviceRegion(),
platform: _platform,
osVersion: _osVersion,
);
@@ -95,6 +96,7 @@ class AuthController extends ChangeNotifier {
target: target,
code: code,
deviceId: await _store.deviceId(),
countryCode: await _store.deviceRegion(),
platform: _platform,
osVersion: _osVersion,
);
@@ -30,6 +30,7 @@ class AuthSessionStore {
static const _kDeviceId = 'device.id';
String? _cachedDeviceId;
String? _cachedRegion;
Future<String> deviceId() async {
if (_cachedDeviceId != null) return _cachedDeviceId!;
@@ -39,6 +40,14 @@ class AuthSessionStore {
return value;
}
/// 设备区域(ISO-2),取不到返回空串;只在注册时作为服务端 IP 解析失败后的兜底。
Future<String> deviceRegion() async {
if (_cachedRegion != null) return _cachedRegion!;
final value = await _deviceIdProvider.deviceRegion() ?? '';
_cachedRegion = value;
return value;
}
/// 系统标识取不到时的兜底:本地 UUIDv4,生成一次后固定下来。
Future<String> _localDeviceId() async {
final stored = await _preferences.getString(_kDeviceId) ?? '';
@@ -33,4 +33,18 @@ class DeviceIdProvider {
}
return null;
}
/// 设备所在区域(ISO-2),仅用于服务端 IP 解析失败时兜底注册国家。
/// Android 依次取网络运营商 / SIM 卡 / 系统语言的国家,iOS 取系统 region。
Future<String?> deviceRegion() async {
if (kIsWeb) return null;
try {
final region = await _channel.invokeMethod<String>('region');
final value = region?.trim().toUpperCase() ?? '';
if (value.length == 2) return value;
} catch (_) {
// 原生通道不可用(widget 测试)时返回 null,由服务端兜底
}
return null;
}
}