mod: webview jump

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-19 11:39:13 +08:00
parent 316a9809e4
commit 15b949bb9c
3 changed files with 18 additions and 9 deletions

View File

@@ -5,7 +5,6 @@ import 'package:PiliPlus/common/widgets/video_card_h.dart';
import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models/common/tab_type.dart'; import 'package:PiliPlus/models/common/tab_type.dart';
import 'package:PiliPlus/pages/rank/view.dart'; import 'package:PiliPlus/pages/rank/view.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -129,9 +128,13 @@ class _HotPageState extends State<HotPage> with AutomaticKeepAliveClientMixin {
'http://i0.hdslb.com/bfs/archive/552ebe8c4794aeef30ebd1568b59ad35f15e21ad.png', 'http://i0.hdslb.com/bfs/archive/552ebe8c4794aeef30ebd1568b59ad35f15e21ad.png',
title: '每周必看', title: '每周必看',
onTap: () { onTap: () {
Utils.handleWebview( Get.toNamed(
'https://www.bilibili.com/h5/weekly-recommend', '/webview',
inApp: true, parameters: {
'url':
'https://www.bilibili.com/h5/weekly-recommend'
},
arguments: {'off': false},
); );
}, },
), ),
@@ -140,9 +143,13 @@ class _HotPageState extends State<HotPage> with AutomaticKeepAliveClientMixin {
'http://i0.hdslb.com/bfs/archive/3693ec9335b78ca57353ac0734f36a46f3d179a9.png', 'http://i0.hdslb.com/bfs/archive/3693ec9335b78ca57353ac0734f36a46f3d179a9.png',
title: '入站必刷', title: '入站必刷',
onTap: () { onTap: () {
Utils.handleWebview( Get.toNamed(
'https://www.bilibili.com/h5/good-history', '/webview',
inApp: true, parameters: {
'url':
'https://www.bilibili.com/h5/good-history'
},
arguments: {'off': false},
); );
}, },
), ),

View File

@@ -45,6 +45,7 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
final _titleStream = StreamController<String?>(); final _titleStream = StreamController<String?>();
final _progressStream = StreamController<double>(); final _progressStream = StreamController<double>();
bool? _inApp; bool? _inApp;
bool? _off;
InAppWebViewController? _webViewController; InAppWebViewController? _webViewController;
@@ -53,6 +54,7 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
super.initState(); super.initState();
if (Get.arguments is Map) { if (Get.arguments is Map) {
_inApp = Get.arguments['inApp']; _inApp = Get.arguments['inApp'];
_off = Get.arguments['off'];
} }
} }
@@ -251,7 +253,7 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
bool hasMatch = await PiliScheme.routePush( bool hasMatch = await PiliScheme.routePush(
navigationAction.request.url?.uriValue ?? Uri(), navigationAction.request.url?.uriValue ?? Uri(),
selfHandle: true, selfHandle: true,
off: true, off: _off ?? true,
); );
// debugPrint('webview: [$url], [$hasMatch]'); // debugPrint('webview: [$url], [$hasMatch]');
if (hasMatch) { if (hasMatch) {

View File

@@ -413,7 +413,7 @@ class PiliScheme {
.firstMatch(path) .firstMatch(path)
?.group(1); ?.group(1);
if (bvid != null) { if (bvid != null) {
videoPush(null, bvid, off: false); videoPush(null, bvid, off: off);
return true; return true;
} }
launchURL(); launchURL();