启动图,签名更换
This commit is contained in:
@@ -82,7 +82,8 @@ class DeviceInfoService {
|
||||
/// note_this:不要修改这个值
|
||||
static const iosBundleId = "yinse_opera";
|
||||
static const naticeChannel = 'com.yinse/device'; //原生通道(设备/视频/编解码信息)
|
||||
static const requestChannel = 'com.yinse/request'; //原生系统桥(现只剩换启动图标 changeIcon)
|
||||
static const requestChannel =
|
||||
'com.yinse/request'; //原生系统桥(现只剩换启动图标 changeIcon)
|
||||
|
||||
/// 外部调用入口
|
||||
static Future<void> init() async {
|
||||
@@ -122,7 +123,9 @@ class DeviceInfoService {
|
||||
/// 拼装 UA。[deviceId] 可覆盖默认 deviceId
|
||||
static String genUserAgent({String? deviceId}) {
|
||||
final Map<String, String?> params = {
|
||||
"DevID": (deviceId == null || deviceId.isEmpty) ? DeviceInfoService.deviceId : deviceId,
|
||||
"DevID": (deviceId == null || deviceId.isEmpty)
|
||||
? DeviceInfoService.deviceId
|
||||
: deviceId,
|
||||
"DevType": DeviceInfoService.devType,
|
||||
"SysType": Platform.operatingSystem,
|
||||
"Ver": Config.innerVersion,
|
||||
@@ -133,7 +136,8 @@ class DeviceInfoService {
|
||||
'device_model': DeviceInfoService.model,
|
||||
};
|
||||
params.removeWhere((key, value) => value == null || value.isEmpty);
|
||||
final ua = Uri.encodeComponent(params.entries.map((e) => "${e.key}=${e.value}").join(";"));
|
||||
final ua = Uri.encodeComponent(
|
||||
params.entries.map((e) => "${e.key}=${e.value}").join(";"));
|
||||
return ua;
|
||||
}
|
||||
|
||||
@@ -147,12 +151,14 @@ class DeviceInfoService {
|
||||
return oldUa;
|
||||
}
|
||||
final newUa = genUserAgent(deviceId: deviceId);
|
||||
if (TextUtil.isNotEmpty(newUa)) lightKV.setString(StoreKeys.UA_CACHE, newUa);
|
||||
if (TextUtil.isNotEmpty(newUa))
|
||||
lightKV.setString(StoreKeys.UA_CACHE, newUa);
|
||||
return newUa;
|
||||
}
|
||||
|
||||
/// 清除 UA 缓存
|
||||
static Future clearCachedUserAgent() => lightKV.setString(StoreKeys.UA_CACHE, null);
|
||||
static Future clearCachedUserAgent() =>
|
||||
lightKV.setString(StoreKeys.UA_CACHE, null);
|
||||
|
||||
/// 从剪切板 json 里取推广 tid,取不到返回空串
|
||||
static Future<String> fetchTraceId() async {
|
||||
@@ -223,7 +229,8 @@ class DeviceInfoService {
|
||||
}
|
||||
|
||||
/// Android 回写 SP + 文件
|
||||
static Future<String> _persistAndroid(SharedPreferences prefs, String id) async {
|
||||
static Future<String> _persistAndroid(
|
||||
SharedPreferences prefs, String id) async {
|
||||
await prefs.setString(StoreKeys.DEVICE_ID, id);
|
||||
await _writeIdFile(id);
|
||||
return id;
|
||||
@@ -257,7 +264,7 @@ class DeviceInfoService {
|
||||
}
|
||||
if (_isInvalidId(raw)) raw = const Uuid().v4();
|
||||
// 业务规则:91jd_ 前缀,去空格,限制 50 字符(日志系统约束)
|
||||
return '91dj_${raw.replaceAll(' ', '')}'.limit(50);
|
||||
return 'hgmj_${raw.replaceAll(' ', '')}'.limit(50);
|
||||
}
|
||||
|
||||
/// 脏值检测:空 / 太短 / 全 0 / 已知脏值
|
||||
@@ -306,7 +313,9 @@ class DeviceInfoService {
|
||||
static Future<String> getChannel() async {
|
||||
if (!Platform.isAndroid) return "";
|
||||
try {
|
||||
return await const MethodChannel(naticeChannel).invokeMethod("getChannel") ?? "";
|
||||
return await const MethodChannel(naticeChannel)
|
||||
.invokeMethod("getChannel") ??
|
||||
"";
|
||||
} on PlatformException {
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user