mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-24 11:06:51 +08:00
tweaks (#1142)
* opt: unused layout * mod: semantics * opt: DanmakuMsg type * opt: avoid cast * opt: unnecessary_lambdas * opt: use isEven * opt: logger * opt: invalid common page * tweak * opt: unify DynController
This commit is contained in:
committed by
GitHub
parent
56ffc2781f
commit
5f8313901b
22
lib/models_new/live/live_danmaku/danmaku_msg.dart
Normal file
22
lib/models_new/live/live_danmaku/danmaku_msg.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:PiliPlus/models_new/live/live_danmaku/live_emote.dart';
|
||||
|
||||
class DanmakuMsg {
|
||||
late String name;
|
||||
late Object uid;
|
||||
late String text;
|
||||
Map<String, BaseEmote>? emots;
|
||||
BaseEmote? uemote;
|
||||
|
||||
DanmakuMsg();
|
||||
|
||||
DanmakuMsg.fromPrefetch(Map<String, dynamic> obj) {
|
||||
final user = obj['user'];
|
||||
name = user['base']['name'];
|
||||
uid = user['uid'];
|
||||
text = obj['text'];
|
||||
emots = (obj['emots'] as Map<String, dynamic>?)?.map((k, v) => MapEntry(k, BaseEmote.fromJson(v)));
|
||||
if ((obj['emoticon']?['emoticon_unique'] as String?)?.isNotEmpty == true) {
|
||||
uemote = BaseEmote.fromJson(obj['emoticon']);
|
||||
}
|
||||
}
|
||||
}
|
||||
48
lib/models_new/live/live_danmaku/live_emote.dart
Normal file
48
lib/models_new/live/live_danmaku/live_emote.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
class BaseEmote {
|
||||
late String url;
|
||||
late String emoticonUnique;
|
||||
late double width;
|
||||
double? height;
|
||||
|
||||
BaseEmote.fromJson(Map<String, dynamic> json) {
|
||||
url = json['url'];
|
||||
emoticonUnique = json['emoticon_unique'];
|
||||
width = (json['width'] as num).toDouble();
|
||||
height = (json['height'] as num?)?.toDouble();
|
||||
}
|
||||
}
|
||||
|
||||
// class Emote extends BaseEmote {
|
||||
// late int count;
|
||||
// late String descript;
|
||||
// late String emoji;
|
||||
// late int emoticonId;
|
||||
// }
|
||||
|
||||
/*
|
||||
{
|
||||
"bulge_display": 1,
|
||||
"emoticon_unique": "upower_[{{emote}}]",
|
||||
"height": {{height}},
|
||||
"in_player_area": 1,
|
||||
"is_dynamic": 0, // 0 or 1
|
||||
"url": "{{url}}",
|
||||
"width": {{width}}
|
||||
}
|
||||
|
||||
{
|
||||
"bulge_display": 1,
|
||||
"emoticon_unique": "room_{{room_id}}_{{int}}",
|
||||
"height": {{height}},
|
||||
"in_player_area": 1,
|
||||
"is_dynamic": 1,
|
||||
"url": "{{url}}",
|
||||
"width": {{width}}
|
||||
}
|
||||
|
||||
*/
|
||||
// class Uemote extends BaseEmote {
|
||||
// late int bulgeDisplay;
|
||||
// late int inPlayerArea;
|
||||
// late int isDynamic;
|
||||
// }
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:PiliPlus/models_new/live/live_dm_block/shield_rules.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_dm_block/shield_user_list.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
|
||||
class ShieldInfo {
|
||||
List<ShieldUserList>? shieldUserList;
|
||||
@@ -20,7 +21,7 @@ class ShieldInfo {
|
||||
shieldUserList: (json['shield_user_list'] as List<dynamic>?)
|
||||
?.map((e) => ShieldUserList.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
keywordList: (json['keyword_list'] as List?)?.cast(),
|
||||
keywordList: (json['keyword_list'] as List?)?.fromCast(),
|
||||
shieldRules: json['shield_rules'] == null
|
||||
? null
|
||||
: ShieldRules.fromJson(json['shield_rules'] as Map<String, dynamic>),
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
|
||||
class LikeInfoV3 {
|
||||
int? totalLikes;
|
||||
bool? clickBlock;
|
||||
@@ -50,8 +52,8 @@ class LikeInfoV3 {
|
||||
guildEmoText: json['guild_emo_text'] as String?,
|
||||
guildDmText: json['guild_dm_text'] as String?,
|
||||
likeDmText: json['like_dm_text'] as String?,
|
||||
handIcons: (json['hand_icons'] as List?)?.cast(),
|
||||
dmIcons: (json['dm_icons'] as List?)?.cast(),
|
||||
handIcons: (json['hand_icons'] as List?)?.fromCast(),
|
||||
dmIcons: (json['dm_icons'] as List?)?.fromCast(),
|
||||
eggshellsIcon: json['eggshells_icon'] as String?,
|
||||
countShowTime: json['count_show_time'] as int?,
|
||||
processIcon: json['process_icon'] as String?,
|
||||
@@ -62,7 +64,7 @@ class LikeInfoV3 {
|
||||
icon: json['icon'] as String?,
|
||||
cooldown: (json['cooldown'] as num?)?.toDouble(),
|
||||
handUseFace: json['hand_use_face'] as bool?,
|
||||
guideIconUrls: (json['guide_icon_urls'] as List?)?.cast(),
|
||||
guideIconUrls: (json['guide_icon_urls'] as List?)?.fromCast(),
|
||||
guideIconRatio: (json['guide_icon_ratio'] as num?)?.toDouble(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:PiliPlus/models_new/live/live_room_play_info/url_info.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
|
||||
class CodecItem {
|
||||
String? codecName;
|
||||
@@ -26,7 +27,7 @@ class CodecItem {
|
||||
factory CodecItem.fromJson(Map<String, dynamic> json) => CodecItem(
|
||||
codecName: json['codec_name'] as String?,
|
||||
currentQn: json['current_qn'] as int?,
|
||||
acceptQn: (json['accept_qn'] as List?)?.cast(),
|
||||
acceptQn: (json['accept_qn'] as List?)?.fromCast(),
|
||||
baseUrl: json['base_url'] as String?,
|
||||
urlInfo: (json['url_info'] as List<dynamic>?)
|
||||
?.map((e) => UrlInfo.fromJson(e as Map<String, dynamic>))
|
||||
|
||||
Reference in New Issue
Block a user