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 2013/03/06 20:24:09 UTC

[2/2] mac commit: Added classes from iOS (to refactor), ARC enabled the code.

Updated Branches:
  refs/heads/plugin-enable [created] b3bdeb8d3


Added classes from iOS (to refactor), ARC enabled the code.


Project: http://git-wip-us.apache.org/repos/asf/cordova-osx/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-osx/commit/b3bdeb8d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-osx/tree/b3bdeb8d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-osx/diff/b3bdeb8d

Branch: refs/heads/plugin-enable
Commit: b3bdeb8d3e67c088f04d115c3785dd38b658483d
Parents: e0f2cdd
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed Mar 6 11:23:54 2013 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Wed Mar 6 11:23:54 2013 -0800

----------------------------------------------------------------------
 CordovaMac/CordovaMac.xcodeproj/project.pbxproj    |   88 +++++
 CordovaMac/CordovaMac/AppDelegate.h                |    4 +-
 CordovaMac/CordovaMac/CDVBridge.h                  |    2 +-
 CordovaMac/CordovaMac/Commands/CDV.h               |   27 ++
 CordovaMac/CordovaMac/Commands/CDVAvailability.h   |   53 +++
 .../CordovaMac/Commands/CDVCommandDelegate.h       |   55 +++
 .../CordovaMac/Commands/CDVCommandDelegateImpl.h   |   32 ++
 .../CordovaMac/Commands/CDVCommandDelegateImpl.m   |  160 ++++++++
 CordovaMac/CordovaMac/Commands/CDVCommandQueue.h   |   40 ++
 CordovaMac/CordovaMac/Commands/CDVCommandQueue.m   |  164 +++++++++
 CordovaMac/CordovaMac/Commands/CDVConnection.h     |   34 ++
 CordovaMac/CordovaMac/Commands/CDVConnection.m     |  125 +++++++
 CordovaMac/CordovaMac/Commands/CDVDebug.h          |   25 ++
 CordovaMac/CordovaMac/Commands/CDVDevice.h         |   29 ++
 CordovaMac/CordovaMac/Commands/CDVDevice.m         |   84 +++++
 .../CordovaMac/Commands/CDVInvokedUrlCommand.h     |   52 +++
 .../CordovaMac/Commands/CDVInvokedUrlCommand.m     |  140 +++++++
 CordovaMac/CordovaMac/Commands/CDVJSON.h           |   30 ++
 CordovaMac/CordovaMac/Commands/CDVJSON.m           |   77 ++++
 CordovaMac/CordovaMac/Commands/CDVPlugin.h         |   64 ++++
 CordovaMac/CordovaMac/Commands/CDVPlugin.m         |  148 ++++++++
 CordovaMac/CordovaMac/Commands/CDVPluginResult.h   |   65 ++++
 CordovaMac/CordovaMac/Commands/CDVPluginResult.m   |  224 +++++++++++
 CordovaMac/CordovaMac/Commands/CDVReachability.h   |   85 +++++
 CordovaMac/CordovaMac/Commands/CDVReachability.m   |  261 +++++++++++++
 CordovaMac/CordovaMac/Commands/CDVSound.m          |    2 +-
 .../CordovaMac/Commands/Utils/NSData+Base64.h      |   33 ++
 .../CordovaMac/Commands/Utils/NSData+Base64.m      |  286 +++++++++++++++
 .../Commands/Utils/NSMutableArray+QueueAdditions.h |   29 ++
 .../Commands/Utils/NSMutableArray+QueueAdditions.m |   58 +++
 CordovaMac/CordovaMac/ContentView.h                |    4 +-
 CordovaMac/CordovaMac/ContentView.m                |    2 +-
 CordovaMac/CordovaMac/Utils.m                      |   30 +-
 CordovaMac/CordovaMac/WebViewDelegate.h            |    8 +-
 CordovaMacScreenShot.png                           |  Bin 349316 -> 0 bytes
 35 files changed, 2494 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac.xcodeproj/project.pbxproj b/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
index 77a119f..72d72e1 100644
--- a/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
+++ b/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
@@ -23,6 +23,18 @@
 		48B4353B152E5EC300906A36 /* ContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 48B4353A152E5EC300906A36 /* ContentView.m */; };
 		48B4353E152E5FE200906A36 /* WebViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 48B4353D152E5FE200906A36 /* WebViewDelegate.m */; };
 		48B43544152E60A300906A36 /* Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 48B43543152E60A300906A36 /* Utils.m */; };
+		7E79274716E7BE63002E20B9 /* CDVConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E79274416E7BE63002E20B9 /* CDVConnection.m */; };
+		7E79274816E7BE63002E20B9 /* CDVDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E79274616E7BE63002E20B9 /* CDVDevice.m */; };
+		7E79274D16E7BF26002E20B9 /* CDVPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E79274C16E7BF26002E20B9 /* CDVPlugin.m */; };
+		7E79275216E7BF48002E20B9 /* CDVPluginResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E79274F16E7BF48002E20B9 /* CDVPluginResult.m */; };
+		7E79275316E7BF48002E20B9 /* CDVReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E79275116E7BF48002E20B9 /* CDVReachability.m */; };
+		7E79275616E7BF6F002E20B9 /* CDVJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E79275516E7BF6F002E20B9 /* CDVJSON.m */; };
+		7E79275B16E7BFFB002E20B9 /* NSData+Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E79275A16E7BFFB002E20B9 /* NSData+Base64.m */; };
+		7E79275E16E7C118002E20B9 /* CDVInvokedUrlCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E79275D16E7C117002E20B9 /* CDVInvokedUrlCommand.m */; };
+		7E79276116E7C21F002E20B9 /* NSMutableArray+QueueAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E79276016E7C21F002E20B9 /* NSMutableArray+QueueAdditions.m */; };
+		7E79276516E7C244002E20B9 /* CDVCommandDelegateImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E79276416E7C244002E20B9 /* CDVCommandDelegateImpl.m */; };
+		7E79276816E7C27A002E20B9 /* CDVCommandQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E79276716E7C279002E20B9 /* CDVCommandQueue.m */; };
+		7E79276A16E7C900002E20B9 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E79276916E7C8FF002E20B9 /* SystemConfiguration.framework */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
@@ -57,6 +69,33 @@
 		48B43542152E60A300906A36 /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utils.h; sourceTree = "<group>"; };
 		48B43543152E60A300906A36 /* Utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Utils.m; sourceTree = "<group>"; };
 		48B43545152E60E500906A36 /* Constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = "<group>"; };
+		7E79274316E7BE63002E20B9 /* CDVConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVConnection.h; sourceTree = "<group>"; };
+		7E79274416E7BE63002E20B9 /* CDVConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVConnection.m; sourceTree = "<group>"; };
+		7E79274516E7BE63002E20B9 /* CDVDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVDevice.h; sourceTree = "<group>"; };
+		7E79274616E7BE63002E20B9 /* CDVDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVDevice.m; sourceTree = "<group>"; };
+		7E79274916E7BE8C002E20B9 /* CDV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDV.h; sourceTree = "<group>"; };
+		7E79274A16E7BECC002E20B9 /* CDVAvailability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVAvailability.h; sourceTree = "<group>"; };
+		7E79274B16E7BF26002E20B9 /* CDVPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVPlugin.h; sourceTree = "<group>"; };
+		7E79274C16E7BF26002E20B9 /* CDVPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVPlugin.m; sourceTree = "<group>"; };
+		7E79274E16E7BF48002E20B9 /* CDVPluginResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVPluginResult.h; sourceTree = "<group>"; };
+		7E79274F16E7BF48002E20B9 /* CDVPluginResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVPluginResult.m; sourceTree = "<group>"; };
+		7E79275016E7BF48002E20B9 /* CDVReachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVReachability.h; sourceTree = "<group>"; };
+		7E79275116E7BF48002E20B9 /* CDVReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVReachability.m; sourceTree = "<group>"; };
+		7E79275416E7BF6F002E20B9 /* CDVJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVJSON.h; sourceTree = "<group>"; };
+		7E79275516E7BF6F002E20B9 /* CDVJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVJSON.m; sourceTree = "<group>"; };
+		7E79275716E7BFB9002E20B9 /* CDVDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVDebug.h; sourceTree = "<group>"; };
+		7E79275916E7BFFB002E20B9 /* NSData+Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Base64.h"; sourceTree = "<group>"; };
+		7E79275A16E7BFFB002E20B9 /* NSData+Base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Base64.m"; sourceTree = "<group>"; };
+		7E79275C16E7C117002E20B9 /* CDVInvokedUrlCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVInvokedUrlCommand.h; sourceTree = "<group>"; };
+		7E79275D16E7C117002E20B9 /* CDVInvokedUrlCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVInvokedUrlCommand.m; sourceTree = "<group>"; };
+		7E79275F16E7C21F002E20B9 /* NSMutableArray+QueueAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+QueueAdditions.h"; sourceTree = "<group>"; };
+		7E79276016E7C21F002E20B9 /* NSMutableArray+QueueAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+QueueAdditions.m"; sourceTree = "<group>"; };
+		7E79276216E7C243002E20B9 /* CDVCommandDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVCommandDelegate.h; sourceTree = "<group>"; };
+		7E79276316E7C243002E20B9 /* CDVCommandDelegateImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVCommandDelegateImpl.h; sourceTree = "<group>"; };
+		7E79276416E7C244002E20B9 /* CDVCommandDelegateImpl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVCommandDelegateImpl.m; sourceTree = "<group>"; };
+		7E79276616E7C279002E20B9 /* CDVCommandQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVCommandQueue.h; sourceTree = "<group>"; };
+		7E79276716E7C279002E20B9 /* CDVCommandQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVCommandQueue.m; sourceTree = "<group>"; };
+		7E79276916E7C8FF002E20B9 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -64,6 +103,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				7E79276A16E7C900002E20B9 /* SystemConfiguration.framework in Frameworks */,
 				48B43536152E5E4100906A36 /* WebKit.framework in Frameworks */,
 				48B43519152E5E3500906A36 /* Cocoa.framework in Frameworks */,
 			);
@@ -75,12 +115,35 @@
 		30513C00154B6DED002B79B6 /* Commands */ = {
 			isa = PBXGroup;
 			children = (
+				7E79275816E7BFFB002E20B9 /* Utils */,
+				7E79276616E7C279002E20B9 /* CDVCommandQueue.h */,
+				7E79276716E7C279002E20B9 /* CDVCommandQueue.m */,
+				7E79276216E7C243002E20B9 /* CDVCommandDelegate.h */,
+				7E79276316E7C243002E20B9 /* CDVCommandDelegateImpl.h */,
+				7E79276416E7C244002E20B9 /* CDVCommandDelegateImpl.m */,
+				7E79275C16E7C117002E20B9 /* CDVInvokedUrlCommand.h */,
+				7E79275D16E7C117002E20B9 /* CDVInvokedUrlCommand.m */,
+				7E79275716E7BFB9002E20B9 /* CDVDebug.h */,
+				7E79275416E7BF6F002E20B9 /* CDVJSON.h */,
+				7E79275516E7BF6F002E20B9 /* CDVJSON.m */,
+				7E79274E16E7BF48002E20B9 /* CDVPluginResult.h */,
+				7E79274F16E7BF48002E20B9 /* CDVPluginResult.m */,
+				7E79275016E7BF48002E20B9 /* CDVReachability.h */,
+				7E79275116E7BF48002E20B9 /* CDVReachability.m */,
+				7E79274B16E7BF26002E20B9 /* CDVPlugin.h */,
+				7E79274C16E7BF26002E20B9 /* CDVPlugin.m */,
+				7E79274A16E7BECC002E20B9 /* CDVAvailability.h */,
+				7E79274316E7BE63002E20B9 /* CDVConnection.h */,
+				7E79274416E7BE63002E20B9 /* CDVConnection.m */,
+				7E79274516E7BE63002E20B9 /* CDVDevice.h */,
+				7E79274616E7BE63002E20B9 /* CDVDevice.m */,
 				30513C07154B6F56002B79B6 /* CDVConsole.h */,
 				30513C08154B6F56002B79B6 /* CDVConsole.m */,
 				30513C01154B6DED002B79B6 /* CDVNotification.h */,
 				30513C02154B6DED002B79B6 /* CDVNotification.m */,
 				30513C03154B6DED002B79B6 /* CDVSound.h */,
 				30513C04154B6DED002B79B6 /* CDVSound.m */,
+				7E79274916E7BE8C002E20B9 /* CDV.h */,
 			);
 			path = Commands;
 			sourceTree = "<group>";
@@ -88,6 +151,7 @@
 		48B43509152E5E3500906A36 = {
 			isa = PBXGroup;
 			children = (
+				7E79276916E7C8FF002E20B9 /* SystemConfiguration.framework */,
 				48B43537152E5E6B00906A36 /* www */,
 				48B4351E152E5E3500906A36 /* CordovaMac */,
 				48B43517152E5E3500906A36 /* Frameworks */,
@@ -157,6 +221,17 @@
 			name = "Supporting Files";
 			sourceTree = "<group>";
 		};
+		7E79275816E7BFFB002E20B9 /* Utils */ = {
+			isa = PBXGroup;
+			children = (
+				7E79275F16E7C21F002E20B9 /* NSMutableArray+QueueAdditions.h */,
+				7E79276016E7C21F002E20B9 /* NSMutableArray+QueueAdditions.m */,
+				7E79275916E7BFFB002E20B9 /* NSData+Base64.h */,
+				7E79275A16E7BFFB002E20B9 /* NSData+Base64.m */,
+			);
+			path = Utils;
+			sourceTree = "<group>";
+		};
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
@@ -233,6 +308,17 @@
 				30513C06154B6DED002B79B6 /* CDVSound.m in Sources */,
 				30513C09154B6F56002B79B6 /* CDVConsole.m in Sources */,
 				30FC415116E5845A004E6F35 /* CDVBridge.m in Sources */,
+				7E79274716E7BE63002E20B9 /* CDVConnection.m in Sources */,
+				7E79274816E7BE63002E20B9 /* CDVDevice.m in Sources */,
+				7E79274D16E7BF26002E20B9 /* CDVPlugin.m in Sources */,
+				7E79275216E7BF48002E20B9 /* CDVPluginResult.m in Sources */,
+				7E79275316E7BF48002E20B9 /* CDVReachability.m in Sources */,
+				7E79275616E7BF6F002E20B9 /* CDVJSON.m in Sources */,
+				7E79275B16E7BFFB002E20B9 /* NSData+Base64.m in Sources */,
+				7E79275E16E7C118002E20B9 /* CDVInvokedUrlCommand.m in Sources */,
+				7E79276116E7C21F002E20B9 /* NSMutableArray+QueueAdditions.m in Sources */,
+				7E79276516E7C244002E20B9 /* CDVCommandDelegateImpl.m in Sources */,
+				7E79276816E7C27A002E20B9 /* CDVCommandQueue.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -322,6 +408,7 @@
 		48B43533152E5E3600906A36 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ENABLE_OBJC_ARC = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "CordovaMac/CordovaMac-Prefix.pch";
@@ -334,6 +421,7 @@
 		48B43534152E5E3600906A36 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ENABLE_OBJC_ARC = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "CordovaMac/CordovaMac-Prefix.pch";

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/AppDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/AppDelegate.h b/CordovaMac/CordovaMac/AppDelegate.h
index ec38a73..ccd218f 100644
--- a/CordovaMac/CordovaMac/AppDelegate.h
+++ b/CordovaMac/CordovaMac/AppDelegate.h
@@ -26,7 +26,7 @@
 	IBOutlet ContentView* contentView;
 }
 
-@property (nonatomic, retain) NSWindow* window;
-@property (nonatomic, retain) ContentView* contentView;
+@property (nonatomic, strong) NSWindow* window;
+@property (nonatomic, strong) ContentView* contentView;
 
 @end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/CDVBridge.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/CDVBridge.h b/CordovaMac/CordovaMac/CDVBridge.h
index cdca928..171675f 100644
--- a/CordovaMac/CordovaMac/CDVBridge.h
+++ b/CordovaMac/CordovaMac/CDVBridge.h
@@ -24,7 +24,7 @@
 	
 }
 
-@property (nonatomic, retain) WebView* webView;
+@property (nonatomic, strong) WebView* webView;
 
 - (id) initWithWebView:(WebView*)webView;
 - (void) exec:(NSString*)callbackId withService:(NSString*)service andAction:(NSString*)action andArguments:(NSArray*)arguments;

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDV.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDV.h b/CordovaMac/CordovaMac/Commands/CDV.h
new file mode 100644
index 0000000..6fe45d8
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDV.h
@@ -0,0 +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 "CDVAvailability.h"
+
+#import "CDVJSON.h"
+#import "CDVDebug.h"
+#import "CDVPluginResult.h"
+#import "CDVInvokedUrlCommand.h"
+#import "CDVPlugin.h"
+#import "CDVDevice.h"

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVAvailability.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVAvailability.h b/CordovaMac/CordovaMac/Commands/CDVAvailability.h
new file mode 100644
index 0000000..955051e
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVAvailability.h
@@ -0,0 +1,53 @@
+/*
+ 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.
+ */
+
+#define __CORDOVA_2_6_0 20600
+#define __CORDOVA_NA 99999      /* not available */
+
+/*
+ #if CORDOVA_VERSION_MIN_REQUIRED >= __CORDOVA_1_7_0
+    // do something when its at least 1.7.0
+ #else
+    // do something else (non 1.7.0)
+ #endif
+ */
+#ifndef CORDOVA_VERSION_MIN_REQUIRED
+    #define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_2_6_0
+#endif
+
+
+/* Return the string version of the decimal version */
+#define CDV_VERSION [NSString stringWithFormat:@"%d.%d.%d", \
+        (CORDOVA_VERSION_MIN_REQUIRED / 10000),             \
+        (CORDOVA_VERSION_MIN_REQUIRED % 10000) / 100,       \
+        (CORDOVA_VERSION_MIN_REQUIRED % 10000) % 100]
+
+#ifdef __clang__
+    #define CDV_DEPRECATED(version, msg) __attribute__((deprecated("Deprecated in Cordova " #version ". " msg)))
+#else
+    #define CDV_DEPRECATED(version, msg) __attribute__((deprecated()))
+#endif
+
+// Enable this to log all exec() calls.
+#define CDV_ENABLE_EXEC_LOGGING 0
+#if CDV_ENABLE_EXEC_LOGGING
+    #define CDV_EXEC_LOG NSLog
+#else
+    #define CDV_EXEC_LOG(...) do {} while (NO)
+#endif

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVCommandDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVCommandDelegate.h b/CordovaMac/CordovaMac/Commands/CDVCommandDelegate.h
new file mode 100644
index 0000000..e177c63
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVCommandDelegate.h
@@ -0,0 +1,55 @@
+/*
+ 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 "CDVAvailability.h"
+#import "CDVInvokedUrlCommand.h"
+
+@class CDVPlugin;
+@class CDVPluginResult;
+@class CDVWhitelist;
+
+@protocol CDVCommandDelegate <NSObject>
+
+@property (nonatomic, readonly) NSDictionary* settings;
+
+- (NSString*)pathForResource:(NSString*)resourcepath;
+- (id)getCommandInstance:(NSString*)pluginName;
+- (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className CDV_DEPRECATED(2.2, "Use CDVViewController to register plugins, or use config.xml.");
+
+// Plugins should not be using this interface to call other plugins since it
+// will result in bogus callbacks being made.
+- (BOOL)execute:(CDVInvokedUrlCommand*)command CDV_DEPRECATED(2.2, "Use direct method calls instead.");
+
+// Sends a plugin result to the JS. This is thread-safe.
+- (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId;
+// Evaluates the given JS. This is thread-safe.
+- (void)evalJs:(NSString*)js;
+// Can be used to evaluate JS right away instead of scheduling it on the run-loop.
+// This is required for dispatch resign and pause events, but should not be used
+// without reason. Without the run-loop delay, alerts used in JS callbacks may result
+// in dead-lock. This method must be called from the UI thread.
+- (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop;
+// Runs the given block on a background thread using a shared thread-pool.
+- (void)runInBackground:(void (^)())block;
+// Returns the User-Agent of the associated UIWebView.
+- (NSString*)userAgent;
+// Returns whether the given URL passes the white-list.
+- (BOOL)URLIsWhitelisted:(NSURL*)url;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVCommandDelegateImpl.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVCommandDelegateImpl.h b/CordovaMac/CordovaMac/Commands/CDVCommandDelegateImpl.h
new file mode 100644
index 0000000..733dd1d
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVCommandDelegateImpl.h
@@ -0,0 +1,32 @@
+/*
+ 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 "CDVCommandDelegate.h"
+
+@class NSViewController;
+@class CDVCommandQueue;
+
+@interface CDVCommandDelegateImpl : NSObject <CDVCommandDelegate>{
+//    @private
+    __weak NSViewController* _viewController;
+    @protected
+    __weak CDVCommandQueue* _commandQueue;
+}
+- (id)initWithViewController:(NSViewController*)viewController;
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVCommandDelegateImpl.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVCommandDelegateImpl.m b/CordovaMac/CordovaMac/Commands/CDVCommandDelegateImpl.m
new file mode 100644
index 0000000..2041b7e
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVCommandDelegateImpl.m
@@ -0,0 +1,160 @@
+/*
+ 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 "CDVCommandDelegateImpl.h"
+#import "CDVJSON.h"
+#import "CDVCommandQueue.h"
+#import "CDVPluginResult.h"
+
+@implementation CDVCommandDelegateImpl
+
+- (id)initWithViewController:(NSViewController*)viewController
+{
+    self = [super init];
+    if (self != nil) {
+        _viewController = viewController;
+        // TODO:
+        //_commandQueue = _viewController.commandQueue;
+    }
+    return self;
+}
+
+- (NSString*)pathForResource:(NSString*)resourcepath
+{
+    NSBundle* mainBundle = [NSBundle mainBundle];
+    NSMutableArray* directoryParts = [NSMutableArray arrayWithArray:[resourcepath componentsSeparatedByString:@"/"]];
+    NSString* filename = [directoryParts lastObject];
+
+    [directoryParts removeLastObject];
+
+    NSString* directoryPartsJoined = [directoryParts componentsJoinedByString:@"/"];
+#pragma unused(directoryPartsJoined)
+    NSString* directoryStr = @""; //TODO: //_viewController.wwwFolderName;
+
+// TODO:
+//    if ([directoryPartsJoined length] > 0) {
+//        directoryStr = [NSString stringWithFormat:@"%@/%@", _viewController.wwwFolderName, [directoryParts componentsJoinedByString:@"/"]];
+//    }
+
+    return [mainBundle pathForResource:filename ofType:@"" inDirectory:directoryStr];
+}
+
+- (void)evalJsHelper2:(NSString*)js
+{
+// TODO: 
+//    CDV_EXEC_LOG(@"Exec: evalling: %@", [js substringToIndex:MIN([js length], 160)]);
+//    NSString* commandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:js];
+//    if ([commandsJSON length] > 0) {
+//        CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining.");
+//    }
+//
+//    [_commandQueue enqueCommandBatch:commandsJSON];
+}
+
+- (void)evalJsHelper:(NSString*)js
+{
+    // Cycle the run-loop before executing the JS.
+    // This works around a bug where sometimes alerts() within callbacks can cause
+    // dead-lock.
+    // If the commandQueue is currently executing, then we know that it is safe to
+    // execute the callback immediately.
+    // Using    (dispatch_get_main_queue()) does *not* fix deadlocks for some reaon,
+    // but performSelectorOnMainThread: does.
+    if (![NSThread isMainThread] || !_commandQueue.currentlyExecuting) {
+        [self performSelectorOnMainThread:@selector(evalJsHelper2:) withObject:js waitUntilDone:NO];
+    } else {
+        [self evalJsHelper2:js];
+    }
+}
+
+- (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId
+{
+    CDV_EXEC_LOG(@"Exec(%@): Sending result. Status=%@", callbackId, result.status);
+    // This occurs when there is are no win/fail callbacks for the call.
+    if ([@"INVALID" isEqualToString:callbackId]) {
+        return;
+    }
+    int status = [result.status intValue];
+    BOOL keepCallback = [result.keepCallback boolValue];
+    NSString* argumentsAsJSON = [result argumentsAsJSON];
+
+    NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d)", callbackId, status, argumentsAsJSON, keepCallback];
+
+    [self evalJsHelper:js];
+}
+
+- (void)evalJs:(NSString*)js
+{
+    [self evalJs:js scheduledOnRunLoop:YES];
+}
+
+- (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop
+{
+    js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeEvalAndFetch(function(){%@})", js];
+    if (scheduledOnRunLoop) {
+        [self evalJsHelper:js];
+    } else {
+        [self evalJsHelper2:js];
+    }
+}
+
+- (BOOL)execute:(CDVInvokedUrlCommand*)command
+{
+    return [_commandQueue execute:command];
+}
+
+- (id)getCommandInstance:(NSString*)pluginName
+{
+    //TODO:
+//    return [_viewController getCommandInstance:pluginName];
+}
+
+- (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className
+{
+    //TODO:
+//    [_viewController registerPlugin:plugin withClassName:className];
+}
+
+- (void)runInBackground:(void (^)())block
+{
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block);
+}
+
+- (NSString*)userAgent
+{
+    // TODO:
+//    return [_viewController userAgent];
+}
+
+- (BOOL)URLIsWhitelisted:(NSURL*)url
+{
+// TODO:
+//    return ![_viewController.whitelist schemeIsAllowed:[url scheme]] ||
+//           [_viewController.whitelist URLIsAllowed:url];
+    return NO;
+}
+
+- (NSDictionary*)settings
+{
+    // TODO:
+//    return _viewController.settings;
+    return nil;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVCommandQueue.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVCommandQueue.h b/CordovaMac/CordovaMac/Commands/CDVCommandQueue.h
new file mode 100644
index 0000000..27c47b5
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVCommandQueue.h
@@ -0,0 +1,40 @@
+/*
+ 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 <Foundation/Foundation.h>
+
+@class CDVInvokedUrlCommand;
+@class CDVViewController;
+
+@interface CDVCommandQueue : NSObject
+
+@property (nonatomic, readonly) BOOL currentlyExecuting;
+
+- (id)initWithViewController:(CDVViewController*)viewController;
+- (void)dispose;
+
+- (void)resetRequestId;
+- (void)enqueCommandBatch:(NSString*)batchJSON;
+
+- (void)maybeFetchCommandsFromJs:(NSNumber*)requestId;
+- (void)fetchCommandsFromJs;
+- (void)executePending;
+- (BOOL)execute:(CDVInvokedUrlCommand*)command;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVCommandQueue.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVCommandQueue.m b/CordovaMac/CordovaMac/Commands/CDVCommandQueue.m
new file mode 100644
index 0000000..d80115e
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVCommandQueue.m
@@ -0,0 +1,164 @@
+/*
+ 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.
+ */
+
+#include <objc/message.h>
+#import "CDV.h"
+#import "CDVCommandQueue.h"
+#import "CDVCommandDelegateImpl.h"
+
+@interface CDVCommandQueue () {
+    NSInteger _lastCommandQueueFlushRequestId;
+    __weak NSViewController* _viewController;
+    NSMutableArray* _queue;
+    BOOL _currentlyExecuting;
+}
+@end
+
+@implementation CDVCommandQueue
+
+@synthesize currentlyExecuting = _currentlyExecuting;
+
+- (id)initWithViewController:(NSViewController*)viewController
+{
+    self = [super init];
+    if (self != nil) {
+        _viewController = viewController;
+        _queue = [[NSMutableArray alloc] init];
+    }
+    return self;
+}
+
+- (void)dispose
+{
+    // TODO(agrieve): Make this a zeroing weak ref once we drop support for 4.3.
+    _viewController = nil;
+}
+
+- (void)resetRequestId
+{
+    _lastCommandQueueFlushRequestId = 0;
+}
+
+- (void)enqueCommandBatch:(NSString*)batchJSON
+{
+    if ([batchJSON length] > 0) {
+        [_queue addObject:batchJSON];
+        [self executePending];
+    }
+}
+
+- (void)maybeFetchCommandsFromJs:(NSNumber*)requestId
+{
+    // Use the request ID to determine if we've already flushed for this request.
+    // This is required only because the NSURLProtocol enqueues the same request
+    // multiple times.
+    if ([requestId integerValue] > _lastCommandQueueFlushRequestId) {
+        _lastCommandQueueFlushRequestId = [requestId integerValue];
+        [self fetchCommandsFromJs];
+    }
+}
+
+- (void)fetchCommandsFromJs
+{
+    // TODO:
+//    // Grab all the queued commands from the JS side.
+//    NSString* queuedCommandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:
+//        @"cordova.require('cordova/exec').nativeFetchMessages()"];
+//
+//    [self enqueCommandBatch:queuedCommandsJSON];
+//    if ([queuedCommandsJSON length] > 0) {
+//        CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by request.");
+//    }
+}
+
+- (void)executePending
+{
+    // Make us re-entrant-safe.
+    if (_currentlyExecuting) {
+        return;
+    }
+    @try {
+        _currentlyExecuting = YES;
+
+        for (NSUInteger i = 0; i < [_queue count]; ++i) {
+            // Parse the returned JSON array.
+            NSArray* commandBatch = [[_queue objectAtIndex:i] JSONObject];
+
+            // Iterate over and execute all of the commands.
+            for (NSArray* jsonEntry in commandBatch) {
+                CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry];
+                CDV_EXEC_LOG(@"Exec(%@): Calling %@.%@", command.callbackId, command.className, command.methodName);
+
+                if (![self execute:command]) {
+#ifdef DEBUG
+                        NSString* commandJson = [jsonEntry JSONString];
+                        static NSUInteger maxLogLength = 1024;
+                        NSString* commandString = ([commandJson length] > maxLogLength) ?
+                        [NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]] :
+                        commandJson;
+
+                        DLog(@"FAILED pluginJSON = %@", commandString);
+#endif
+                }
+            }
+        }
+
+        [_queue removeAllObjects];
+    } @finally
+    {
+        _currentlyExecuting = NO;
+    }
+}
+
+- (BOOL)execute:(CDVInvokedUrlCommand*)command
+{
+    if ((command.className == nil) || (command.methodName == nil)) {
+        NSLog(@"ERROR: Classname and/or methodName not found for command.");
+        return NO;
+    }
+
+    // Fetch an instance of this class
+    //TODO:
+//    CDVPlugin* obj = [_viewController.commandDelegate getCommandInstance:command.className];
+//
+    CDVPlugin* obj = nil;
+    
+    if (!([obj isKindOfClass:[CDVPlugin class]])) {
+        NSLog(@"ERROR: Plugin '%@' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.", command.className);
+        return NO;
+    }
+    BOOL retVal = YES;
+
+    // Find the proper selector to call.
+    NSString* methodName = [NSString stringWithFormat:@"%@:", command.methodName];
+    SEL normalSelector = NSSelectorFromString(methodName);
+    // Test for the legacy selector first in case they both exist.
+    if ([obj respondsToSelector:normalSelector]) {
+        // [obj performSelector:normalSelector withObject:command];
+        objc_msgSend(obj, normalSelector, command);
+    } else {
+        // There's no method to call, so throw an error.
+        NSLog(@"ERROR: Method '%@' not defined in Plugin '%@'", methodName, command.className);
+        retVal = NO;
+    }
+
+    return retVal;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVConnection.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVConnection.h b/CordovaMac/CordovaMac/Commands/CDVConnection.h
new file mode 100644
index 0000000..d3e8c5d
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVConnection.h
@@ -0,0 +1,34 @@
+/*
+ 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 <Foundation/Foundation.h>
+#import "CDVPlugin.h"
+#import "CDVReachability.h"
+
+@interface CDVConnection : CDVPlugin {
+    NSString* type;
+    NSString* _callbackId;
+
+    CDVReachability* internetReach;
+}
+
+@property (copy) NSString* connectionType;
+@property (strong) CDVReachability* internetReach;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVConnection.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVConnection.m b/CordovaMac/CordovaMac/Commands/CDVConnection.m
new file mode 100644
index 0000000..61030d3
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVConnection.m
@@ -0,0 +1,125 @@
+/*
+ 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 "CDVConnection.h"
+#import "CDVReachability.h"
+
+@interface CDVConnection (PrivateMethods)
+- (void)updateOnlineStatus;
+- (void)sendPluginResult;
+@end
+
+@implementation CDVConnection
+
+@synthesize connectionType, internetReach;
+
+- (void)getConnectionInfo:(CDVInvokedUrlCommand*)command
+{
+    _callbackId = command.callbackId;
+    [self sendPluginResult];
+}
+
+- (void)sendPluginResult
+{
+    CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:self.connectionType];
+
+    [result setKeepCallbackAsBool:YES];
+    [self.commandDelegate sendPluginResult:result callbackId:_callbackId];
+}
+
+- (NSString*)w3cConnectionTypeFor:(CDVReachability*)reachability
+{
+    NetworkStatus networkStatus = [reachability currentReachabilityStatus];
+
+    switch (networkStatus) {
+        case NotReachable:
+            return @"none";
+
+        case ReachableViaWWAN:
+            return @"2g"; // no generic default, so we use the lowest common denominator
+
+        case ReachableViaWiFi:
+            return @"wifi";
+
+        default:
+            return @"unknown";
+    }
+}
+
+- (BOOL)isCellularConnection:(NSString*)theConnectionType
+{
+    return [theConnectionType isEqualToString:@"2g"] ||
+           [theConnectionType isEqualToString:@"3g"] ||
+           [theConnectionType isEqualToString:@"4g"];
+}
+
+- (void)updateReachability:(CDVReachability*)reachability
+{
+    if (reachability) {
+        // check whether the connection type has changed
+        NSString* newConnectionType = [self w3cConnectionTypeFor:reachability];
+        if ([newConnectionType isEqualToString:self.connectionType]) { // the same as before, remove dupes
+            return;
+        } else {
+            self.connectionType = [self w3cConnectionTypeFor:reachability];
+        }
+    }
+    [self sendPluginResult];
+}
+
+- (void)updateConnectionType:(NSNotification*)note
+{
+    CDVReachability* curReach = [note object];
+
+    if ((curReach != nil) && [curReach isKindOfClass:[CDVReachability class]]) {
+        [self updateReachability:curReach];
+    }
+}
+
+- (void)onPause
+{
+    [self.internetReach stopNotifier];
+}
+
+- (void)onResume
+{
+    [self.internetReach startNotifier];
+    [self updateReachability:self.internetReach];
+}
+
+- (CDVPlugin*)initWithWebView:(WebView*)theWebView
+{
+    self = [super initWithWebView:theWebView];
+    if (self) {
+        self.connectionType = @"none";
+        self.internetReach = [CDVReachability reachabilityForInternetConnection];
+        self.connectionType = [self w3cConnectionTypeFor:self.internetReach];
+        [self.internetReach startNotifier];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateConnectionType:)
+                                                     name:kReachabilityChangedNotification object:nil];
+// TODO:
+//        if (&UIApplicationDidEnterBackgroundNotification && &UIApplicationWillEnterForegroundNotification) {
+//            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil];
+//            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResume) name:UIApplicationWillEnterForegroundNotification object:nil];
+//        }
+    }
+    return self;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVDebug.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVDebug.h b/CordovaMac/CordovaMac/Commands/CDVDebug.h
new file mode 100644
index 0000000..4a0d9f9
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVDebug.h
@@ -0,0 +1,25 @@
+/*
+ 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.
+ */
+
+#ifdef DEBUG
+    #define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
+#else
+    #define DLog(...)
+#endif
+#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVDevice.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVDevice.h b/CordovaMac/CordovaMac/Commands/CDVDevice.h
new file mode 100644
index 0000000..81cffb7
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVDevice.h
@@ -0,0 +1,29 @@
+/*
+ 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 CDVDevice : CDVPlugin
+{}
+
++ (NSString*)cordovaVersion;
+
+- (void)getDeviceInfo:(CDVInvokedUrlCommand*)command;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVDevice.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVDevice.m b/CordovaMac/CordovaMac/Commands/CDVDevice.m
new file mode 100644
index 0000000..83ff1d3
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVDevice.m
@@ -0,0 +1,84 @@
+/*
+ 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.
+ */
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
+#import "CDVDevice.h"
+#import "CDVAvailability.h"
+
+@implementation CDVDevice
+
+- (NSString*)modelVersion
+{
+    size_t size;
+
+    sysctlbyname("hw.machine", NULL, &size, NULL, 0);
+    char* machine = malloc(size);
+    sysctlbyname("hw.machine", machine, &size, NULL, 0);
+    NSString* platform = [NSString stringWithUTF8String:machine];
+    free(machine);
+
+    return platform;
+}
+
+- (NSString*)model
+{
+    return nil;
+}
+
+- (NSString*)uniqueAppInstanceIdentifier
+{
+    return nil;
+}
+
+- (NSString*)systemVersion
+{
+    return nil;
+}
+
+- (void)getDeviceInfo:(CDVInvokedUrlCommand*)command
+{
+    NSDictionary* deviceProperties = [self deviceProperties];
+    CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:deviceProperties];
+
+    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+}
+
+- (NSDictionary*)deviceProperties
+{
+    NSMutableDictionary* devProps = [NSMutableDictionary dictionaryWithCapacity:4];
+
+    [devProps setObject:[self modelVersion] forKey:@"model"];
+    [devProps setObject:@"OS X" forKey:@"platform"];
+    [devProps setObject:[self systemVersion] forKey:@"version"];
+    [devProps setObject:[self uniqueAppInstanceIdentifier] forKey:@"uuid"];
+    [devProps setObject:[self model] forKey:@"name"];
+    [devProps setObject:[[self class] cordovaVersion] forKey:@"cordova"];
+
+    NSDictionary* devReturn = [NSDictionary dictionaryWithDictionary:devProps];
+    return devReturn;
+}
+
++ (NSString*)cordovaVersion
+{
+    return CDV_VERSION;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVInvokedUrlCommand.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVInvokedUrlCommand.h b/CordovaMac/CordovaMac/Commands/CDVInvokedUrlCommand.h
new file mode 100644
index 0000000..5f7e204
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVInvokedUrlCommand.h
@@ -0,0 +1,52 @@
+/*
+ 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 <Foundation/Foundation.h>
+
+@interface CDVInvokedUrlCommand : NSObject {
+    NSString* __weak _callbackId;
+    NSString* __weak _className;
+    NSString* __weak _methodName;
+    NSArray* __weak _arguments;
+}
+
+@property (weak, nonatomic, readonly) NSArray* arguments;
+@property (weak, nonatomic, readonly) NSString* callbackId;
+@property (weak, nonatomic, readonly) NSString* className;
+@property (weak, nonatomic, readonly) NSString* methodName;
+
++ (CDVInvokedUrlCommand*)commandFromJson:(NSArray*)jsonEntry;
+
+- (id)initWithArguments:(NSArray*)arguments
+   callbackId          :(NSString*)callbackId
+    className           :(NSString*)className
+   methodName          :(NSString*)methodName;
+
+- (id)initFromJson:(NSArray*)jsonEntry;
+
+// Returns the argument at the given index.
+// If index >= the number of arguments, returns nil.
+// If the argument at the given index is NSNull, returns nil.
+- (id)argumentAtIndex:(NSUInteger)index;
+// Same as above, but returns defaultValue instead of nil.
+- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue;
+// Same as above, but returns defaultValue instead of nil, and if the argument is not of the expected class, returns defaultValue
+- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue andClass:(Class)aClass;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVInvokedUrlCommand.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVInvokedUrlCommand.m b/CordovaMac/CordovaMac/Commands/CDVInvokedUrlCommand.m
new file mode 100644
index 0000000..6c7a856
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVInvokedUrlCommand.m
@@ -0,0 +1,140 @@
+/*
+ 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 "CDVInvokedUrlCommand.h"
+#import "CDVJSON.h"
+#import "NSData+Base64.h"
+
+@implementation CDVInvokedUrlCommand
+
+@synthesize arguments = _arguments;
+@synthesize callbackId = _callbackId;
+@synthesize className = _className;
+@synthesize methodName = _methodName;
+
++ (CDVInvokedUrlCommand*)commandFromJson:(NSArray*)jsonEntry
+{
+    return [[CDVInvokedUrlCommand alloc] initFromJson:jsonEntry];
+}
+
+- (id)initFromJson:(NSArray*)jsonEntry
+{
+    id tmp = [jsonEntry objectAtIndex:0];
+    NSString* callbackId = tmp == [NSNull null] ? nil : tmp;
+    NSString* className = [jsonEntry objectAtIndex:1];
+    NSString* methodName = [jsonEntry objectAtIndex:2];
+    NSMutableArray* arguments = [jsonEntry objectAtIndex:3];
+
+    return [self initWithArguments:arguments
+                        callbackId:callbackId
+                         className:className
+                        methodName:methodName];
+}
+
+- (id)initWithArguments:(NSArray*)arguments
+             callbackId:(NSString*)callbackId
+              className:(NSString*)className
+             methodName:(NSString*)methodName
+{
+    self = [super init];
+    if (self != nil) {
+        _arguments = arguments;
+        _callbackId = callbackId;
+        _className = className;
+        _methodName = methodName;
+    }
+    [self massageArguments];
+    return self;
+}
+
+- (void)massageArguments
+{
+    NSMutableArray* newArgs = nil;
+
+    for (NSUInteger i = 0, count = [_arguments count]; i < count; ++i) {
+        id arg = [_arguments objectAtIndex:i];
+        if (![arg isKindOfClass:[NSDictionary class]]) {
+            continue;
+        }
+        NSDictionary* dict = arg;
+        NSString* type = [dict objectForKey:@"CDVType"];
+        if (!type || ![type isEqualToString:@"ArrayBuffer"]) {
+            continue;
+        }
+        NSString* data = [dict objectForKey:@"data"];
+        if (!data) {
+            continue;
+        }
+        if (newArgs == nil) {
+            newArgs = [NSMutableArray arrayWithArray:_arguments];
+            _arguments = newArgs;
+        }
+        [newArgs replaceObjectAtIndex:i withObject:[NSData dataFromBase64String:data]];
+    }
+}
+
+- (void)legacyArguments:(NSMutableArray**)legacyArguments andDict:(NSMutableDictionary**)legacyDict
+{
+    NSMutableArray* newArguments = [NSMutableArray arrayWithArray:_arguments];
+
+    for (NSUInteger i = 0; i < [newArguments count]; ++i) {
+        if ([[newArguments objectAtIndex:i] isKindOfClass:[NSDictionary class]]) {
+            if (legacyDict != NULL) {
+                *legacyDict = [newArguments objectAtIndex:i];
+            }
+            [newArguments removeObjectAtIndex:i];
+            break;
+        }
+    }
+
+    // Legacy (two versions back) has no callbackId.
+    if (_callbackId != nil) {
+        [newArguments insertObject:_callbackId atIndex:0];
+    }
+    if (legacyArguments != NULL) {
+        *legacyArguments = newArguments;
+    }
+}
+
+- (id)argumentAtIndex:(NSUInteger)index
+{
+    return [self argumentAtIndex:index withDefault:nil];
+}
+
+- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue
+{
+    return [self argumentAtIndex:index withDefault:defaultValue andClass:nil];
+}
+
+- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue andClass:(Class)aClass
+{
+    if (index >= [_arguments count]) {
+        return defaultValue;
+    }
+    id ret = [_arguments objectAtIndex:index];
+    if (ret == [NSNull null]) {
+        ret = defaultValue;
+    }
+    if ((aClass != nil) && ![ret isKindOfClass:aClass]) {
+        ret = defaultValue;
+    }
+    return ret;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVJSON.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVJSON.h b/CordovaMac/CordovaMac/Commands/CDVJSON.h
new file mode 100644
index 0000000..eaa895e
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVJSON.h
@@ -0,0 +1,30 @@
+/*
+ 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.
+ */
+
+@interface NSArray (CDVJSONSerializing)
+- (NSString*)JSONString;
+@end
+
+@interface NSDictionary (CDVJSONSerializing)
+- (NSString*)JSONString;
+@end
+
+@interface NSString (CDVJSONSerializing)
+- (id)JSONObject;
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVJSON.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVJSON.m b/CordovaMac/CordovaMac/Commands/CDVJSON.m
new file mode 100644
index 0000000..78267e5
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVJSON.m
@@ -0,0 +1,77 @@
+/*
+ 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 "CDVJSON.h"
+#import <Foundation/NSJSONSerialization.h>
+
+@implementation NSArray (CDVJSONSerializing)
+
+- (NSString*)JSONString
+{
+    NSError* error = nil;
+    NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self
+                                                       options:NSJSONWritingPrettyPrinted
+                                                         error:&error];
+
+    if (error != nil) {
+        NSLog(@"NSArray JSONString error: %@", [error localizedDescription]);
+        return nil;
+    } else {
+        return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
+    }
+}
+
+@end
+
+@implementation NSDictionary (CDVJSONSerializing)
+
+- (NSString*)JSONString
+{
+    NSError* error = nil;
+    NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self
+                                                       options:NSJSONWritingPrettyPrinted
+                                                         error:&error];
+
+    if (error != nil) {
+        NSLog(@"NSDictionary JSONString error: %@", [error localizedDescription]);
+        return nil;
+    } else {
+        return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
+    }
+}
+
+@end
+
+@implementation NSString (CDVJSONSerializing)
+
+- (id)JSONObject
+{
+    NSError* error = nil;
+    id object = [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding]
+                                                options:kNilOptions
+                                                  error:&error];
+
+    if (error != nil) {
+        NSLog(@"NSString JSONObject error: %@", [error localizedDescription]);
+    }
+
+    return object;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVPlugin.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVPlugin.h b/CordovaMac/CordovaMac/Commands/CDVPlugin.h
new file mode 100644
index 0000000..8f8d1a1
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVPlugin.h
@@ -0,0 +1,64 @@
+/*
+ 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 <Foundation/Foundation.h>
+#import <WebKit/WebKit.h>
+#import "CDVPluginResult.h"
+#import "NSMutableArray+QueueAdditions.h"
+#import "CDVCommandDelegate.h"
+
+NSString* const CDVPageDidLoadNotification;
+NSString* const CDVPluginHandleOpenURLNotification;
+NSString* const CDVPluginResetNotification;
+NSString* const CDVLocalNotification;
+
+@interface CDVPlugin : NSObject {}
+
+@property (nonatomic, weak) WebView* webView;
+@property (nonatomic, unsafe_unretained) NSViewController* viewController;
+@property (nonatomic, unsafe_unretained) id <CDVCommandDelegate> commandDelegate;
+
+@property (readonly, assign) BOOL hasPendingOperation;
+
+- (CDVPlugin*)initWithWebView:(WebView*)theWebView;
+- (void)pluginInitialize;
+
+- (void)handleOpenURL:(NSNotification*)notification;
+- (void)onAppTerminate;
+- (void)onMemoryWarning;
+- (void)onReset;
+- (void)dispose;
+
+/*
+ // see initWithWebView implementation
+ - (void) onPause {}
+ - (void) onResume {}
+ - (void) onOrientationWillChange {}
+ - (void) onOrientationDidChange {}
+ - (void)didReceiveLocalNotification:(NSNotification *)notification;
+ */
+
+- (id)appDelegate;
+
+// TODO(agrieve): Deprecate these in favour of using CDVCommandDelegate directly.
+- (NSString*)writeJavascript:(NSString*)javascript;
+- (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId;
+- (NSString*)error:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVPlugin.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVPlugin.m b/CordovaMac/CordovaMac/Commands/CDVPlugin.m
new file mode 100644
index 0000000..6301fac
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVPlugin.m
@@ -0,0 +1,148 @@
+/*
+ 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"
+
+NSString* const CDVPageDidLoadNotification = @"CDVPageDidLoadNotification";
+NSString* const CDVPluginHandleOpenURLNotification = @"CDVPluginHandleOpenURLNotification";
+NSString* const CDVPluginResetNotification = @"CDVPluginResetNotification";
+NSString* const CDVLocalNotification = @"CDVLocalNotification";
+
+@interface CDVPlugin ()
+
+@property (readwrite, assign) BOOL hasPendingOperation;
+
+@end
+
+@implementation CDVPlugin
+@synthesize webView, viewController, commandDelegate, hasPendingOperation;
+
+- (CDVPlugin*)initWithWebView:(WebView*)theWebView
+{
+    self = [super init];
+    if (self) {
+//        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppTerminate) name:UIApplicationWillTerminateNotification object:nil];
+//        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMemoryWarning) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenURL:) name:CDVPluginHandleOpenURLNotification object:nil];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onReset) name:CDVPluginResetNotification object:theWebView];
+
+        self.webView = theWebView;
+    }
+    return self;
+}
+
+- (void)pluginInitialize
+{
+    // You can listen to more app notifications, see:
+    // http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006728-CH3-DontLinkElementID_4
+
+    // NOTE: if you want to use these, make sure you uncomment the corresponding notification handler
+
+    // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil];
+    // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResume) name:UIApplicationWillEnterForegroundNotification object:nil];
+    // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationWillChange) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
+    // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationDidChange) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
+
+    // Added in 2.3.0
+    // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveLocalNotification:) name:CDVLocalNotification object:nil];
+
+    // Added in 2.5.0
+    // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad:) name:CDVPageDidLoadNotification object:self.webView];
+}
+
+- (void)dispose
+{
+    viewController = nil;
+    commandDelegate = nil;
+    webView = nil;
+}
+
+/*
+// NOTE: for onPause and onResume, calls into JavaScript must not call or trigger any blocking UI, like alerts
+- (void) onPause {}
+- (void) onResume {}
+- (void) onOrientationWillChange {}
+- (void) onOrientationDidChange {}
+*/
+
+/* NOTE: calls into JavaScript must not call or trigger any blocking UI, like alerts */
+- (void)handleOpenURL:(NSNotification*)notification
+{
+    // override to handle urls sent to your app
+    // register your url schemes in your App-Info.plist
+
+    NSURL* url = [notification object];
+
+    if ([url isKindOfClass:[NSURL class]]) {
+        /* Do your thing! */
+    }
+}
+
+/* NOTE: calls into JavaScript must not call or trigger any blocking UI, like alerts */
+- (void)onAppTerminate
+{
+    // override this if you need to do any cleanup on app exit
+}
+
+- (void)onMemoryWarning
+{
+    // override to remove caches, etc
+}
+
+- (void)onReset
+{
+    // Override to cancel any long-running requests when the WebView navigates or refreshes.
+}
+
+- (void)dealloc
+{
+    [[NSNotificationCenter defaultCenter] removeObserver:self];   // this will remove all notification unless added using addObserverForName:object:queue:usingBlock:
+}
+
+- (id)appDelegate
+{
+    // TODO:
+    //return [[UIApplication sharedApplication] delegate];
+    return nil;
+}
+
+- (NSString*)writeJavascript:(NSString*)javascript
+{
+    return [self.webView stringByEvaluatingJavaScriptFromString:javascript];
+}
+
+- (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId
+{
+    [self.commandDelegate evalJs:[pluginResult toSuccessCallbackString:callbackId]];
+    return @"";
+}
+
+- (NSString*)error:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId
+{
+    [self.commandDelegate evalJs:[pluginResult toErrorCallbackString:callbackId]];
+    return @"";
+}
+
+// default implementation does nothing, ideally, we are not registered for notification if we aren't going to do anything.
+// - (void)didReceiveLocalNotification:(NSNotification *)notification
+// {
+//    // UILocalNotification* localNotification = [notification object]; // get the payload as a LocalNotification
+// }
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVPluginResult.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVPluginResult.h b/CordovaMac/CordovaMac/Commands/CDVPluginResult.h
new file mode 100644
index 0000000..8393df2
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVPluginResult.h
@@ -0,0 +1,65 @@
+/*
+ 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 <Foundation/Foundation.h>
+
+typedef enum {
+    CDVCommandStatus_NO_RESULT = 0,
+    CDVCommandStatus_OK,
+    CDVCommandStatus_CLASS_NOT_FOUND_EXCEPTION,
+    CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION,
+    CDVCommandStatus_INSTANTIATION_EXCEPTION,
+    CDVCommandStatus_MALFORMED_URL_EXCEPTION,
+    CDVCommandStatus_IO_EXCEPTION,
+    CDVCommandStatus_INVALID_ACTION,
+    CDVCommandStatus_JSON_EXCEPTION,
+    CDVCommandStatus_ERROR
+} CDVCommandStatus;
+
+@interface CDVPluginResult : NSObject {}
+
+@property (nonatomic, strong, readonly) NSNumber* status;
+@property (nonatomic, strong, readonly) id message;
+@property (nonatomic, strong)           NSNumber* keepCallback;
+
+- (CDVPluginResult*)init;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsString:(NSString*)theMessage;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArray:(NSArray*)theMessage;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsInt:(int)theMessage;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDouble:(double)theMessage;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsBool:(BOOL)theMessage;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDictionary:(NSDictionary*)theMessage;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArrayBuffer:(NSData*)theMessage;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsMultipart:(NSArray*)theMessages;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageToErrorObject:(int)errorCode;
+
++ (void)setVerbose:(BOOL)verbose;
++ (BOOL)isVerbose;
+
+- (void)setKeepCallbackAsBool:(BOOL)bKeepCallback;
+
+- (NSString*)argumentsAsJSON;
+
+// These methods are used by the legacy plugin return result method
+- (NSString*)toJSONString;
+- (NSString*)toSuccessCallbackString:(NSString*)callbackId;
+- (NSString*)toErrorCallbackString:(NSString*)callbackId;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVPluginResult.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVPluginResult.m b/CordovaMac/CordovaMac/Commands/CDVPluginResult.m
new file mode 100644
index 0000000..a03e005
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVPluginResult.m
@@ -0,0 +1,224 @@
+/*
+ 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 "CDVPluginResult.h"
+#import "CDVJSON.h"
+#import "CDVDebug.h"
+#import "NSData+Base64.h"
+
+@interface CDVPluginResult ()
+
+- (CDVPluginResult*)initWithStatus:(CDVCommandStatus)statusOrdinal message:(id)theMessage;
+
+@end
+
+@implementation CDVPluginResult
+@synthesize status, message, keepCallback;
+
+static NSArray* org_apache_cordova_CommandStatusMsgs;
+
+id messageFromArrayBuffer(NSData* data)
+{
+    return @{
+        @"CDVType" : @"ArrayBuffer",
+        @"data" :[data base64EncodedString]
+    };
+}
+
+id massageMessage(id message)
+{
+    if ([message isKindOfClass:[NSData class]]) {
+        return messageFromArrayBuffer(message);
+    }
+    return message;
+}
+
+id messageFromMultipart(NSArray* theMessages)
+{
+    NSMutableArray* messages = [NSMutableArray arrayWithArray:theMessages];
+
+    for (NSUInteger i = 0; i < messages.count; ++i) {
+        [messages replaceObjectAtIndex:i withObject:massageMessage([messages objectAtIndex:i])];
+    }
+
+    return @{
+        @"CDVType" : @"MultiPart",
+        @"messages" : messages
+    };
+}
+
++ (void)initialize
+{
+    org_apache_cordova_CommandStatusMsgs = [[NSArray alloc] initWithObjects:@"No result",
+        @"OK",
+        @"Class not found",
+        @"Illegal access",
+        @"Instantiation error",
+        @"Malformed url",
+        @"IO error",
+        @"Invalid action",
+        @"JSON error",
+        @"Error",
+        nil];
+}
+
+- (CDVPluginResult*)init
+{
+    return [self initWithStatus:CDVCommandStatus_NO_RESULT message:nil];
+}
+
+- (CDVPluginResult*)initWithStatus:(CDVCommandStatus)statusOrdinal message:(id)theMessage
+{
+    self = [super init];
+    if (self) {
+        status = [NSNumber numberWithInt:statusOrdinal];
+        message = theMessage;
+        keepCallback = [NSNumber numberWithBool:NO];
+    }
+    return self;
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:[org_apache_cordova_CommandStatusMsgs objectAtIndex:statusOrdinal]];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsString:(NSString*)theMessage
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:theMessage];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArray:(NSArray*)theMessage
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:theMessage];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsInt:(int)theMessage
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithInt:theMessage]];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDouble:(double)theMessage
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithDouble:theMessage]];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsBool:(BOOL)theMessage
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithBool:theMessage]];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDictionary:(NSDictionary*)theMessage
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:theMessage];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArrayBuffer:(NSData*)theMessage
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:messageFromArrayBuffer(theMessage)];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsMultipart:(NSArray*)theMessages
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:messageFromMultipart(theMessages)];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageToErrorObject:(int)errorCode
+{
+    NSDictionary* errDict = @{@"code": [NSNumber numberWithInt:errorCode]};
+
+    return [[self alloc] initWithStatus:statusOrdinal message:errDict];
+}
+
+- (void)setKeepCallbackAsBool:(BOOL)bKeepCallback
+{
+    [self setKeepCallback:[NSNumber numberWithBool:bKeepCallback]];
+}
+
+- (NSString*)argumentsAsJSON
+{
+    id arguments = (self.message == nil ? [NSNull null] : self.message);
+    NSArray* argumentsWrappedInArray = [NSArray arrayWithObject:arguments];
+
+    NSString* argumentsJSON = [argumentsWrappedInArray JSONString];
+
+    argumentsJSON = [argumentsJSON substringWithRange:NSMakeRange(1, [argumentsJSON length] - 2)];
+
+    return argumentsJSON;
+}
+
+// These methods are used by the legacy plugin return result method
+- (NSString*)toJSONString
+{
+    NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
+        self.status, @"status",
+        self.message ? self.                                message:[NSNull null], @"message",
+        self.keepCallback, @"keepCallback",
+        nil];
+
+    NSError* error = nil;
+    NSData* jsonData = [NSJSONSerialization dataWithJSONObject:dict
+                                                       options:NSJSONWritingPrettyPrinted
+                                                         error:&error];
+    NSString* resultString = nil;
+
+    if (error != nil) {
+        NSLog(@"toJSONString error: %@", [error localizedDescription]);
+    } else {
+        resultString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
+    }
+
+    if ([[self class] isVerbose]) {
+        NSLog(@"PluginResult:toJSONString - %@", resultString);
+    }
+    return resultString;
+}
+
+- (NSString*)toSuccessCallbackString:(NSString*)callbackId
+{
+    NSString* successCB = [NSString stringWithFormat:@"cordova.callbackSuccess('%@',%@);", callbackId, [self toJSONString]];
+
+    if ([[self class] isVerbose]) {
+        NSLog(@"PluginResult toSuccessCallbackString: %@", successCB);
+    }
+    return successCB;
+}
+
+- (NSString*)toErrorCallbackString:(NSString*)callbackId
+{
+    NSString* errorCB = [NSString stringWithFormat:@"cordova.callbackError('%@',%@);", callbackId, [self toJSONString]];
+
+    if ([[self class] isVerbose]) {
+        NSLog(@"PluginResult toErrorCallbackString: %@", errorCB);
+    }
+    return errorCB;
+}
+
+static BOOL gIsVerbose = NO;
++ (void)setVerbose:(BOOL)verbose
+{
+    gIsVerbose = verbose;
+}
+
++ (BOOL)isVerbose
+{
+    return gIsVerbose;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/b3bdeb8d/CordovaMac/CordovaMac/Commands/CDVReachability.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVReachability.h b/CordovaMac/CordovaMac/Commands/CDVReachability.h
new file mode 100644
index 0000000..01a95c3
--- /dev/null
+++ b/CordovaMac/CordovaMac/Commands/CDVReachability.h
@@ -0,0 +1,85 @@
+/*
+
+ File: Reachability.h
+ Abstract: Basic demonstration of how to use the SystemConfiguration Reachability APIs.
+ Version: 2.2
+
+ Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Inc.
+ ("Apple") in consideration of your agreement to the following terms, and your
+ use, installation, modification or redistribution of this Apple software
+ constitutes acceptance of these terms.  If you do not agree with these terms,
+ please do not use, install, modify or redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject
+ to these terms, Apple grants you a personal, non-exclusive license, under
+ Apple's copyrights in this original Apple software (the "Apple Software"), to
+ use, reproduce, modify and redistribute the Apple Software, with or without
+ modifications, in source and/or binary forms; provided that if you redistribute
+ the Apple Software in its entirety and without modifications, you must retain
+ this notice and the following text and disclaimers in all such redistributions
+ of the Apple Software.
+ Neither the name, trademarks, service marks or logos of Apple Inc. may be used
+ to endorse or promote products derived from the Apple Software without specific
+ prior written permission from Apple.  Except as expressly stated in this notice,
+ no other rights or licenses, express or implied, are granted by Apple herein,
+ including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be
+ incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
+ WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+ WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
+ COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
+ DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
+ CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+ APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ Copyright (C) 2010 Apple Inc. All Rights Reserved.
+
+*/
+
+#import <Foundation/Foundation.h>
+#import <SystemConfiguration/SystemConfiguration.h>
+#import <netinet/in.h>
+
+typedef enum {
+    NotReachable = 0,
+    ReachableViaWWAN, // this value has been swapped with ReachableViaWiFi for Cordova backwards compat. reasons
+    ReachableViaWiFi  // this value has been swapped with ReachableViaWWAN for Cordova backwards compat. reasons
+} NetworkStatus;
+#define kReachabilityChangedNotification @"kNetworkReachabilityChangedNotification"
+
+@interface CDVReachability : NSObject
+{
+    BOOL localWiFiRef;
+    SCNetworkReachabilityRef reachabilityRef;
+}
+
+// reachabilityWithHostName- Use to check the reachability of a particular host name.
++ (CDVReachability*)reachabilityWithHostName:(NSString*)hostName;
+
+// reachabilityWithAddress- Use to check the reachability of a particular IP address.
++ (CDVReachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+
+// reachabilityForInternetConnection- checks whether the default route is available.
+//  Should be used by applications that do not connect to a particular host
++ (CDVReachability*)reachabilityForInternetConnection;
+
+// reachabilityForLocalWiFi- checks whether a local wifi connection is available.
++ (CDVReachability*)reachabilityForLocalWiFi;
+
+// Start listening for reachability notifications on the current run loop
+- (BOOL)startNotifier;
+- (void)stopNotifier;
+
+- (NetworkStatus)currentReachabilityStatus;
+// WWAN may be available, but not active until a connection has been established.
+// WiFi may require a connection for VPN on Demand.
+- (BOOL)connectionRequired;
+@end