mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 08:38:18 +08:00
fix: save bangumi & fav pic (#917)
This commit is contained in:
committed by
GitHub
parent
05c9269531
commit
edc9a1ca7b
@@ -81,10 +81,10 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
if (_item is ReplyInfo) {
|
if (_item case ReplyInfo reply) {
|
||||||
itemType = '评论';
|
itemType = '评论';
|
||||||
final currentRoute = Get.currentRoute;
|
final currentRoute = Get.currentRoute;
|
||||||
late final hasRoot = _item.hasRoot();
|
late final hasRoot = reply.hasRoot();
|
||||||
|
|
||||||
if (currentRoute.startsWith('/video')) {
|
if (currentRoute.startsWith('/video')) {
|
||||||
try {
|
try {
|
||||||
@@ -97,15 +97,15 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
uname = videoDetail.owner?.name;
|
uname = videoDetail.owner?.name;
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
uri =
|
uri =
|
||||||
'bilibili://video/${_item.oid}?comment_root_id=${hasRoot ? _item.root : _item.id}${hasRoot ? '&comment_secondary_id=${_item.id}' : ''}';
|
'bilibili://video/${reply.oid}?comment_root_id=${hasRoot ? reply.root : reply.id}${hasRoot ? '&comment_secondary_id=${reply.id}' : ''}';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final heroTag = Get.arguments?['heroTag'];
|
final heroTag = Get.arguments?['heroTag'];
|
||||||
late final ctr = Get.find<PgcIntroController>(tag: heroTag);
|
late final ctr = Get.find<PgcIntroController>(tag: heroTag);
|
||||||
final type = _item.type.toInt();
|
final type = reply.type.toInt();
|
||||||
late final oid = _item.oid;
|
late final oid = reply.oid;
|
||||||
late final rootId = hasRoot ? _item.root : _item.id;
|
late final rootId = hasRoot ? reply.root : reply.id;
|
||||||
late final anchor = hasRoot ? 'anchor=${_item.id}&' : '';
|
late final anchor = hasRoot ? 'anchor=${reply.id}&' : '';
|
||||||
uri =
|
uri =
|
||||||
'bilibili://comment/detail/$type/$oid/$rootId/?${anchor}enterUri=bilibili://pgc/season/ep/${ctr.epId}';
|
'bilibili://comment/detail/$type/$oid/$rootId/?${anchor}enterUri=bilibili://pgc/season/ep/${ctr.epId}';
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
@@ -113,10 +113,10 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
try {
|
try {
|
||||||
DynamicItemModel dynItem = Get.arguments['item'];
|
DynamicItemModel dynItem = Get.arguments['item'];
|
||||||
uname = dynItem.modules.moduleAuthor?.name;
|
uname = dynItem.modules.moduleAuthor?.name;
|
||||||
final type = _item.type.toInt();
|
final type = reply.type.toInt();
|
||||||
late final oid = dynItem.idStr;
|
late final oid = dynItem.idStr;
|
||||||
late final rootId = hasRoot ? _item.root : _item.id;
|
late final rootId = hasRoot ? reply.root : reply.id;
|
||||||
late final anchor = hasRoot ? 'anchor=${_item.id}&' : '';
|
late final anchor = hasRoot ? 'anchor=${reply.id}&' : '';
|
||||||
late final enterUri = parseDyn(dynItem);
|
late final enterUri = parseDyn(dynItem);
|
||||||
viewType = '查看';
|
viewType = '查看';
|
||||||
itemType = '评论';
|
itemType = '评论';
|
||||||
@@ -129,10 +129,10 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
} else if (currentRoute.startsWith('/Scaffold')) {
|
} else if (currentRoute.startsWith('/Scaffold')) {
|
||||||
try {
|
try {
|
||||||
final type = _item.type.toInt();
|
final type = reply.type.toInt();
|
||||||
late final oid = Get.arguments['oid'];
|
late final oid = Get.arguments['oid'];
|
||||||
late final rootId = hasRoot ? _item.root : _item.id;
|
late final rootId = hasRoot ? reply.root : reply.id;
|
||||||
late final anchor = hasRoot ? 'anchor=${_item.id}&' : '';
|
late final anchor = hasRoot ? 'anchor=${reply.id}&' : '';
|
||||||
late final enterUri = 'bilibili://following/detail/$oid';
|
late final enterUri = 'bilibili://following/detail/$oid';
|
||||||
uri = switch (type) {
|
uri = switch (type) {
|
||||||
1 || 11 || 12 =>
|
1 || 11 || 12 =>
|
||||||
@@ -143,10 +143,10 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
} else if (currentRoute.startsWith('/articlePage')) {
|
} else if (currentRoute.startsWith('/articlePage')) {
|
||||||
try {
|
try {
|
||||||
final type = _item.type.toInt();
|
final type = reply.type.toInt();
|
||||||
late final oid = _item.oid;
|
late final oid = reply.oid;
|
||||||
late final rootId = hasRoot ? _item.root : _item.id;
|
late final rootId = hasRoot ? reply.root : reply.id;
|
||||||
late final anchor = hasRoot ? 'anchor=${_item.id}&' : '';
|
late final anchor = hasRoot ? 'anchor=${reply.id}&' : '';
|
||||||
late final enterUri =
|
late final enterUri =
|
||||||
'bilibili://following/detail/${Get.parameters['id'] ?? Get.arguments?['id']}';
|
'bilibili://following/detail/${Get.parameters['id'] ?? Get.arguments?['id']}';
|
||||||
uri =
|
uri =
|
||||||
@@ -155,21 +155,21 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (kDebugMode) debugPrint(uri);
|
if (kDebugMode) debugPrint(uri);
|
||||||
} else if (_item is DynamicItemModel) {
|
} else if (_item case DynamicItemModel i) {
|
||||||
uri = parseDyn(_item);
|
uri = parseDyn(i);
|
||||||
|
|
||||||
if (kDebugMode) debugPrint(uri);
|
if (kDebugMode) debugPrint(uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String parseDyn(dynamic item) {
|
String parseDyn(DynamicItemModel item) {
|
||||||
String uri = '';
|
String uri = '';
|
||||||
try {
|
try {
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case 'DYNAMIC_TYPE_AV':
|
case 'DYNAMIC_TYPE_AV':
|
||||||
viewType = '观看';
|
viewType = '观看';
|
||||||
itemType = '视频';
|
itemType = '视频';
|
||||||
uri = 'bilibili://video/${item.basic.commentIdStr}';
|
uri = 'bilibili://video/${item.basic!.commentIdStr}';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'DYNAMIC_TYPE_ARTICLE':
|
case 'DYNAMIC_TYPE_ARTICLE':
|
||||||
@@ -180,14 +180,14 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||||
viewType = '观看';
|
viewType = '观看';
|
||||||
itemType = '直播';
|
itemType = '直播';
|
||||||
final roomId = item.modules.moduleDynamic.major.liveRcmd.roomId;
|
final roomId = item.modules.moduleDynamic!.major!.liveRcmd!.roomId;
|
||||||
uri = 'bilibili://live/$roomId';
|
uri = 'bilibili://live/$roomId';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||||
viewType = '观看';
|
viewType = '观看';
|
||||||
itemType = '合集';
|
itemType = '合集';
|
||||||
int aid = item.modules.moduleDynamic.major.ugcSeason.aid;
|
final aid = item.modules.moduleDynamic!.major!.ugcSeason!.aid;
|
||||||
uri = 'bilibili://video/$aid';
|
uri = 'bilibili://video/$aid';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -195,15 +195,15 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
case 'DYNAMIC_TYPE_PGC_UNION':
|
case 'DYNAMIC_TYPE_PGC_UNION':
|
||||||
viewType = '观看';
|
viewType = '观看';
|
||||||
itemType =
|
itemType =
|
||||||
item?.modules?.moduleDynamic?.major?.pgc?.badge?['text'] ?? '番剧';
|
item.modules.moduleDynamic?.major?.pgc?.badge?.text ?? '番剧';
|
||||||
final epid = item.modules.moduleDynamic.major.pgc.epid;
|
final epid = item.modules.moduleDynamic!.major!.pgc!.epid;
|
||||||
uri = 'bilibili://pgc/season/ep/$epid';
|
uri = 'bilibili://pgc/season/ep/$epid';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// https://www.bilibili.com/medialist/detail/ml12345678
|
// https://www.bilibili.com/medialist/detail/ml12345678
|
||||||
case 'DYNAMIC_TYPE_MEDIALIST':
|
case 'DYNAMIC_TYPE_MEDIALIST':
|
||||||
itemType = '收藏夹';
|
itemType = '收藏夹';
|
||||||
final mediaId = item.modules.moduleDynamic.major.medialist!['id'];
|
final mediaId = item.modules.moduleDynamic!.major!.medialist!.id;
|
||||||
uri = 'bilibili://medialist/detail/$mediaId';
|
uri = 'bilibili://medialist/detail/$mediaId';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user