mod: 评论链接跳转视频
This commit is contained in:
@ -56,14 +56,20 @@ class SearchPanelController extends GetxController {
|
|||||||
// 匹配输入内容,如果是AV、BV号且有结果 直接跳转详情页
|
// 匹配输入内容,如果是AV、BV号且有结果 直接跳转详情页
|
||||||
Map matchRes = IdUtils.matchAvorBv(input: keyword);
|
Map matchRes = IdUtils.matchAvorBv(input: keyword);
|
||||||
List matchKeys = matchRes.keys.toList();
|
List matchKeys = matchRes.keys.toList();
|
||||||
if (matchKeys.isNotEmpty && searchType == SearchType.video) {
|
String bvid = resultList.first.bvid;
|
||||||
String bvid = resultList.first.bvid;
|
// keyword 可能输入纯数字
|
||||||
int aid = resultList.first.aid;
|
int aid = resultList.first.aid;
|
||||||
|
if (matchKeys.isNotEmpty && searchType == SearchType.video ||
|
||||||
|
aid.toString() == keyword) {
|
||||||
String heroTag = Utils.makeHeroTag(bvid);
|
String heroTag = Utils.makeHeroTag(bvid);
|
||||||
|
|
||||||
int cid = await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
int cid = await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
||||||
if (matchKeys.first == 'BV' && matchRes[matchKeys.first] == bvid ||
|
if (matchKeys.isNotEmpty &&
|
||||||
matchKeys.first == 'AV' && matchRes[matchKeys.first] == aid) {
|
matchKeys.first == 'BV' &&
|
||||||
|
matchRes[matchKeys.first] == bvid ||
|
||||||
|
matchKeys.isNotEmpty &&
|
||||||
|
matchKeys.first == 'AV' &&
|
||||||
|
matchRes[matchKeys.first] == aid ||
|
||||||
|
aid.toString() == keyword) {
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
'/video?bvid=$bvid&cid=$cid',
|
'/video?bvid=$bvid&cid=$cid',
|
||||||
arguments: {'videoItem': resultList.first, 'heroTag': heroTag},
|
arguments: {'videoItem': resultList.first, 'heroTag': heroTag},
|
||||||
|
@ -602,9 +602,26 @@ InlineSpan buildContent(
|
|||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
recognizer: TapGestureRecognizer()
|
recognizer: TapGestureRecognizer()
|
||||||
..onTap = () => Get.toNamed('/searchResult', parameters: {
|
..onTap = () {
|
||||||
'keyword': content.jumpUrl[matchStr]['title']
|
String appUrlSchema =
|
||||||
}),
|
content.jumpUrl[matchStr]['app_url_schema'];
|
||||||
|
if (appUrlSchema == '') {
|
||||||
|
Get.toNamed(
|
||||||
|
'/webview',
|
||||||
|
parameters: {
|
||||||
|
'url': matchStr,
|
||||||
|
'type': 'url',
|
||||||
|
'pageTitle': ''
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if (appUrlSchema.startsWith('bilibili://search')) {
|
||||||
|
Get.toNamed('/searchResult', parameters: {
|
||||||
|
'keyword': content.jumpUrl[matchStr]['title']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
spanChilds.add(
|
spanChilds.add(
|
||||||
|
@ -63,6 +63,13 @@ class WebviewController extends GetxController {
|
|||||||
onWebResourceError: (WebResourceError error) {},
|
onWebResourceError: (WebResourceError error) {},
|
||||||
onNavigationRequest: (NavigationRequest request) {
|
onNavigationRequest: (NavigationRequest request) {
|
||||||
if (request.url.startsWith('bilibili://')) {
|
if (request.url.startsWith('bilibili://')) {
|
||||||
|
if (request.url.startsWith('bilibili://video/')) {
|
||||||
|
String str = Uri.parse(request.url).pathSegments[0];
|
||||||
|
Get.offAndToNamed(
|
||||||
|
'/searchResult',
|
||||||
|
parameters: {'keyword': str},
|
||||||
|
);
|
||||||
|
}
|
||||||
return NavigationDecision.prevent;
|
return NavigationDecision.prevent;
|
||||||
}
|
}
|
||||||
return NavigationDecision.navigate;
|
return NavigationDecision.navigate;
|
||||||
|
Reference in New Issue
Block a user