mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-17 07:36:14 +08:00
opt member tab
try-catch handle live dm Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -58,6 +58,7 @@ class SpaceData {
|
|||||||
List<Entry>? entry;
|
List<Entry>? entry;
|
||||||
List<SpaceButtonList>? spaceButtonList;
|
List<SpaceButtonList>? spaceButtonList;
|
||||||
int? relSpecial;
|
int? relSpecial;
|
||||||
|
bool? hasItem;
|
||||||
|
|
||||||
SpaceData({
|
SpaceData({
|
||||||
this.relation,
|
this.relation,
|
||||||
@@ -94,90 +95,95 @@ class SpaceData {
|
|||||||
this.relSpecial,
|
this.relSpecial,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory SpaceData.fromJson(Map<String, dynamic> json) => SpaceData(
|
SpaceData.fromJson(Map<String, dynamic> json) {
|
||||||
relation: json['relation'] as int?,
|
relation = json['relation'] as int?;
|
||||||
guestRelation: json['guest_relation'] as int?,
|
guestRelation = json['guest_relation'] as int?;
|
||||||
medal: json['medal'] as int?,
|
medal = json['medal'] as int?;
|
||||||
defaultTab: json['default_tab'] as String?,
|
defaultTab = json['default_tab'] as String?;
|
||||||
isParams: json['is_params'] as bool?,
|
isParams = json['is_params'] as bool?;
|
||||||
setting: json['setting'] == null
|
setting = json['setting'] == null
|
||||||
? null
|
? null
|
||||||
: SpaceSetting.fromJson(json['setting'] as Map<String, dynamic>),
|
: SpaceSetting.fromJson(json['setting'] as Map<String, dynamic>);
|
||||||
tab: json['tab'] == null
|
tab = json['tab'] == null
|
||||||
? null
|
? null
|
||||||
: SpaceTab.fromJson(json['tab'] as Map<String, dynamic>),
|
: SpaceTab.fromJson(json['tab'] as Map<String, dynamic>);
|
||||||
card: json['card'] == null
|
card = json['card'] == null
|
||||||
? null
|
? null
|
||||||
: SpaceCard.fromJson(json['card'] as Map<String, dynamic>),
|
: SpaceCard.fromJson(json['card'] as Map<String, dynamic>);
|
||||||
images: json['images'] == null
|
images = json['images'] == null
|
||||||
? null
|
? null
|
||||||
: SpaceImages.fromJson(json['images'] as Map<String, dynamic>),
|
: SpaceImages.fromJson(json['images'] as Map<String, dynamic>);
|
||||||
live: json['live'] == null
|
live = json['live'] == null
|
||||||
? null
|
? null
|
||||||
: Live.fromJson(json['live'] as Map<String, dynamic>),
|
: Live.fromJson(json['live'] as Map<String, dynamic>);
|
||||||
elec: json['elec'] == null
|
elec = json['elec'] == null
|
||||||
? null
|
? null
|
||||||
: Elec.fromJson(json['elec'] as Map<String, dynamic>),
|
: Elec.fromJson(json['elec'] as Map<String, dynamic>);
|
||||||
archive: json['archive'] == null
|
archive = json['archive'] == null
|
||||||
? null
|
? null
|
||||||
: Archive.fromJson(json['archive'] as Map<String, dynamic>),
|
: Archive.fromJson(json['archive'] as Map<String, dynamic>);
|
||||||
series: json['series'] == null
|
series = json['series'] == null
|
||||||
? null
|
? null
|
||||||
: SpaceSeries.fromJson(json['series'] as Map<String, dynamic>),
|
: SpaceSeries.fromJson(json['series'] as Map<String, dynamic>);
|
||||||
playGame: json['play_game'] == null
|
playGame = json['play_game'] == null
|
||||||
? null
|
? null
|
||||||
: PlayGame.fromJson(json['play_game'] as Map<String, dynamic>),
|
: PlayGame.fromJson(json['play_game'] as Map<String, dynamic>);
|
||||||
article: json['article'] == null
|
article = json['article'] == null
|
||||||
? null
|
? null
|
||||||
: Article.fromJson(json['article'] as Map<String, dynamic>),
|
: Article.fromJson(json['article'] as Map<String, dynamic>);
|
||||||
season: json['season'] == null
|
season = json['season'] == null
|
||||||
? null
|
? null
|
||||||
: SpaceSeason.fromJson(json['season'] as Map<String, dynamic>),
|
: SpaceSeason.fromJson(json['season'] as Map<String, dynamic>);
|
||||||
coinArchive: json['coin_archive'] == null
|
coinArchive = json['coin_archive'] == null
|
||||||
? null
|
? null
|
||||||
: CoinArchive.fromJson(
|
: CoinArchive.fromJson(json['coin_archive'] as Map<String, dynamic>);
|
||||||
json['coin_archive'] as Map<String, dynamic>),
|
likeArchive = json['like_archive'] == null
|
||||||
likeArchive: json['like_archive'] == null
|
? null
|
||||||
? null
|
: LikeArchive.fromJson(json['like_archive'] as Map<String, dynamic>);
|
||||||
: LikeArchive.fromJson(
|
audios = json['audios'] == null
|
||||||
json['like_archive'] as Map<String, dynamic>),
|
? null
|
||||||
audios: json['audios'] == null
|
: Audios.fromJson(json['audios'] as Map<String, dynamic>);
|
||||||
? null
|
favourite2 = json['favourite2'] == null
|
||||||
: Audios.fromJson(json['audios'] as Map<String, dynamic>),
|
? null
|
||||||
favourite2: json['favourite2'] == null
|
: Favourite2.fromJson(json['favourite2'] as Map<String, dynamic>);
|
||||||
? null
|
comic = json['comic'] == null
|
||||||
: Favourite2.fromJson(json['favourite2'] as Map<String, dynamic>),
|
? null
|
||||||
comic: json['comic'] == null
|
: Comic.fromJson(json['comic'] as Map<String, dynamic>);
|
||||||
? null
|
ugcSeason = json['ugc_season'] == null
|
||||||
: Comic.fromJson(json['comic'] as Map<String, dynamic>),
|
? null
|
||||||
ugcSeason: json['ugc_season'] == null
|
: UgcSeason.fromJson(json['ugc_season'] as Map<String, dynamic>);
|
||||||
? null
|
cheese = json['cheese'] == null
|
||||||
: UgcSeason.fromJson(json['ugc_season'] as Map<String, dynamic>),
|
? null
|
||||||
cheese: json['cheese'] == null
|
: Cheese.fromJson(json['cheese'] as Map<String, dynamic>);
|
||||||
? null
|
guard = json['guard'] == null
|
||||||
: Cheese.fromJson(json['cheese'] as Map<String, dynamic>),
|
? null
|
||||||
guard: json['guard'] == null
|
: Guard.fromJson(json['guard'] as Map<String, dynamic>);
|
||||||
? null
|
attentionTip = json['attention_tip'] == null
|
||||||
: Guard.fromJson(json['guard'] as Map<String, dynamic>),
|
? null
|
||||||
attentionTip: json['attention_tip'] == null
|
: AttentionTip.fromJson(json['attention_tip'] as Map<String, dynamic>);
|
||||||
? null
|
nftShowModule = json['nft_show_module'] == null
|
||||||
: AttentionTip.fromJson(
|
? null
|
||||||
json['attention_tip'] as Map<String, dynamic>),
|
: NftShowModule.fromJson(
|
||||||
nftShowModule: json['nft_show_module'] == null
|
json['nft_show_module'] as Map<String, dynamic>);
|
||||||
? null
|
tab2 = (json['tab2'] as List<dynamic>?)
|
||||||
: NftShowModule.fromJson(
|
?.map((e) => SpaceTab2.fromJson(e as Map<String, dynamic>))
|
||||||
json['nft_show_module'] as Map<String, dynamic>),
|
.toList();
|
||||||
tab2: (json['tab2'] as List<dynamic>?)
|
nftFaceButton = json['nft_face_button'] as dynamic;
|
||||||
?.map((e) => SpaceTab2.fromJson(e as Map<String, dynamic>))
|
digitalButton = json['digital_button'] as dynamic;
|
||||||
.toList(),
|
entry = (json['entry'] as List<dynamic>?)
|
||||||
nftFaceButton: json['nft_face_button'] as dynamic,
|
?.map((e) => Entry.fromJson(e as Map<String, dynamic>))
|
||||||
digitalButton: json['digital_button'] as dynamic,
|
.toList();
|
||||||
entry: (json['entry'] as List<dynamic>?)
|
spaceButtonList = (json['space_button_list'] as List<dynamic>?)
|
||||||
?.map((e) => Entry.fromJson(e as Map<String, dynamic>))
|
?.map((e) => SpaceButtonList.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList();
|
||||||
spaceButtonList: (json['space_button_list'] as List<dynamic>?)
|
relSpecial = (json['rel_special'] as num?)?.toInt();
|
||||||
?.map((e) => SpaceButtonList.fromJson(e as Map<String, dynamic>))
|
hasItem = archive?.item?.isNotEmpty == true ||
|
||||||
.toList(),
|
favourite2?.item?.isNotEmpty == true ||
|
||||||
relSpecial: (json['rel_special'] as num?)?.toInt(),
|
coinArchive?.item?.isNotEmpty == true ||
|
||||||
);
|
likeArchive?.item?.isNotEmpty == true ||
|
||||||
|
article?.item?.isNotEmpty == true ||
|
||||||
|
audios?.item?.isNotEmpty == true ||
|
||||||
|
comic?.item?.isNotEmpty == true ||
|
||||||
|
season?.item?.isNotEmpty == true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class SpaceTab {
|
|||||||
bool? opus;
|
bool? opus;
|
||||||
bool? cheeseVideo;
|
bool? cheeseVideo;
|
||||||
bool? brand;
|
bool? brand;
|
||||||
bool? hasItem;
|
// bool? hasItem;
|
||||||
|
|
||||||
SpaceTab({
|
SpaceTab({
|
||||||
this.archive,
|
this.archive,
|
||||||
@@ -74,6 +74,6 @@ class SpaceTab {
|
|||||||
opus = json['opus'] as bool?;
|
opus = json['opus'] as bool?;
|
||||||
cheeseVideo = json['cheese_video'] as bool?;
|
cheeseVideo = json['cheese_video'] as bool?;
|
||||||
brand = json['brand'] as bool?;
|
brand = json['brand'] as bool?;
|
||||||
hasItem = json.values.any((e) => e == true);
|
// hasItem = json.values.any((e) => e == true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,20 +187,22 @@ class LiveRoomController extends GetxController {
|
|||||||
LiveHttp.liveRoomDanmaPrefetch(roomId: roomId).then((v) {
|
LiveHttp.liveRoomDanmaPrefetch(roomId: roomId).then((v) {
|
||||||
if (v['status']) {
|
if (v['status']) {
|
||||||
if ((v['data'] as List?)?.isNotEmpty == true) {
|
if ((v['data'] as List?)?.isNotEmpty == true) {
|
||||||
messages.addAll((v['data'] as List)
|
try {
|
||||||
.map((obj) => {
|
messages.addAll((v['data'] as List)
|
||||||
'name': obj['user']['base']['name'],
|
.map((obj) => {
|
||||||
'uid': obj['user']['uid'],
|
'name': obj['user']['base']['name'],
|
||||||
'text': obj['text'],
|
'uid': obj['user']['uid'],
|
||||||
'emots': obj['emots'],
|
'text': obj['text'],
|
||||||
'uemote': obj['emoticon']['emoticon_unique'] != ""
|
'emots': obj['emots'],
|
||||||
? obj['emoticon']
|
'uemote': obj['emoticon']['emoticon_unique'] != ""
|
||||||
: null,
|
? obj['emoticon']
|
||||||
})
|
: null,
|
||||||
.toList());
|
})
|
||||||
WidgetsBinding.instance.addPostFrameCallback(
|
.toList());
|
||||||
(_) => scrollToBottom(),
|
WidgetsBinding.instance.addPostFrameCallback(
|
||||||
);
|
(_) => scrollToBottom(),
|
||||||
|
);
|
||||||
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -268,34 +270,36 @@ class LiveRoomController extends GetxController {
|
|||||||
.toList(),
|
.toList(),
|
||||||
)
|
)
|
||||||
..addEventListener((obj) {
|
..addEventListener((obj) {
|
||||||
if (obj['cmd'] == 'DANMU_MSG') {
|
try {
|
||||||
// logger.i(' 原始弹幕消息 ======> ${jsonEncode(obj)}');
|
if (obj['cmd'] == 'DANMU_MSG') {
|
||||||
final info = obj['info'];
|
// logger.i(' 原始弹幕消息 ======> ${jsonEncode(obj)}');
|
||||||
final first = info[0];
|
final info = obj['info'];
|
||||||
final content = first[15];
|
final first = info[0];
|
||||||
final extra = jsonDecode(content['extra']);
|
final content = first[15];
|
||||||
final user = content['user'];
|
final extra = jsonDecode(content['extra']);
|
||||||
final uid = user['uid'];
|
final user = content['user'];
|
||||||
messages.add({
|
final uid = user['uid'];
|
||||||
'name': user['base']['name'],
|
messages.add({
|
||||||
'uid': uid,
|
'name': user['base']['name'],
|
||||||
'text': info[1],
|
'uid': uid,
|
||||||
'emots': extra['emots'],
|
'text': info[1],
|
||||||
'uemote': first[13],
|
'emots': extra['emots'],
|
||||||
});
|
'uemote': first[13],
|
||||||
if (showDanmaku) {
|
});
|
||||||
controller?.addDanmaku(
|
if (showDanmaku) {
|
||||||
DanmakuContentItem(
|
controller?.addDanmaku(
|
||||||
extra['content'],
|
DanmakuContentItem(
|
||||||
color: DmUtils.decimalToColor(extra['color']),
|
extra['content'],
|
||||||
type: DmUtils.getPosition(extra['mode']),
|
color: DmUtils.decimalToColor(extra['color']),
|
||||||
selfSend: isLogin && uid == accountService.mid,
|
type: DmUtils.getPosition(extra['mode']),
|
||||||
),
|
selfSend: isLogin && uid == accountService.mid,
|
||||||
);
|
),
|
||||||
WidgetsBinding.instance
|
);
|
||||||
.addPostFrameCallback((_) => scrollToBottom());
|
WidgetsBinding.instance
|
||||||
|
.addPostFrameCallback((_) => scrollToBottom());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (_) {}
|
||||||
})
|
})
|
||||||
..init();
|
..init();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class MemberController extends CommonDataController<SpaceData, SpaceData?>
|
|||||||
}
|
}
|
||||||
tab2?.retainWhere((item) => implTabs.contains(item.param));
|
tab2?.retainWhere((item) => implTabs.contains(item.param));
|
||||||
if (tab2?.isNotEmpty == true) {
|
if (tab2?.isNotEmpty == true) {
|
||||||
if (data.tab!.hasItem != true && tab2!.first.param == 'home') {
|
if (data.hasItem != true && tab2!.first.param == 'home') {
|
||||||
// remove empty home tab
|
// remove empty home tab
|
||||||
tab2!.removeAt(0);
|
tab2!.removeAt(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user