From 26821696678cf84ee19f4eb803807e41a7b56780 Mon Sep 17 00:00:00 2001 From: Arjun Roychowdhury Date: Wed, 23 Sep 2015 15:44:19 -0400 Subject: IOS9 patch to remove callout --- plugins/cordova-plugin-ios-longpress-fix/LICENSE | 21 ++++++++++++ plugins/cordova-plugin-ios-longpress-fix/README.md | 37 ++++++++++++++++++++ .../cordova-plugin-ios-longpress-fix/package.json | 37 ++++++++++++++++++++ .../cordova-plugin-ios-longpress-fix/plugin.xml | 38 +++++++++++++++++++++ .../screenshots/magnifying-glass.png | Bin 0 -> 67841 bytes .../src/ios/LongPressFix.h | 7 ++++ .../src/ios/LongPressFix.m | 35 +++++++++++++++++++ 7 files changed, 175 insertions(+) create mode 100644 plugins/cordova-plugin-ios-longpress-fix/LICENSE create mode 100644 plugins/cordova-plugin-ios-longpress-fix/README.md create mode 100644 plugins/cordova-plugin-ios-longpress-fix/package.json create mode 100755 plugins/cordova-plugin-ios-longpress-fix/plugin.xml create mode 100644 plugins/cordova-plugin-ios-longpress-fix/screenshots/magnifying-glass.png create mode 100755 plugins/cordova-plugin-ios-longpress-fix/src/ios/LongPressFix.h create mode 100755 plugins/cordova-plugin-ios-longpress-fix/src/ios/LongPressFix.m diff --git a/plugins/cordova-plugin-ios-longpress-fix/LICENSE b/plugins/cordova-plugin-ios-longpress-fix/LICENSE new file mode 100644 index 00000000..02389508 --- /dev/null +++ b/plugins/cordova-plugin-ios-longpress-fix/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Telerik + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/plugins/cordova-plugin-ios-longpress-fix/README.md b/plugins/cordova-plugin-ios-longpress-fix/README.md new file mode 100644 index 00000000..77f620a8 --- /dev/null +++ b/plugins/cordova-plugin-ios-longpress-fix/README.md @@ -0,0 +1,37 @@ +# Cordova iOS LongPress Fix Plugin +by [Eddy Verbruggen](http://twitter.com/eddyverbruggen) + + +## Description + +Apple thought it'd be nice to show a magnifying glass when longpressing the webview on iOS9. + +Don't like it? This plugin removes it! + + + + +## Installation + +Cordova CLI +``` +$ cordova plugin add cordova-plugin-ios-longpress-fix +``` + +PhoneGap Build +```xml + +``` + + +## Usage +It just works, and will proudly shout that at the XCode console when it does. + + +## Limitations +Currently only works with UIWebView, not WKWebView, but you should be able to +suppress the magnifying glass on WKWebView with a few lines of CSS. + + +## Future +I'm working with Cordova guys to get this in their distribution as standard. \ No newline at end of file diff --git a/plugins/cordova-plugin-ios-longpress-fix/package.json b/plugins/cordova-plugin-ios-longpress-fix/package.json new file mode 100644 index 00000000..085c61f9 --- /dev/null +++ b/plugins/cordova-plugin-ios-longpress-fix/package.json @@ -0,0 +1,37 @@ +{ + "name": "cordova-plugin-ios-longpress-fix", + "version": "1.0.1", + "description": "Suppresses the silly magnifying glass when longpressing your app on iOS9", + "cordova": { + "id": "cordova-plugin-ios-longpress-fix", + "platforms": [ + "ios" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/EddyVerbruggen/cordova-plugin-ios-longpress-fix.git" + }, + "keywords": [ + "LongPress", + "LongTap", + "Zoom", + "Magnification", + "Magnifying glass", + "iOS9", + "ecosystem:cordova", + "cordova-ios" + ], + "engines": [ + { + "name": "cordova", + "version": ">=3.0.0" + } + ], + "author": "Eddy Verbruggen (https://github.com/EddyVerbruggen)", + "license": "MIT", + "bugs": { + "url": "https://github.com/EddyVerbruggen/cordova-plugin-ios-longpress-fix/issues" + }, + "homepage": "https://github.com/EddyVerbruggen/cordova-plugin-ios-longpress-fix#readme" +} \ No newline at end of file diff --git a/plugins/cordova-plugin-ios-longpress-fix/plugin.xml b/plugins/cordova-plugin-ios-longpress-fix/plugin.xml new file mode 100755 index 00000000..228eec60 --- /dev/null +++ b/plugins/cordova-plugin-ios-longpress-fix/plugin.xml @@ -0,0 +1,38 @@ + + + + iOS LongPress Fix + + + Suppresses the silly magnifying glass when longpressing your app on iOS9 + + + Eddy Verbruggen + + MIT + + LongPress, LongTap, Zoom, Magnification, Magnifying glass, iOS9 + + https://github.com/EddyVerbruggen/cordova-plugin-ios-longpress-fix.git + + https://github.com/EddyVerbruggen/cordova-plugin-ios-longpress-fix/issues + + + + + + + + + + + + + + + + + + diff --git a/plugins/cordova-plugin-ios-longpress-fix/screenshots/magnifying-glass.png b/plugins/cordova-plugin-ios-longpress-fix/screenshots/magnifying-glass.png new file mode 100644 index 00000000..5ab7c70e Binary files /dev/null and b/plugins/cordova-plugin-ios-longpress-fix/screenshots/magnifying-glass.png differ diff --git a/plugins/cordova-plugin-ios-longpress-fix/src/ios/LongPressFix.h b/plugins/cordova-plugin-ios-longpress-fix/src/ios/LongPressFix.h new file mode 100755 index 00000000..132bb8ad --- /dev/null +++ b/plugins/cordova-plugin-ios-longpress-fix/src/ios/LongPressFix.h @@ -0,0 +1,7 @@ +#import + +@interface LongPressFix : CDVPlugin + +@property (nonatomic,strong) UILongPressGestureRecognizer *lpgr; + +@end \ No newline at end of file diff --git a/plugins/cordova-plugin-ios-longpress-fix/src/ios/LongPressFix.m b/plugins/cordova-plugin-ios-longpress-fix/src/ios/LongPressFix.m new file mode 100755 index 00000000..9f3d8521 --- /dev/null +++ b/plugins/cordova-plugin-ios-longpress-fix/src/ios/LongPressFix.m @@ -0,0 +1,35 @@ +#import "LongPressFix.h" + +@implementation LongPressFix + +- (void)pluginInitialize { + self.lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressGestures:)]; + self.lpgr.minimumPressDuration = 0.45f; + self.lpgr.allowableMovement = 100.0f; + + NSArray *views = self.webView.subviews; + if (views.count == 0) { + NSLog(@"No webview subviews found, not applying the longpress fix"); + return; + } + for (int i=0; i