cordova-plugin-3dtouch icon indicating copy to clipboard operation
cordova-plugin-3dtouch copied to clipboard

Need help with .disableLinkPreview()

Open bhernez opened this issue 7 years ago • 2 comments

Hello,

I'm trying to use .disableLinkPreview to avoid the preview popup to be shown when the user press a "button" inside my app.

I'm using links (<a>) as buttons in our navigation bar and the toolbar, so it doesn't look good that the user presses the "button" and a preview popup appears. Eventhough I call the .disableLinkPreview() as soon as the page loads, the preview popup keeps appearing in all the links of the app.

Am I understanding correctly that disableLinkPreview() will avoid this preview popup to appear? or I'm misunderstanding its use?

I'm attaching a picture of what preview popup I'm referring to.

2017-06-06 04 56 27

cordova-plugin-3dtouch version: ~1.3.5 ios version: 10.3.2

bhernez avatar Jun 06 '17 22:06 bhernez

Probably the issue is at line 44 of ThreeDeeTouch.m.

UIWebView is deprecated, and new cordova versions use WKWebView. So statement like this is never run if you are using WKWebView:

if ([self.webView class] == [UIWebView class])

You have to add a new if statement in the function disableLinkPreview , for example:

if ([self.webView class] == [WKWebView class]) {
        WKWebView *w = (WKWebView*)self.webView;
        w.allowsLinkPreview = NO;
    }

and at the top of the file import WKWebView.

#import "CDVWKWebViewEngine.h"

The same issue is in enableLinkPreview().

zabuTNT avatar Jun 07 '19 13:06 zabuTNT

It makes sense, I haven't tried yet but I'll try to setup a small project in the weekend to try it out

bhernez avatar Jun 07 '19 13:06 bhernez