opt: parse scheme

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-23 11:05:30 +08:00
parent 09cebd70ae
commit 8e4ce07d19

View File

@@ -87,11 +87,12 @@ class PiliScheme {
return false; return false;
case 'video': case 'video':
// bilibili://video/12345678?dm_progress=123000&cid=12345678&dmid=12345678 // bilibili://video/12345678?dm_progress=123000&cid=12345678&dmid=12345678
if (uri.queryParameters['comment_root_id'] != null) { final queryParameters = uri.queryParameters;
if (queryParameters['comment_root_id'] != null) {
// to check // to check
// to video reply // to video reply
String? oid = RegExp(r'/(\d+)').firstMatch(path)?.group(1); String? oid = RegExp(r'/(\d+)').firstMatch(path)?.group(1);
int? rpid = int.tryParse(uri.queryParameters['comment_root_id']!); int? rpid = int.tryParse(queryParameters['comment_root_id']!);
if (oid != null && rpid != null) { if (oid != null && rpid != null) {
Get.to( Get.to(
() => Scaffold( () => Scaffold(
@@ -131,16 +132,15 @@ class PiliScheme {
.firstMatch(path) .firstMatch(path)
?.group(1); ?.group(1);
if (aid != null || bvid != null) { if (aid != null || bvid != null) {
if (uri.queryParameters['cid'] != null) { if (queryParameters['cid'] != null) {
bvid ??= IdUtils.av2bv(int.parse(aid!)); bvid ??= IdUtils.av2bv(int.parse(aid!));
Utils.toDupNamed( Utils.toDupNamed(
'/video?bvid=$bvid&cid=${uri.queryParameters['cid']}', '/video?bvid=$bvid&cid=${queryParameters['cid']}',
arguments: { arguments: {
'pic': null, 'pic': null,
'heroTag': Utils.makeHeroTag(aid), 'heroTag': Utils.makeHeroTag(aid),
if (uri.queryParameters['dm_progress'] != null) if (queryParameters['dm_progress'] != null)
'progress': 'progress': int.tryParse(queryParameters['dm_progress']!),
int.tryParse(uri.queryParameters['dm_progress']!),
}, },
off: off, off: off,
); );
@@ -149,7 +149,7 @@ class PiliScheme {
aid != null ? int.parse(aid) : null, aid != null ? int.parse(aid) : null,
bvid, bvid,
off: off, off: off,
progress: uri.queryParameters['dm_progress'], progress: queryParameters['dm_progress'],
); );
} }
return true; return true;
@@ -247,10 +247,10 @@ class PiliScheme {
return false; return false;
case 'following': case 'following':
if (path.startsWith("/detail/")) { if (path.startsWith("/detail/")) {
if (uri.queryParameters['comment_root_id'] != null) { final commentRootId = uri.queryParameters['comment_root_id'];
if (commentRootId != null) {
String? oid = RegExp(r'/(\d+)').firstMatch(path)?.group(1); String? oid = RegExp(r'/(\d+)').firstMatch(path)?.group(1);
int? rpid = int? rpid = int.tryParse(commentRootId);
int.tryParse(uri.queryParameters['comment_root_id']!);
if (oid != null && rpid != null) { if (oid != null && rpid != null) {
Get.to( Get.to(
() => Scaffold( () => Scaffold(