You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2015/03/06 23:26:22 UTC
ios commit: Merge wkwebview with master
Repository: cordova-ios
Updated Branches:
refs/heads/wkwebview2 [created] 270002c40
Merge wkwebview with master
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/270002c4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/270002c4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/270002c4
Branch: refs/heads/wkwebview2
Commit: 270002c403755e47733d2c4aa96029fe3fdb79e6
Parents: 5fae77d b3c26fc
Author: Shazron Abdullah <sh...@gmail.com>
Authored: Fri Mar 6 14:24:11 2015 -0800
Committer: Shazron Abdullah <sh...@gmail.com>
Committed: Fri Mar 6 14:24:11 2015 -0800
----------------------------------------------------------------------
.jshintignore | 2 +
.jshintrc | 10 +
.travis.yml | 5 +-
CordovaLib/Classes/CDVAvailability.h | 6 +-
CordovaLib/Classes/CDVCommandDelegateImpl.m | 2 +-
CordovaLib/Classes/CDVCommandQueue.m | 15 +-
CordovaLib/Classes/CDVHandleOpenURL.h | 27 +
CordovaLib/Classes/CDVHandleOpenURL.m | 86 ++
CordovaLib/Classes/CDVInvokedUrlCommand.m | 4 +-
CordovaLib/Classes/CDVJSON.h | 14 +-
CordovaLib/Classes/CDVJSON.m | 58 +-
CordovaLib/Classes/CDVJSON_private.h | 31 +
CordovaLib/Classes/CDVJSON_private.m | 91 ++
CordovaLib/Classes/CDVPluginResult.m | 6 +-
CordovaLib/Classes/CDVViewController.m | 10 +-
CordovaLib/Classes/NSArray+Comparisons.h | 3 +-
CordovaLib/Classes/NSData+Base64.h | 9 +-
CordovaLib/Classes/NSData+Base64.m | 14 +-
CordovaLib/Classes/NSDictionary+Extensions.h | 26 +-
CordovaLib/Classes/UIDevice+Extensions.h | 3 +-
CordovaLib/CordovaLib.xcodeproj/project.pbxproj | 14 +
CordovaLib/VERSION | 2 +-
CordovaLib/cordova.js | 19 +-
RELEASENOTES.md | 29 +-
bin/apple_xcode_version | 6 +-
bin/check_reqs | 58 +-
bin/check_reqs.bat | 25 +
bin/create | 27 +-
bin/lib/check_reqs.js | 94 +++
bin/lib/create.js | 207 ++---
bin/lib/update.js | 72 --
bin/lib/versions.js | 99 ++-
bin/node_modules/.bin/shjs | 51 --
bin/node_modules/nopt/LICENSE | 23 +
bin/node_modules/nopt/lib/nopt.js | 414 ++++++++++
.../nopt/node_modules/abbrev/LICENSE | 23 +
.../nopt/node_modules/abbrev/abbrev.js | 62 ++
.../nopt/node_modules/abbrev/package.json | 31 +
bin/node_modules/nopt/package.json | 41 +
bin/node_modules/q/CONTRIBUTING.md | 40 -
bin/node_modules/q/README.md | 820 -------------------
.../q/benchmark/compare-with-callbacks.js | 71 --
bin/node_modules/q/benchmark/scenarios.js | 36 -
bin/node_modules/shelljs/.documentup.json | 6 -
bin/node_modules/shelljs/.npmignore | 1 -
bin/node_modules/shelljs/.travis.yml | 5 -
bin/node_modules/shelljs/README.md | 513 ------------
bin/node_modules/shelljs/bin/shjs | 51 --
bin/node_modules/shelljs/global.js | 3 -
bin/node_modules/shelljs/jshint.json | 4 -
bin/node_modules/shelljs/make.js | 48 --
bin/node_modules/shelljs/scripts/docs.js | 15 -
bin/node_modules/shelljs/scripts/run-tests.js | 50 --
bin/node_modules/which/LICENSE | 23 -
bin/node_modules/which/README.md | 5 -
bin/node_modules/which/bin/which | 14 -
bin/node_modules/which/package.json | 31 -
bin/node_modules/which/which.js | 104 ---
.../__PROJECT_NAME__/Classes/AppDelegate.m | 37 +-
.../project/__PROJECT_NAME__/config.xml | 19 +-
bin/templates/project/www/index.html | 11 +-
bin/templates/scripts/cordova/build | 92 +--
bin/templates/scripts/cordova/clean | 69 +-
bin/templates/scripts/cordova/clean.bat | 25 +
bin/templates/scripts/cordova/defaults.xml | 5 -
bin/templates/scripts/cordova/emulate | 59 --
bin/templates/scripts/cordova/lib/build.js | 148 ++++
bin/templates/scripts/cordova/lib/clean.js | 46 ++
.../scripts/cordova/lib/install-device | 52 --
.../scripts/cordova/lib/install-emulator | 91 --
bin/templates/scripts/cordova/lib/list-devices | 85 +-
.../scripts/cordova/lib/list-emulator-images | 92 ++-
.../scripts/cordova/lib/list-started-emulators | 81 +-
bin/templates/scripts/cordova/lib/run.js | 177 ++++
bin/templates/scripts/cordova/lib/spawn.js | 50 ++
bin/templates/scripts/cordova/run | 222 +----
bin/templates/scripts/cordova/run.bat | 25 +
bin/templates/scripts/cordova/version | 2 +-
bin/uncrustify.sh | 9 +-
bin/update | 22 +-
cordova-js-src/exec.js | 323 ++++++++
cordova-js-src/platform.js | 28 +
hooks/pre-commit | 5 -
package.json | 11 +-
tests/.jshintrc | 11 +
.../CDVPluginResultJSONSerializationTests.m | 16 +-
tests/CordovaLibTests/CordovaLibApp/config.xml | 1 -
tests/spec/cordovalib.spec.js | 2 +-
tests/spec/create.spec.js | 4 +
89 files changed, 2537 insertions(+), 2842 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/Classes/CDVAvailability.h
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVAvailability.h
index 1d37be0,71e20b9..5c5430f
--- a/CordovaLib/Classes/CDVAvailability.h
+++ b/CordovaLib/Classes/CDVAvailability.h
@@@ -87,5 -88,5 +88,6 @@@
#if CDV_ENABLE_EXEC_LOGGING
#define CDV_EXEC_LOG NSLog
#else
-- #define CDV_EXEC_LOG(...) do {} while (NO)
++ #define CDV_EXEC_LOG(...) do { \
++} while (NO)
#endif
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/Classes/CDVCommandDelegateImpl.m
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVCommandQueue.m
index e88ed61,48264b2..df218c5
--- a/CordovaLib/Classes/CDVCommandQueue.m
+++ b/CordovaLib/Classes/CDVCommandQueue.m
@@@ -73,12 -74,12 +74,12 @@@ static const double MAX_EXECUTION_TIME
[commandBatchHolder addObject:[batchJSON cdv_JSONObject]];
} else {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^() {
-- NSMutableArray* result = [batchJSON cdv_JSONObject];
-- @synchronized(commandBatchHolder) {
-- [commandBatchHolder addObject:result];
-- }
-- [self performSelectorOnMainThread:@selector(executePending) withObject:nil waitUntilDone:NO];
-- });
++ NSMutableArray* result = [batchJSON cdv_JSONObject];
++ @synchronized(commandBatchHolder) {
++ [commandBatchHolder addObject:result];
++ }
++ [self performSelectorOnMainThread:@selector(executePending) withObject:nil waitUntilDone:NO];
++ });
}
}
}
@@@ -159,7 -153,7 +160,7 @@@
NSString* commandJson = [jsonEntry cdv_JSONString];
static NSUInteger maxLogLength = 1024;
NSString* commandString = ([commandJson length] > maxLogLength) ?
-- [NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]] :
++ [NSString stringWithFormat : @"%@[...]", [commandJson substringToIndex:maxLogLength]] :
commandJson;
DLog(@"FAILED pluginJSON = %@", commandString);
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/Classes/CDVHandleOpenURL.h
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVHandleOpenURL.h
index 0000000,24f461f..f9b0bff
mode 000000,100644..100644
--- a/CordovaLib/Classes/CDVHandleOpenURL.h
+++ b/CordovaLib/Classes/CDVHandleOpenURL.h
@@@ -1,0 -1,28 +1,27 @@@
+ /*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+ #import "CDVPlugin.h"
+
+ @interface CDVHandleOpenURL : CDVPlugin
+
+ @property (nonatomic, strong) NSURL* url;
+ @property (nonatomic, assign) BOOL pageLoaded;
+
+ @end
-
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/Classes/CDVHandleOpenURL.m
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVHandleOpenURL.m
index 0000000,e5dcdd5..60fbf8e
mode 000000,100644..100644
--- a/CordovaLib/Classes/CDVHandleOpenURL.m
+++ b/CordovaLib/Classes/CDVHandleOpenURL.m
@@@ -1,0 -1,74 +1,86 @@@
+ /*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+ #import "CDVHandleOpenURL.h"
+ #import "CDV.h"
+
+ @implementation CDVHandleOpenURL
+
+ - (void)pluginInitialize
+ {
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationLaunchedWithUrl:) name:CDVPluginHandleOpenURLNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationPageDidLoad:) name:CDVPageDidLoadNotification object:nil];
+ }
+
+ - (void)applicationLaunchedWithUrl:(NSNotification*)notification
+ {
- NSURL *url = [notification object];
++ NSURL* url = [notification object];
++
+ self.url = url;
-
++
+ // warm-start handler
+ if (self.pageLoaded) {
+ [self processOpenUrl:self.url pageLoaded:YES];
+ self.url = nil;
+ }
+ }
+
+ - (void)applicationPageDidLoad:(NSNotification*)notification
+ {
+ // cold-start handler
-
++
+ self.pageLoaded = YES;
+
+ if (self.url) {
+ [self processOpenUrl:self.url pageLoaded:YES];
+ self.url = nil;
+ }
+ }
+
+ - (void)processOpenUrl:(NSURL*)url pageLoaded:(BOOL)pageLoaded
+ {
- if (!pageLoaded) {
- // query the webview for readystate
- NSString* readyState = [self.webView stringByEvaluatingJavaScriptFromString:@"document.readyState"];
- pageLoaded = [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"];
- }
-
- if (pageLoaded) {
++ __weak __typeof(self) weakSelf = self;
++
++ dispatch_block_t handleOpenUrl = ^(void) {
+ // calls into javascript global function 'handleOpenURL'
- NSString* jsString = [NSString stringWithFormat:@"document.addEventListener('deviceready',function(){if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}});", url];
- [self.webView stringByEvaluatingJavaScriptFromString:jsString];
++ NSString* jsString = [NSString stringWithFormat:@"document.addEventListener('deviceready',function(){if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}});", url];
++
++ [weakSelf.webViewEngine evaluateJavaScript:jsString completionHandler:nil];
++ };
++
++ if (!pageLoaded) {
++ NSString* jsString = @"document.readystate";
++ [self.webViewEngine evaluateJavaScript:jsString
++ completionHandler:^(id object, NSError* error) {
++ if ((error == nil) && [object isKindOfClass:[NSString class]]) {
++ NSString* readyState = (NSString*)object;
++ BOOL ready = [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"];
++ if (ready) {
++ handleOpenUrl();
++ } else {
++ self.url = url;
++ }
++ }
++ }];
+ } else {
- // save for when page has loaded
- self.url = url;
++ handleOpenUrl();
+ }
+ }
+
-
+ @end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/Classes/CDVPluginResult.m
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVPluginResult.m
index b8b69ed,13839ef..bba70e3
--- a/CordovaLib/Classes/CDVPluginResult.m
+++ b/CordovaLib/Classes/CDVPluginResult.m
@@@ -168,7 -168,7 +168,7 @@@ id messageFromMultipart(NSArray* theMes
{
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
self.status, @"status",
-- self.message ? self. message:[NSNull null], @"message",
++ self.message ? self.message : [NSNull null], @"message",
self.keepCallback, @"keepCallback",
nil];
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --cc CordovaLib/Classes/CDVViewController.m
index 21136f7,6d81e8d..946c723
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@@ -17,12 -17,16 +17,16 @@@
under the License.
*/
+ #import <objc/message.h>
#import "CDV.h"
-#import "CDVCommandDelegateImpl.h"
+#import "CDVUIWebViewDelegate.h"
+ #import "CDVConfigParser.h"
+ #import "CDVUserAgentUtil.h"
-#import "CDVWebViewDelegate.h"
+ #import <AVFoundation/AVFoundation.h>
+#import "NSDictionary+CordovaPreferences.h"
+ #import "CDVHandleOpenURL.h"
- #import <objc/message.h>
- #import <AVFoundation/AVFoundation.h>
+ #define degreesToRadian(x) (M_PI * (x) / 180.0)
@interface CDVViewController () {
NSInteger _userAgentLockToken;
@@@ -309,7 -460,9 +313,9 @@@
[CDVTimer stop:@"TotalPluginStartup"];
}
-
- [self registerPlugin:[[CDVHandleOpenURL alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVHandleOpenURL class])];
-
+
++ [self registerPlugin:[[CDVHandleOpenURL alloc] initWithWebViewEngine:self.webViewEngine] withClassName:NSStringFromClass([CDVHandleOpenURL class])];
++
// /////////////////
NSURL* appURL = [self appUrl];
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --cc CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index 2a13f87,c6b0f23..a1677ef
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@@ -214,7 -198,11 +221,9 @@@
888700D710922F56009987E8 /* Commands */ = {
isa = PBXGroup;
children = (
+ 30E6B8CB1A8ADD900025B9EE /* CDVHandleOpenURL.h */,
+ 30E6B8CC1A8ADD900025B9EE /* CDVHandleOpenURL.m */,
7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */,
- EBFF4DBA16D3FE2E008F452B /* CDVWebViewDelegate.m */,
- EBFF4DBB16D3FE2E008F452B /* CDVWebViewDelegate.h */,
301F2F2914F3C9CA003FE9FC /* CDV.h */,
3034979A1513D56A0090E688 /* CDVLocalStorage.h */,
3034979B1513D56A0090E688 /* CDVLocalStorage.m */,
@@@ -384,9 -370,9 +397,10 @@@
EB3B357D161F2A45003DBE7D /* CDVCommandDelegateImpl.m in Sources */,
F858FBC7166009A8007DA594 /* CDVConfigParser.m in Sources */,
30F3930C169F839700B22307 /* CDVJSON.m in Sources */,
+ 3083EB991A0AF23A00548672 /* CDVUIWebViewEngine.m in Sources */,
EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */,
+ 30E6B8CE1A8ADD900025B9EE /* CDVHandleOpenURL.m in Sources */,
- EBFF4DBC16D3FE2E008F452B /* CDVWebViewDelegate.m in Sources */,
+ EBFF4DBC16D3FE2E008F452B /* CDVUIWebViewDelegate.m in Sources */,
7E14B5A91705050A0032169E /* CDVTimer.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/270002c4/CordovaLib/cordova.js
----------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org