├── CordovaLib ├── VERSION ├── .gitignore ├── CordovaLib_Prefix.pch └── Classes │ ├── Private │ ├── CDVPlugin+Private.h │ ├── Plugins │ │ ├── CDVGestureHandler │ │ │ ├── CDVGestureHandler.h │ │ │ └── CDVGestureHandler.m │ │ ├── CDVHandleOpenURL │ │ │ └── CDVHandleOpenURL.h │ │ ├── CDVUIWebViewEngine │ │ │ ├── CDVUIWebViewEngine.h │ │ │ ├── CDVUIWebViewNavigationDelegate.h │ │ │ └── CDVUIWebViewDelegate.h │ │ ├── CDVIntentAndNavigationFilter │ │ │ └── CDVIntentAndNavigationFilter.h │ │ └── CDVLocalStorage │ │ │ └── CDVLocalStorage.h │ ├── CDVDebug.h │ └── CDVJSON_private.h │ └── Public │ ├── CDVTimer.h │ ├── CDVURLProtocol.h │ ├── NSMutableArray+QueueAdditions.h │ ├── CDVAvailabilityDeprecated.h │ ├── CDVAppDelegate.h │ ├── CDVScreenOrientationDelegate.h │ ├── CDVUserAgentUtil.h │ ├── CDV.h │ ├── CDVConfigParser.h │ ├── CDVWhitelist.h │ ├── NSDictionary+CordovaPreferences.h │ ├── CDVCommandQueue.h │ ├── CDVCommandDelegateImpl.h │ ├── CDVPlugin+Resources.m │ ├── CDVPlugin+Resources.h │ ├── NSMutableArray+QueueAdditions.m │ ├── CDVWebViewEngineProtocol.h │ ├── NSDictionary+CordovaPreferences.m │ ├── CDVCommandDelegate.h │ ├── CDVInvokedUrlCommand.h │ └── CDVPlugin.h ├── tests ├── CordovaLibTests │ ├── .gitignore │ ├── Default-568h@2x.png │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── CordovaLibApp │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ ├── ViewController.h │ │ ├── AppDelegate.h │ │ ├── main.m │ │ ├── Bridging-Header.h │ │ ├── CordovaLibApp-Info.plist │ │ ├── ViewController.m │ │ └── AppDelegate.m │ ├── config-custom.xml │ ├── CDVFakeFileManager.h │ ├── CDVFakeFileManager.m │ ├── CordovaLibTests-Info.plist │ ├── CDVWebViewTest.h │ ├── CDVCommandDelegateTests.m │ ├── CDVBase64Tests.m │ ├── CDVInvokedUrlCommandTests.m │ └── CDVViewControllerTest.m ├── spec │ └── unit │ │ ├── fixtures │ │ ├── ios-config-xml │ │ │ ├── www │ │ │ │ └── .gitkeep │ │ │ ├── CordovaLib │ │ │ │ └── VERSION │ │ │ └── SampleApp │ │ │ │ ├── config.xml │ │ │ │ └── SampleApp-Info.plist │ │ ├── org.test.plugins.dummyplugin │ │ │ ├── www │ │ │ │ ├── dummyplugin.js │ │ │ │ └── dummyplugin │ │ │ │ │ └── image.jpg │ │ │ ├── src │ │ │ │ └── ios │ │ │ │ │ ├── TargetDirTest.h │ │ │ │ │ ├── TargetDirTest.m │ │ │ │ │ ├── libsqlite3.dylib │ │ │ │ │ ├── DummyPlugin.bundle │ │ │ │ │ ├── DummyPluginCommand.h │ │ │ │ │ ├── DummyPluginCommand.m │ │ │ │ │ ├── SourceWithFramework.m │ │ │ │ │ └── Custom.framework │ │ │ │ │ ├── somebinlib │ │ │ │ │ └── someFheader.h │ │ │ └── plugin.xml │ │ ├── org.test.plugins.faultyplugin │ │ │ ├── src │ │ │ │ └── ios │ │ │ │ │ ├── FaultyPlugin.h │ │ │ │ │ └── FaultyPlugin.m │ │ │ └── plugin.xml │ │ ├── org.test.plugins.weblessplugin │ │ │ ├── src │ │ │ │ └── ios │ │ │ │ │ ├── WeblessPluginCommand.h │ │ │ │ │ ├── WeblessPluginCommand.m │ │ │ │ │ ├── WeblessPluginViewController.h │ │ │ │ │ ├── WeblessPluginViewController.m │ │ │ │ │ ├── WeblessPluginViewController.xib │ │ │ │ │ └── WeblessPlugin.bundle │ │ │ │ │ ├── compass.png │ │ │ │ │ ├── arrow_left.png │ │ │ │ │ ├── arrow_right.png │ │ │ │ │ ├── but_refresh.png │ │ │ │ │ ├── compass@2x.png │ │ │ │ │ ├── arrow_left@2x.png │ │ │ │ │ ├── arrow_right@2x.png │ │ │ │ │ └── but_refresh@2x.png │ │ │ └── plugin.xml │ │ └── test-config-2.xml │ │ └── Api.spec.js ├── .jshintrc ├── cordova-ios.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── cordova-ios.xccheckout │ │ └── xcschemes │ │ └── CordovaLib.xcscheme └── scripts │ └── killsim.js ├── .jshintignore ├── bin ├── templates │ ├── project │ │ ├── __PROJECT_NAME__ │ │ │ ├── gitignore │ │ │ ├── Images.xcassets │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ ├── icon.png │ │ │ │ │ ├── icon-40.png │ │ │ │ │ ├── icon-50.png │ │ │ │ │ ├── icon-72.png │ │ │ │ │ ├── icon-76.png │ │ │ │ │ ├── icon@2x.png │ │ │ │ │ ├── icon-40@2x.png │ │ │ │ │ ├── icon-50@2x.png │ │ │ │ │ ├── icon-60@2x.png │ │ │ │ │ ├── icon-60@3x.png │ │ │ │ │ ├── icon-72@2x.png │ │ │ │ │ ├── icon-76@2x.png │ │ │ │ │ ├── icon-small.png │ │ │ │ │ ├── icon-83.5@2x.png │ │ │ │ │ ├── icon-small@2x.png │ │ │ │ │ └── icon-small@3x.png │ │ │ │ └── LaunchImage.launchimage │ │ │ │ │ ├── Default-667h.png │ │ │ │ │ ├── Default-736h.png │ │ │ │ │ ├── Default~iphone.png │ │ │ │ │ ├── Default@2x~iphone.png │ │ │ │ │ ├── Default-Portrait~ipad.png │ │ │ │ │ ├── Default-568h@2x~iphone.png │ │ │ │ │ ├── Default-Landscape-736h.png │ │ │ │ │ ├── Default-Landscape~ipad.png │ │ │ │ │ ├── Default-Portrait@2x~ipad.png │ │ │ │ │ └── Default-Landscape@2x~ipad.png │ │ │ ├── Plugins │ │ │ │ └── README │ │ │ ├── __PROJECT_NAME__-Prefix.pch │ │ │ ├── Bridging-Header.h │ │ │ ├── Classes │ │ │ │ ├── AppDelegate.h │ │ │ │ ├── MainViewController.h │ │ │ │ └── AppDelegate.m │ │ │ ├── main.m │ │ │ └── __PROJECT_NAME__-Info.plist │ │ └── www │ │ │ ├── img │ │ │ └── logo.png │ │ │ ├── js │ │ │ └── index.js │ │ │ └── index.html │ └── scripts │ │ └── cordova │ │ ├── run.bat │ │ ├── log.bat │ │ ├── build.bat │ │ ├── clean.bat │ │ ├── log │ │ ├── build-extras.xcconfig │ │ ├── build-debug.xcconfig │ │ ├── version.bat │ │ ├── build-release.xcconfig │ │ ├── lib │ │ ├── start-emulator │ │ ├── configMunger.js │ │ ├── list-emulator-images │ │ ├── clean.js │ │ ├── list-started-emulators │ │ ├── spawn.js │ │ ├── copy-www-build-step.js │ │ └── list-devices │ │ ├── version │ │ ├── loggingHelper.js │ │ ├── clean │ │ ├── build.xcconfig │ │ ├── build │ │ ├── run │ │ └── defaults.xml ├── tests │ ├── debug.coffee │ ├── test.coffee │ ├── autotest.coffee │ └── create.coffee ├── autotest ├── create.bat ├── update.bat ├── apple_osx_version ├── apple_ios_version ├── check_reqs.bat ├── apple_ios_version.bat ├── apple_osx_version.bat ├── apple_xcode_version.bat ├── apple_xcode_version ├── check_reqs ├── update ├── test ├── create └── uncrustify.sh ├── .istanbul.yml ├── NOTICE ├── .jshintrc ├── .ratignore ├── component.json ├── .travis.yml ├── appveyor.yml ├── cordova-js-src └── platform.js ├── CONTRIBUTING.md ├── .gitattributes ├── hooks └── pre-commit ├── package.json └── guides ├── Cordova Custom URL Scheme Handling.md └── Setting Delegates, Preferences and Script Message Handlers in the WebView.md /CordovaLib/VERSION: -------------------------------------------------------------------------------- 1 | 4.3.0-dev 2 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/.gitignore: -------------------------------------------------------------------------------- 1 | build -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/ios-config-xml/www/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/ios-config-xml/CordovaLib/VERSION: -------------------------------------------------------------------------------- 1 | 3.5.0 2 | -------------------------------------------------------------------------------- /.jshintignore: -------------------------------------------------------------------------------- 1 | bin/node_modules/* 2 | bin/templates/project/* 3 | tests/spec/unit/fixtures/* 4 | -------------------------------------------------------------------------------- /CordovaLib/.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | *.pbxuser 3 | *.perspectivev3 4 | *.mode1v3 5 | javascripts/cordova-*.js 6 | 7 | -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.perspectivev3 3 | *.pbxuser 4 | .DS_Store 5 | build/ 6 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.dummyplugin/www/dummyplugin.js: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.dummyplugin/www/dummyplugin.js 2 | -------------------------------------------------------------------------------- /bin/templates/project/www/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/www/img/logo.png -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.dummyplugin/src/ios/TargetDirTest.h: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.dummyplugin/src/ios/TargetDirTest.h 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.dummyplugin/src/ios/TargetDirTest.m: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.dummyplugin/src/ios/TargetDirTest.m 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.dummyplugin/src/ios/libsqlite3.dylib: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.dummyplugin/src/ios/libsqlite3.dylib 2 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/tests/CordovaLibTests/Default-568h@2x.png -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.dummyplugin/src/ios/DummyPlugin.bundle: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.dummyplugin/src/ios/DummyPlugin.bundle 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.dummyplugin/www/dummyplugin/image.jpg: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.dummyplugin/www/dummyplugin/image.jpg 2 | -------------------------------------------------------------------------------- /.istanbul.yml: -------------------------------------------------------------------------------- 1 | instrumentation: 2 | root: "bin/templates/scripts" 3 | include-all-sources: true 4 | reporting: 5 | print: "detail" 6 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.dummyplugin/src/ios/DummyPluginCommand.h: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.dummyplugin/src/ios/DummyPluginCommand.h 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.dummyplugin/src/ios/DummyPluginCommand.m: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.dummyplugin/src/ios/DummyPluginCommand.m 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.dummyplugin/src/ios/SourceWithFramework.m: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.dummyplugin/src/ios/SourceWithFramework.m 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.faultyplugin/src/ios/FaultyPlugin.h: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.faultyplugin/src/ios/org.test.plugins.faultyplugin.h 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.faultyplugin/src/ios/FaultyPlugin.m: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.faultyplugin/src/ios/org.test.plugins.faultyplugin.m 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.weblessplugin/src/ios/WeblessPluginCommand.h: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.weblessplugin/src/ios/WeblessPluginCommand.h 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.weblessplugin/src/ios/WeblessPluginCommand.m: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.weblessplugin/src/ios/WeblessPluginCommand.m 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.dummyplugin/src/ios/Custom.framework/somebinlib: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.dummyplugin/src/ios/Custom.framework/somebinlib 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.dummyplugin/src/ios/Custom.framework/someFheader.h: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.dummyplugin/src/ios/Custom.framework/someFheader.h 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.weblessplugin/src/ios/WeblessPluginViewController.h: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.weblessplugin/src/ios/WeblessPluginViewController.h 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.weblessplugin/src/ios/WeblessPluginViewController.m: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.weblessplugin/src/ios/WeblessPluginViewController.m 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.weblessplugin/src/ios/WeblessPluginViewController.xib: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.weblessplugin/src/ios/WeblessPluginViewController.xib 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/compass.png: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/compass.png 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/arrow_left.png: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/arrow_left.png 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/arrow_right.png: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/arrow_right.png 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/but_refresh.png: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/but_refresh.png 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/compass@2x.png: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/compass@2x.png 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/arrow_left@2x.png: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/arrow_left@2x.png 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/arrow_right@2x.png: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/arrow_right@2x.png 2 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/but_refresh@2x.png: -------------------------------------------------------------------------------- 1 | ./org.test.plugins.weblessplugin/src/ios/WeblessPlugin.bundle/but_refresh@2x.png 2 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Apache Cordova 2 | Copyright 2012 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true 3 | , "bitwise": true 4 | , "undef": true 5 | , "trailing": true 6 | , "quotmark": true 7 | , "indent": 4 8 | , "unused": "vars" 9 | , "latedef": "nofunc" 10 | } 11 | -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-50.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-72.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon@2x.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-50@2x.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-72@2x.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-small.png -------------------------------------------------------------------------------- /.ratignore: -------------------------------------------------------------------------------- 1 | # yes, not .gitignore 2 | gitignore 3 | 4 | # licenses for both below are in the cordova-ios LICENSE file 5 | NSData+Base64.h 6 | NSData+Base64.m 7 | 8 | Contents.json 9 | 10 | fixtures 11 | appveyor.yml 12 | i386 13 | -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-small@2x.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/AppIcon.appiconset/icon-small@3x.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-667h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-667h.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-736h.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default~iphone.png -------------------------------------------------------------------------------- /tests/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true 3 | , "bitwise": true 4 | , "undef": true 5 | , "trailing": true 6 | , "quotmark": true 7 | , "indent": 4 8 | , "unused": "vars" 9 | , "latedef": "nofunc" 10 | , "jasmine": true 11 | } 12 | -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default@2x~iphone.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-568h@2x~iphone.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/cordova-ios/master/bin/templates/project/__PROJECT_NAME__/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-ios", 3 | "version": "3.7.0-dev", 4 | "repository": "apache/cordova-ios", 5 | "main": "CordovaLib/cordova.js", 6 | "scripts": [ 7 | "CordovaLib/cordova.js" 8 | ], 9 | "license": "Apache Version 2.0" 10 | } 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | sudo: false 3 | node_js: 4 | - "4.2" 5 | - "6.0" 6 | install: 7 | - npm install 8 | - npm install ios-deploy 9 | - npm install -g codecov 10 | script: 11 | - npm run jshint 12 | - npm run e2e-tests 13 | - npm run objc-tests 14 | - npm run cover 15 | after_script: codecov 16 | -------------------------------------------------------------------------------- /tests/cordova-ios.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | environment: 2 | matrix: 3 | - nodejs_version: "0.10" 4 | - nodejs_version: "0.12" 5 | - nodejs_version: "4.2" 6 | - nodejs_version: "6.0" 7 | 8 | install: 9 | - ps: Install-Product node $env:nodejs_version 10 | # Lines below required due to uncrustify installation failure on Windows 11 | - npm install --prod 12 | - npm install jshint jasmine-node rewire 13 | 14 | build: off 15 | 16 | test_script: 17 | - node --version 18 | - npm --version 19 | - npm run jshint 20 | - npm run unit-tests 21 | -------------------------------------------------------------------------------- /bin/tests/debug.coffee: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | -------------------------------------------------------------------------------- /bin/tests/test.coffee: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | /* Localized versions of Info.plist keys */ 20 | 21 | -------------------------------------------------------------------------------- /CordovaLib/CordovaLib_Prefix.pch: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #ifdef __OBJC__ 21 | #import 22 | #endif 23 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CordovaLibApp/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | /* Localized versions of Info.plist keys */ 20 | 21 | -------------------------------------------------------------------------------- /bin/autotest: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | 23 | 24 | require('nodeunit').reporters.default.run(['bin/tests']) 25 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/run.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License 17 | 18 | @ECHO OFF 19 | ECHO WARN: The `run` is not available for cordova-ios on windows machines.>&2 20 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/log.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License 17 | 18 | @ECHO OFF 19 | ECHO WARN: The 'log' command is not available for cordova-ios on windows machines.>&2 20 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/build.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License 17 | 18 | @ECHO OFF 19 | ECHO WARN: The 'build' command is not available for cordova-ios on windows machines.>&2 20 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/clean.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License 17 | 18 | @ECHO OFF 19 | ECHO WARN: The 'clean' command is not available for cordova-ios on windows machines.>&2 20 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/log: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 22 | 23 | tail -f "$CORDOVA_PATH/console.log" 24 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/test-config-2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello Cordova 4 | 5 | A sample Apache Cordova application that responds to the deviceready event. 6 | 7 | 8 | Apache Cordova Team 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |   22 | 23 | -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Plugins/README: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | Put the .h and .m files of your plugin here. The .js files of your plugin belong in the www folder. 21 | -------------------------------------------------------------------------------- /bin/tests/autotest.coffee: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | 21 | exports['you are sane'] = (test) -> 22 | test.expect 1 23 | test.ok true, "this assertion should always pass" 24 | test.done() 25 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Private/CDVPlugin+Private.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | @interface CDVPlugin (Private) 21 | 22 | - (instancetype)initWithWebViewEngine:(id )theWebViewEngine; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/build-extras.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed to the Apache Software Foundation (ASF) under one 3 | // or more contributor license agreements. See the NOTICE file 4 | // distributed with this work for additional information 5 | // regarding copyright ownership. The ASF licenses this file 6 | // to you under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in compliance 8 | // with the License. You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, 13 | // software distributed under the License is distributed on an 14 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | // KIND, either express or implied. See the License for the 16 | // specific language governing permissions and limitations 17 | // under the License. 18 | // 19 | 20 | // 21 | // Auto-generated config file to override configuration files (build-release/build-debug). 22 | // 23 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CordovaLibApp/ViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | 23 | @interface ViewController : CDVViewController 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVTimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface CDVTimer : NSObject 23 | 24 | + (void)start:(NSString*)name; 25 | + (void)stop:(NSString*)name; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVURLProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "CDVAvailability.h" 22 | 23 | @class CDVViewController; 24 | 25 | @interface CDVURLProtocol : NSURLProtocol {} 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /cordova-js-src/platform.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | * 20 | */ 21 | 22 | module.exports = { 23 | id: 'ios', 24 | bootstrap: function() { 25 | require('cordova/channel').onNativeReady.fire(); 26 | } 27 | }; 28 | 29 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVPlugin.h" 21 | 22 | @interface CDVGestureHandler : CDVPlugin 23 | 24 | @property (nonatomic, strong) UILongPressGestureRecognizer* lpgr; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /bin/create.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script="%~dp0create" 20 | IF EXIST %script% ( 21 | node %script% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'create' script in 'bin' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /bin/update.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script="%~dp0update" 20 | IF EXIST %script% ( 21 | node %script% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'update' script in 'bin' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Private/Plugins/CDVHandleOpenURL/CDVHandleOpenURL.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVPlugin.h" 21 | 22 | @interface CDVHandleOpenURL : CDVPlugin 23 | 24 | @property (nonatomic, strong) NSURL* url; 25 | @property (nonatomic, assign) BOOL pageLoaded; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /bin/apple_osx_version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var versions = require('./lib/versions.js'); 23 | 24 | versions.get_apple_osx_version().done(null, function(err) { 25 | console.log(err); 26 | process.exit(2); 27 | }); 28 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/NSMutableArray+QueueAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface NSMutableArray (QueueAdditions) 23 | 24 | - (id)cdv_pop; 25 | - (id)cdv_queueHead; 26 | - (id)cdv_dequeue; 27 | - (void)cdv_enqueue:(id)obj; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /bin/apple_ios_version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var versions = require('./lib/versions.js'); 23 | 24 | versions.get_apple_ios_version().done(null, function(err) { 25 | console.log(err); 26 | process.exit(2); 27 | }); 28 | -------------------------------------------------------------------------------- /bin/check_reqs.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License 17 | @ECHO OFF 18 | SET script_path="%~dp0check_reqs" 19 | IF EXIST %script_path% ( 20 | node "%script_path%" %* 21 | ) ELSE ( 22 | ECHO. 23 | ECHO ERROR: Could not find 'check_reqs' script in 'bin' folder, aborting...>&2 24 | EXIT /B 1 25 | ) -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/build-debug.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed to the Apache Software Foundation (ASF) under one 3 | // or more contributor license agreements. See the NOTICE file 4 | // distributed with this work for additional information 5 | // regarding copyright ownership. The ASF licenses this file 6 | // to you under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in compliance 8 | // with the License. You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, 13 | // software distributed under the License is distributed on an 14 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | // KIND, either express or implied. See the License for the 16 | // specific language governing permissions and limitations 17 | // under the License. 18 | // 19 | 20 | // 21 | // XCode Build settings for "Debug" Build Configuration. 22 | // 23 | 24 | #include "build.xcconfig" 25 | 26 | GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 27 | 28 | #include "build-extras.xcconfig" 29 | -------------------------------------------------------------------------------- /bin/apple_ios_version.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script="%~dp0apple_ios_version" 20 | IF EXIST %script% ( 21 | node %script% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'apple_ios_version' script in 'bin' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /bin/apple_osx_version.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script="%~dp0apple_osx_version" 20 | IF EXIST %script% ( 21 | node %script% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'apple_osx_version' script in 'bin' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/version.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script="%~dp0version" 20 | IF EXIST %script% ( 21 | node %script% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'version' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CordovaLibApp/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | 23 | @class ViewController; 24 | 25 | @interface AppDelegate : CDVAppDelegate 26 | 27 | - (void)createViewController; 28 | - (void)destroyViewController; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /bin/apple_xcode_version.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script="%~dp0apple_xcode_version" 20 | IF EXIST %script% ( 21 | node %script% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'apple_xcode_version' script in 'bin' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/__PROJECT_NAME__-Prefix.pch: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | // 20 | // Prefix header for all source files of the '__PROJECT_NAME__' target in the '__PROJECT_NAME__' project 21 | // 22 | 23 | #ifdef __OBJC__ 24 | #import 25 | #import 26 | #endif 27 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CordovaLibApp/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | #import "AppDelegate.h" 23 | 24 | int main(int argc, char* argv[]) 25 | { 26 | @autoreleasepool { 27 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/config-custom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Private/CDVDebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #ifdef DEBUG 21 | #define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) 22 | #else 23 | #define DLog(...) 24 | #endif 25 | #define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) 26 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVAvailabilityDeprecated.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | #ifdef __clang__ 23 | #define CDV_DEPRECATED(version, msg) __attribute__((deprecated("Deprecated in Cordova " #version ". " msg))) 24 | #else 25 | #define CDV_DEPRECATED(version, msg) __attribute__((deprecated())) 26 | #endif 27 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewEngine.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVPlugin.h" 21 | #import "CDVWebViewEngineProtocol.h" 22 | 23 | @interface CDVUIWebViewEngine : CDVPlugin 24 | 25 | @property (nonatomic, strong, readonly) id uiWebViewDelegate; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /bin/apple_xcode_version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var versions = require('./lib/versions.js'); 23 | 24 | versions.get_apple_xcode_version().done(function (version) { 25 | console.log(version); 26 | }, function(err) { 27 | console.error(err); 28 | process.exit(2); 29 | }); 30 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVAppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "CDVViewController.h" 22 | 23 | @interface CDVAppDelegate : NSObject {} 24 | 25 | @property (nonatomic, strong) IBOutlet UIWindow* window; 26 | @property (nonatomic, strong) IBOutlet CDVViewController* viewController; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVScreenOrientationDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @protocol CDVScreenOrientationDelegate 23 | 24 | - (NSUInteger)supportedInterfaceOrientations; 25 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation; 26 | - (BOOL)shouldAutorotate; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/build-release.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed to the Apache Software Foundation (ASF) under one 3 | // or more contributor license agreements. See the NOTICE file 4 | // distributed with this work for additional information 5 | // regarding copyright ownership. The ASF licenses this file 6 | // to you under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in compliance 8 | // with the License. You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, 13 | // software distributed under the License is distributed on an 14 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | // KIND, either express or implied. See the License for the 16 | // specific language governing permissions and limitations 17 | // under the License. 18 | // 19 | 20 | // 21 | // XCode Build settings for "Release" Build Configuration. 22 | // 23 | 24 | #include "build.xcconfig" 25 | 26 | CODE_SIGN_IDENTITY = iPhone Distribution 27 | CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Distribution 28 | 29 | #include "build-extras.xcconfig" 30 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/lib/start-emulator: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | # Run the below to get the device targets: 21 | # xcrun instruments -s 22 | 23 | set -e 24 | 25 | 26 | DEFAULT_TARGET="iPhone 5s" 27 | TARGET=${1:-$DEFAULT_TARGET} 28 | LIB_PATH=$( cd "$( dirname "$0" )" && pwd -P) 29 | 30 | xcrun instruments -w "$TARGET" &> /dev/null -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVUserAgentUtil.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface CDVUserAgentUtil : NSObject 23 | + (NSString*)originalUserAgent; 24 | + (void)acquireLock:(void (^)(NSInteger lockToken))block; 25 | + (void)releaseLock:(NSInteger*)lockToken; 26 | + (void)setUserAgent:(NSString*)value lockToken:(NSInteger)lockToken; 27 | @end 28 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Private/CDVJSON_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | @interface NSArray (CDVJSONSerializingPrivate) 21 | - (NSString*)cdv_JSONString; 22 | @end 23 | 24 | @interface NSDictionary (CDVJSONSerializingPrivate) 25 | - (NSString*)cdv_JSONString; 26 | @end 27 | 28 | @interface NSString (CDVJSONSerializingPrivate) 29 | - (id)cdv_JSONObject; 30 | - (id)cdv_JSONFragment; 31 | @end 32 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "CDVUIWebViewEngine.h" 22 | 23 | @interface CDVUIWebViewNavigationDelegate : NSObject 24 | 25 | @property (nonatomic, weak) CDVPlugin* enginePlugin; 26 | 27 | - (instancetype)initWithEnginePlugin:(CDVPlugin*)enginePlugin; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Bridging-Header.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | Unless required by applicable law or agreed to in writing, 11 | software distributed under the License is distributed on an 12 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | KIND, either express or implied. See the License for the 14 | specific language governing permissions and limitations 15 | under the License. 16 | */ 17 | // 18 | // Bridging-Header.h 19 | // __PROJECT_NAME__ 20 | // 21 | // Created by ___FULLUSERNAME___ on ___DATE___. 22 | // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. 23 | // 24 | // 25 | // Use this file to import your target's public headers that you would like to expose to Swift. 26 | // 27 | 28 | #import 29 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CordovaLibApp/Bridging-Header.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | Unless required by applicable law or agreed to in writing, 11 | software distributed under the License is distributed on an 12 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | KIND, either express or implied. See the License for the 14 | specific language governing permissions and limitations 15 | under the License. 16 | */ 17 | // 18 | // Bridging-Header.h 19 | // __PROJECT_NAME__ 20 | // 21 | // Created by ___FULLUSERNAME___ on ___DATE___. 22 | // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. 23 | // 24 | // 25 | // Use this file to import your target's public headers that you would like to expose to Swift. 26 | // 27 | 28 | #import 29 | -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Classes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // 21 | // AppDelegate.h 22 | // __PROJECT_NAME__ 23 | // 24 | // Created by ___FULLUSERNAME___ on ___DATE___. 25 | // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. 26 | // 27 | 28 | #import 29 | #import 30 | 31 | @interface AppDelegate : CDVAppDelegate {} 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | /* 23 | 24 | Returns the VERSION of CordovaLib used. 25 | Note: it does not work if the --shared option was used to create the project. 26 | */ 27 | 28 | // Coho updates this line 29 | var VERSION="4.3.0-dev"; 30 | 31 | module.exports.version = VERSION; 32 | 33 | if (!module.parent) { 34 | console.log(VERSION); 35 | } 36 | -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | // 20 | // main.m 21 | // __PROJECT_NAME__ 22 | // 23 | // Created by ___FULLUSERNAME___ on ___DATE___. 24 | // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. 25 | // 26 | 27 | #import 28 | 29 | int main(int argc, char* argv[]) 30 | { 31 | @autoreleasepool { 32 | int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate"); 33 | return retVal; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDV.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVAvailability.h" 21 | #import "CDVAvailabilityDeprecated.h" 22 | #import "CDVAppDelegate.h" 23 | #import "CDVPlugin.h" 24 | #import "CDVPluginResult.h" 25 | #import "CDVViewController.h" 26 | #import "CDVCommandDelegate.h" 27 | #import "CDVURLProtocol.h" 28 | #import "CDVInvokedUrlCommand.h" 29 | #import "CDVWhitelist.h" 30 | #import "CDVScreenOrientationDelegate.h" 31 | #import "CDVTimer.h" 32 | #import "CDVUserAgentUtil.h" 33 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVConfigParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | @interface CDVConfigParser : NSObject 21 | { 22 | NSString* featureName; 23 | } 24 | 25 | @property (nonatomic, readonly, strong) NSMutableDictionary* pluginsDict; 26 | @property (nonatomic, readonly, strong) NSMutableDictionary* settings; 27 | @property (nonatomic, readonly, strong) NSMutableArray* startupPluginNames; 28 | @property (nonatomic, readonly, strong) NSString* startPage; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVWhitelist.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | extern NSString* const kCDVDefaultWhitelistRejectionString; 23 | 24 | @interface CDVWhitelist : NSObject 25 | 26 | @property (nonatomic, copy) NSString* whitelistRejectionFormatString; 27 | 28 | - (id)initWithArray:(NSArray*)array; 29 | - (BOOL)schemeIsAllowed:(NSString*)scheme; 30 | - (BOOL)URLIsAllowed:(NSURL*)url; 31 | - (BOOL)URLIsAllowed:(NSURL*)url logFailure:(BOOL)logFailure; 32 | - (NSString*)errorStringForURL:(NSURL*)url; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /bin/check_reqs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var check_reqs = require('./lib/check_reqs'); 23 | 24 | // check for help flag 25 | if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) > -1) { 26 | console.log('Usage: check_reqs or node check_reqs'); 27 | } else { 28 | check_reqs.run().done(null, function (err) { 29 | console.error('Failed to check requirements due to ' + err); 30 | process.exit(2); 31 | }); 32 | } 33 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/loggingHelper.js: -------------------------------------------------------------------------------- 1 | /** 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | var CordovaLogger = require('cordova-common').CordovaLogger; 21 | 22 | module.exports = { 23 | adjustLoggerLevel: function (opts) { 24 | if (opts.verbose || (Array.isArray(opts) && opts.indexOf('--verbose') !== -1)) { 25 | CordovaLogger.get().setLevel('verbose'); 26 | } else if (opts.silent || (Array.isArray(opts) && opts.indexOf('--silent') !== -1)) { 27 | CordovaLogger.get().setLevel('error'); 28 | } 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/NSDictionary+CordovaPreferences.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | 23 | @interface NSDictionary (CordovaPreferences) 24 | 25 | - (id)cordovaSettingForKey:(NSString*)key; 26 | - (BOOL)cordovaBoolSettingForKey:(NSString*)key defaultValue:(BOOL)defaultValue; 27 | - (CGFloat)cordovaFloatSettingForKey:(NSString*)key defaultValue:(CGFloat)defaultValue; 28 | 29 | @end 30 | 31 | @interface NSMutableDictionary (CordovaPreferences) 32 | 33 | - (void)setCordovaSetting:(id)value forKey:(NSString*)key; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVCommandQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @class CDVInvokedUrlCommand; 23 | @class CDVViewController; 24 | 25 | @interface CDVCommandQueue : NSObject 26 | 27 | @property (nonatomic, readonly) BOOL currentlyExecuting; 28 | 29 | - (id)initWithViewController:(CDVViewController*)viewController; 30 | - (void)dispose; 31 | 32 | - (void)resetRequestId; 33 | - (void)enqueueCommandBatch:(NSString*)batchJSON; 34 | 35 | - (void)fetchCommandsFromJs; 36 | - (void)executePending; 37 | - (BOOL)execute:(CDVInvokedUrlCommand*)command; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /bin/tests/create.coffee: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | util = require 'util' 21 | exec = require('child_process').exec 22 | path = require 'path' 23 | 24 | exports['default example project is generated'] = (test) -> 25 | test.expect 1 26 | exec './bin/create', (error, stdout, stderr) -> 27 | test.ok true, "this assertion should pass" unless error? 28 | test.done() 29 | 30 | exports['default example project has a /phonegap folder'] = (test) -> 31 | test.expect 1 32 | path.exists './example/phonegap', (exists) -> 33 | test.ok exists, 'the other phonegap folder exists' 34 | test.done() 35 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVCommandDelegateImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "CDVCommandDelegate.h" 22 | 23 | @class CDVViewController; 24 | @class CDVCommandQueue; 25 | 26 | @interface CDVCommandDelegateImpl : NSObject { 27 | @private 28 | __weak CDVViewController* _viewController; 29 | NSRegularExpression* _callbackIdPattern; 30 | @protected 31 | __weak CDVCommandQueue* _commandQueue; 32 | BOOL _delayResponses; 33 | } 34 | - (id)initWithViewController:(CDVViewController*)viewController; 35 | - (void)flushCommandQueueWithDelayedJs; 36 | @end 37 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CDVFakeFileManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | typedef BOOL (^ CDVFileExistsBlock)(NSString*); 23 | 24 | // Used in place of an NSFileManager for unit tests. It implements only those functions 25 | // which are required by the tests that use it. 26 | @interface CDVFakeFileManager : NSObject { 27 | @private 28 | CDVFileExistsBlock _fileExistsBlock; 29 | } 30 | 31 | - (id)initWithFileExistsBlock:(CDVFileExistsBlock)fileExistsBlock; 32 | + (id)managerWithFileExistsBlock:(CDVFileExistsBlock)fileExistsBlock; 33 | 34 | - (BOOL)fileExistsAtPath:(NSString*)path; 35 | @end 36 | -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Classes/MainViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // 21 | // MainViewController.h 22 | // __PROJECT_NAME__ 23 | // 24 | // Created by ___FULLUSERNAME___ on ___DATE___. 25 | // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. 26 | // 27 | 28 | #import 29 | #import 30 | #import 31 | 32 | @interface MainViewController : CDVViewController 33 | 34 | @end 35 | 36 | @interface MainCommandDelegate : CDVCommandDelegateImpl 37 | @end 38 | 39 | @interface MainCommandQueue : CDVCommandQueue 40 | @end 41 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CDVFakeFileManager.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVFakeFileManager.h" 21 | 22 | @implementation CDVFakeFileManager 23 | 24 | - (id)initWithFileExistsBlock:(CDVFileExistsBlock)fileExistsBlock 25 | { 26 | self = [super init]; 27 | if (self != nil) { 28 | _fileExistsBlock = [fileExistsBlock copy]; 29 | } 30 | return self; 31 | } 32 | 33 | + (id)managerWithFileExistsBlock:(CDVFileExistsBlock)fileExistsBlock 34 | { 35 | return [[CDVFakeFileManager alloc] initWithFileExistsBlock:fileExistsBlock]; 36 | } 37 | 38 | - (BOOL)fileExistsAtPath:(NSString*)path 39 | { 40 | return _fileExistsBlock(path); 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/Classes/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // 21 | // AppDelegate.m 22 | // __PROJECT_NAME__ 23 | // 24 | // Created by ___FULLUSERNAME___ on ___DATE___. 25 | // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. 26 | // 27 | 28 | #import "AppDelegate.h" 29 | #import "MainViewController.h" 30 | 31 | @implementation AppDelegate 32 | 33 | - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions 34 | { 35 | self.viewController = [[MainViewController alloc] init]; 36 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Private/Plugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVPlugin.h" 21 | #import "CDVWhitelist.h" 22 | 23 | typedef NS_ENUM(NSInteger, CDVIntentAndNavigationFilterValue) { 24 | CDVIntentAndNavigationFilterValueIntentAllowed, 25 | CDVIntentAndNavigationFilterValueNavigationAllowed, 26 | CDVIntentAndNavigationFilterValueNoneAllowed 27 | }; 28 | 29 | @interface CDVIntentAndNavigationFilter : CDVPlugin 30 | 31 | + (CDVIntentAndNavigationFilterValue) filterUrl:(NSURL*)url intentsWhitelist:(CDVWhitelist*)intentsWhitelist navigationsWhitelist:(CDVWhitelist*)navigationsWhitelist; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVPlugin+Resources.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVPlugin+Resources.h" 21 | 22 | @implementation CDVPlugin (CDVPluginResources) 23 | 24 | - (NSString*)pluginLocalizedString:(NSString*)key 25 | { 26 | NSBundle* bundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:NSStringFromClass([self class]) ofType:@"bundle"]]; 27 | 28 | return [bundle localizedStringForKey:(key) value:nil table:nil]; 29 | } 30 | 31 | - (UIImage*)pluginImageResource:(NSString*)name 32 | { 33 | NSString* resourceIdentifier = [NSString stringWithFormat:@"%@.bundle/%@", NSStringFromClass([self class]), name]; 34 | 35 | return [UIImage imageNamed:resourceIdentifier]; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 21 | 22 | # Contributing to Apache Cordova 23 | 24 | Anyone can contribute to Cordova. And we need your contributions. 25 | 26 | There are multiple ways to contribute: report bugs, improve the docs, and 27 | contribute code. 28 | 29 | For instructions on this, start with the 30 | [contribution overview](http://cordova.apache.org/contribute/). 31 | 32 | The details are explained there, but the important items are: 33 | - Sign and submit an Apache ICLA (Contributor License Agreement). 34 | - Have a Jira issue open that corresponds to your contribution. 35 | - Run the tests so your patch doesn't break existing functionality. 36 | 37 | We look forward to your contributions! 38 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | 3 | # source code 4 | *.php text 5 | *.css text 6 | *.sass text 7 | *.scss text 8 | *.less text 9 | *.styl text 10 | *.js text 11 | *.coffee text 12 | *.json text 13 | *.htm text 14 | *.html text 15 | *.xml text 16 | *.svg text 17 | *.txt text 18 | *.ini text 19 | *.inc text 20 | *.pl text 21 | *.rb text 22 | *.py text 23 | *.scm text 24 | *.sql text 25 | *.sh text 26 | *.bat text 27 | 28 | # templates 29 | *.ejs text 30 | *.hbt text 31 | *.jade text 32 | *.haml text 33 | *.hbs text 34 | *.dot text 35 | *.tmpl text 36 | *.phtml text 37 | 38 | # server config 39 | .htaccess text 40 | 41 | # git config 42 | .gitattributes text 43 | .gitignore text 44 | .gitconfig text 45 | 46 | # code analysis config 47 | .jshintrc text 48 | .jscsrc text 49 | .jshintignore text 50 | .csslintrc text 51 | 52 | # misc config 53 | *.yaml text 54 | *.yml text 55 | .editorconfig text 56 | 57 | # build config 58 | *.npmignore text 59 | *.bowerrc text 60 | 61 | # Heroku 62 | Procfile text 63 | .slugignore text 64 | 65 | # Documentation 66 | *.md text 67 | LICENSE text 68 | AUTHORS text 69 | 70 | 71 | # 72 | ## These files are binary and should be left untouched 73 | # 74 | 75 | # (binary is a macro for -text -diff) 76 | *.png binary 77 | *.jpg binary 78 | *.jpeg binary 79 | *.gif binary 80 | *.ico binary 81 | *.mov binary 82 | *.mp4 binary 83 | *.mp3 binary 84 | *.flv binary 85 | *.fla binary 86 | *.swf binary 87 | *.gz binary 88 | *.zip binary 89 | *.7z binary 90 | *.ttf binary 91 | *.eot binary 92 | *.woff binary 93 | *.pyc binary 94 | *.pdf binary 95 | -------------------------------------------------------------------------------- /bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var path = require('path'); 23 | var Api = require('./templates/scripts/cordova/Api'); 24 | var args = require('nopt')({ 25 | 'link': Boolean, 26 | 'shared': Boolean, // alias for --link 27 | 'help': Boolean 28 | }, { 'd' : '--verbose' }); 29 | 30 | if (args.help || args.argv.remain.length === 0) { 31 | console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'update')) + ' [--link]'); 32 | process.exit(0); 33 | } 34 | 35 | require('./templates/scripts/cordova/loggingHelper').adjustLoggerLevel(args); 36 | 37 | Api.updatePlatform(args.argv.remain[0], {link: (args.link || args.shared)}).done(); 38 | -------------------------------------------------------------------------------- /hooks/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | PATH=$PATH:/usr/local/bin:/usr/local/sbin 22 | 23 | # Redirect output to stderr. 24 | exec 1>&2 25 | test $SKIP_UNCRUSTIFY && exit 0 26 | 27 | RET=0 28 | files=$(bin/uncrustify.sh --filter $(git diff --cached --name-only)) 29 | MSGS= 30 | for file in $files; do 31 | if ! bin/uncrustify.sh --check-file $file; then 32 | MSGS="$MSGS 33 | bin/uncrustify.sh \"$file\" && git add \"$file\"" 34 | RET=1 35 | fi 36 | done 37 | 38 | if [[ $RET = 1 ]]; then 39 | echo "Commit aborted because style fix-ups are required." 40 | echo "Please run:$MSGS" 41 | echo "Alternatively, run \"$PWD/bin/uncrustify.sh --staged\" and then re-stage affected files." 42 | fi 43 | 44 | exit $RET 45 | 46 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/lib/configMunger.js: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | /*jshint node: true*/ 21 | 22 | var PlatformJson = require('cordova-common').PlatformJson; 23 | var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger; 24 | var PluginInfoProvider = require('cordova-common').PluginInfoProvider; 25 | 26 | //shared PlatformMunger instance 27 | var _instance = null; 28 | 29 | module.exports = { 30 | 31 | get: function(platformRoot) { 32 | if (!_instance) { 33 | _instance = new PlatformMunger('ios', platformRoot, PlatformJson.load(platformRoot, 'ios'), 34 | new PluginInfoProvider()); 35 | } 36 | 37 | return _instance; 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CordovaLibTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | CFBundleDevelopmentRegion 26 | en 27 | CFBundleExecutable 28 | ${EXECUTABLE_NAME} 29 | CFBundleIdentifier 30 | org.apache.cordova.${PRODUCT_NAME:rfc1034identifier} 31 | CFBundleInfoDictionaryVersion 32 | 6.0 33 | CFBundlePackageType 34 | BNDL 35 | CFBundleShortVersionString 36 | 1.0 37 | CFBundleSignature 38 | ???? 39 | CFBundleVersion 40 | 1 41 | 42 | 43 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "CDVAvailability.h" 22 | 23 | /** 24 | * Distinguishes top-level navigations from sub-frame navigations. 25 | * shouldStartLoadWithRequest is called for every request, but didStartLoad 26 | * and didFinishLoad is called only for top-level navigations. 27 | * Relevant bug: CB-2389 28 | */ 29 | @interface CDVUIWebViewDelegate : NSObject { 30 | __weak NSObject * _delegate; 31 | NSInteger _loadCount; 32 | NSInteger _state; 33 | NSInteger _curLoadToken; 34 | NSInteger _loadStartPollCount; 35 | } 36 | 37 | - (id)initWithDelegate:(NSObject *)delegate; 38 | 39 | - (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CordovaLibApp/CordovaLibApp-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | org.apache.cordova.cordovalibapptests.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CDVWebViewTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | 23 | @class AppDelegate; 24 | @class CDVViewController; 25 | 26 | @interface CDVWebViewTest : XCTestCase 27 | 28 | @property (nonatomic, strong) UIWebView* webView; 29 | 30 | - (AppDelegate*)appDelegate; 31 | - (CDVViewController*)viewController; 32 | - (UIWebView*)webView; 33 | 34 | // Returns the already registered plugin object for the given class. 35 | - (id)pluginInstance:(NSString*)pluginName; 36 | // Destroys the existing webview and creates a new one. 37 | - (void)reloadWebView; 38 | // Runs the run loop until the given block returns true, or until a timeout 39 | // occurs. 40 | - (void)waitForConditionName:(NSString*)conditionName block:(BOOL (^)())block; 41 | // Convenience function for stringByEvaluatingJavaScriptFromString. 42 | - (NSString*)evalJs:(NSString*)code; 43 | @end 44 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVPlugin+Resources.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "CDVPlugin.h" 22 | 23 | @interface CDVPlugin (CDVPluginResources) 24 | 25 | /* 26 | This will return the localized string for a key in a .bundle that is named the same as your class 27 | For example, if your plugin class was called Foo, and you have a Spanish localized strings file, it will 28 | try to load the desired key from Foo.bundle/es.lproj/Localizable.strings 29 | */ 30 | - (NSString*)pluginLocalizedString:(NSString*)key; 31 | 32 | /* 33 | This will return the image for a name in a .bundle that is named the same as your class 34 | For example, if your plugin class was called Foo, and you have an image called "bar", 35 | it will try to load the image from Foo.bundle/bar.png (and appropriately named retina versions) 36 | */ 37 | - (UIImage*)pluginImageResource:(NSString*)name; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/NSMutableArray+QueueAdditions.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "NSMutableArray+QueueAdditions.h" 21 | 22 | @implementation NSMutableArray (QueueAdditions) 23 | 24 | - (id)cdv_queueHead 25 | { 26 | if ([self count] == 0) { 27 | return nil; 28 | } 29 | 30 | return [self objectAtIndex:0]; 31 | } 32 | 33 | - (__autoreleasing id)cdv_dequeue 34 | { 35 | if ([self count] == 0) { 36 | return nil; 37 | } 38 | 39 | id head = [self objectAtIndex:0]; 40 | if (head != nil) { 41 | // [[head retain] autorelease]; ARC - the __autoreleasing on the return value should so the same thing 42 | [self removeObjectAtIndex:0]; 43 | } 44 | 45 | return head; 46 | } 47 | 48 | - (id)cdv_pop 49 | { 50 | return [self cdv_dequeue]; 51 | } 52 | 53 | - (void)cdv_enqueue:(id)object 54 | { 55 | [self addObject:object]; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /tests/cordova-ios.xcworkspace/xcshareddata/cordova-ios.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 98C9766F-4C4F-444E-8FA9-C08C9A9BD59C 9 | IDESourceControlProjectName 10 | cordova-ios 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | BCEF5DF91F385AC4047CEAF9627D88E4C774D4FA 14 | https://git-wip-us.apache.org/repos/asf/cordova-ios.git 15 | 16 | IDESourceControlProjectPath 17 | tests/cordova-ios.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | BCEF5DF91F385AC4047CEAF9627D88E4C774D4FA 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://git-wip-us.apache.org/repos/asf/cordova-ios.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | BCEF5DF91F385AC4047CEAF9627D88E4C774D4FA 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | BCEF5DF91F385AC4047CEAF9627D88E4C774D4FA 36 | IDESourceControlWCCName 37 | cordova-ios 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /tests/scripts/killsim.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var shell = require('shelljs'); 23 | 24 | function killSimulator(processName) { 25 | var result; 26 | var return_code = 0; 27 | // check iOS Simulator if running 28 | var command = 'pgrep -x "' + processName + '" > /dev/null'; 29 | return_code = shell.exec(command).code; 30 | 31 | // if iOS Simulator is running, kill it 32 | if (return_code === 0) { // found 33 | shell.echo('iOS Simulator is running as ("'+ processName +'"), we\'re going to kill it.'); 34 | result = shell.exec('killall "' + processName + '"'); 35 | if (result.code !== 0) { 36 | shell.echo('Failed to kill process: ' + processName); 37 | } else { 38 | shell.echo('Process was killed: ' + processName); 39 | } 40 | } 41 | } 42 | 43 | killSimulator('iOS Simulator'); // XCode 6 44 | killSimulator('Simulator'); // XCode 7 45 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CordovaLibApp/ViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "ViewController.h" 21 | 22 | @interface ViewController () 23 | 24 | @end 25 | 26 | @implementation ViewController 27 | 28 | - (void)viewWillAppear:(BOOL)animated 29 | { 30 | // View defaults to full size. If you want to customize the view's size, or its subviews (e.g. webView), 31 | // you can do so here. 32 | 33 | [super viewWillAppear:animated]; 34 | } 35 | 36 | - (void)viewDidLoad 37 | { 38 | [super viewDidLoad]; 39 | // Do any additional setup after loading the view, typically from a nib. 40 | } 41 | 42 | - (void)viewDidUnload 43 | { 44 | [super viewDidUnload]; 45 | // Release any retained subviews of the main view. 46 | } 47 | 48 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 49 | { 50 | return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation]; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /bin/test: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | 23 | 24 | # the two lines below are to get the current folder, and resolve symlinks 25 | SCRIPT="$0" 26 | # need this for relative symlinks 27 | while [ -h "$SCRIPT" ] ; do 28 | SCRIPT=`readlink "$SCRIPT"` 29 | done 30 | 31 | BINDIR=$( cd "$( dirname "$SCRIPT" )" && pwd ) 32 | TESTDIR=$BINDIR/mobile-spec-test 33 | 34 | echo "TESTDIR" $SCRIPT 35 | 36 | # get the latest mobile-spec 37 | git clone git://github.com/apache/cordova-mobile-spec.git $BINDIR/mobile-spec 38 | 39 | # clobber test if it exists 40 | if [ -e $TESTDIR ] 41 | then 42 | rm -rf $TESTDIR 43 | fi 44 | 45 | # generate a working proj 46 | $BINDIR/create $TESTDIR org.apache.cordova.test CordovaTest 47 | 48 | # kill the default app and replace it w/ mobile-spec 49 | rm -rf $TESTDIR/www 50 | mv $BINDIR/mobile-spec $TESTDIR/www 51 | 52 | # build it, launch it and start logging on stdout 53 | $TESTDIR/cordova/debug && $TESTDIR/cordova/log 54 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/lib/list-emulator-images: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | /*jshint node: true*/ 23 | 24 | var Q = require('q'), 25 | iossim = require('ios-sim'), 26 | exec = require('child_process').exec, 27 | check_reqs = require('./check_reqs'); 28 | 29 | /** 30 | * Gets list of iOS devices available for simulation 31 | * @return {Promise} Promise fulfilled with list of devices available for simulation 32 | */ 33 | function listEmulatorImages () { 34 | return Q.resolve(iossim.getdevicetypes()); 35 | } 36 | 37 | 38 | exports.run = listEmulatorImages; 39 | 40 | // Check if module is started as separate script. 41 | // If so, then invoke main method and print out results. 42 | if (!module.parent) { 43 | listEmulatorImages().then(function (names) { 44 | names.forEach(function (name) { 45 | console.log(name); 46 | }); 47 | }); 48 | } 49 | -------------------------------------------------------------------------------- /bin/templates/project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIcons 12 | 13 | CFBundleIcons~ipad 14 | 15 | CFBundleIdentifier 16 | --ID-- 17 | CFBundleInfoDictionaryVersion 18 | 6.0 19 | CFBundleName 20 | ${PRODUCT_NAME} 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | 1.0 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | 1.0 29 | LSRequiresIPhoneOS 30 | 31 | NSMainNibFile 32 | 33 | NSMainNibFile~ipad 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationLandscapeLeft 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | UIRequiresFullScreen 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/lib/clean.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /*jshint node: true*/ 21 | 22 | var Q = require('q'), 23 | path = require('path'), 24 | shell = require('shelljs'), 25 | spawn = require('./spawn'); 26 | 27 | var projectPath = path.join(__dirname, '..', '..'); 28 | 29 | module.exports.run = function() { 30 | var projectName = shell.ls(projectPath).filter(function (name) { 31 | return path.extname(name) === '.xcodeproj'; 32 | })[0]; 33 | 34 | if (!projectName) { 35 | return Q.reject('No Xcode project found in ' + projectPath); 36 | } 37 | 38 | return spawn('xcodebuild', ['-project', projectName, '-configuration', 'Debug', '-alltargets', 'clean'], projectPath) 39 | .then(function () { 40 | return spawn('xcodebuild', ['-project', projectName, '-configuration', 'Release', '-alltargets', 'clean'], projectPath); 41 | }).then(function () { 42 | return shell.rm('-rf', path.join(projectPath, 'build')); 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/clean: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var Api = require('./Api'); 23 | var path = require('path'); 24 | var nopt = require('nopt'); 25 | 26 | if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) { 27 | console.log('Cleans the project directory.'); 28 | process.exit(0); 29 | } 30 | 31 | // Do some basic argument parsing 32 | var opts = nopt({ 33 | 'verbose' : Boolean, 34 | 'silent' : Boolean 35 | }, { 'd' : '--verbose' }); 36 | 37 | // Make buildOptions compatible with PlatformApi clean method spec 38 | opts.argv = opts.argv.original; 39 | 40 | // Skip cleaning prepared files when not invoking via cordova CLI. 41 | opts.noPrepare = true; 42 | 43 | require('./loggingHelper').adjustLoggerLevel(opts); 44 | 45 | new Api().clean(opts).done(function() { 46 | console.log('** CLEAN SUCCEEDED **'); 47 | }, function(err) { 48 | console.error(err); 49 | process.exit(2); 50 | }); 51 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CDVCommandDelegateTests.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | 23 | @interface CDVCommandDelegateTests : XCTestCase 24 | 25 | @end 26 | 27 | @interface CDVCommandDelegateImpl () 28 | 29 | // expose private interface 30 | - (BOOL)isValidCallbackId:(NSString*)callbackId; 31 | 32 | @end 33 | 34 | @implementation CDVCommandDelegateTests 35 | 36 | - (void)setUp 37 | { 38 | [super setUp]; 39 | // Put setup code here. This method is called before the invocation of each test method in the class. 40 | } 41 | 42 | - (void)tearDown 43 | { 44 | // Put teardown code here. This method is called after the invocation of each test method in the class. 45 | [super tearDown]; 46 | } 47 | 48 | - (void)testNullCallbackId 49 | { 50 | CDVCommandDelegateImpl* impl = [[CDVCommandDelegateImpl alloc] initWithViewController:nil]; 51 | 52 | NSString* callbackId = nil; 53 | 54 | XCTAssertFalse([impl isValidCallbackId:callbackId], @"A nil callbackId should be not valid"); 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVWebViewEngineProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | #define kCDVWebViewEngineScriptMessageHandlers @"kCDVWebViewEngineScriptMessageHandlers" 23 | #define kCDVWebViewEngineUIWebViewDelegate @"kCDVWebViewEngineUIWebViewDelegate" 24 | #define kCDVWebViewEngineWKNavigationDelegate @"kCDVWebViewEngineWKNavigationDelegate" 25 | #define kCDVWebViewEngineWKUIDelegate @"kCDVWebViewEngineWKUIDelegate" 26 | #define kCDVWebViewEngineWebViewPreferences @"kCDVWebViewEngineWebViewPreferences" 27 | 28 | @protocol CDVWebViewEngineProtocol 29 | 30 | @property (nonatomic, strong, readonly) UIView* engineWebView; 31 | 32 | - (id)loadRequest:(NSURLRequest*)request; 33 | - (id)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL; 34 | - (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler; 35 | 36 | - (NSURL*)URL; 37 | - (BOOL)canLoadRequest:(NSURLRequest*)request; 38 | 39 | - (instancetype)initWithFrame:(CGRect)frame; 40 | - (void)updateWithInfo:(NSDictionary*)info; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-ios", 3 | "version": "4.3.0-dev", 4 | "description": "cordova-ios release", 5 | "main": "bin/templates/scripts/cordova/Api.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://git-wip-us.apache.org/repos/asf/cordova-ios.git" 9 | }, 10 | "keywords": [ 11 | "ios", 12 | "cordova", 13 | "apache", 14 | "ecosystem:cordova", 15 | "cordova:platform" 16 | ], 17 | "scripts": { 18 | "test": "npm run e2e-tests && npm run objc-tests && npm run unit-tests", 19 | "posttest": "npm run jshint", 20 | "cover": "istanbul cover node_modules/jasmine-node/bin/jasmine-node -- tests/spec/unit", 21 | "e2e-tests": "jasmine-node --captureExceptions --color tests/spec", 22 | "objc-tests": "xcodebuild test -workspace tests/cordova-ios.xcworkspace -scheme CordovaLibTests -destination \"platform=iOS Simulator,name=iPhone 5\" CONFIGURATION_BUILD_DIR=\"`mktemp -d 2>/dev/null || mktemp -d -t 'cordova-ios'`\"", 23 | "preobjc-tests": "tests/scripts/killsim.js", 24 | "unit-tests": "jasmine-node --captureExceptions --color tests/spec/unit", 25 | "jshint": "jshint bin tests" 26 | }, 27 | "author": "Apache Software Foundation", 28 | "license": "Apache-2.0", 29 | "devDependencies": { 30 | "coffee-script": "^1.7.1", 31 | "istanbul": "^0.4.2", 32 | "jasmine-node": "~1", 33 | "jshint": "^2.6.0", 34 | "nodeunit": "^0.8.7", 35 | "rewire": "^2.5.1", 36 | "tmp": "^0.0.26", 37 | "uncrustify": "^0.6.1" 38 | }, 39 | "dependencies": { 40 | "cordova-common": "^1.3.0", 41 | "ios-sim": "^5.0.7", 42 | "nopt": "^3.0.6", 43 | "plist": "^1.2.0", 44 | "q": "^1.4.1", 45 | "shelljs": "^0.5.3", 46 | "xcode": "^0.8.5" 47 | }, 48 | "bundledDependencies": [ 49 | "cordova-common", 50 | "ios-sim", 51 | "nopt", 52 | "plist", 53 | "q", 54 | "shelljs", 55 | "xcode" 56 | ] 57 | } 58 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Private/Plugins/CDVLocalStorage/CDVLocalStorage.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVPlugin.h" 21 | 22 | #define kCDVLocalStorageErrorDomain @"kCDVLocalStorageErrorDomain" 23 | #define kCDVLocalStorageFileOperationError 1 24 | 25 | @interface CDVLocalStorage : CDVPlugin 26 | 27 | @property (nonatomic, readonly, strong) NSMutableArray* backupInfo; 28 | 29 | - (BOOL)shouldBackup; 30 | - (BOOL)shouldRestore; 31 | - (void)backup:(CDVInvokedUrlCommand*)command; 32 | - (void)restore:(CDVInvokedUrlCommand*)command; 33 | 34 | + (void)__fixupDatabaseLocationsWithBackupType:(NSString*)backupType; 35 | // Visible for testing. 36 | + (BOOL)__verifyAndFixDatabaseLocationsWithAppPlistDict:(NSMutableDictionary*)appPlistDict 37 | bundlePath:(NSString*)bundlePath 38 | fileManager:(NSFileManager*)fileManager; 39 | @end 40 | 41 | @interface CDVBackupInfo : NSObject 42 | 43 | @property (nonatomic, copy) NSString* original; 44 | @property (nonatomic, copy) NSString* backup; 45 | @property (nonatomic, copy) NSString* label; 46 | 47 | - (BOOL)shouldBackup; 48 | - (BOOL)shouldRestore; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/lib/list-started-emulators: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | /*jshint node: true*/ 23 | 24 | var Q = require('q'), 25 | exec = require('child_process').exec; 26 | 27 | /** 28 | * Gets list of running iOS simulators 29 | * @return {Promise} Promise fulfilled with list of running iOS simulators 30 | */ 31 | function listStartedEmulators () { 32 | // wrap exec call into promise 33 | return Q.nfcall(exec, 'ps aux | grep -i "[i]OS Simulator"') 34 | .then(function () { 35 | return Q.nfcall(exec, 'defaults read com.apple.iphonesimulator "SimulateDevice"'); 36 | }).then(function (stdio) { 37 | return stdio[0].trim().split('\n'); 38 | }); 39 | } 40 | 41 | exports.run = listStartedEmulators; 42 | 43 | // Check if module is started as separate script. 44 | // If so, then invoke main method and print out results. 45 | if (!module.parent) { 46 | listStartedEmulators().then(function (emulators) { 47 | emulators.forEach(function (emulator) { 48 | console.log(emulator); 49 | }); 50 | }); 51 | } 52 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/NSDictionary+CordovaPreferences.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "NSDictionary+CordovaPreferences.h" 21 | #import 22 | 23 | @implementation NSDictionary (CordovaPreferences) 24 | 25 | - (id)cordovaSettingForKey:(NSString*)key 26 | { 27 | return [self objectForKey:[key lowercaseString]]; 28 | } 29 | 30 | - (BOOL)cordovaBoolSettingForKey:(NSString*)key defaultValue:(BOOL)defaultValue 31 | { 32 | BOOL value = defaultValue; 33 | id prefObj = [self cordovaSettingForKey:key]; 34 | 35 | if (prefObj != nil) { 36 | value = [(NSNumber*)prefObj boolValue]; 37 | } 38 | 39 | return value; 40 | } 41 | 42 | - (CGFloat)cordovaFloatSettingForKey:(NSString*)key defaultValue:(CGFloat)defaultValue 43 | { 44 | CGFloat value = defaultValue; 45 | id prefObj = [self cordovaSettingForKey:key]; 46 | 47 | if (prefObj != nil) { 48 | value = [prefObj floatValue]; 49 | } 50 | 51 | return value; 52 | } 53 | 54 | @end 55 | 56 | @implementation NSMutableDictionary (CordovaPreferences) 57 | 58 | - (void)setCordovaSetting:(id)value forKey:(NSString*)key 59 | { 60 | [self setObject:value forKey:[key lowercaseString]]; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/lib/spawn.js: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | /*jshint node: true*/ 21 | 22 | var Q = require('q'), 23 | proc = require('child_process'); 24 | 25 | /** 26 | * Run specified command with arguments 27 | * @param {String} cmd Command 28 | * @param {Array} args Array of arguments that should be passed to command 29 | * @param {String} opt_cwd Working directory for command 30 | * @param {String} opt_verbosity Verbosity level for command stdout output, "verbose" by default 31 | * @return {Promise} Promise either fullfilled or rejected with error code 32 | */ 33 | module.exports = function(cmd, args, opt_cwd) { 34 | var d = Q.defer(); 35 | try { 36 | var child = proc.spawn(cmd, args, {cwd: opt_cwd, stdio: 'inherit'}); 37 | 38 | child.on('exit', function(code) { 39 | if (code) { 40 | d.reject('Error code ' + code + ' for command: ' + cmd + ' with args: ' + args); 41 | } else { 42 | d.resolve(); 43 | } 44 | }); 45 | } catch(e) { 46 | d.reject(e); 47 | } 48 | return d.promise; 49 | }; 50 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CordovaLibApp/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "AppDelegate.h" 21 | 22 | #import "ViewController.h" 23 | 24 | @implementation AppDelegate 25 | 26 | - (void)createViewController 27 | { 28 | NSAssert(!self.viewController, @"ViewController already created."); 29 | 30 | self.viewController = [[ViewController alloc] init]; 31 | self.viewController.wwwFolderName = @"www"; 32 | self.viewController.startPage = @"index.html"; 33 | 34 | // NOTE: To customize the view's frame size (which defaults to full screen), override 35 | // [self.viewController viewWillAppear:] in your view controller. 36 | 37 | self.window.rootViewController = self.viewController; 38 | } 39 | 40 | - (void)destroyViewController 41 | { 42 | self.viewController = nil; 43 | } 44 | 45 | - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions 46 | { 47 | BOOL retVal = [super application:application didFinishLaunchingWithOptions:launchOptions]; 48 | // Create the main view on start-up only when not running unit tests. 49 | if (!NSClassFromString(@"CDVWebViewTest")) { 50 | [self createViewController]; 51 | } 52 | 53 | return retVal; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/build.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed to the Apache Software Foundation (ASF) under one 3 | // or more contributor license agreements. See the NOTICE file 4 | // distributed with this work for additional information 5 | // regarding copyright ownership. The ASF licenses this file 6 | // to you under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in compliance 8 | // with the License. You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, 13 | // software distributed under the License is distributed on an 14 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | // KIND, either express or implied. See the License for the 16 | // specific language governing permissions and limitations 17 | // under the License. 18 | // 19 | 20 | // 21 | // XCode build settings shared by all Build Configurations. 22 | // Settings are overridden by configuration-level .xcconfig file (build-release/build-debug). 23 | // 24 | 25 | HEADER_SEARCH_PATHS = "$(TARGET_BUILD_DIR)/usr/local/lib/include" "$(OBJROOT)/UninstalledProducts/include" "$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include" "$(BUILT_PRODUCTS_DIR)" 26 | IPHONEOS_DEPLOYMENT_TARGET = 8.0 27 | OTHER_LDFLAGS = -ObjC 28 | TARGETED_DEVICE_FAMILY = 1,2 29 | 30 | // Type of signing identity used for codesigning, resolves to first match of given type. 31 | // "iPhone Developer": Development builds (default, local only; iOS Development certificate) or "iPhone Distribution": Distribution builds (Adhoc/In-House/AppStore; iOS Distribution certificate) 32 | CODE_SIGN_IDENTITY = iPhone Developer 33 | CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer 34 | 35 | // (CB-9721) Set ENABLE_BITCODE to NO in build.xcconfig 36 | ENABLE_BITCODE = NO 37 | 38 | // (CB-9719) Set CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES to YES in build.xcconfig 39 | CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES 40 | 41 | // (CB-10072) 42 | SWIFT_OBJC_BRIDGING_HEADER = $(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h -------------------------------------------------------------------------------- /bin/templates/project/www/js/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | var app = { 20 | // Application Constructor 21 | initialize: function() { 22 | this.bindEvents(); 23 | }, 24 | // Bind Event Listeners 25 | // 26 | // Bind any events that are required on startup. Common events are: 27 | // 'load', 'deviceready', 'offline', and 'online'. 28 | bindEvents: function() { 29 | document.addEventListener('deviceready', this.onDeviceReady, false); 30 | }, 31 | // deviceready Event Handler 32 | // 33 | // The scope of 'this' is the event. In order to call the 'receivedEvent' 34 | // function, we must explicitly call 'app.receivedEvent(...);' 35 | onDeviceReady: function() { 36 | app.receivedEvent('deviceready'); 37 | }, 38 | // Update DOM on a Received Event 39 | receivedEvent: function(id) { 40 | var parentElement = document.getElementById(id); 41 | var listeningElement = parentElement.querySelector('.listening'); 42 | var receivedElement = parentElement.querySelector('.received'); 43 | 44 | listeningElement.setAttribute('style', 'display:none;'); 45 | receivedElement.setAttribute('style', 'display:block;'); 46 | 47 | console.log('Received Event: ' + id); 48 | } 49 | }; 50 | 51 | app.initialize(); -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.weblessplugin/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 25 | 26 | Webless Plugin 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CDVBase64Tests.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface CDVBase64Tests : XCTestCase 23 | @end 24 | 25 | @implementation CDVBase64Tests 26 | 27 | - (void)setUp 28 | { 29 | [super setUp]; 30 | 31 | // setup code here 32 | } 33 | 34 | - (void)tearDown 35 | { 36 | // Tear-down code here. 37 | 38 | [super tearDown]; 39 | } 40 | 41 | - (void)testBase64Encode 42 | { 43 | NSString* decodedString = @"abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&"; 44 | NSData* decodedData = [decodedString dataUsingEncoding:NSUTF8StringEncoding]; 45 | 46 | NSString* expectedEncodedString = @"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY3ODkwIUAjJCVeJg=="; 47 | NSString* actualEncodedString = [decodedData base64EncodedStringWithOptions:0]; 48 | 49 | XCTAssertTrue([expectedEncodedString isEqualToString:actualEncodedString]); 50 | } 51 | 52 | - (void)testBase64Decode 53 | { 54 | NSString* encodedString = @"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY3ODkwIUAjJCVeJg=="; 55 | NSString* decodedString = @"abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&"; 56 | NSData* encodedData = [decodedString dataUsingEncoding:NSUTF8StringEncoding]; 57 | NSData* decodedData = [[NSData alloc] initWithBase64EncodedString:encodedString options:0]; 58 | 59 | XCTAssertTrue([encodedData isEqualToData:decodedData]); 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /tests/spec/unit/Api.spec.js: -------------------------------------------------------------------------------- 1 | /** 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | var path = require('path'); 21 | var Api = require('../../../bin/templates/scripts/cordova/Api'); 22 | var FIXTURES = path.join(__dirname, 'fixtures'); 23 | var iosProjectFixture = path.join(FIXTURES, 'ios-config-xml'); 24 | 25 | describe('Platform Api', function () { 26 | 27 | describe('constructor', function() { 28 | it('should throw if provided directory does not contain an xcodeproj file', function() { 29 | expect(function() { new Api('ios', path.join(FIXTURES, '..')); }).toThrow(); 30 | }); 31 | it('should create an instance with path, pbxproj, xcodeproj, originalName and cordovaproj properties', function() { 32 | expect(function() { 33 | var p = new Api('ios',iosProjectFixture); 34 | expect(p.locations.root).toEqual(iosProjectFixture); 35 | expect(p.locations.pbxproj).toEqual(path.join(iosProjectFixture, 'SampleApp.xcodeproj', 'project.pbxproj')); 36 | expect(p.locations.xcodeProjDir).toEqual(path.join(iosProjectFixture, 'SampleApp.xcodeproj')); 37 | expect(p.locations.www).toEqual(path.join(iosProjectFixture, 'www')); 38 | expect(p.locations.configXml).toEqual(path.join(iosProjectFixture, 'SampleApp', 'config.xml')); 39 | }).not.toThrow(); 40 | }); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /tests/CordovaLibTests/CDVInvokedUrlCommandTests.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | #import 23 | 24 | @interface CDVInvokedUrlCommandTests : XCTestCase 25 | @end 26 | 27 | @implementation CDVInvokedUrlCommandTests 28 | 29 | - (void)testInitWithNoArgs 30 | { 31 | NSArray* jsonArr = [NSArray arrayWithObjects:@"callbackId", @"className", @"methodName", [NSArray array], nil]; 32 | CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonArr]; 33 | 34 | XCTAssertEqual(@"callbackId", command.callbackId); 35 | XCTAssertEqual(@"className", command.className); 36 | XCTAssertEqual(@"methodName", command.methodName); 37 | XCTAssertEqual([NSArray array], command.arguments); 38 | } 39 | 40 | - (void)testArgumentAtIndex 41 | { 42 | NSArray* jsonArr = [NSArray arrayWithObjects:[NSNull null], @"className", @"methodName", [NSArray array], nil]; 43 | CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonArr]; 44 | 45 | XCTAssertNil([command argumentAtIndex:0], @"NSNull to nil"); 46 | XCTAssertNil([command argumentAtIndex:100], @"Invalid index to nil"); 47 | XCTAssertEqual(@"default", [command argumentAtIndex:0 withDefault:@"default"], @"NSNull to default"); 48 | XCTAssertEqual(@"default", [command argumentAtIndex:100 withDefault:@"default"], @"Invalid index to default"); 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVCommandDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVAvailability.h" 21 | #import "CDVInvokedUrlCommand.h" 22 | 23 | @class CDVPlugin; 24 | @class CDVPluginResult; 25 | @class CDVWhitelist; 26 | 27 | typedef NSURL* (^ UrlTransformerBlock)(NSURL*); 28 | 29 | @protocol CDVCommandDelegate 30 | 31 | @property (nonatomic, readonly) NSDictionary* settings; 32 | @property (nonatomic, copy) UrlTransformerBlock urlTransformer; 33 | 34 | - (NSString*)pathForResource:(NSString*)resourcepath; 35 | - (id)getCommandInstance:(NSString*)pluginName; 36 | 37 | // Sends a plugin result to the JS. This is thread-safe. 38 | - (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId; 39 | // Evaluates the given JS. This is thread-safe. 40 | - (void)evalJs:(NSString*)js; 41 | // Can be used to evaluate JS right away instead of scheduling it on the run-loop. 42 | // This is required for dispatch resign and pause events, but should not be used 43 | // without reason. Without the run-loop delay, alerts used in JS callbacks may result 44 | // in dead-lock. This method must be called from the UI thread. 45 | - (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop; 46 | // Runs the given block on a background thread using a shared thread-pool. 47 | - (void)runInBackground:(void (^)())block; 48 | // Returns the User-Agent of the associated UIWebView. 49 | - (NSString*)userAgent; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVInvokedUrlCommand.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface CDVInvokedUrlCommand : NSObject { 23 | NSString* _callbackId; 24 | NSString* _className; 25 | NSString* _methodName; 26 | NSArray* _arguments; 27 | } 28 | 29 | @property (nonatomic, readonly) NSArray* arguments; 30 | @property (nonatomic, readonly) NSString* callbackId; 31 | @property (nonatomic, readonly) NSString* className; 32 | @property (nonatomic, readonly) NSString* methodName; 33 | 34 | + (CDVInvokedUrlCommand*)commandFromJson:(NSArray*)jsonEntry; 35 | 36 | - (id)initWithArguments:(NSArray*)arguments 37 | callbackId:(NSString*)callbackId 38 | className:(NSString*)className 39 | methodName:(NSString*)methodName; 40 | 41 | - (id)initFromJson:(NSArray*)jsonEntry; 42 | 43 | // Returns the argument at the given index. 44 | // If index >= the number of arguments, returns nil. 45 | // If the argument at the given index is NSNull, returns nil. 46 | - (id)argumentAtIndex:(NSUInteger)index; 47 | // Same as above, but returns defaultValue instead of nil. 48 | - (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue; 49 | // Same as above, but returns defaultValue instead of nil, and if the argument is not of the expected class, returns defaultValue 50 | - (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue andClass:(Class)aClass; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var args = process.argv; 23 | var Api = require('./Api'); 24 | var nopt = require('nopt'); 25 | var path = require('path'); 26 | 27 | // Support basic help commands 28 | if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) { 29 | require('./lib/build').help(); 30 | process.exit(0); 31 | } 32 | 33 | // Parse arguments 34 | var buildOpts = nopt({ 35 | 'verbose' : Boolean, 36 | 'silent' : Boolean, 37 | 'archs': String, 38 | 'debug': Boolean, 39 | 'release': Boolean, 40 | 'device': Boolean, 41 | 'emulator': Boolean, 42 | 'codeSignIdentity': String, 43 | 'codeSignResourceRules': String, 44 | 'provisioningProfile': String, 45 | 'buildConfig' : String, 46 | 'noSign' : Boolean 47 | }, { '-r': '--release', 'd' : '--verbose' }, args); 48 | 49 | // Make buildOptions compatible with PlatformApi build method spec 50 | buildOpts.argv = buildOpts.argv.remain; 51 | 52 | require('./loggingHelper').adjustLoggerLevel(buildOpts); 53 | 54 | new Api().build(buildOpts).done(function() { 55 | console.log('** BUILD SUCCEEDED **'); 56 | }, function(err) { 57 | var errorMessage = (err && err.stack) ? err.stack : err; 58 | console.error(errorMessage); 59 | process.exit(2); 60 | }); 61 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | 23 | var args = process.argv; 24 | var Api = require('./Api'); 25 | var nopt = require('nopt'); 26 | 27 | // Handle help flag 28 | if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) { 29 | require('./lib/run').help(); 30 | process.exit(0); 31 | } 32 | 33 | // Parse arguments (includes build params as well) 34 | var opts = nopt({ 35 | 'verbose' : Boolean, 36 | 'silent' : Boolean, 37 | 'debug': Boolean, 38 | 'release': Boolean, 39 | 'nobuild': Boolean, 40 | 'archs': String, 41 | 'list': Boolean, 42 | 'device': Boolean, 43 | 'emulator': Boolean, 44 | 'target' : String, 45 | 'codeSignIdentity': String, 46 | 'codeSignResourceRules': String, 47 | 'provisioningProfile': String, 48 | 'buildConfig' : String, 49 | 'noSign' : Boolean 50 | }, { 'd' : '--verbose' }, args); 51 | 52 | // Make options compatible with PlatformApi build method spec 53 | opts.argv = opts.argv.remain; 54 | 55 | require('./loggingHelper').adjustLoggerLevel(opts); 56 | 57 | new Api().run(opts).done(function() { 58 | console.log('** RUN SUCCEEDED **'); 59 | }, function (err) { 60 | var errorMessage = (err && err.stack) ? err.stack : err; 61 | console.error(errorMessage); 62 | process.exit(2); 63 | }); 64 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.faultyplugin/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 25 | 26 | Faulty Plugin 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /guides/Cordova Custom URL Scheme Handling.md: -------------------------------------------------------------------------------- 1 | 21 | # Cordova Custom URL Scheme Handling # 22 | 23 | For an iOS app, you can add a URL Scheme handler in your app's Info.plist so that your app launches when another iOS app (like Mobile Safari) launches a URL with your custom scheme. 24 | 25 | 1. Register your custom scheme in your app's Info.plist: the instructions are [here](http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html#//apple_ref/doc/uid/TP40007072-CH7-SW21) 26 | 2. In your JavaScript, add a global function **handleOpenURL** which just takes one parameter, which will be a string containing the URL that was launched. Add your code to parse and handle the URL in that global function. This function will be called always if your app was launched from the custom scheme. 27 | 28 | function handleOpenURL(url) { 29 | // TODO: parse the url, and do something 30 | } 31 | 32 | 33 | **IMPORTANT NOTE:** 34 | 35 | You **cannot** launch any interactive features like alerts in the **handleOpenURL** code, if you do, your app will hang. Similarly, you should not call any Cordova APIs in there, unless you wrap it first in a setTimeout call, with a timeout value of zero: 36 | 37 | function handleOpenURL(url) { 38 | // TODO: parse the url, and do something 39 | setTimeout(function() { 40 | // TODO: call some Cordova API here 41 | }, 0); 42 | } 43 | -------------------------------------------------------------------------------- /guides/Setting Delegates, Preferences and Script Message Handlers in the WebView.md: -------------------------------------------------------------------------------- 1 | # Setting Delegates, Preferences and Script Message Handlers in the WebView 2 | 3 | In cordova-ios-4.0, you would set the delegates of the webview through the `webViewEngine` property of a `CDVPlugin` or your `CDVViewController` subclass. 4 | 5 | There are constants in the [`CDVWebViewEngineProtocol`](https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/Public/CDVWebViewEngineProtocol.h#L22-L26) (which a webview-engine implements) that you can use to set the delegates and preferences. These values are the constants to be used when setting delegates or preferences in the UIWebView (default in cordova-ios-4.0) or the WKWebView (through installing the [cordova-plugin-wkwebview-engine](https://github.com/apache/cordova-plugin-wkwebview-engine) plugin). You can set one additional thing in the WKWebView, [script message handlers](https://developer.apple.com/library/ios/documentation/WebKit/Reference/WKScriptMessageHandler_Ref/). 6 | 7 | For example, to set the `UIWebViewDelegate` in your plugin code: 8 | 9 | ``` 10 | // your UIWebViewDelegate implementation reference 11 | id< UIWebViewDelegate > myUIWebViewDelegate; 12 | 13 | // set it 14 | [self.webViewEngine updateWithInfo:@{ 15 | kCDVWebViewEngineUIWebViewDelegate : myUIWebViewDelegate 16 | }] 17 | ``` 18 | 19 | For example, to set the webview preferences in your plugin code: 20 | 21 | ``` 22 | // put the preferences in a dictionary 23 | NSDictionary* preferences = @{ 24 | @"EnableViewPortScale" : @YES, 25 | @"AllowInlineMediaPlayback" : @NO 26 | }; 27 | 28 | [self.webViewEngine updateWithInfo:@{ 29 | kCDVWebViewEngineWebViewPreferences : preferences 30 | }] 31 | ``` 32 | If you are using the [cordova-plugin-wkwebview-engine](https://github.com/apache/cordova-plugin-wkwebview-engine) plugin, you can add a [script message handler](https://developer.apple.com/library/ios/documentation/WebKit/Reference/WKScriptMessageHandler_Ref/): 33 | ``` 34 | // your WKScriptMessageHandler implementation references 35 | id< WKScriptMessageHandler > foo; 36 | id< WKScriptMessageHandler > bar; 37 | 38 | // put the handlers in a dictionary 39 | NSDictionary* scriptMessageHandlers = @{ 40 | @"foo" : foo, 41 | @"bar" : bar 42 | }; 43 | 44 | [self.webViewEngine updateWithInfo:@{ 45 | kCDVWebViewEngineScriptMessageHandlers : scriptMessageHandlers 46 | }] 47 | ``` 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Public/CDVPlugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | #import "CDVPluginResult.h" 23 | #import "NSMutableArray+QueueAdditions.h" 24 | #import "CDVCommandDelegate.h" 25 | #import "CDVWebViewEngineProtocol.h" 26 | 27 | @interface UIView (org_apache_cordova_UIView_Extension) 28 | 29 | @property (nonatomic, weak) UIScrollView* scrollView; 30 | 31 | @end 32 | 33 | extern NSString* const CDVPageDidLoadNotification; 34 | extern NSString* const CDVPluginHandleOpenURLNotification; 35 | extern NSString* const CDVPluginResetNotification; 36 | extern NSString* const CDVLocalNotification; 37 | extern NSString* const CDVRemoteNotification; 38 | extern NSString* const CDVRemoteNotificationError; 39 | 40 | @interface CDVPlugin : NSObject {} 41 | 42 | @property (nonatomic, readonly, weak) UIView* webView; 43 | @property (nonatomic, readonly, weak) id webViewEngine; 44 | 45 | @property (nonatomic, weak) UIViewController* viewController; 46 | @property (nonatomic, weak) id commandDelegate; 47 | 48 | @property (readonly, assign) BOOL hasPendingOperation; 49 | 50 | - (void)pluginInitialize; 51 | 52 | - (void)handleOpenURL:(NSNotification*)notification; 53 | - (void)onAppTerminate; 54 | - (void)onMemoryWarning; 55 | - (void)onReset; 56 | - (void)dispose; 57 | 58 | /* 59 | // see initWithWebView implementation 60 | - (void) onPause {} 61 | - (void) onResume {} 62 | - (void) onOrientationWillChange {} 63 | - (void) onOrientationDidChange {} 64 | - (void)didReceiveLocalNotification:(NSNotification *)notification; 65 | */ 66 | 67 | - (id)appDelegate; 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /bin/templates/project/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 31 | 32 | 33 | 34 | 35 | 36 | Hello World 37 | 38 | 39 |
40 |

Apache Cordova

41 | 45 |
46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/org.test.plugins.dummyplugin/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 25 | 26 | 27 | dummyplugin 28 | 29 | my description 30 | Jackson Badman 31 | dummy,plugin 32 | BSD 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/lib/copy-www-build-step.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | // This script copies the www directory into the Xcode project. 23 | 24 | // This script should not be called directly. 25 | // It is called as a build step from Xcode. 26 | 27 | var BUILT_PRODUCTS_DIR = process.env.BUILT_PRODUCTS_DIR, 28 | FULL_PRODUCT_NAME = process.env.FULL_PRODUCT_NAME, 29 | COPY_HIDDEN = process.env.COPY_HIDDEN, 30 | PROJECT_FILE_PATH = process.env.PROJECT_FILE_PATH; 31 | 32 | var path = require('path'), 33 | fs = require('fs'), 34 | shell = require('shelljs'), 35 | srcDir = 'www', 36 | dstDir = path.join(BUILT_PRODUCTS_DIR, FULL_PRODUCT_NAME), 37 | dstWwwDir = path.join(dstDir, 'www'); 38 | 39 | if(!BUILT_PRODUCTS_DIR) { 40 | console.error('The script is meant to be run as an Xcode build step and relies on env variables set by Xcode.'); 41 | process.exit(1); 42 | } 43 | 44 | try { 45 | fs.statSync(srcDir); 46 | } catch (e) { 47 | console.error('Path does not exist: ' + srcDir); 48 | process.exit(2); 49 | } 50 | 51 | // Code signing files must be removed or else there are 52 | // resource signing errors. 53 | shell.rm('-rf', dstWwwDir); 54 | shell.rm('-rf', path.join(dstDir, '_CodeSignature')); 55 | shell.rm('-rf', path.join(dstDir, 'PkgInfo')); 56 | shell.rm('-rf', path.join(dstDir, 'embedded.mobileprovision')); 57 | 58 | // Copy www dir recursively 59 | var code; 60 | if(!!COPY_HIDDEN) { 61 | code = shell.exec('rsync -Lra "' + srcDir + '" "' + dstDir + '"').code; 62 | } else { 63 | code = shell.exec('rsync -Lra --exclude="- .*" "' + srcDir + '" "' + dstDir + '"').code; 64 | } 65 | 66 | if(code !== 0) { 67 | console.error('Error occured on copying www. Code: ' + code); 68 | process.exit(3); 69 | } 70 | 71 | // Copy the config.xml file. 72 | shell.cp('-f', path.join(path.dirname(PROJECT_FILE_PATH), path.basename(PROJECT_FILE_PATH, '.xcodeproj'), 'config.xml'), 73 | dstDir); 74 | -------------------------------------------------------------------------------- /bin/templates/scripts/cordova/lib/list-devices: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | /*jshint node: true*/ 23 | 24 | var Q = require('q'), 25 | exec = require('child_process').exec; 26 | 27 | /** 28 | * Gets list of connected iOS devices 29 | * @return {Promise} Promise fulfilled with list of available iOS devices 30 | */ 31 | function listDevices() { 32 | var commands = [ 33 | Q.nfcall(exec, 'system_profiler SPUSBDataType | sed -n -e \'/iPad/,/Serial/p\' | grep "Serial Number:" | awk -F ": " \'{print $2 " iPad"}\''), 34 | Q.nfcall(exec, 'system_profiler SPUSBDataType | sed -n -e \'/iPhone/,/Serial/p\' | grep "Serial Number:" | awk -F ": " \'{print $2 " iPhone"}\''), 35 | Q.nfcall(exec, 'system_profiler SPUSBDataType | sed -n -e \'/iPod/,/Serial/p\' | grep "Serial Number:" | awk -F ": " \'{print $2 " iPod"}\'') 36 | ]; 37 | 38 | // wrap al lexec calls into promises and wait until they're fullfilled 39 | return Q.all(commands).then(function (results) { 40 | var accumulator = []; 41 | results.forEach(function (result) { 42 | var devicefound; 43 | // Each command promise resolves with array [stout, stderr], and we need stdout only 44 | // Append stdout lines to accumulator 45 | devicefound = result[0].trim().split('\n'); 46 | if(devicefound && devicefound.length) { 47 | devicefound.forEach(function(device) { 48 | if (device) { 49 | accumulator.push(device); 50 | } 51 | }); 52 | } 53 | }); 54 | return accumulator; 55 | }); 56 | } 57 | 58 | exports.run = listDevices; 59 | 60 | // Check if module is started as separate script. 61 | // If so, then invoke main method and print out results. 62 | if (!module.parent) { 63 | listDevices().then(function (devices) { 64 | devices.forEach(function (device) { 65 | console.log(device); 66 | }); 67 | }); 68 | } -------------------------------------------------------------------------------- /tests/CordovaLibTests/CDVViewControllerTest.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | Unless required by applicable law or agreed to in writing, 11 | software distributed under the License is distributed on an 12 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | KIND, either express or implied. See the License for the 14 | specific language governing permissions and limitations 15 | under the License. 16 | */ 17 | 18 | #import 19 | #import 20 | 21 | #define CDVViewControllerTestSettingKey @"test_cdvconfigfile" 22 | #define CDVViewControllerTestSettingValueDefault @"config.xml" 23 | #define CDVViewControllerTestSettingValueCustom @"config-custom.xml" 24 | 25 | @interface CDVViewControllerTest : XCTestCase 26 | 27 | @end 28 | 29 | @implementation CDVViewControllerTest 30 | 31 | -(CDVViewController*)viewController{ 32 | CDVViewController* viewController = [CDVViewController new]; 33 | return viewController; 34 | } 35 | 36 | -(void)doTestInitWithConfigFile:(NSString*)configFile expectedSettingValue:(NSString*)value{ 37 | // Create a CDVViewController 38 | CDVViewController* viewController = [self viewController]; 39 | if(configFile){ 40 | // Set custom config file 41 | viewController.configFile = configFile; 42 | }else{ 43 | // Do not specify config file ==> fallback to default config.xml 44 | } 45 | 46 | // Trigger -viewDidLoad 47 | [viewController view]; 48 | 49 | // Assert that the proper file was actually loaded, checking the value of a test setting it must contain 50 | NSString* settingValue = [viewController.settings objectForKey:CDVViewControllerTestSettingKey]; 51 | XCTAssertEqualObjects(settingValue, value); 52 | } 53 | 54 | -(void)testInitWithDefaultConfigFile{ 55 | [self doTestInitWithConfigFile:nil expectedSettingValue:CDVViewControllerTestSettingValueDefault]; 56 | } 57 | 58 | -(void)testInitWithCustomConfigFileAbsolutePath{ 59 | NSString* configFileAbsolutePath = [[NSBundle mainBundle] pathForResource:@"config-custom" ofType:@"xml"]; 60 | [self doTestInitWithConfigFile:configFileAbsolutePath expectedSettingValue:CDVViewControllerTestSettingValueCustom]; 61 | } 62 | 63 | -(void)testInitWithCustomConfigFileRelativePath{ 64 | NSString* configFileRelativePath = @"config-custom.xml"; 65 | [self doTestInitWithConfigFile:configFileRelativePath expectedSettingValue:CDVViewControllerTestSettingValueCustom]; 66 | } 67 | 68 | @end 69 | 70 | -------------------------------------------------------------------------------- /bin/create: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | /* 23 | * create a Cordova/iOS project 24 | * 25 | * USAGE 26 | * ./create 27 | * 28 | * EXAMPLE 29 | * ./create ~/Desktop/radness org.apache.cordova.radness Radness 30 | */ 31 | 32 | var path = require('path'); 33 | var ConfigParser = require('cordova-common').ConfigParser; 34 | var Api = require('./templates/scripts/cordova/Api'); 35 | 36 | var argv = require('nopt')({ 37 | 'help' : Boolean, 38 | 'cli' : Boolean, 39 | 'shared' : Boolean, // alias for --link 40 | 'link' : Boolean 41 | }, { 'd' : '--verbose' }); 42 | 43 | var projectPath = argv.argv.remain[0]; 44 | 45 | if (argv.help || !projectPath) { 46 | console.log('Usage: $0 [--link] [--cli] []'); 47 | console.log(' --link (optional): Link directly against the shared copy of the CordovaLib instead of a copy of it.'); 48 | console.log(' --cli (optional): Use the CLI-project template.'); 49 | console.log(' : Path to your new Cordova iOS project'); 50 | console.log(' : Package name, following reverse-domain style convention'); 51 | console.log(' : Project name'); 52 | console.log(' : Path to project template (override).'); 53 | process.exit(0); 54 | } 55 | 56 | // use default configuration file from project template 57 | var config = new ConfigParser(path.resolve(__dirname, 'templates/project/__PROJECT_NAME__/config.xml')); 58 | 59 | // apply overrides (package and project names 60 | if (argv.argv.remain[1]) config.setPackageName(argv.argv.remain[1]); 61 | if (argv.argv.remain[2]) config.setName(argv.argv.remain[2]); 62 | 63 | var options = { 64 | cli: argv.cli, 65 | link: argv.link || argv.shared, 66 | customTemplate: argv.argv.remain[3], 67 | }; 68 | 69 | require('./templates/scripts/cordova/loggingHelper').adjustLoggerLevel(argv); 70 | 71 | Api.createPlatform(projectPath, config, options).done(); 72 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/ios-config-xml/SampleApp/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /tests/spec/unit/fixtures/ios-config-xml/SampleApp/SampleApp-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 23 | 24 | 25 | CFBundleIcons 26 | 27 | CFBundlePrimaryIcon 28 | 29 | CFBundleIconFiles 30 | 31 | icon.png 32 | icon@2x.png 33 | icon-72.png 34 | icon-72@2x.png 35 | 36 | UIPrerenderedIcon 37 | 38 | 39 | 40 | UISupportedInterfaceOrientations~ipad 41 | 42 | UIInterfaceOrientationPortrait 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeRight 46 | 47 | UISupportedInterfaceOrientations 48 | 49 | UIInterfaceOrientationPortrait 50 | 51 | CFValidSchemas 52 | 53 | schema-a 54 | 55 | SchemaName 56 | schema-c 57 | 58 | 59 | CFBundleDevelopmentRegion 60 | English 61 | CFBundleDisplayName 62 | ${PRODUCT_NAME} 63 | CFBundleExecutable 64 | ${EXECUTABLE_NAME} 65 | CFBundleIconFile 66 | icon.png 67 | CFBundleIdentifier 68 | com.example.friendstring 69 | CFBundleInfoDictionaryVersion 70 | 6.0 71 | CFBundleName 72 | ${PRODUCT_NAME} 73 | CFBundlePackageType 74 | APPL 75 | CFBundleSignature 76 | ???? 77 | CFBundleVersion 78 | 1.0 79 | LSRequiresIPhoneOS 80 | 81 | NSMainNibFile 82 | 83 | NSMainNibFile~ipad 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVGestureHandler.h" 21 | 22 | @implementation CDVGestureHandler 23 | 24 | - (void)pluginInitialize 25 | { 26 | [self applyLongPressFix]; 27 | } 28 | 29 | - (void)applyLongPressFix 30 | { 31 | // You can't suppress 3D Touch and still have regular longpress, 32 | // so if this is false, let's not consider the 3D Touch setting at all. 33 | if (![self.commandDelegate.settings objectForKey:@"suppresseslongpressgesture"] || 34 | ![[self.commandDelegate.settings objectForKey:@"suppresseslongpressgesture"] boolValue]) { 35 | return; 36 | } 37 | 38 | self.lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressGestures:)]; 39 | self.lpgr.minimumPressDuration = 0.45f; 40 | self.lpgr.allowableMovement = 100.0f; 41 | 42 | // 0.45 is ok for 'regular longpress', 0.05-0.08 is required for '3D Touch longpress', 43 | // but since this will also kill onclick handlers (not ontouchend) it's optional. 44 | if ([self.commandDelegate.settings objectForKey:@"suppresses3dtouchgesture"] && 45 | [[self.commandDelegate.settings objectForKey:@"suppresses3dtouchgesture"] boolValue]) { 46 | self.lpgr.minimumPressDuration = 0.05f; 47 | } 48 | 49 | NSArray *views = self.webView.subviews; 50 | if (views.count == 0) { 51 | NSLog(@"No webview subviews found, not applying the longpress fix."); 52 | return; 53 | } 54 | for (int i=0; i 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 60 | 61 | 67 | 68 | 69 | 70 | 72 | 73 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /bin/uncrustify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | SCRIPT_PATH=$(dirname $0) 22 | CONFIG="$SCRIPT_PATH/uncrustify.cfg" 23 | EXE="$SCRIPT_PATH/../node_modules/.bin/uncrustify" 24 | 25 | function Usage() { 26 | echo "Formats code using uncrustify." 27 | echo "Usage: bin/uncrustify.sh --changed # Runs on changed (staged or not) files" 28 | echo " bin/uncrustify.sh --staged # Runs on staged files" 29 | echo " bin/uncrustify.sh --all # Runs on all source files under the current directory" 30 | echo " bin/uncrustify.sh --check-file file # Returns 1 if the given file requires changes, 0 otherwise." 31 | echo " bin/uncrustify.sh files # Runs on the given files" 32 | exit 1 33 | } 34 | 35 | function VerifyEnv() { 36 | if ! which "$EXE" > /dev/null; then 37 | echo "uncrustify binary not found in the cordova-ios repo." 38 | echo "In the repo root, install via npm: npm install" 39 | exit 1 40 | fi 41 | } 42 | 43 | function FilterFileList() { 44 | #-name "*.[hm]" | grep -v "JSONKit" 45 | #| grep "\.h\|\.m" 46 | for f in "$@"; do 47 | # Filter out deleted files. 48 | [[ ! -e "$f" ]] && continue 49 | # Filter out non .h & .m files. 50 | [[ "$f" != *.[hm] ]] && continue 51 | # Filter out Third-party sources. 52 | [[ "$f" == *JSONKit* ]] && continue 53 | echo $f 54 | done 55 | } 56 | 57 | function FilterAndRun() { 58 | files=$(FilterFileList "$@") 59 | 60 | if [[ -z "$files" ]]; then 61 | echo No files to uncrustify. 62 | exit 2 63 | else 64 | echo "$files" | xargs uncrustify -l OC --no-backup -c "$CONFIG" 65 | fi 66 | } 67 | 68 | if [[ "$1" = "--changed" ]]; then 69 | VerifyEnv 70 | files=$(git status --porcelain | sed s:...::) 71 | FilterAndRun $files 72 | elif [[ "$1" = "--staged" ]]; then 73 | VerifyEnv 74 | files=$(git diff --cached --name-only) 75 | FilterAndRun $files 76 | elif [[ "$1" = "--all" ]]; then 77 | VerifyEnv 78 | files=$(find .) 79 | FilterAndRun $files 80 | elif [[ "$1" = "--check-file" ]]; then 81 | "$EXE" -q -l OC -c "$CONFIG" -f "$2" | cmp --quiet - "$2" 82 | elif [[ "$1" = "--filter" ]]; then 83 | FilterFileList "$@" 84 | elif [[ "$1" = -* ]]; then 85 | Usage 86 | else 87 | VerifyEnv 88 | FilterAndRun "$@" 89 | fi 90 | --------------------------------------------------------------------------------