mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-30 23:58:13 +08:00
mod: save panel (#1706)
This commit is contained in:
committed by
GitHub
parent
1a9d8e35ba
commit
b43840b636
@@ -93,14 +93,19 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
late final hasRoot = reply.hasRoot();
|
late final hasRoot = reply.hasRoot();
|
||||||
|
|
||||||
if (currentRoute.startsWith('/video')) {
|
if (currentRoute.startsWith('/video')) {
|
||||||
|
final rootId = hasRoot ? reply.root : reply.id;
|
||||||
|
|
||||||
|
uri =
|
||||||
|
'https://www.bilibili.com/video/av${reply.oid}?comment_on=1&comment_root_id=$rootId${hasRoot ? '&comment_secondary_id=${reply.id}' : ''}';
|
||||||
try {
|
try {
|
||||||
final heroTag = Get.arguments['heroTag'];
|
final heroTag = Get.arguments['heroTag'];
|
||||||
final videoType = Get.arguments['videoType'];
|
final videoType = Get.arguments['videoType'];
|
||||||
if (videoType == VideoType.pgc || videoType == VideoType.pugv) {
|
if (videoType == VideoType.pgc || videoType == VideoType.pugv) {
|
||||||
final ctr = Get.find<PgcIntroController>(tag: heroTag);
|
final ctr = Get.find<PgcIntroController>(tag: heroTag);
|
||||||
final pgcItem = ctr.pgcItem;
|
final pgcItem = ctr.pgcItem;
|
||||||
|
final cid = ctr.cid.value;
|
||||||
final episode = pgcItem.episodes!.firstWhere(
|
final episode = pgcItem.episodes!.firstWhere(
|
||||||
(e) => e.cid == ctr.cid.value,
|
(e) => e.cid == cid,
|
||||||
);
|
);
|
||||||
cover = episode.cover;
|
cover = episode.cover;
|
||||||
title =
|
title =
|
||||||
@@ -108,6 +113,12 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
'${pgcItem.title} ${episode.showTitle ?? episode.longTitle ?? ''}';
|
'${pgcItem.title} ${episode.showTitle ?? episode.longTitle ?? ''}';
|
||||||
pubdate = episode.pubTime;
|
pubdate = episode.pubTime;
|
||||||
uname = pgcItem.upInfo?.uname;
|
uname = pgcItem.upInfo?.uname;
|
||||||
|
|
||||||
|
final oid = reply.oid;
|
||||||
|
final type = reply.type.toInt();
|
||||||
|
final anchor = hasRoot ? 'anchor=${reply.id}&' : '';
|
||||||
|
uri =
|
||||||
|
'bilibili://comment/detail/$type/$oid/$rootId/?${anchor}enterUri=bilibili://pgc/season/ep/${ctr.epId}';
|
||||||
} else {
|
} else {
|
||||||
final ctr = Get.find<UgcIntroController>(tag: heroTag);
|
final ctr = Get.find<UgcIntroController>(tag: heroTag);
|
||||||
final videoDetail = ctr.videoDetail.value;
|
final videoDetail = ctr.videoDetail.value;
|
||||||
@@ -115,50 +126,52 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
title = videoDetail.title;
|
title = videoDetail.title;
|
||||||
pubdate = videoDetail.pubdate;
|
pubdate = videoDetail.pubdate;
|
||||||
uname = videoDetail.owner?.name;
|
uname = videoDetail.owner?.name;
|
||||||
|
|
||||||
|
final cid = ctr.cid.value;
|
||||||
|
final part =
|
||||||
|
ctr.videoDetail.value.pages?.indexWhere((i) => i.cid == cid) ??
|
||||||
|
-1;
|
||||||
|
if (part > 0) uri += '&p=${part + 1}';
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
uri =
|
|
||||||
'bilibili://video/${reply.oid}?comment_root_id=${hasRoot ? reply.root : reply.id}${hasRoot ? '&comment_secondary_id=${reply.id}' : ''}';
|
|
||||||
|
|
||||||
try {
|
|
||||||
final heroTag = Get.arguments['heroTag'];
|
|
||||||
late final ctr = Get.find<PgcIntroController>(tag: heroTag);
|
|
||||||
final type = reply.type.toInt();
|
|
||||||
late final oid = reply.oid;
|
|
||||||
late final rootId = hasRoot ? reply.root : reply.id;
|
|
||||||
late final anchor = hasRoot ? 'anchor=${reply.id}&' : '';
|
|
||||||
uri =
|
|
||||||
'bilibili://comment/detail/$type/$oid/$rootId/?${anchor}enterUri=bilibili://pgc/season/ep/${ctr.epId}';
|
|
||||||
} catch (_) {}
|
|
||||||
} else if (currentRoute.startsWith('/dynamicDetail')) {
|
} else if (currentRoute.startsWith('/dynamicDetail')) {
|
||||||
|
DynamicItemModel? dynItem;
|
||||||
try {
|
try {
|
||||||
DynamicItemModel dynItem = Get.arguments['item'];
|
dynItem = Get.arguments['item'] as DynamicItemModel;
|
||||||
uname = dynItem.modules.moduleAuthor?.name;
|
uname = dynItem.modules.moduleAuthor?.name;
|
||||||
final type = reply.type.toInt();
|
|
||||||
late final oid = dynItem.idStr;
|
|
||||||
late final rootId = hasRoot ? reply.root : reply.id;
|
|
||||||
late final anchor = hasRoot ? 'anchor=${reply.id}&' : '';
|
|
||||||
late final enterUri = parseDyn(dynItem);
|
|
||||||
uri = switch (type) {
|
|
||||||
1 || 11 || 12 =>
|
|
||||||
'bilibili://comment/detail/$type/${dynItem.basic!.ridStr}/$rootId/?${anchor}enterUri=$enterUri',
|
|
||||||
_ =>
|
|
||||||
'bilibili://comment/detail/$type/$oid/$rootId/?${anchor}enterUri=$enterUri',
|
|
||||||
};
|
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
final type = reply.type.toInt();
|
||||||
|
final oid = reply.oid;
|
||||||
|
final rootId = hasRoot ? reply.root : reply.id;
|
||||||
|
|
||||||
|
if (type == 1) {
|
||||||
|
uri =
|
||||||
|
'https://www.bilibili.com/video/av$oid?comment_on=1&comment_root_id=$rootId${hasRoot ? '&comment_secondary_id=${reply.id}' : ''}';
|
||||||
|
} else {
|
||||||
|
final enterUri = dynItem == null
|
||||||
|
? ''
|
||||||
|
: 'enterUri=${parseDyn(dynItem)}';
|
||||||
|
uri =
|
||||||
|
'bilibili://comment/detail/$type/$oid/$rootId/?${hasRoot ? 'anchor=${reply.id}&' : ''}$enterUri';
|
||||||
|
}
|
||||||
} else if (currentRoute.startsWith('/Scaffold')) {
|
} else if (currentRoute.startsWith('/Scaffold')) {
|
||||||
try {
|
try {
|
||||||
final type = reply.type.toInt();
|
final type = reply.type.toInt();
|
||||||
late final oid = Get.arguments['oid'];
|
final oid = Get.arguments['oid'] ?? reply.oid;
|
||||||
late final rootId = hasRoot ? reply.root : reply.id;
|
final rootId = hasRoot ? reply.root : reply.id;
|
||||||
late final anchor = hasRoot ? 'anchor=${reply.id}&' : '';
|
if (type == 1) {
|
||||||
late final enterUri = 'bilibili://following/detail/$oid';
|
uri =
|
||||||
uri = switch (type) {
|
'https://www.bilibili.com/video/av$oid?comment_on=1&comment_root_id=$rootId${hasRoot ? '&comment_secondary_id=${reply.id}' : ''}';
|
||||||
1 || 11 || 12 =>
|
} else {
|
||||||
'bilibili://comment/detail/$type/$oid/$rootId/?${anchor}enterUri=${Get.arguments['enterUri']}',
|
String enterUri = Get.arguments['enterUri'] ?? '';
|
||||||
_ =>
|
if (enterUri.isNotEmpty) {
|
||||||
'bilibili://comment/detail/$type/$oid/$rootId/?${anchor}enterUri=$enterUri',
|
enterUri = 'enterUri=${Uri.encodeComponent(enterUri)}';
|
||||||
};
|
} else if (const [11, 12, 17].contains(type)) {
|
||||||
|
enterUri = 'enterUri=bilibili://following/detail/$oid';
|
||||||
|
}
|
||||||
|
uri =
|
||||||
|
'bilibili://comment/detail/$type/$oid/$rootId/?${hasRoot ? 'anchor=${reply.id}&' : ''}$enterUri';
|
||||||
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
} else if (currentRoute.startsWith('/articlePage')) {
|
} else if (currentRoute.startsWith('/articlePage')) {
|
||||||
try {
|
try {
|
||||||
@@ -181,7 +194,8 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
final ctr = Get.find<MusicDetailController>(
|
final ctr = Get.find<MusicDetailController>(
|
||||||
tag: Get.parameters['musicId'],
|
tag: Get.parameters['musicId'],
|
||||||
);
|
);
|
||||||
// enterUri = 'enterUri=${Uri.encodeComponent(ctr.shareUrl)}'; // official client cannot parse it
|
enterUri =
|
||||||
|
'enterUri=${Uri.encodeComponent(ctr.shareUrl)}'; // official client cannot parse it
|
||||||
final data = ctr.infoState.value.dataOrNull;
|
final data = ctr.infoState.value.dataOrNull;
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
coverType = _CoverType.square;
|
coverType = _CoverType.square;
|
||||||
@@ -484,26 +498,31 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
GestureDetector(
|
||||||
width: 100,
|
onTap: () => Utils.copyText(uri),
|
||||||
height: 100,
|
|
||||||
padding: const EdgeInsets.all(
|
|
||||||
12,
|
|
||||||
),
|
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Get.isDarkMode
|
width: 100,
|
||||||
? Colors.white
|
height: 100,
|
||||||
: theme.colorScheme.surface,
|
|
||||||
padding: const EdgeInsets.all(
|
padding: const EdgeInsets.all(
|
||||||
3,
|
12,
|
||||||
),
|
),
|
||||||
child: PrettyQrView.data(
|
child: Container(
|
||||||
data: uri,
|
color: Get.isDarkMode
|
||||||
decoration:
|
? Colors.white
|
||||||
const PrettyQrDecoration(
|
: theme
|
||||||
shape:
|
.colorScheme
|
||||||
PrettyQrSquaresSymbol(),
|
.surface,
|
||||||
),
|
padding: const EdgeInsets.all(
|
||||||
|
3,
|
||||||
|
),
|
||||||
|
child: PrettyQrView.data(
|
||||||
|
data: uri,
|
||||||
|
decoration:
|
||||||
|
const PrettyQrDecoration(
|
||||||
|
shape:
|
||||||
|
PrettyQrSquaresSymbol(),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class VideoReplyReplyPanel extends CommonSlidePage {
|
|||||||
'rpid': rootId,
|
'rpid': rootId,
|
||||||
'id': ?rpId,
|
'id': ?rpId,
|
||||||
'type': type,
|
'type': type,
|
||||||
'enterUri': ?uri, // save panel
|
'enterUri': ?uri?.toString(), // save panel
|
||||||
},
|
},
|
||||||
() => Scaffold(
|
() => Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
|
|||||||
@@ -644,16 +644,14 @@ abstract final class PiliScheme {
|
|||||||
if (res.isNotEmpty) {
|
if (res.isNotEmpty) {
|
||||||
final queryParameters = uri.queryParameters;
|
final queryParameters = uri.queryParameters;
|
||||||
final rootIdStr = queryParameters['comment_root_id'];
|
final rootIdStr = queryParameters['comment_root_id'];
|
||||||
|
final part = queryParameters['p'];
|
||||||
if (rootIdStr != null) {
|
if (rootIdStr != null) {
|
||||||
VideoReplyReplyPanel.toReply(
|
VideoReplyReplyPanel.toReply(
|
||||||
res.av ?? IdUtils.bv2av(res.bv!),
|
res.av ?? IdUtils.bv2av(res.bv!),
|
||||||
int.parse(rootIdStr),
|
int.parse(rootIdStr),
|
||||||
queryParameters['comment_secondary_id'],
|
queryParameters['comment_secondary_id'],
|
||||||
1,
|
1,
|
||||||
uri.replace(
|
uri.replace(query: part != null ? 'p=$part' : ''),
|
||||||
queryParameters: Map.of(queryParameters)
|
|
||||||
..remove('comment_root_id'),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -662,7 +660,7 @@ abstract final class PiliScheme {
|
|||||||
res.bv,
|
res.bv,
|
||||||
off: off,
|
off: off,
|
||||||
progress: queryParameters['dm_progress'],
|
progress: queryParameters['dm_progress'],
|
||||||
part: queryParameters['p'],
|
part: part,
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user