mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: in-app webview
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -230,9 +230,9 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: '用内置浏览器打开',
|
||||
tooltip: '浏览器打开',
|
||||
onPressed: () {
|
||||
Utils.handleWebview(url.startsWith('http') ? url : 'https:$url');
|
||||
Utils.inAppWebview(url.startsWith('http') ? url : 'https:$url');
|
||||
},
|
||||
icon: const Icon(Icons.open_in_browser_outlined, size: 19),
|
||||
),
|
||||
@@ -253,9 +253,9 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
onTap: () => {
|
||||
Utils.handleWebview(
|
||||
url.startsWith('http') ? url : 'https:$url')
|
||||
onTap: () {
|
||||
Utils.inAppWebview(
|
||||
url.startsWith('http') ? url : 'https:$url');
|
||||
},
|
||||
child: const Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -298,7 +298,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
IconButton(
|
||||
tooltip: '浏览器打开',
|
||||
onPressed: () {
|
||||
Utils.handleWebview(
|
||||
Utils.inAppWebview(
|
||||
'https://live.bilibili.com/h5/${_liveRoomController.roomId}',
|
||||
off: true,
|
||||
);
|
||||
|
||||
@@ -44,9 +44,18 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
|
||||
final uaType = Get.parameters['uaType'] ?? 'mob';
|
||||
final _titleStream = StreamController<String?>();
|
||||
final _progressStream = StreamController<double>();
|
||||
bool? _inApp;
|
||||
|
||||
InAppWebViewController? _webViewController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (Get.arguments is Map) {
|
||||
_inApp = Get.arguments['inApp'];
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_titleStream.close();
|
||||
@@ -235,6 +244,9 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
|
||||
}
|
||||
: null,
|
||||
shouldOverrideUrlLoading: (controller, navigationAction) async {
|
||||
if (_inApp == false) {
|
||||
return NavigationActionPolicy.ALLOW;
|
||||
}
|
||||
late String url = navigationAction.request.url.toString();
|
||||
bool hasMatch = await PiliScheme.routePush(
|
||||
navigationAction.request.url?.uriValue ?? Uri(),
|
||||
|
||||
Reference in New Issue
Block a user