mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-17 15:46: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<SpaceButtonList>? spaceButtonList;
|
||||
int? relSpecial;
|
||||
bool? hasItem;
|
||||
|
||||
SpaceData({
|
||||
this.relation,
|
||||
@@ -94,90 +95,95 @@ class SpaceData {
|
||||
this.relSpecial,
|
||||
});
|
||||
|
||||
factory SpaceData.fromJson(Map<String, dynamic> json) => SpaceData(
|
||||
relation: json['relation'] as int?,
|
||||
guestRelation: json['guest_relation'] as int?,
|
||||
medal: json['medal'] as int?,
|
||||
defaultTab: json['default_tab'] as String?,
|
||||
isParams: json['is_params'] as bool?,
|
||||
setting: json['setting'] == null
|
||||
SpaceData.fromJson(Map<String, dynamic> json) {
|
||||
relation = json['relation'] as int?;
|
||||
guestRelation = json['guest_relation'] as int?;
|
||||
medal = json['medal'] as int?;
|
||||
defaultTab = json['default_tab'] as String?;
|
||||
isParams = json['is_params'] as bool?;
|
||||
setting = json['setting'] == null
|
||||
? null
|
||||
: SpaceSetting.fromJson(json['setting'] as Map<String, dynamic>),
|
||||
tab: json['tab'] == null
|
||||
: SpaceSetting.fromJson(json['setting'] as Map<String, dynamic>);
|
||||
tab = json['tab'] == null
|
||||
? null
|
||||
: SpaceTab.fromJson(json['tab'] as Map<String, dynamic>),
|
||||
card: json['card'] == null
|
||||
: SpaceTab.fromJson(json['tab'] as Map<String, dynamic>);
|
||||
card = json['card'] == null
|
||||
? null
|
||||
: SpaceCard.fromJson(json['card'] as Map<String, dynamic>),
|
||||
images: json['images'] == null
|
||||
: SpaceCard.fromJson(json['card'] as Map<String, dynamic>);
|
||||
images = json['images'] == null
|
||||
? null
|
||||
: SpaceImages.fromJson(json['images'] as Map<String, dynamic>),
|
||||
live: json['live'] == null
|
||||
: SpaceImages.fromJson(json['images'] as Map<String, dynamic>);
|
||||
live = json['live'] == null
|
||||
? null
|
||||
: Live.fromJson(json['live'] as Map<String, dynamic>),
|
||||
elec: json['elec'] == null
|
||||
: Live.fromJson(json['live'] as Map<String, dynamic>);
|
||||
elec = json['elec'] == null
|
||||
? null
|
||||
: Elec.fromJson(json['elec'] as Map<String, dynamic>),
|
||||
archive: json['archive'] == null
|
||||
: Elec.fromJson(json['elec'] as Map<String, dynamic>);
|
||||
archive = json['archive'] == null
|
||||
? null
|
||||
: Archive.fromJson(json['archive'] as Map<String, dynamic>),
|
||||
series: json['series'] == null
|
||||
: Archive.fromJson(json['archive'] as Map<String, dynamic>);
|
||||
series = json['series'] == null
|
||||
? null
|
||||
: SpaceSeries.fromJson(json['series'] as Map<String, dynamic>),
|
||||
playGame: json['play_game'] == null
|
||||
: SpaceSeries.fromJson(json['series'] as Map<String, dynamic>);
|
||||
playGame = json['play_game'] == null
|
||||
? null
|
||||
: PlayGame.fromJson(json['play_game'] as Map<String, dynamic>),
|
||||
article: json['article'] == null
|
||||
: PlayGame.fromJson(json['play_game'] as Map<String, dynamic>);
|
||||
article = json['article'] == null
|
||||
? null
|
||||
: Article.fromJson(json['article'] as Map<String, dynamic>),
|
||||
season: json['season'] == null
|
||||
: Article.fromJson(json['article'] as Map<String, dynamic>);
|
||||
season = json['season'] == null
|
||||
? null
|
||||
: SpaceSeason.fromJson(json['season'] as Map<String, dynamic>),
|
||||
coinArchive: json['coin_archive'] == null
|
||||
: SpaceSeason.fromJson(json['season'] as Map<String, dynamic>);
|
||||
coinArchive = json['coin_archive'] == null
|
||||
? null
|
||||
: CoinArchive.fromJson(
|
||||
json['coin_archive'] as Map<String, dynamic>),
|
||||
likeArchive: json['like_archive'] == null
|
||||
: CoinArchive.fromJson(json['coin_archive'] as Map<String, dynamic>);
|
||||
likeArchive = json['like_archive'] == null
|
||||
? null
|
||||
: LikeArchive.fromJson(
|
||||
json['like_archive'] as Map<String, dynamic>),
|
||||
audios: json['audios'] == null
|
||||
: LikeArchive.fromJson(json['like_archive'] as Map<String, dynamic>);
|
||||
audios = json['audios'] == null
|
||||
? null
|
||||
: Audios.fromJson(json['audios'] as Map<String, dynamic>),
|
||||
favourite2: json['favourite2'] == null
|
||||
: Audios.fromJson(json['audios'] as Map<String, dynamic>);
|
||||
favourite2 = json['favourite2'] == null
|
||||
? null
|
||||
: Favourite2.fromJson(json['favourite2'] as Map<String, dynamic>),
|
||||
comic: json['comic'] == null
|
||||
: Favourite2.fromJson(json['favourite2'] as Map<String, dynamic>);
|
||||
comic = json['comic'] == null
|
||||
? null
|
||||
: Comic.fromJson(json['comic'] as Map<String, dynamic>),
|
||||
ugcSeason: json['ugc_season'] == null
|
||||
: Comic.fromJson(json['comic'] as Map<String, dynamic>);
|
||||
ugcSeason = json['ugc_season'] == null
|
||||
? null
|
||||
: UgcSeason.fromJson(json['ugc_season'] as Map<String, dynamic>),
|
||||
cheese: json['cheese'] == null
|
||||
: UgcSeason.fromJson(json['ugc_season'] as Map<String, dynamic>);
|
||||
cheese = json['cheese'] == null
|
||||
? null
|
||||
: Cheese.fromJson(json['cheese'] as Map<String, dynamic>),
|
||||
guard: json['guard'] == null
|
||||
: Cheese.fromJson(json['cheese'] as Map<String, dynamic>);
|
||||
guard = json['guard'] == null
|
||||
? null
|
||||
: Guard.fromJson(json['guard'] as Map<String, dynamic>),
|
||||
attentionTip: json['attention_tip'] == null
|
||||
: Guard.fromJson(json['guard'] as Map<String, dynamic>);
|
||||
attentionTip = json['attention_tip'] == null
|
||||
? null
|
||||
: AttentionTip.fromJson(
|
||||
json['attention_tip'] as Map<String, dynamic>),
|
||||
nftShowModule: json['nft_show_module'] == null
|
||||
: AttentionTip.fromJson(json['attention_tip'] as Map<String, dynamic>);
|
||||
nftShowModule = json['nft_show_module'] == null
|
||||
? null
|
||||
: NftShowModule.fromJson(
|
||||
json['nft_show_module'] as Map<String, dynamic>),
|
||||
tab2: (json['tab2'] as List<dynamic>?)
|
||||
json['nft_show_module'] as Map<String, dynamic>);
|
||||
tab2 = (json['tab2'] as List<dynamic>?)
|
||||
?.map((e) => SpaceTab2.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
nftFaceButton: json['nft_face_button'] as dynamic,
|
||||
digitalButton: json['digital_button'] as dynamic,
|
||||
entry: (json['entry'] as List<dynamic>?)
|
||||
.toList();
|
||||
nftFaceButton = json['nft_face_button'] as dynamic;
|
||||
digitalButton = json['digital_button'] as dynamic;
|
||||
entry = (json['entry'] as List<dynamic>?)
|
||||
?.map((e) => Entry.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
spaceButtonList: (json['space_button_list'] as List<dynamic>?)
|
||||
.toList();
|
||||
spaceButtonList = (json['space_button_list'] as List<dynamic>?)
|
||||
?.map((e) => SpaceButtonList.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
relSpecial: (json['rel_special'] as num?)?.toInt(),
|
||||
);
|
||||
.toList();
|
||||
relSpecial = (json['rel_special'] as num?)?.toInt();
|
||||
hasItem = archive?.item?.isNotEmpty == true ||
|
||||
favourite2?.item?.isNotEmpty == true ||
|
||||
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? cheeseVideo;
|
||||
bool? brand;
|
||||
bool? hasItem;
|
||||
// bool? hasItem;
|
||||
|
||||
SpaceTab({
|
||||
this.archive,
|
||||
@@ -74,6 +74,6 @@ class SpaceTab {
|
||||
opus = json['opus'] as bool?;
|
||||
cheeseVideo = json['cheese_video'] as bool?;
|
||||
brand = json['brand'] as bool?;
|
||||
hasItem = json.values.any((e) => e == true);
|
||||
// hasItem = json.values.any((e) => e == true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,6 +187,7 @@ class LiveRoomController extends GetxController {
|
||||
LiveHttp.liveRoomDanmaPrefetch(roomId: roomId).then((v) {
|
||||
if (v['status']) {
|
||||
if ((v['data'] as List?)?.isNotEmpty == true) {
|
||||
try {
|
||||
messages.addAll((v['data'] as List)
|
||||
.map((obj) => {
|
||||
'name': obj['user']['base']['name'],
|
||||
@@ -201,6 +202,7 @@ class LiveRoomController extends GetxController {
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => scrollToBottom(),
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -268,6 +270,7 @@ class LiveRoomController extends GetxController {
|
||||
.toList(),
|
||||
)
|
||||
..addEventListener((obj) {
|
||||
try {
|
||||
if (obj['cmd'] == 'DANMU_MSG') {
|
||||
// logger.i(' 原始弹幕消息 ======> ${jsonEncode(obj)}');
|
||||
final info = obj['info'];
|
||||
@@ -296,6 +299,7 @@ class LiveRoomController extends GetxController {
|
||||
.addPostFrameCallback((_) => scrollToBottom());
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
})
|
||||
..init();
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class MemberController extends CommonDataController<SpaceData, SpaceData?>
|
||||
}
|
||||
tab2?.retainWhere((item) => implTabs.contains(item.param));
|
||||
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
|
||||
tab2!.removeAt(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user