Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-03-23 11:47:56 +08:00
parent 1724f0d202
commit 9578f948b4
20 changed files with 132 additions and 77 deletions

View File

@@ -2,6 +2,7 @@ import 'package:PiliPlus/models/model_owner.dart';
import 'package:PiliPlus/models_new/live/live_danmaku/live_emote.dart';
import 'package:PiliPlus/models_new/live/live_medal_wall/uinfo_medal.dart';
import 'package:PiliPlus/pages/danmaku/danmaku_model.dart';
import 'package:PiliPlus/utils/global_data.dart';
class DanmakuMsg {
final String name;
@@ -55,7 +56,9 @@ class DanmakuMsg {
ts: checkInfo['ts'],
ct: checkInfo['ct'],
),
medalInfo: medal == null ? null : UinfoMedal.fromJson(medal),
medalInfo: !GlobalData().showMedal || medal == null
? null
: UinfoMedal.fromJson(medal),
);
}
@@ -66,5 +69,6 @@ class DanmakuMsg {
'uemote': ?uemote?.toJson(),
'reply': ?reply?.toJson(),
'extra': extra.toJson(),
'medal': ?medalInfo?.toJson(),
};
}

View File

@@ -23,4 +23,13 @@ class UinfoMedal {
v2MedalColorStart: json['v2_medal_color_start'] as String?,
v2MedalColorText: json['v2_medal_color_text'] as String?,
);
Map<String, dynamic> toJson() => {
'name': name,
'level': level,
'id': id,
'ruid': ruid,
'v2_medal_color_start': v2MedalColorStart,
'v2_medal_color_text': v2MedalColorText,
};
}

View File

@@ -1,5 +1,6 @@
import 'package:PiliPlus/models_new/live/live_medal_wall/uinfo_medal.dart';
import 'package:PiliPlus/models_new/live/live_superchat/user_info.dart';
import 'package:PiliPlus/utils/global_data.dart';
import 'package:PiliPlus/utils/parse_string.dart';
import 'package:PiliPlus/utils/utils.dart';
@@ -50,6 +51,16 @@ class SuperChatItem {
},
'token': '',
'ts': 0,
'uinfo': {
'medal': {
"name": "MedalName",
"level": Utils.random.nextInt(40),
"id": 123,
"ruid": 456,
"v2_medal_color_start": "#4C7DFF99",
"v2_medal_color_text": "#FFFFFF",
},
},
});
factory SuperChatItem.fromJson(Map<String, dynamic> json) => SuperChatItem(
@@ -66,7 +77,7 @@ class SuperChatItem {
token: json['token'],
ts: Utils.safeToInt(json['ts'])!,
userInfo: UserInfo.fromJson(json['user_info'] as Map<String, dynamic>),
medalInfo: json['uinfo']?['medal'] == null
medalInfo: !GlobalData().showMedal || json['uinfo']?['medal'] == null
? null
: UinfoMedal.fromJson(json['uinfo']['medal']),
);
@@ -119,5 +130,6 @@ class SuperChatItem {
'token': token,
'ts': ts,
'user_info': userInfo.toJson(),
'medal': ?medalInfo?.toJson(),
};
}