From 8fa59f8f582640f15789905ca374dab64c9212d0 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 24 Sep 2023 01:20:34 +0800 Subject: [PATCH 1/3] fix: issues #135 --- lib/pages/video/detail/introduction/widgets/season.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pages/video/detail/introduction/widgets/season.dart b/lib/pages/video/detail/introduction/widgets/season.dart index 3f3a1475..a72b381a 100644 --- a/lib/pages/video/detail/introduction/widgets/season.dart +++ b/lib/pages/video/detail/introduction/widgets/season.dart @@ -58,6 +58,7 @@ class _SeasonPanelState extends State { ); currentIndex = i; Get.back(); + setState(() {}); } @override From 2fd23aa20def80ae6836867eacc8787bb3d4af04 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Wed, 27 Sep 2023 23:38:00 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E6=90=9C=E7=B4=A2=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E6=98=BE=E7=A4=BA=E4=B9=B1=E7=A0=81=20issues?= =?UTF-8?q?=20#165?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/utils/em.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/utils/em.dart b/lib/utils/em.dart index 68eed977..8dba2c13 100644 --- a/lib/utils/em.dart +++ b/lib/utils/em.dart @@ -19,6 +19,10 @@ class Em { return regCate(matchStr); }, onNonMatch: (String str) { if (str != '') { + str = str + .replaceAll('>', '>') + .replaceAll('"', '"') + .replaceAll(''', "'"); Map map = {'type': 'text', 'text': str}; res.add(map); } From 10965fae7392695d417d84b4c899e1a0bf8599f7 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Fri, 29 Sep 2023 23:13:28 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E8=AF=84=E8=AE=BA=E5=8C=BA=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E9=93=BE=E6=8E=A5=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/reply/widgets/reply_item.dart | 34 +++++++++++++------ lib/pages/webview/controller.dart | 15 +++++++- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index 76e63e72..0c2328fc 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -11,6 +11,7 @@ import 'package:pilipala/pages/preview/index.dart'; import 'package:pilipala/pages/video/detail/index.dart'; import 'package:pilipala/pages/video/detail/replyNew/index.dart'; import 'package:pilipala/utils/feed_back.dart'; +import 'package:pilipala/utils/id_utils.dart'; import 'package:pilipala/utils/storage.dart'; import 'package:pilipala/utils/utils.dart'; @@ -667,10 +668,11 @@ InlineSpan buildContent( // 匹配 jumpUrl String matchUrl = matchMember; if (content.jumpUrl.isNotEmpty && hasMatchMember) { - List urlKeys = content.jumpUrl.keys.toList(); + List urlKeys = content.jumpUrl.keys.toList().reversed.toList(); matchUrl = matchMember.splitMapJoin( /// RegExp.escape() 转义特殊字符 - RegExp(RegExp.escape(urlKeys.join("|"))), + RegExp(urlKeys.map((key) => key).join("|")), + // RegExp(RegExp.escape(urlKeys.join("|"))), onMatch: (Match match) { String matchStr = match[0]!; String appUrlSchema = content.jumpUrl[matchStr]['app_url_schema']; @@ -688,14 +690,26 @@ InlineSpan buildContent( recognizer: TapGestureRecognizer() ..onTap = () { if (appUrlSchema == '') { - Get.toNamed( - '/webview', - parameters: { - 'url': matchStr, - 'type': 'url', - 'pageTitle': '' - }, - ); + String str = Uri.parse(matchStr).pathSegments[0]; + Map matchRes = IdUtils.matchAvorBv(input: str); + List matchKeys = matchRes.keys.toList(); + if (matchKeys.isNotEmpty) { + if (matchKeys.first == 'BV') { + Get.toNamed( + '/searchResult', + parameters: {'keyword': matchRes['BV']}, + ); + } + } else { + Get.toNamed( + '/webview', + parameters: { + 'url': matchStr, + 'type': 'url', + 'pageTitle': '' + }, + ); + } } else { if (appUrlSchema.startsWith('bilibili://search') && enableWordRe) { diff --git a/lib/pages/webview/controller.dart b/lib/pages/webview/controller.dart index 9cc7817d..fae5a5fc 100644 --- a/lib/pages/webview/controller.dart +++ b/lib/pages/webview/controller.dart @@ -11,6 +11,7 @@ import 'package:pilipala/pages/home/index.dart'; import 'package:pilipala/pages/media/index.dart'; import 'package:pilipala/utils/cookie.dart'; import 'package:pilipala/utils/event_bus.dart'; +import 'package:pilipala/utils/id_utils.dart'; import 'package:pilipala/utils/login.dart'; import 'package:pilipala/utils/storage.dart'; import 'package:webview_flutter/webview_flutter.dart'; @@ -50,7 +51,19 @@ class WebviewController extends GetxController { // Update loading bar. loadProgress.value = progress; }, - onPageStarted: (String url) {}, + onPageStarted: (String url) { + String str = Uri.parse(url).pathSegments[0]; + Map matchRes = IdUtils.matchAvorBv(input: str); + List matchKeys = matchRes.keys.toList(); + if (matchKeys.isNotEmpty) { + if (matchKeys.first == 'BV') { + Get.offAndToNamed( + '/searchResult', + parameters: {'keyword': matchRes['BV']}, + ); + } + } + }, // 加载完成 onUrlChange: (UrlChange urlChange) async { loadShow.value = false;