Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onLongPressHitTestResult bug #340

Closed
Karatla opened this issue May 12, 2020 · 3 comments
Closed

onLongPressHitTestResult bug #340

Karatla opened this issue May 12, 2020 · 3 comments

Comments

@Karatla
Copy link

Karatla commented May 12, 2020

first , thanks for your amazing webview plugin
and i am glad you keep to update this plugin
Flutter version: 1.17
Plugin version: 3.1.0

Current behavior: use onLongPressHitTestResult function

Steps to reproduce

InAppWebView(
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(),
),
initialUrl: url,
onLongPressHitTestResult: (InAppWebViewController inAppWebViewController,LongPressHitTestResult longPressHitTestResult){
print("longPressHitTestResult: ${longPressHitTestResult.extra}");
print("longPressHitTestResult: ${longPressHitTestResult.type}");
showModalBottomSheet(context: context, builder: (BuildContext context){
return Container(
height: 500,
child: Center(
child: Text("${longPressHitTestResult.extra}\n\n${longPressHitTestResult.type},style: TextStyle(fontSize: 10),),
),
);
});
},
)

Images

when i use long press , the longPressHitTestResult.type always return SRC_IMAGE_ANCHOR_TYPE which means always return an image url not website url
In my app like this:
WechatIMG124
but it should be like this :
WechatIMG125

In ios onLongPressHitTestResult return ios way like below:
Screen Shot 2020-05-12 at 10 18 09
i can not controll

@pichillilorenzo
Copy link
Owner

@Karatla I will investigate about it.
For iOS, to make it work, you need to disable allowsLinkPreview option, otherwise, the long press event will be captured by the system.

@Karatla
Copy link
Author

Karatla commented May 21, 2020

@Karatla I will investigate about it.
For iOS, to make it work, you need to disable allowsLinkPreview option, otherwise, the long press event will be captured by the system.

thank you

@pichillilorenzo
Copy link
Owner

To achieve that, you can use now:

var requestFocusNodeHrefResult =  = await inAppWebViewController.requestFocusNodeHref();
print(requestFocusNodeHrefResult.url);
print(requestFocusNodeHrefResult.title);

inside the onLongPressHitTestResult event.

This was referenced Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants