fix push dyn

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-04 14:15:40 +08:00
parent daf5d302e3
commit 50efe1e24c

View File

@@ -207,7 +207,7 @@ class PiliScheme {
} }
return false; return false;
case 'opus': case 'opus':
bool hasMatch = await _onPushDynDetail(path, off); bool hasMatch = _onPushDynDetail(uri, off);
return hasMatch; return hasMatch;
case 'search': case 'search':
final keyword = uri.queryParameters['keyword']; final keyword = uri.queryParameters['keyword'];
@@ -385,7 +385,7 @@ class PiliScheme {
actions: [ actions: [
IconButton( IconButton(
tooltip: '前往', tooltip: '前往',
onPressed: () => _onPushDynDetail(path, off), onPressed: () => _onPushDynDetail(uri, off),
icon: const Icon(Icons.open_in_new), icon: const Icon(Icons.open_in_new),
), ),
], ],
@@ -410,11 +410,11 @@ class PiliScheme {
} }
return true; return true;
} else { } else {
bool hasMatch = await _onPushDynDetail(path, off); bool hasMatch = _onPushDynDetail(uri, off);
return hasMatch; return hasMatch;
} }
} else { } else {
bool hasMatch = await _onPushDynDetail(path, off); bool hasMatch = _onPushDynDetail(uri, off);
return hasMatch; return hasMatch;
} }
case 'album': case 'album':
@@ -542,7 +542,7 @@ class PiliScheme {
final String path = uri.path; final String path = uri.path;
if (host.contains('t.bilibili.com')) { if (host.contains('t.bilibili.com')) {
bool hasMatch = await _onPushDynDetail(path, off); bool hasMatch = _onPushDynDetail(uri, off);
if (!hasMatch) { if (!hasMatch) {
launchURL(); launchURL();
} }
@@ -610,7 +610,7 @@ class PiliScheme {
launchURL(); launchURL();
return false; return false;
case 'dynamic' || 'opus': case 'dynamic' || 'opus':
bool hasMatch = await _onPushDynDetail(path, off); bool hasMatch = _onPushDynDetail(uri, off);
if (!hasMatch) { if (!hasMatch) {
launchURL(); launchURL();
} }
@@ -817,10 +817,15 @@ class PiliScheme {
} }
} }
static Future<bool> _onPushDynDetail(path, off) async { static bool _onPushDynDetail(Uri uri, bool off) {
String? id = uriDigitRegExp.firstMatch(path)?.group(1); String? id = uriDigitRegExp.firstMatch(uri.path)?.group(1);
bool isRid = uri.queryParameters['type'] == '2';
if (id != null) { if (id != null) {
PageUtils.pushDynFromId(id: id, off: off); PageUtils.pushDynFromId(
id: isRid ? null : id,
rid: isRid ? id : null,
off: off,
);
return true; return true;
} }
return false; return false;