mirror of
https://github.com/scratchfoundation/scratchjr.git
synced 2024-11-25 00:28:20 -05:00
Merge pull request #330 from LLK/fix-wkwebkit-context-menu
updated method of disabling long press in wkwebkit
This commit is contained in:
commit
203a4eeec4
1 changed files with 1 additions and 22 deletions
|
@ -118,27 +118,6 @@ NSDate *startDate;
|
|||
startDate = [NSDate date];
|
||||
}
|
||||
|
||||
// Disables iOS 9 webview touch tooltip by disabling the long-press gesture recognizer in subviews
|
||||
// Thanks to Rye:
|
||||
// http://stackoverflow.com/questions/32687368/how-to-completely-disable-magnifying-glass-for-uiwebview-ios9
|
||||
- (void) disableWebViewLongPressGestures:(WKWebView *)webview {
|
||||
for(id subView in webview.subviews) {
|
||||
if([subView isKindOfClass:[UIScrollView class]]) {
|
||||
UIScrollView *scrollView = (UIScrollView *)subView;
|
||||
for(id ssView in scrollView.subviews) {
|
||||
if([NSStringFromClass([ssView class]) isEqualToString:@"UIWebBrowserView"]) {
|
||||
for(UIGestureRecognizer *gs in [ssView gestureRecognizers]) {
|
||||
if ([gs isKindOfClass:[UILongPressGestureRecognizer class]])
|
||||
{
|
||||
gs.enabled = NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) receiveProject:(NSString *)project{
|
||||
NSString *callback = [NSString stringWithFormat:@"OS.loadProjectFromSjr('%@');", project];
|
||||
WKWebView *webview = [ViewController webview];
|
||||
|
@ -171,7 +150,7 @@ NSDate *startDate;
|
|||
|
||||
- (void) webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
|
||||
[webview evaluateJavaScript:@"window.tablet = window.webkit.messageHandlers.jsBridge" completionHandler:nil];
|
||||
[self disableWebViewLongPressGestures:webView];
|
||||
[webview evaluateJavaScript:@"document.body.style.webkitTouchCallout='none';" completionHandler:nil];
|
||||
|
||||
NSString *debugChoice =[[NSUserDefaults standardUserDefaults] stringForKey:@"debugstate"];
|
||||
|
||||
|
|
Loading…
Reference in a new issue