refactor: 拆分主页与公共组件,扫码登录改走 WinHTTP
- 抽出 lib/core 的日期/JSON 工具,收敛各页重复解析 - 主页与音乐风险页拆成组件,风险功能共用一套运行框架 - 修复设置页作为主页页签保存时弹掉根路由导致的黑屏 - 登录对齐 Astral aimedb 协议:84 位二维码校验、签名与请求头修正, 补 GlobalSign 中间证书;Windows 改用 WinHTTP 绕过服务端对 BoringSSL 的 TLS 指纹拦截(证书校验保持开启) - 补开发预览数据与测试
This commit is contained in:
1 parent
0cb5320290
commit
e9357f5969
55 files changed
+4387
-3392
No files matched your search
+12
-32
@@ -1,3 +1,5 @@
|
||||
import '../core/json_value.dart';
|
||||
|
||||
/// GetUserRatingApi 的 `userRating` 结构,移植自 Empurple 的 `UserRatingData`。
|
||||
///
|
||||
/// 服务端已按 RA 排好 BEST 35 / BEST 15,客户端不再重排。
|
||||
@@ -43,21 +45,13 @@ class UserRatingItemBean {
|
||||
MusicLevel get musicLevel => MusicLevel.fromInt(level);
|
||||
|
||||
factory UserRatingItemBean.fromJson(Map<String, dynamic> json) {
|
||||
int toInt(dynamic v) {
|
||||
if (v == null) return 0;
|
||||
if (v is int) return v;
|
||||
if (v is num) return v.toInt();
|
||||
if (v is String) return int.tryParse(v) ?? 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return UserRatingItemBean(
|
||||
musicId: toInt(json['musicId']),
|
||||
level: toInt(json['level']),
|
||||
achievement: toInt(json['achievement']),
|
||||
comboStatus: toInt(json['comboStatus']),
|
||||
syncStatus: toInt(json['syncStatus']),
|
||||
romVersion: toInt(json['romVersion']),
|
||||
musicId: jsonInt(json['musicId']),
|
||||
level: jsonInt(json['level']),
|
||||
achievement: jsonInt(json['achievement']),
|
||||
comboStatus: jsonInt(json['comboStatus']),
|
||||
syncStatus: jsonInt(json['syncStatus']),
|
||||
romVersion: jsonInt(json['romVersion']),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -73,28 +67,14 @@ class UserRatingBean {
|
||||
required this.newRatingList,
|
||||
});
|
||||
|
||||
static List<UserRatingItemBean> _parseList(dynamic raw) {
|
||||
if (raw is! List) return const [];
|
||||
return raw
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(UserRatingItemBean.fromJson)
|
||||
.toList();
|
||||
}
|
||||
static List<UserRatingItemBean> _parseList(dynamic raw) =>
|
||||
jsonMapList(raw).map(UserRatingItemBean.fromJson).toList();
|
||||
|
||||
factory UserRatingBean.fromJson(Map<String, dynamic> json) {
|
||||
int toInt(dynamic v) {
|
||||
if (v == null) return 0;
|
||||
if (v is int) return v;
|
||||
if (v is num) return v.toInt();
|
||||
if (v is String) return int.tryParse(v) ?? 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
final userRating =
|
||||
(json['userRating'] as Map<String, dynamic>?) ?? const {};
|
||||
final userRating = jsonMap(json['userRating']);
|
||||
|
||||
return UserRatingBean(
|
||||
userId: toInt(json['userId']),
|
||||
userId: jsonInt(json['userId']),
|
||||
ratingList: _parseList(userRating['ratingList']),
|
||||
newRatingList: _parseList(userRating['newRatingList']),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user