├── .gitignore ├── README.md ├── config.xml ├── gulpfile.js ├── hooks ├── .gitignore └── README.md ├── ionic.project ├── package.json ├── platforms ├── .gitignore └── ios │ ├── .gitignore │ ├── CameraTest.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── driftyadmin.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── driftyadmin.xcuserdatad │ │ └── xcschemes │ │ ├── CameraTest.xcscheme │ │ └── xcschememanagement.plist │ ├── CameraTest │ ├── .gitignore │ ├── CameraTest-Info.plist │ ├── CameraTest-Prefix.pch │ ├── Classes │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── MainViewController.h │ │ ├── MainViewController.m │ │ └── MainViewController.xib │ ├── Plugins │ │ ├── README │ │ ├── org.apache.cordova.camera │ │ │ ├── CDVCamera.h │ │ │ ├── CDVCamera.m │ │ │ ├── CDVExif.h │ │ │ ├── CDVJpegHeaderWriter.h │ │ │ └── CDVJpegHeaderWriter.m │ │ ├── org.apache.cordova.console │ │ │ ├── CDVLogger.h │ │ │ └── CDVLogger.m │ │ └── org.apache.cordova.device │ │ │ ├── CDVDevice.h │ │ │ └── CDVDevice.m │ ├── Resources │ │ ├── de.lproj │ │ │ └── Localizable.strings │ │ ├── en.lproj │ │ │ └── Localizable.strings │ │ ├── es.lproj │ │ │ └── Localizable.strings │ │ ├── icons │ │ │ ├── icon-40.png │ │ │ ├── icon-40@2x.png │ │ │ ├── icon-50.png │ │ │ ├── icon-50@2x.png │ │ │ ├── icon-60.png │ │ │ ├── icon-60@2x.png │ │ │ ├── icon-72.png │ │ │ ├── icon-72@2x.png │ │ │ ├── icon-76.png │ │ │ ├── icon-76@2x.png │ │ │ ├── icon-small.png │ │ │ ├── icon-small@2x.png │ │ │ ├── icon.png │ │ │ └── icon@2x.png │ │ ├── se.lproj │ │ │ └── Localizable.strings │ │ └── splash │ │ │ ├── Default-568h@2x~iphone.png │ │ │ ├── Default-Landscape@2x~ipad.png │ │ │ ├── Default-Landscape~ipad.png │ │ │ ├── Default-Portrait@2x~ipad.png │ │ │ ├── Default-Portrait~ipad.png │ │ │ ├── Default@2x~iphone.png │ │ │ └── Default~iphone.png │ ├── config.xml │ └── main.m │ ├── CordovaLib │ ├── Classes │ │ ├── CDV.h │ │ ├── CDVAvailability.h │ │ ├── CDVCommandDelegate.h │ │ ├── CDVCommandDelegateImpl.h │ │ ├── CDVCommandDelegateImpl.m │ │ ├── CDVCommandQueue.h │ │ ├── CDVCommandQueue.m │ │ ├── CDVConfigParser.h │ │ ├── CDVConfigParser.m │ │ ├── CDVDebug.h │ │ ├── CDVInvokedUrlCommand.h │ │ ├── CDVInvokedUrlCommand.m │ │ ├── CDVJSON.h │ │ ├── CDVJSON.m │ │ ├── CDVLocalStorage.h │ │ ├── CDVLocalStorage.m │ │ ├── CDVPlugin.h │ │ ├── CDVPlugin.m │ │ ├── CDVPluginResult.h │ │ ├── CDVPluginResult.m │ │ ├── CDVScreenOrientationDelegate.h │ │ ├── CDVShared.h │ │ ├── CDVShared.m │ │ ├── CDVTimer.h │ │ ├── CDVTimer.m │ │ ├── CDVURLProtocol.h │ │ ├── CDVURLProtocol.m │ │ ├── CDVUserAgentUtil.h │ │ ├── CDVUserAgentUtil.m │ │ ├── CDVViewController.h │ │ ├── CDVViewController.m │ │ ├── CDVWebViewDelegate.h │ │ ├── CDVWebViewDelegate.m │ │ ├── CDVWhitelist.h │ │ ├── CDVWhitelist.m │ │ ├── NSArray+Comparisons.h │ │ ├── NSArray+Comparisons.m │ │ ├── NSData+Base64.h │ │ ├── NSData+Base64.m │ │ ├── NSDictionary+Extensions.h │ │ ├── NSDictionary+Extensions.m │ │ ├── NSMutableArray+QueueAdditions.h │ │ ├── NSMutableArray+QueueAdditions.m │ │ ├── UIDevice+Extensions.h │ │ └── UIDevice+Extensions.m │ ├── CordovaLib.xcodeproj │ │ ├── project.pbxproj │ │ └── xcuserdata │ │ │ └── driftyadmin.xcuserdatad │ │ │ └── xcschemes │ │ │ ├── CordovaLib.xcscheme │ │ │ └── xcschememanagement.plist │ ├── CordovaLib_Prefix.pch │ ├── VERSION │ └── cordova.js │ ├── cordova │ ├── apple_ios_version │ ├── apple_osx_version │ ├── apple_xcode_version │ ├── build │ ├── build.xcconfig │ ├── check_reqs │ ├── clean │ ├── console.log │ ├── defaults.xml │ ├── emulate │ ├── lib │ │ ├── copy-www-build-step.sh │ │ ├── install-device │ │ ├── install-emulator │ │ ├── list-devices │ │ ├── list-emulator-images │ │ ├── list-started-emulators │ │ ├── sim.applescript │ │ └── start-emulator │ ├── log │ ├── run │ └── version │ ├── platform_www │ └── cordova.js │ └── www │ ├── README.md │ ├── cordova.js │ ├── cordova_plugins.js │ ├── css │ └── style.css │ ├── img │ └── ionic.png │ ├── index.html │ ├── js │ ├── app.js │ ├── controllers.js │ └── services.js │ ├── lib │ └── ionic │ │ ├── css │ │ ├── ionic.css │ │ └── ionic.min.css │ │ ├── fonts │ │ ├── ionicons.eot │ │ ├── ionicons.svg │ │ ├── ionicons.ttf │ │ └── ionicons.woff │ │ └── js │ │ ├── angular-ui │ │ ├── angular-ui-router.js │ │ └── angular-ui-router.min.js │ │ ├── angular │ │ ├── angular-animate.js │ │ ├── angular-animate.min.js │ │ ├── angular-resource.js │ │ ├── angular-resource.min.js │ │ ├── angular-sanitize.js │ │ ├── angular-sanitize.min.js │ │ ├── angular.js │ │ └── angular.min.js │ │ ├── ionic-angular.js │ │ ├── ionic-angular.min.js │ │ ├── ionic.bundle.js │ │ ├── ionic.js │ │ └── ionic.min.js │ ├── plugins │ ├── org.apache.cordova.camera │ │ └── www │ │ │ ├── Camera.js │ │ │ ├── CameraConstants.js │ │ │ ├── CameraPopoverOptions.js │ │ │ └── ios │ │ │ └── CameraPopoverHandle.js │ ├── org.apache.cordova.console │ │ └── www │ │ │ ├── console-via-logger.js │ │ │ └── logger.js │ └── org.apache.cordova.device │ │ └── www │ │ └── device.js │ └── templates │ ├── friend-detail.html │ ├── tab-account.html │ ├── tab-dash.html │ ├── tab-friends.html │ └── tabs.html ├── plugins ├── .gitignore ├── ios.json ├── org.apache.cordova.camera │ ├── .fetch.json │ ├── LICENSE │ ├── NOTICE │ ├── README.md │ ├── RELEASENOTES.md │ ├── doc │ │ └── index.md │ ├── package.json │ ├── plugin.xml │ ├── src │ │ ├── android │ │ │ ├── CameraLauncher.java │ │ │ ├── ExifHelper.java │ │ │ └── FileHelper.java │ │ ├── blackberry10 │ │ │ └── index.js │ │ ├── firefoxos │ │ │ └── CameraProxy.js │ │ ├── ios │ │ │ ├── CDVCamera.h │ │ │ ├── CDVCamera.m │ │ │ ├── CDVExif.h │ │ │ ├── CDVJpegHeaderWriter.h │ │ │ └── CDVJpegHeaderWriter.m │ │ ├── ubuntu │ │ │ ├── CaptureWidget.qml │ │ │ ├── back.png │ │ │ ├── camera.cpp │ │ │ ├── camera.h │ │ │ ├── shoot.png │ │ │ ├── toolbar-left.png │ │ │ ├── toolbar-middle.png │ │ │ └── toolbar-right.png │ │ ├── windows8 │ │ │ └── CameraProxy.js │ │ └── wp │ │ │ └── Camera.cs │ └── www │ │ ├── Camera.js │ │ ├── CameraConstants.js │ │ ├── CameraPopoverHandle.js │ │ ├── CameraPopoverOptions.js │ │ └── ios │ │ └── CameraPopoverHandle.js ├── org.apache.cordova.console │ ├── .fetch.json │ ├── LICENSE │ ├── NOTICE │ ├── README.md │ ├── RELEASENOTES.md │ ├── doc │ │ └── index.md │ ├── package.json │ ├── plugin.xml │ ├── src │ │ ├── ios │ │ │ ├── CDVLogger.h │ │ │ └── CDVLogger.m │ │ ├── ubuntu │ │ │ ├── console.cpp │ │ │ └── console.h │ │ └── wp │ │ │ └── DebugConsole.cs │ └── www │ │ ├── console-via-logger.js │ │ └── logger.js └── org.apache.cordova.device │ ├── .fetch.json │ ├── LICENSE │ ├── NOTICE │ ├── README.md │ ├── RELEASENOTES.md │ ├── doc │ └── index.md │ ├── package.json │ ├── plugin.xml │ ├── src │ ├── android │ │ └── Device.java │ ├── blackberry10 │ │ └── index.js │ ├── firefoxos │ │ └── DeviceProxy.js │ ├── ios │ │ ├── CDVDevice.h │ │ └── CDVDevice.m │ ├── tizen │ │ └── DeviceProxy.js │ ├── ubuntu │ │ ├── device.cpp │ │ ├── device.h │ │ └── device.js │ ├── windows8 │ │ └── DeviceProxy.js │ └── wp │ │ └── Device.cs │ └── www │ └── device.js └── www ├── .gitignore ├── .index.html.swo ├── .index.html.swp ├── README.md ├── css └── style.css ├── img └── ionic.png ├── index.html ├── js ├── app.js ├── controllers.js └── services.js ├── lib └── ionic │ ├── css │ ├── ionic.css │ └── ionic.min.css │ ├── fonts │ ├── ionicons.eot │ ├── ionicons.svg │ ├── ionicons.ttf │ └── ionicons.woff │ └── js │ ├── angular-ui │ ├── angular-ui-router.js │ └── angular-ui-router.min.js │ ├── angular │ ├── angular-animate.js │ ├── angular-animate.min.js │ ├── angular-resource.js │ ├── angular-resource.min.js │ ├── angular-sanitize.js │ ├── angular-sanitize.min.js │ ├── angular.js │ └── angular.min.js │ ├── ionic-angular.js │ ├── ionic-angular.min.js │ ├── ionic.bundle.js │ ├── ionic.js │ └── ionic.min.js └── templates ├── friend-detail.html ├── tab-account.html ├── tab-dash.html ├── tab-friends.html └── tabs.html /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Ionic App Base 2 | ===================== 3 | 4 | A starting project for Ionic that optionally supports 5 | using custom SCSS. 6 | 7 | ## Using this project 8 | 9 | We recommend using the `ionic` utility to create new Ionic projects that are based on this project but use a ready-made starter template. 10 | 11 | For example, to start a new Ionic project with the default tabs interface, make sure the `ionic` utility is installed: 12 | 13 | ```bash 14 | $ sudo npm install -g ionic 15 | ``` 16 | 17 | Then run: 18 | 19 | ```bash 20 | $ sudo npm install -g ionic 21 | $ ionic start myProject tabs 22 | ``` 23 | 24 | More info on this can be found on the Ionic [Getting Started](http://ionicframework.com/getting-started) page. 25 | 26 | ## Installation 27 | 28 | While we recommend using the `ionic` utility to create new Ionic projects, you can use this repo as a barebones starting point to your next Ionic app. 29 | 30 | To use this project as is, first clone the repo from GitHub, then run: 31 | 32 | ```bash 33 | $ cd ionic-app-base 34 | $ sudo npm install -g cordova ionic gulp 35 | $ npm install 36 | $ gulp init 37 | ``` 38 | 39 | ## Using Sass (optional) 40 | 41 | This project makes it easy to use Sass (the SCSS syntax) in your projects. This enables you to override styles from Ionic, and benefit from 42 | Sass's great features. 43 | 44 | Just update the `./scss/ionic.app.scss` file, and run `gulp` or `gulp watch` to rebuild the CSS files for Ionic. 45 | 46 | Note: if you choose to use the Sass method, make sure to remove the included `ionic.css` file in `index.html`, and then uncomment 47 | the include to your `ionic.app.css` file which now contains all your Sass code and Ionic itself: 48 | 49 | ```html 50 | 53 | ``` 54 | ## Issues 55 | Issues have been disabled on this repo, if you do find an issue or have a question consider posting it on the [Ionic Forum](http://forum.ionicframework.com/). Or else if there is truly an error, follow our guidelines for [submitting an issue](http://ionicframework.com/contribute/#issues) to the main Ionic repository. On the other hand, pull requests are welcome here! 56 | 57 | -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | CameraTest 4 | 5 | An Ionic Framework and Cordova project. 6 | 7 | 8 | Ionic Framework Team 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var concat = require('gulp-concat'); 3 | var sass = require('gulp-sass'); 4 | var minifyCss = require('gulp-minify-css'); 5 | var rename = require('gulp-rename'); 6 | 7 | var paths = { 8 | sass: ['./scss/**/*.scss'] 9 | }; 10 | 11 | gulp.task('sass', function(done) { 12 | gulp.src('./scss/ionic.app.scss') 13 | .pipe(sass()) 14 | .pipe(gulp.dest('./www/css/')) 15 | .pipe(minifyCss({ 16 | keepSpecialComments: 0 17 | })) 18 | .pipe(rename({ extname: '.min.css' })) 19 | .pipe(gulp.dest('./www/css/')) 20 | .on('end', done); 21 | }); 22 | 23 | gulp.task('watch', function() { 24 | gulp.watch(paths.sass, ['sass']); 25 | }); 26 | 27 | gulp.task('default', ['sass']); 28 | -------------------------------------------------------------------------------- /hooks/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/hooks/.gitignore -------------------------------------------------------------------------------- /ionic.project: -------------------------------------------------------------------------------- 1 | { 2 | "name": "myApp", 3 | "email": "", 4 | "app_id": "", 5 | "package_name": "" 6 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ionic-project", 3 | "version": "1.0.0", 4 | "description": "An Ionic project", 5 | "dependencies": { 6 | "gulp": "^3.5.6", 7 | "gulp-sass": "^0.7.1", 8 | "gulp-concat": "^2.2.0", 9 | "gulp-minify-css": "^0.3.0", 10 | "gulp-rename": "^1.2.0" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /platforms/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/.gitignore -------------------------------------------------------------------------------- /platforms/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.perspectivev3 3 | *.pbxuser 4 | .DS_Store 5 | build/ 6 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest.xcodeproj/project.xcworkspace/xcuserdata/driftyadmin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest.xcodeproj/project.xcworkspace/xcuserdata/driftyadmin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /platforms/ios/CameraTest.xcodeproj/xcuserdata/driftyadmin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CameraTest.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 1D6058900D05DD3D006BFB54 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.perspectivev3 3 | *.pbxuser 4 | .DS_Store 5 | build/ 6 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/CameraTest-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | icon.png 13 | CFBundleIcons 14 | 15 | CFBundlePrimaryIcon 16 | 17 | CFBundleIconFiles 18 | 19 | icon-40 20 | icon-small 21 | icon-60 22 | icon.png 23 | icon@2x 24 | icon-72 25 | icon-72@2x 26 | 27 | UIPrerenderedIcon 28 | 29 | 30 | 31 | CFBundleIcons~ipad 32 | 33 | CFBundlePrimaryIcon 34 | 35 | CFBundleIconFiles 36 | 37 | icon-small 38 | icon-40 39 | icon-50 40 | icon-76 41 | icon-60 42 | icon 43 | icon@2x 44 | icon-72 45 | icon-72@2x 46 | 47 | UIPrerenderedIcon 48 | 49 | 50 | 51 | CFBundleIdentifier 52 | com.ionicframework.starter 53 | CFBundleInfoDictionaryVersion 54 | 6.0 55 | CFBundleName 56 | ${PRODUCT_NAME} 57 | CFBundlePackageType 58 | APPL 59 | CFBundleSignature 60 | ???? 61 | CFBundleVersion 62 | 1.0 63 | LSRequiresIPhoneOS 64 | 65 | NSMainNibFile 66 | 67 | NSMainNibFile~ipad 68 | 69 | UISupportedInterfaceOrientations 70 | 71 | UIInterfaceOrientationPortrait 72 | 73 | UISupportedInterfaceOrientations~ipad 74 | 75 | UIInterfaceOrientationPortrait 76 | UIInterfaceOrientationLandscapeLeft 77 | UIInterfaceOrientationPortraitUpsideDown 78 | UIInterfaceOrientationLandscapeRight 79 | 80 | CFBundleShortVersionString 81 | 0.0.1 82 | 83 | 84 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/CameraTest-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 'HelloCordova' target in the 'HelloCordova' project 21 | // 22 | 23 | #ifdef __OBJC__ 24 | #import 25 | #import 26 | #endif 27 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/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 | // HelloCordova 23 | // 24 | // Created by ___FULLUSERNAME___ on ___DATE___. 25 | // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. 26 | // 27 | 28 | #import 29 | 30 | #import 31 | 32 | @interface AppDelegate : NSObject {} 33 | 34 | // invoke string is passed to your app on launch, this is only valid if you 35 | // edit HelloCordova-Info.plist to add a protocol 36 | // a simple tutorial can be found here : 37 | // http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html 38 | 39 | @property (nonatomic, strong) IBOutlet UIWindow* window; 40 | @property (nonatomic, strong) IBOutlet CDVViewController* viewController; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/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 | // HelloCordova 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 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/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 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Plugins/org.apache.cordova.camera/CDVExif.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 | #ifndef CordovaLib_ExifData_h 21 | #define CordovaLib_ExifData_h 22 | 23 | // exif data types 24 | typedef enum exifDataTypes { 25 | EDT_UBYTE = 1, // 8 bit unsigned integer 26 | EDT_ASCII_STRING, // 8 bits containing 7 bit ASCII code, null terminated 27 | EDT_USHORT, // 16 bit unsigned integer 28 | EDT_ULONG, // 32 bit unsigned integer 29 | EDT_URATIONAL, // 2 longs, first is numerator and second is denominator 30 | EDT_SBYTE, 31 | EDT_UNDEFINED, // 8 bits 32 | EDT_SSHORT, 33 | EDT_SLONG, // 32bit signed integer (2's complement) 34 | EDT_SRATIONAL, // 2 SLONGS, first long is numerator, second is denominator 35 | EDT_SINGLEFLOAT, 36 | EDT_DOUBLEFLOAT 37 | } ExifDataTypes; 38 | 39 | // maps integer code for exif data types to width in bytes 40 | static const int DataTypeToWidth[] = {1,1,2,4,8,1,1,2,4,8,4,8}; 41 | 42 | static const int RECURSE_HORIZON = 8; 43 | #endif 44 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Plugins/org.apache.cordova.camera/CDVJpegHeaderWriter.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 CDVJpegHeaderWriter : NSObject { 23 | NSDictionary * SubIFDTagFormatDict; 24 | NSDictionary * IFD0TagFormatDict; 25 | } 26 | 27 | - (NSData*) spliceExifBlockIntoJpeg: (NSData*) jpegdata 28 | withExifBlock: (NSString*) exifstr; 29 | - (NSString*) createExifAPP1 : (NSDictionary*) datadict; 30 | - (NSString*) formattedHexStringFromDecimalNumber: (NSNumber*) numb 31 | withPlaces: (NSNumber*) width; 32 | - (NSString*) formatNumberWithLeadingZeroes: (NSNumber*) numb 33 | withPlaces: (NSNumber*) places; 34 | - (NSString*) decimalToUnsignedRational: (NSNumber*) numb 35 | withResultNumerator: (NSNumber**) numerator 36 | withResultDenominator: (NSNumber**) denominator; 37 | - (void) continuedFraction: (double) val 38 | withFractionList: (NSMutableArray*) fractionlist 39 | withHorizon: (int) horizon; 40 | //- (void) expandContinuedFraction: (NSArray*) fractionlist; 41 | - (void) splitDouble: (double) val 42 | withIntComponent: (int*) rightside 43 | withFloatRemainder: (double*) leftside; 44 | - (NSString*) formatRationalWithNumerator: (NSNumber*) numerator 45 | withDenominator: (NSNumber*) denominator 46 | asSigned: (Boolean) signedFlag; 47 | - (NSString*) hexStringFromData : (NSData*) data; 48 | - (NSNumber*) numericFromHexString : (NSString *) hexstring; 49 | 50 | /* 51 | - (void) readExifMetaData : (NSData*) imgdata; 52 | - (void) spliceImageData : (NSData*) imgdata withExifData: (NSDictionary*) exifdata; 53 | - (void) locateExifMetaData : (NSData*) imgdata; 54 | - (NSString*) createExifAPP1 : (NSDictionary*) datadict; 55 | - (void) createExifDataString : (NSDictionary*) datadict; 56 | - (NSString*) createDataElement : (NSString*) element 57 | withElementData: (NSString*) data 58 | withExternalDataBlock: (NSDictionary*) memblock; 59 | - (NSString*) hexStringFromData : (NSData*) data; 60 | - (NSNumber*) numericFromHexString : (NSString *) hexstring; 61 | */ 62 | @end 63 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Plugins/org.apache.cordova.console/CDVLogger.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 CDVLogger : CDVPlugin 23 | 24 | - (void)logLevel:(CDVInvokedUrlCommand*)command; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Plugins/org.apache.cordova.console/CDVLogger.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 "CDVLogger.h" 21 | #import 22 | 23 | @implementation CDVLogger 24 | 25 | /* log a message */ 26 | - (void)logLevel:(CDVInvokedUrlCommand*)command 27 | { 28 | id level = [command.arguments objectAtIndex:0]; 29 | id message = [command.arguments objectAtIndex:1]; 30 | 31 | if ([level isEqualToString:@"LOG"]) { 32 | NSLog(@"%@", message); 33 | } else { 34 | NSLog(@"%@: %@", level, message); 35 | } 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Plugins/org.apache.cordova.device/CDVDevice.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 CDVDevice : CDVPlugin 24 | {} 25 | 26 | + (NSString*)cordovaVersion; 27 | 28 | - (void)getDeviceInfo:(CDVInvokedUrlCommand*)command; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/de.lproj/Localizable.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 | 20 | 21 | // controller title for Videos 22 | "Videos title" = "Videos"; 23 | // accessibility label for recording button 24 | "toggle audio recording" = "starten/beenden der Tonaufnahme"; 25 | // notification spoken by VoiceOver when timed recording finishes 26 | "timed recording complete" = "programmierte Aufnahme beendet"; 27 | // accessibility hint for display of recorded elapsed time 28 | "recorded time in minutes and seconds" = "aufgenommene Zeit in Minuten und Sekunden"; 29 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/en.lproj/Localizable.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 | 20 | // controller title for Videos 21 | "Videos title" = "Videos"; 22 | // accessibility label for recording button 23 | "toggle audio recording" = "toggle audio recording"; 24 | // notification spoken by VoiceOver when timed recording finishes 25 | "timed recording complete" = "timed recording complete"; 26 | // accessibility hint for display of recorded elapsed time 27 | "recorded time in minutes and seconds" = "recorded time in minutes and seconds"; 28 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/es.lproj/Localizable.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 | 20 | // controller title for Videos 21 | "Videos title" = "Videos"; 22 | // accessibility label for recording button 23 | "toggle audio recording" = "grabación de audio cambiar"; 24 | // notification spoken by VoiceOver when timed recording finishes 25 | "timed recording complete" = "tiempo de grabación completo"; 26 | // accessibility hint for display of recorded elapsed time 27 | "recorded time in minutes and seconds" = "tiempo registrado en minutos y segundos"; 28 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/icons/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/icons/icon-40.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/icons/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/icons/icon-40@2x.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/icons/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/icons/icon-50.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/icons/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/icons/icon-50@2x.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/icons/icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/icons/icon-60.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/icons/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/icons/icon-60@2x.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/icons/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/icons/icon-72.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/icons/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/icons/icon-72@2x.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/icons/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/icons/icon-76.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/icons/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/icons/icon-76@2x.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/icons/icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/icons/icon-small.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/icons/icon-small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/icons/icon-small@2x.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/icons/icon.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/icons/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/icons/icon@2x.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/se.lproj/Localizable.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 | 20 | 21 | // controller title for Videos 22 | "Videos title" = "Videor"; 23 | // accessibility label for recording button 24 | "toggle audio recording" = "börja/avsluta inspelning"; 25 | // notification spoken by VoiceOver when timed recording finishes 26 | "timed recording complete" = "inspelning har avslutad"; 27 | // accessibility hint for display of recorded elapsed time 28 | "recorded time in minutes and seconds" = "inspelad tid in minuter och sekund"; 29 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/splash/Default-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/splash/Default-568h@2x~iphone.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/splash/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/splash/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/splash/Default-Landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/splash/Default-Landscape~ipad.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/splash/Default-Portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/splash/Default-Portrait@2x~ipad.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/splash/Default-Portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/splash/Default-Portrait~ipad.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/splash/Default@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/splash/Default@2x~iphone.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/Resources/splash/Default~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/CameraTest/Resources/splash/Default~iphone.png -------------------------------------------------------------------------------- /platforms/ios/CameraTest/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | CameraTest 32 | 33 | An Ionic Framework and Cordova project. 34 | 35 | 36 | Ionic Framework Team 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /platforms/ios/CameraTest/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 | // HelloCordova 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 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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 | 22 | #import "CDVPlugin.h" 23 | #import "CDVViewController.h" 24 | #import "CDVCommandDelegate.h" 25 | #import "CDVURLProtocol.h" 26 | #import "CDVInvokedUrlCommand.h" 27 | 28 | #import "CDVDebug.h" 29 | #import "CDVPluginResult.h" 30 | #import "CDVWhitelist.h" 31 | #import "CDVLocalStorage.h" 32 | #import "CDVScreenOrientationDelegate.h" 33 | #import "CDVTimer.h" 34 | 35 | #import "NSArray+Comparisons.h" 36 | #import "NSData+Base64.h" 37 | #import "NSDictionary+Extensions.h" 38 | #import "NSMutableArray+QueueAdditions.h" 39 | #import "UIDevice+Extensions.h" 40 | 41 | #import "CDVJSON.h" 42 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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 | @protocol CDVCommandDelegate 28 | 29 | @property (nonatomic, readonly) NSDictionary* settings; 30 | 31 | - (NSString*)pathForResource:(NSString*)resourcepath; 32 | - (id)getCommandInstance:(NSString*)pluginName; 33 | 34 | // Plugins should not be using this interface to call other plugins since it 35 | // will result in bogus callbacks being made. 36 | - (BOOL)execute:(CDVInvokedUrlCommand*)command CDV_DEPRECATED(2.2, "Use direct method calls instead."); 37 | 38 | // Sends a plugin result to the JS. This is thread-safe. 39 | - (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId; 40 | // Evaluates the given JS. This is thread-safe. 41 | - (void)evalJs:(NSString*)js; 42 | // Can be used to evaluate JS right away instead of scheduling it on the run-loop. 43 | // This is required for dispatch resign and pause events, but should not be used 44 | // without reason. Without the run-loop delay, alerts used in JS callbacks may result 45 | // in dead-lock. This method must be called from the UI thread. 46 | - (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop; 47 | // Runs the given block on a background thread using a shared thread-pool. 48 | - (void)runInBackground:(void (^)())block; 49 | // Returns the User-Agent of the associated UIWebView. 50 | - (NSString*)userAgent; 51 | // Returns whether the given URL passes the white-list. 52 | - (BOOL)URLIsWhitelisted:(NSURL*)url; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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)processXhrExecBridgePoke:(NSNumber*)requestId; 36 | - (void)fetchCommandsFromJs; 37 | - (void)executePending; 38 | - (BOOL)execute:(CDVInvokedUrlCommand*)command; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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* whitelistHosts; 28 | @property (nonatomic, readonly, strong) NSMutableArray* startupPluginNames; 29 | @property (nonatomic, readonly, strong) NSString* startPage; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/CDVJSON.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 (CDVJSONSerializing) 21 | - (NSString*)JSONString; 22 | @end 23 | 24 | @interface NSDictionary (CDVJSONSerializing) 25 | - (NSString*)JSONString; 26 | @end 27 | 28 | @interface NSString (CDVJSONSerializing) 29 | - (id)JSONObject; 30 | @end 31 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/CDVJSON.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 "CDVJSON.h" 21 | #import 22 | 23 | @implementation NSArray (CDVJSONSerializing) 24 | 25 | - (NSString*)JSONString 26 | { 27 | NSError* error = nil; 28 | NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self 29 | options:NSJSONWritingPrettyPrinted 30 | error:&error]; 31 | 32 | if (error != nil) { 33 | NSLog(@"NSArray JSONString error: %@", [error localizedDescription]); 34 | return nil; 35 | } else { 36 | return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; 37 | } 38 | } 39 | 40 | @end 41 | 42 | @implementation NSDictionary (CDVJSONSerializing) 43 | 44 | - (NSString*)JSONString 45 | { 46 | NSError* error = nil; 47 | NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self 48 | options:NSJSONWritingPrettyPrinted 49 | error:&error]; 50 | 51 | if (error != nil) { 52 | NSLog(@"NSDictionary JSONString error: %@", [error localizedDescription]); 53 | return nil; 54 | } else { 55 | return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; 56 | } 57 | } 58 | 59 | @end 60 | 61 | @implementation NSString (CDVJSONSerializing) 62 | 63 | - (id)JSONObject 64 | { 65 | NSError* error = nil; 66 | id object = [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding] 67 | options:NSJSONReadingMutableContainers 68 | error:&error]; 69 | 70 | if (error != nil) { 71 | NSLog(@"NSString JSONObject error: %@", [error localizedDescription]); 72 | } 73 | 74 | return object; 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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 | 26 | extern NSString* const CDVPageDidLoadNotification; 27 | extern NSString* const CDVPluginHandleOpenURLNotification; 28 | extern NSString* const CDVPluginResetNotification; 29 | extern NSString* const CDVLocalNotification; 30 | 31 | @interface CDVPlugin : NSObject {} 32 | 33 | @property (nonatomic, weak) UIWebView* webView; 34 | @property (nonatomic, weak) UIViewController* viewController; 35 | @property (nonatomic, weak) id commandDelegate; 36 | 37 | @property (readonly, assign) BOOL hasPendingOperation; 38 | 39 | - (CDVPlugin*)initWithWebView:(UIWebView*)theWebView; 40 | - (void)pluginInitialize; 41 | 42 | - (void)handleOpenURL:(NSNotification*)notification; 43 | - (void)onAppTerminate; 44 | - (void)onMemoryWarning; 45 | - (void)onReset; 46 | - (void)dispose; 47 | 48 | /* 49 | // see initWithWebView implementation 50 | - (void) onPause {} 51 | - (void) onResume {} 52 | - (void) onOrientationWillChange {} 53 | - (void) onOrientationDidChange {} 54 | - (void)didReceiveLocalNotification:(NSNotification *)notification; 55 | */ 56 | 57 | - (id)appDelegate; 58 | 59 | // TODO(agrieve): Deprecate these in favour of using CDVCommandDelegate directly. 60 | - (NSString*)writeJavascript:(NSString*)javascript; 61 | - (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId; 62 | - (NSString*)error:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId; 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/CDVShared.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 NSError (JSONMethods) 24 | 25 | - (NSString*)JSONRepresentation; 26 | 27 | @end 28 | 29 | @interface CLLocation (JSONMethods) 30 | 31 | - (NSString*)JSONRepresentation; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/CDVShared.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 "CDVShared.h" 21 | 22 | #pragma mark - 23 | #pragma mark CLLocation(JSONMethods) 24 | 25 | @implementation CLLocation (JSONMethods) 26 | 27 | - (NSString*)JSONRepresentation 28 | { 29 | return [NSString stringWithFormat: 30 | @"{ timestamp: %.00f, \ 31 | coords: { latitude: %f, longitude: %f, altitude: %.02f, heading: %.02f, speed: %.02f, accuracy: %.02f, altitudeAccuracy: %.02f } \ 32 | }", 33 | [self.timestamp timeIntervalSince1970] * 1000.0, 34 | self.coordinate.latitude, 35 | self.coordinate.longitude, 36 | self.altitude, 37 | self.course, 38 | self.speed, 39 | self.horizontalAccuracy, 40 | self.verticalAccuracy 41 | ]; 42 | } 43 | 44 | @end 45 | 46 | #pragma mark NSError(JSONMethods) 47 | 48 | @implementation NSError (JSONMethods) 49 | 50 | - (NSString*)JSONRepresentation 51 | { 52 | return [NSString stringWithFormat: 53 | @"{ code: %ld, message: '%@'}", 54 | (long)self.code, 55 | [self localizedDescription] 56 | ]; 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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 | + (void)registerViewController:(CDVViewController*)viewController; 28 | + (void)unregisterViewController:(CDVViewController*)viewController; 29 | @end 30 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/CDVViewController.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 "CDVAvailability.h" 23 | #import "CDVInvokedUrlCommand.h" 24 | #import "CDVCommandDelegate.h" 25 | #import "CDVCommandQueue.h" 26 | #import "CDVWhitelist.h" 27 | #import "CDVScreenOrientationDelegate.h" 28 | #import "CDVPlugin.h" 29 | 30 | @interface CDVViewController : UIViewController { 31 | @protected 32 | id _commandDelegate; 33 | @protected 34 | CDVCommandQueue* _commandQueue; 35 | NSString* _userAgent; 36 | } 37 | 38 | @property (nonatomic, strong) IBOutlet UIWebView* webView; 39 | 40 | @property (nonatomic, readonly, strong) NSMutableDictionary* pluginObjects; 41 | @property (nonatomic, readonly, strong) NSDictionary* pluginsMap; 42 | @property (nonatomic, readonly, strong) NSMutableDictionary* settings; 43 | @property (nonatomic, readonly, strong) NSXMLParser* configParser; 44 | @property (nonatomic, readonly, strong) CDVWhitelist* whitelist; // readonly for public 45 | @property (nonatomic, readonly, assign) BOOL loadFromString; 46 | 47 | @property (nonatomic, readwrite, copy) NSString* wwwFolderName; 48 | @property (nonatomic, readwrite, copy) NSString* startPage; 49 | @property (nonatomic, readonly, strong) CDVCommandQueue* commandQueue; 50 | @property (nonatomic, readonly, strong) id commandDelegate; 51 | @property (nonatomic, readonly) NSString* userAgent; 52 | 53 | + (NSDictionary*)getBundlePlist:(NSString*)plistName; 54 | + (NSString*)applicationDocumentsDirectory; 55 | 56 | - (void)printMultitaskingInfo; 57 | - (void)createGapView; 58 | - (UIWebView*)newCordovaViewWithFrame:(CGRect)bounds; 59 | 60 | - (void)javascriptAlert:(NSString*)text; 61 | - (NSString*)appURLScheme; 62 | 63 | - (NSArray*)parseInterfaceOrientations:(NSArray*)orientations; 64 | - (BOOL)supportsOrientation:(UIInterfaceOrientation)orientation; 65 | 66 | - (id)getCommandInstance:(NSString*)pluginName; 67 | - (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className; 68 | - (void)registerPlugin:(CDVPlugin*)plugin withPluginName:(NSString*)pluginName; 69 | 70 | - (BOOL)URLisAllowed:(NSURL*)url; 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/CDVWebViewDelegate.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 | /** 23 | * Distinguishes top-level navigations from sub-frame navigations. 24 | * shouldStartLoadWithRequest is called for every request, but didStartLoad 25 | * and didFinishLoad is called only for top-level navigations. 26 | * Relevant bug: CB-2389 27 | */ 28 | @interface CDVWebViewDelegate : NSObject { 29 | __weak NSObject * _delegate; 30 | NSInteger _loadCount; 31 | NSInteger _state; 32 | NSInteger _curLoadToken; 33 | NSInteger _loadStartPollCount; 34 | } 35 | 36 | - (id)initWithDelegate:(NSObject *)delegate; 37 | - (BOOL)request:(NSURLRequest*)newRequest isFragmentIdentifierToRequest:(NSURLRequest*)originalRequest; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/NSArray+Comparisons.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 NSArray (Comparisons) 23 | 24 | - (id)objectAtIndex:(NSUInteger)index withDefault:(id)aDefault; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/NSArray+Comparisons.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 "NSArray+Comparisons.h" 21 | 22 | @implementation NSArray (Comparisons) 23 | 24 | - (id)objectAtIndex:(NSUInteger)index withDefault:(id)aDefault 25 | { 26 | id obj = nil; 27 | 28 | @try { 29 | obj = [self objectAtIndex:index]; 30 | if ((obj == [NSNull null]) || (obj == nil)) { 31 | return aDefault; 32 | } 33 | } 34 | @catch(NSException* exception) { 35 | NSLog(@"Exception - Name: %@ Reason: %@", [exception name], [exception reason]); 36 | } 37 | 38 | return obj; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/NSData+Base64.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+Base64.h 3 | // base64 4 | // 5 | // Created by Matt Gallagher on 2009/06/03. 6 | // Copyright 2009 Matt Gallagher. All rights reserved. 7 | // 8 | // Permission is given to use this source code file, free of charge, in any 9 | // project, commercial or otherwise, entirely at your risk, with the condition 10 | // that any redistribution (in part or whole) of source code must retain 11 | // this copyright and permission notice. Attribution in compiled projects is 12 | // appreciated but not required. 13 | // 14 | 15 | #import 16 | 17 | void *CDVNewBase64Decode( 18 | const char* inputBuffer, 19 | size_t length, 20 | size_t * outputLength); 21 | 22 | char *CDVNewBase64Encode( 23 | const void* inputBuffer, 24 | size_t length, 25 | bool separateLines, 26 | size_t * outputLength); 27 | 28 | @interface NSData (CDVBase64) 29 | 30 | + (NSData*)dataFromBase64String:(NSString*)aString; 31 | - (NSString*)base64EncodedString; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/NSDictionary+Extensions.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 NSDictionary (org_apache_cordova_NSDictionary_Extension) 23 | 24 | - (bool)existsValue:(NSString*)expectedValue forKey:(NSString*)key; 25 | - (NSInteger)integerValueForKey:(NSString*)key defaultValue:(NSInteger)defaultValue withRange:(NSRange)range; 26 | - (NSInteger)integerValueForKey:(NSString*)key defaultValue:(NSInteger)defaultValue; 27 | - (BOOL)typeValueForKey:(NSString*)key isArray:(BOOL*)bArray isNull:(BOOL*)bNull isNumber:(BOOL*)bNumber isString:(BOOL*)bString; 28 | - (BOOL)valueForKeyIsArray:(NSString*)key; 29 | - (BOOL)valueForKeyIsNull:(NSString*)key; 30 | - (BOOL)valueForKeyIsString:(NSString*)key; 31 | - (BOOL)valueForKeyIsNumber:(NSString*)key; 32 | 33 | - (NSDictionary*)dictionaryWithLowercaseKeys; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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)pop; 25 | - (id)queueHead; 26 | - (id)dequeue; 27 | - (void)enqueue:(id)obj; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/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)queueHead 25 | { 26 | if ([self count] == 0) { 27 | return nil; 28 | } 29 | 30 | return [self objectAtIndex:0]; 31 | } 32 | 33 | - (__autoreleasing id)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)pop 49 | { 50 | return [self dequeue]; 51 | } 52 | 53 | - (void)enqueue:(id)object 54 | { 55 | [self addObject:object]; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/UIDevice+Extensions.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 UIDevice (org_apache_cordova_UIDevice_Extension) 23 | 24 | /* 25 | Get the unique identifier from the app bundle's folder, which is already a GUID 26 | Upgrading and/or deleting the app and re-installing will get you a new GUID, so 27 | this is only unique per install per device. 28 | */ 29 | - (NSString*)uniqueAppInstanceIdentifier; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/Classes/UIDevice+Extensions.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 "UIDevice+Extensions.h" 22 | 23 | @implementation UIDevice (org_apache_cordova_UIDevice_Extension) 24 | 25 | - (NSString*)uniqueAppInstanceIdentifier 26 | { 27 | NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; 28 | static NSString* UUID_KEY = @"CDVUUID"; 29 | 30 | NSString* app_uuid = [userDefaults stringForKey:UUID_KEY]; 31 | 32 | if (app_uuid == nil) { 33 | CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault); 34 | CFStringRef uuidString = CFUUIDCreateString(kCFAllocatorDefault, uuidRef); 35 | 36 | app_uuid = [NSString stringWithString:(__bridge NSString*)uuidString]; 37 | [userDefaults setObject:app_uuid forKey:UUID_KEY]; 38 | [userDefaults synchronize]; 39 | 40 | CFRelease(uuidString); 41 | CFRelease(uuidRef); 42 | } 43 | 44 | return app_uuid; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/driftyadmin.xcuserdatad/xcschemes/CordovaLib.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/driftyadmin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CordovaLib.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D2AAC07D0554694100DB518D 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /platforms/ios/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 | -------------------------------------------------------------------------------- /platforms/ios/CordovaLib/VERSION: -------------------------------------------------------------------------------- 1 | 3.4.1 2 | -------------------------------------------------------------------------------- /platforms/ios/cordova/apple_ios_version: -------------------------------------------------------------------------------- 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 | # outputs the highest level of iOS sdk installed 23 | iOS_X_VERSIONS=$(xcodebuild -showsdks | sed -e '/./{H;$!d;}' -e 'x;/iOS SDKs/!d;' | grep -o '[0-9]*\.[0-9]* '); 24 | echo $iOS_X_VERSIONS | tr " " "\n" | sort -g | tail -1; -------------------------------------------------------------------------------- /platforms/ios/cordova/apple_osx_version: -------------------------------------------------------------------------------- 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 | # outputs the highest level of OS X sdk installed 23 | OS_X_VERSIONS=$(xcodebuild -showsdks | sed -e '/./{H;$!d;}' -e 'x;/OS X SDKs/!d;' | grep -o '[0-9]*\.[0-9]* '); 24 | echo $OS_X_VERSIONS | tr " " "\n" | sort -g | tail -1; -------------------------------------------------------------------------------- /platforms/ios/cordova/apple_xcode_version: -------------------------------------------------------------------------------- 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 | # outputs which version of XCODE is installed 23 | XCODEBUILD_VERSION=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //') 24 | echo $XCODEBUILD_VERSION -------------------------------------------------------------------------------- /platforms/ios/cordova/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 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 | # compile and launch a Cordova/iOS project to the simulator 24 | # 25 | 26 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 27 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 28 | XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) 29 | PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) 30 | 31 | source "$CORDOVA_PATH/check_reqs" 32 | 33 | cd "$PROJECT_PATH" 34 | 35 | APP=build/$PROJECT_NAME.app 36 | 37 | CONFIGURATION=Debug 38 | EMULATOR=1 39 | DEVICE=0 40 | while [[ $# -gt 0 ]]; do 41 | case "$1" in 42 | --debug) ;; 43 | --release) CONFIGURATION=Release;; 44 | --device) EMULATOR=0;; 45 | --emulator) ;; 46 | *) echo "Unrecognized flag: $1"; exit 2;; 47 | esac 48 | shift 49 | done 50 | 51 | if (( $EMULATOR )); then 52 | exec xcodebuild -project "$PROJECT_NAME.xcodeproj" -arch i386 -target "$PROJECT_NAME" -configuration $CONFIGURATION -sdk iphonesimulator build VALID_ARCHS="i386" CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build/emulator" 53 | else 54 | exec xcodebuild -xcconfig "$CORDOVA_PATH/build.xcconfig" -project "$PROJECT_NAME.xcodeproj" ARCHS="armv7 armv7s arm64" -target "$PROJECT_NAME" -configuration $CONFIGURATION -sdk iphoneos build VALID_ARCHS="armv7 armv7s arm64" CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build/device" 55 | fi 56 | 57 | -------------------------------------------------------------------------------- /platforms/ios/cordova/build.xcconfig: -------------------------------------------------------------------------------- 1 | // to list all installed iOS identities, run: 2 | // security find-identity | sed -n 's/.*\("[^"]*"\).*/\1/p' | grep 'iPhone' 3 | 4 | // generic 'iPhone Developer' (no quotes) will match the right Identity with the right Provisioning Profile plus Certificate, based on the app bundle id 5 | CODE_SIGN_IDENTITY = iPhone Developer -------------------------------------------------------------------------------- /platforms/ios/cordova/check_reqs: -------------------------------------------------------------------------------- 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 | XCODEBUILD_LOCATION=$(which xcodebuild) 23 | if [ $? != 0 ]; then 24 | echo "Xcode is (probably) not installed, specifically the command 'xcodebuild' is unavailable." 25 | exit 2 26 | fi 27 | 28 | XCODEBUILD_MIN_VERSION="4.6" 29 | XCODEBUILD_VERSION=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //') 30 | 31 | if [[ "$XCODEBUILD_VERSION" < "$XCODEBUILD_MIN_VERSION" ]]; then 32 | echo "Cordova can only run in Xcode version $XCODEBUILD_MIN_VERSION or greater." 33 | exit 2 34 | fi 35 | -------------------------------------------------------------------------------- /platforms/ios/cordova/clean: -------------------------------------------------------------------------------- 1 | #!/bin/bash 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 | # Clean a Cordova/iOS project 24 | # 25 | 26 | set -e 27 | 28 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 29 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 30 | XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) 31 | PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) 32 | 33 | source "$CORDOVA_PATH/check_reqs" 34 | 35 | cd "$PROJECT_PATH" 36 | 37 | xcodebuild -project "$PROJECT_NAME.xcodeproj" -configuration Debug -alltargets clean 38 | xcodebuild -project "$PROJECT_NAME.xcodeproj" -configuration Release -alltargets clean 39 | 40 | rm -rf "build" -------------------------------------------------------------------------------- /platforms/ios/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 | -------------------------------------------------------------------------------- /platforms/ios/cordova/emulate: -------------------------------------------------------------------------------- 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 | SDK=`xcodebuild -showsdks | grep Sim | tail -1 | awk '{print $6}'` 22 | 23 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 24 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 25 | XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) 26 | PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) 27 | 28 | source "$CORDOVA_PATH/check_reqs" 29 | 30 | APP_PATH=${1:-$PROJECT_PATH/build/emulator/$(xcodebuild -project "$PROJECT_PATH/$PROJECT_NAME.xcodeproj" -arch i386 -target "$PROJECT_NAME" -configuration Debug -sdk $SDK -showBuildSettings | grep FULL_PRODUCT_NAME | awk -F ' = ' '{print $2}')} 31 | 32 | DEVICE_FAMILY=${2:-${DEVICE_FAMILY:-iphone}} 33 | 34 | IOS_SIM_MIN_VERSION="1.7" 35 | IOS_SIM_LOCATION=$(which ios-sim) 36 | if [ $? != 0 ]; then 37 | echo -e "\033[31mError: ios-sim was not found. Please download, build and install version $IOS_SIM_MIN_VERSION or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/\033[m" 1>&2; 38 | exit 1; 39 | fi 40 | 41 | IOS_SIM_VERSION=$(ios-sim --version) 42 | 43 | if [[ "$IOS_SIM_VERSION" < "$IOS_SIM_MIN_VERSION" ]]; then 44 | echo "Cordova needs ios-sim version $IOS_SIM_MIN_VERSION or greater, you have version $IOS_SIM_VERSION." 1>&2; 45 | exit 1 46 | fi 47 | 48 | if [ ! -d "$APP_PATH" ]; then 49 | echo "Project '$APP_PATH' is not built. Building." 50 | "$CORDOVA_PATH/build" || exit $? 51 | fi 52 | 53 | if [ ! -d "$APP_PATH" ]; then 54 | echo "$APP_PATH not found to emulate." 1>&2; 55 | exit 1 56 | fi 57 | 58 | # launch using ios-sim 59 | ios-sim launch "$APP_PATH" --family "$DEVICE_FAMILY" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" --exit 60 | -------------------------------------------------------------------------------- /platforms/ios/cordova/lib/copy-www-build-step.sh: -------------------------------------------------------------------------------- 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 | # This script copies the www directory into the Xcode project. 22 | # 23 | # This script should not be called directly. 24 | # It is called as a build step from Xcode. 25 | 26 | SRC_DIR="www/" 27 | DST_DIR="$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/www" 28 | COPY_HIDDEN= 29 | ORIG_IFS=$IFS 30 | IFS=$(echo -en "\n\b") 31 | 32 | if [[ -z "$BUILT_PRODUCTS_DIR" ]]; then 33 | echo "The script is meant to be run as an Xcode build step and relies on env variables set by Xcode." 34 | exit 1 35 | fi 36 | if [[ ! -e "$SRC_DIR" ]]; then 37 | echo "Path does not exist: $SRC_DIR" 38 | exit 1 39 | fi 40 | 41 | if [[ -n $COPY_HIDDEN ]]; then 42 | alias do_find='find "$SRC_DIR"' 43 | else 44 | alias do_find='find -L "$SRC_DIR" -name ".*" -prune -o' 45 | fi 46 | 47 | time ( 48 | # Code signing files must be removed or else there are 49 | # resource signing errors. 50 | rm -rf "$DST_DIR" \ 51 | "$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/_CodeSignature" \ 52 | "$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/PkgInfo" \ 53 | "$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/embedded.mobileprovision" 54 | 55 | # Directories 56 | for p in $(do_find -type d -print); do 57 | subpath="${p#$SRC_DIR}" 58 | mkdir "$DST_DIR$subpath" || exit 1 59 | done 60 | 61 | # Symlinks 62 | for p in $(do_find -type l -print); do 63 | subpath="${p#$SRC_DIR}" 64 | source=$(readlink $SRC_DIR$subpath) 65 | sourcetype=$(stat -f "%HT%SY" $source) 66 | if [ "$sourcetype" = "Directory" ]; then 67 | mkdir "$DST_DIR$subpath" || exit 2 68 | else 69 | rsync -a "$source" "$DST_DIR$subpath" || exit 3 70 | fi 71 | done 72 | 73 | # Files 74 | for p in $(do_find -type f -print); do 75 | subpath="${p#$SRC_DIR}" 76 | if ! ln "$SRC_DIR$subpath" "$DST_DIR$subpath" 2>/dev/null; then 77 | rsync -a "$SRC_DIR$subpath" "$DST_DIR$subpath" || exit 4 78 | fi 79 | done 80 | 81 | # Copy the config.xml file. 82 | cp -f "${PROJECT_FILE_PATH%.xcodeproj}/config.xml" "$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME" 83 | 84 | ) 85 | IFS=$ORIG_IFS 86 | 87 | -------------------------------------------------------------------------------- /platforms/ios/cordova/lib/install-device: -------------------------------------------------------------------------------- 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 | # Valid values for "--target" (case insensitive): 21 | # "iPhone (Retina 3.5-inch)" (default) 22 | # "iPhone (Retina 4-inch)" 23 | # "iPhone" 24 | # "iPad" 25 | # "iPad (Retina)" 26 | 27 | LIB_PATH=$( cd "$( dirname "$0" )" && pwd -P) 28 | CORDOVA_PATH="$(dirname "$LIB_PATH")" 29 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 30 | XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) 31 | PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) 32 | 33 | DEVICE_APP_PATH="$PROJECT_PATH/build/device/$PROJECT_NAME.app" 34 | 35 | source "$CORDOVA_PATH/check_reqs" 36 | 37 | if [ ! -d "$DEVICE_APP_PATH" ]; then 38 | echo "Project '$DEVIC_APP_PATH' is not built." 39 | exit 1 40 | fi 41 | 42 | 43 | IOS_DEPLOY_MIN_VERSION="1.0.4" 44 | IOS_DEPLOY_LOCATION=$(which ios-deploy) 45 | if [ $? != 0 ]; then 46 | echo -e "\033[31mError: ios-deploy was not found. Please download, build and install version $IOS_DEPLOY_MIN_VERSION or greater from https://github.com/phonegap/ios-deploy into your path. Or 'npm install -g ios-deploy' using node.js: http://nodejs.org/\033[m"; exit 1; 47 | exit 1 48 | fi 49 | 50 | IOS_DEPLOY_VERSION=$(ios-deploy --version) 51 | if [[ "$IOS_DEPLOY_VERSION" < "$IOS_DEPLOY_MIN_VERSION" ]]; then 52 | echo "Cordova needs ios-deploy version $IOS_DEPLOY_MIN_VERSION or greater, you have version $IOS_DEPLOY_VERSION." 53 | exit 1 54 | fi 55 | 56 | # if we got here, we can deploy the app, then exit success 57 | ios-deploy -b "$DEVICE_APP_PATH" 58 | exit 0 59 | -------------------------------------------------------------------------------- /platforms/ios/cordova/lib/list-devices: -------------------------------------------------------------------------------- 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 | 21 | system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2 " iPad"}' 22 | system_profiler SPUSBDataType | sed -n -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2 " iPhone"}' 23 | -------------------------------------------------------------------------------- /platforms/ios/cordova/lib/list-emulator-images: -------------------------------------------------------------------------------- 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 | # Valid values for "--target" (case insensitive): 21 | # "iPhone Retina (3.5-inch)" (default) 22 | # "iPhone Retina (4-inch)" 23 | # "iPhone" 24 | # "iPad" 25 | # "iPad Retina" 26 | 27 | set -e 28 | 29 | echo \""iPhone (Retina 3.5-inch)"\" 30 | echo \""iPhone (Retina 4-inch)"\" 31 | 32 | # this assumes Xcode 5 minimum not supported by ios-sim yet 33 | # echo \""iPhone (Retina 4-inch 64-bit)"\" 34 | 35 | echo \""iPhone"\" 36 | echo \""iPad"\" 37 | echo \""iPad (Retina)"\" 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /platforms/ios/cordova/lib/list-started-emulators: -------------------------------------------------------------------------------- 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 | # Valid values for "--target" (case insensitive): 21 | # "iPhone (Retina 3.5-inch)" (default) 22 | # "iPhone (Retina 4-inch)" 23 | # "iPhone" 24 | # "iPad" 25 | # "iPad (Retina)" 26 | 27 | set -e 28 | 29 | SIM_RUNNING=$(ps aux | grep -i "[i]Phone Simulator" | wc -l) 30 | if [ $SIM_RUNNING == 0 ]; then 31 | echo "No emulators are running." 32 | exit 1 33 | fi 34 | 35 | SIM_ID=`defaults read com.apple.iphonesimulator "SimulateDevice"` 36 | echo \"$SIM_ID\" 37 | -------------------------------------------------------------------------------- /platforms/ios/cordova/lib/sim.applescript: -------------------------------------------------------------------------------- 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 | tell application "System Events" 19 | set UI elements enabled to true 20 | end tell 21 | 22 | tell application "iPhone Simulator" 23 | activate 24 | end tell 25 | 26 | tell application "System Events" 27 | tell process "iPhone Simulator" 28 | click menu item "$DEVICE_NAME" of menu 1 of menu item "Device" of menu 1 of menu bar item "Hardware" of menu bar 1 29 | click menu item "Home" of menu 1 of menu bar item "Hardware" of menu bar 1 30 | end tell 31 | end tell 32 | -------------------------------------------------------------------------------- /platforms/ios/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 | # Valid values for "--target" (case insensitive): 21 | # "iPhone (Retina 3.5-inch)" (default) 22 | # "iPhone (Retina 4-inch)" 23 | # "iPhone" 24 | # "iPad" 25 | # "iPad (Retina)" 26 | 27 | set -e 28 | 29 | 30 | DEFAULT_TARGET="iPhone Retina (3.5-inch)" 31 | TARGET=${1:-$DEFAULT_TARGET} 32 | LIB_PATH=$( cd "$( dirname "$0" )" && pwd -P) 33 | 34 | SCPT=`sed -e "s/\\$DEVICE_NAME/$TARGET/g" "$LIB_PATH/sim.applescript"` 35 | osascript -e "$SCPT" 36 | -------------------------------------------------------------------------------- /platforms/ios/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 | -------------------------------------------------------------------------------- /platforms/ios/cordova/version: -------------------------------------------------------------------------------- 1 | #!/bin/bash 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 | # Returns the VERSION of CordovaLib used. 24 | # Note: it does not work if the --shared option was used to create the project. 25 | # 26 | 27 | set -e 28 | 29 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 30 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 31 | 32 | VERSION_FILE_PATH="$PROJECT_PATH/CordovaLib/VERSION" 33 | VERSION=$(<"$VERSION_FILE_PATH") 34 | 35 | if [ -f "$VERSION_FILE_PATH" ]; then 36 | echo $VERSION 37 | else 38 | echo "The file \"$VERSION_FILE_PATH\" does not exist." 39 | exit 1 40 | fi -------------------------------------------------------------------------------- /platforms/ios/www/README.md: -------------------------------------------------------------------------------- 1 | This is an addon starter template for the [Ionic Framework](http://ionicframework.com/). 2 | 3 | ## How to use this template 4 | 5 | *This template does not work on its own*. It is missing the Ionic library, and AngularJS. 6 | 7 | To use this, either create a new ionic project using the ionic node.js utility, or copy and paste this into an existing Cordova project and download a release of Ionic separately. 8 | 9 | ### With the Ionic tool: 10 | 11 | Take the name after `ionic-starter-`, and that is the name of the template to be used when using the `ionic start` command below: 12 | 13 | ```bash 14 | $ sudo npm install -g ionic cordova 15 | $ ionic start myApp tabs 16 | ``` 17 | 18 | Then, to run it, cd into `myApp` and run: 19 | 20 | ```bash 21 | $ ionic platform add ios 22 | $ ionic build ios 23 | $ ionic emulate ios 24 | ``` 25 | 26 | Substitute ios for android if not on a Mac, but if you can, the ios development toolchain is a lot easier to work with until you need to do anything custom to Android. 27 | 28 | ## Demo 29 | http://plnkr.co/edit/qYMCrt?p=preview 30 | 31 | ## Issues 32 | Issues have been disabled on this repo, if you do find an issue or have a question consider posting it on the [Ionic Forum](http://forum.ionicframework.com/). Or else if there is truly an error, follow our guidelines for [submitting an issue](http://ionicframework.com/contribute/#issues) to the main Ionic repository. On the other hand, pull requests are welcome here! 33 | -------------------------------------------------------------------------------- /platforms/ios/www/cordova_plugins.js: -------------------------------------------------------------------------------- 1 | cordova.define('cordova/plugin_list', function(require, exports, module) { 2 | module.exports = [ 3 | { 4 | "file": "plugins/org.apache.cordova.console/www/console-via-logger.js", 5 | "id": "org.apache.cordova.console.console", 6 | "clobbers": [ 7 | "console" 8 | ] 9 | }, 10 | { 11 | "file": "plugins/org.apache.cordova.console/www/logger.js", 12 | "id": "org.apache.cordova.console.logger", 13 | "clobbers": [ 14 | "cordova.logger" 15 | ] 16 | }, 17 | { 18 | "file": "plugins/org.apache.cordova.device/www/device.js", 19 | "id": "org.apache.cordova.device.device", 20 | "clobbers": [ 21 | "device" 22 | ] 23 | }, 24 | { 25 | "file": "plugins/org.apache.cordova.camera/www/CameraConstants.js", 26 | "id": "org.apache.cordova.camera.Camera", 27 | "clobbers": [ 28 | "Camera" 29 | ] 30 | }, 31 | { 32 | "file": "plugins/org.apache.cordova.camera/www/CameraPopoverOptions.js", 33 | "id": "org.apache.cordova.camera.CameraPopoverOptions", 34 | "clobbers": [ 35 | "CameraPopoverOptions" 36 | ] 37 | }, 38 | { 39 | "file": "plugins/org.apache.cordova.camera/www/Camera.js", 40 | "id": "org.apache.cordova.camera.camera", 41 | "clobbers": [ 42 | "navigator.camera" 43 | ] 44 | }, 45 | { 46 | "file": "plugins/org.apache.cordova.camera/www/ios/CameraPopoverHandle.js", 47 | "id": "org.apache.cordova.camera.CameraPopoverHandle", 48 | "clobbers": [ 49 | "CameraPopoverHandle" 50 | ] 51 | } 52 | ]; 53 | module.exports.metadata = 54 | // TOP OF METADATA 55 | { 56 | "org.apache.cordova.console": "0.2.8", 57 | "org.apache.cordova.device": "0.2.9", 58 | "org.apache.cordova.camera": "0.2.9" 59 | } 60 | // BOTTOM OF METADATA 61 | }); -------------------------------------------------------------------------------- /platforms/ios/www/css/style.css: -------------------------------------------------------------------------------- 1 | /* Empty. Add your own CSS if you like */ 2 | -------------------------------------------------------------------------------- /platforms/ios/www/img/ionic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/www/img/ionic.png -------------------------------------------------------------------------------- /platforms/ios/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |

Photos

28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /platforms/ios/www/js/app.js: -------------------------------------------------------------------------------- 1 | // Ionic Starter App 2 | 3 | // angular.module is a global place for creating, registering and retrieving Angular modules 4 | // 'starter' is the name of this angular module example (also set in a attribute in index.html) 5 | // the 2nd parameter is an array of 'requires' 6 | // 'starter.services' is found in services.js 7 | // 'starter.controllers' is found in controllers.js 8 | angular.module('starter', ['ionic', 'starter.services']) 9 | 10 | .config(function($compileProvider){ 11 | $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel):/); 12 | }) 13 | 14 | .run(function($ionicPlatform) { 15 | $ionicPlatform.ready(function() { 16 | if(window.StatusBar) { 17 | // org.apache.cordova.statusbar required 18 | StatusBar.styleDefault(); 19 | } 20 | }); 21 | }) 22 | 23 | .controller('MainCtrl', function($scope, Camera) { 24 | 25 | $scope.getPhoto = function() { 26 | Camera.getPicture().then(function(imageURI) { 27 | console.log(imageURI); 28 | $scope.lastPhoto = imageURI; 29 | }, function(err) { 30 | console.err(err); 31 | }, { 32 | quality: 75, 33 | targetWidth: 320, 34 | targetHeight: 320, 35 | saveToPhotoAlbum: false 36 | }); 37 | }; 38 | 39 | }) 40 | -------------------------------------------------------------------------------- /platforms/ios/www/js/controllers.js: -------------------------------------------------------------------------------- 1 | angular.module('starter.controllers', []) 2 | 3 | .config(function($compileProvider){ 4 | $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel):/); 5 | }) 6 | 7 | .controller('DashCtrl', function($scope) { 8 | }) 9 | 10 | .controller('FriendsCtrl', function($scope, Friends, Camera) { 11 | $scope.friends = Friends.all(); 12 | $scope.getPhoto = function() { 13 | console.log('Getting camera'); 14 | Camera.getPicture().then(function(imageURI) { 15 | console.log(imageURI); 16 | $scope.lastPhoto = imageURI; 17 | }, function(err) { 18 | console.err(err); 19 | }, { 20 | quality: 75, 21 | targetWidth: 320, 22 | targetHeight: 320, 23 | saveToPhotoAlbum: false 24 | }); 25 | /* 26 | navigator.camera.getPicture(function(imageURI) { 27 | console.log(imageURI); 28 | }, function(err) { 29 | }, { 30 | quality: 50, 31 | destinationType: Camera.DestinationType.DATA_URL 32 | }); 33 | */ 34 | } 35 | }) 36 | 37 | .controller('FriendDetailCtrl', function($scope, $stateParams, Friends) { 38 | $scope.friend = Friends.get($stateParams.friendId); 39 | }) 40 | 41 | .controller('AccountCtrl', function($scope) { 42 | }); 43 | -------------------------------------------------------------------------------- /platforms/ios/www/js/services.js: -------------------------------------------------------------------------------- 1 | angular.module('starter.services', []) 2 | 3 | .factory('Camera', ['$q', function($q) { 4 | 5 | return { 6 | getPicture: function(options) { 7 | var q = $q.defer(); 8 | 9 | navigator.camera.getPicture(function(result) { 10 | // Do any magic you need 11 | q.resolve(result); 12 | }, function(err) { 13 | q.reject(err); 14 | }, options); 15 | 16 | return q.promise; 17 | } 18 | } 19 | }]) 20 | 21 | /** 22 | * A simple example service that returns some data. 23 | */ 24 | .factory('Friends', function() { 25 | // Might use a resource here that returns a JSON array 26 | 27 | // Some fake testing data 28 | var friends = [ 29 | { id: 0, name: 'Scruff McGruff' }, 30 | { id: 1, name: 'G.I. Joe' }, 31 | { id: 2, name: 'Miss Frizzle' }, 32 | { id: 3, name: 'Ash Ketchum' } 33 | ]; 34 | 35 | return { 36 | all: function() { 37 | return friends; 38 | }, 39 | get: function(friendId) { 40 | // Simple index lookup 41 | return friends[friendId]; 42 | } 43 | } 44 | }); 45 | -------------------------------------------------------------------------------- /platforms/ios/www/lib/ionic/fonts/ionicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/www/lib/ionic/fonts/ionicons.eot -------------------------------------------------------------------------------- /platforms/ios/www/lib/ionic/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/www/lib/ionic/fonts/ionicons.ttf -------------------------------------------------------------------------------- /platforms/ios/www/lib/ionic/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/platforms/ios/www/lib/ionic/fonts/ionicons.woff -------------------------------------------------------------------------------- /platforms/ios/www/lib/ionic/js/angular/angular-resource.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.2.12 3 | (c) 2010-2014 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(H,a,A){'use strict';function D(p,g){g=g||{};a.forEach(g,function(a,c){delete g[c]});for(var c in p)!p.hasOwnProperty(c)||"$"===c.charAt(0)&&"$"===c.charAt(1)||(g[c]=p[c]);return g}var v=a.$$minErr("$resource"),C=/^(\.[a-zA-Z_$][0-9a-zA-Z_$]*)+$/;a.module("ngResource",["ng"]).factory("$resource",["$http","$q",function(p,g){function c(a,c){this.template=a;this.defaults=c||{};this.urlParams={}}function t(n,w,l){function r(h,d){var e={};d=x({},w,d);s(d,function(b,d){u(b)&&(b=b());var k;if(b&& 7 | b.charAt&&"@"==b.charAt(0)){k=h;var a=b.substr(1);if(null==a||""===a||"hasOwnProperty"===a||!C.test("."+a))throw v("badmember",a);for(var a=a.split("."),f=0,c=a.length;f 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /platforms/ios/www/templates/tab-account.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Account

4 |
5 |
6 | -------------------------------------------------------------------------------- /platforms/ios/www/templates/tab-dash.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Dash

4 |
5 |
6 | -------------------------------------------------------------------------------- /platforms/ios/www/templates/tab-friends.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{friend.name}} 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /platforms/ios/www/templates/tabs.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /plugins/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/plugins/.gitignore -------------------------------------------------------------------------------- /plugins/ios.json: -------------------------------------------------------------------------------- 1 | { 2 | "prepare_queue": { 3 | "installed": [], 4 | "uninstalled": [] 5 | }, 6 | "config_munge": { 7 | "files": { 8 | "framework": { 9 | "parents": { 10 | "ImageIO.framework": [ 11 | { 12 | "xml": "true", 13 | "count": 1 14 | } 15 | ], 16 | "CoreLocation.framework": [ 17 | { 18 | "xml": "false", 19 | "count": 1 20 | } 21 | ], 22 | "CoreGraphics.framework": [ 23 | { 24 | "xml": "false", 25 | "count": 1 26 | } 27 | ], 28 | "AssetsLibrary.framework": [ 29 | { 30 | "xml": "false", 31 | "count": 1 32 | } 33 | ], 34 | "MobileCoreServices.framework": [ 35 | { 36 | "xml": "false", 37 | "count": 1 38 | } 39 | ] 40 | } 41 | }, 42 | "config.xml": { 43 | "parents": { 44 | "/*": [ 45 | { 46 | "xml": "", 47 | "count": 1 48 | }, 49 | { 50 | "xml": "", 51 | "count": 1 52 | }, 53 | { 54 | "xml": "", 55 | "count": 1 56 | } 57 | ] 58 | } 59 | } 60 | } 61 | }, 62 | "installed_plugins": { 63 | "org.apache.cordova.console": { 64 | "PACKAGE_NAME": "com.ionicframework.starter" 65 | }, 66 | "org.apache.cordova.device": { 67 | "PACKAGE_NAME": "com.ionicframework.starter" 68 | }, 69 | "org.apache.cordova.camera": { 70 | "PACKAGE_NAME": "com.ionicframework.starter" 71 | } 72 | }, 73 | "dependent_plugins": {} 74 | } -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/.fetch.json: -------------------------------------------------------------------------------- 1 | {"source":{"type":"local","path":"/var/folders/yc/wb4ct6qn5vl2r6hv8k3mck_w0000gq/T/org.apache.cordova.camera/package"}} -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/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 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/README.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | # org.apache.cordova.camera 21 | 22 | Plugin documentation: [doc/index.md](doc/index.md) 23 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/src/firefoxos/CameraProxy.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 | function takePicture(success, error, opts) { 23 | var pick = new MozActivity({ 24 | name: "pick", 25 | data: { 26 | type: ["image/*"] 27 | } 28 | }); 29 | 30 | pick.onerror = error || function() {}; 31 | 32 | pick.onsuccess = function() { 33 | // image is returned as Blob in this.result.blob 34 | // we need to call success with url or base64 encoded image 35 | if (opts && opts.destinationType == 0) { 36 | // TODO: base64 37 | return; 38 | } 39 | if (!opts || !opts.destinationType || opts.destinationType > 0) { 40 | // url 41 | return success(window.URL.createObjectURL(this.result.blob)); 42 | } 43 | }; 44 | } 45 | 46 | module.exports = { 47 | takePicture: takePicture, 48 | cleanup: function(){} 49 | }; 50 | 51 | require("cordova/firefoxos/commandProxy").add("Camera", module.exports); 52 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/src/ios/CDVExif.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 | #ifndef CordovaLib_ExifData_h 21 | #define CordovaLib_ExifData_h 22 | 23 | // exif data types 24 | typedef enum exifDataTypes { 25 | EDT_UBYTE = 1, // 8 bit unsigned integer 26 | EDT_ASCII_STRING, // 8 bits containing 7 bit ASCII code, null terminated 27 | EDT_USHORT, // 16 bit unsigned integer 28 | EDT_ULONG, // 32 bit unsigned integer 29 | EDT_URATIONAL, // 2 longs, first is numerator and second is denominator 30 | EDT_SBYTE, 31 | EDT_UNDEFINED, // 8 bits 32 | EDT_SSHORT, 33 | EDT_SLONG, // 32bit signed integer (2's complement) 34 | EDT_SRATIONAL, // 2 SLONGS, first long is numerator, second is denominator 35 | EDT_SINGLEFLOAT, 36 | EDT_DOUBLEFLOAT 37 | } ExifDataTypes; 38 | 39 | // maps integer code for exif data types to width in bytes 40 | static const int DataTypeToWidth[] = {1,1,2,4,8,1,1,2,4,8,4,8}; 41 | 42 | static const int RECURSE_HORIZON = 8; 43 | #endif 44 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/src/ios/CDVJpegHeaderWriter.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 CDVJpegHeaderWriter : NSObject { 23 | NSDictionary * SubIFDTagFormatDict; 24 | NSDictionary * IFD0TagFormatDict; 25 | } 26 | 27 | - (NSData*) spliceExifBlockIntoJpeg: (NSData*) jpegdata 28 | withExifBlock: (NSString*) exifstr; 29 | - (NSString*) createExifAPP1 : (NSDictionary*) datadict; 30 | - (NSString*) formattedHexStringFromDecimalNumber: (NSNumber*) numb 31 | withPlaces: (NSNumber*) width; 32 | - (NSString*) formatNumberWithLeadingZeroes: (NSNumber*) numb 33 | withPlaces: (NSNumber*) places; 34 | - (NSString*) decimalToUnsignedRational: (NSNumber*) numb 35 | withResultNumerator: (NSNumber**) numerator 36 | withResultDenominator: (NSNumber**) denominator; 37 | - (void) continuedFraction: (double) val 38 | withFractionList: (NSMutableArray*) fractionlist 39 | withHorizon: (int) horizon; 40 | //- (void) expandContinuedFraction: (NSArray*) fractionlist; 41 | - (void) splitDouble: (double) val 42 | withIntComponent: (int*) rightside 43 | withFloatRemainder: (double*) leftside; 44 | - (NSString*) formatRationalWithNumerator: (NSNumber*) numerator 45 | withDenominator: (NSNumber*) denominator 46 | asSigned: (Boolean) signedFlag; 47 | - (NSString*) hexStringFromData : (NSData*) data; 48 | - (NSNumber*) numericFromHexString : (NSString *) hexstring; 49 | 50 | /* 51 | - (void) readExifMetaData : (NSData*) imgdata; 52 | - (void) spliceImageData : (NSData*) imgdata withExifData: (NSDictionary*) exifdata; 53 | - (void) locateExifMetaData : (NSData*) imgdata; 54 | - (NSString*) createExifAPP1 : (NSDictionary*) datadict; 55 | - (void) createExifDataString : (NSDictionary*) datadict; 56 | - (NSString*) createDataElement : (NSString*) element 57 | withElementData: (NSString*) data 58 | withExternalDataBlock: (NSDictionary*) memblock; 59 | - (NSString*) hexStringFromData : (NSData*) data; 60 | - (NSNumber*) numericFromHexString : (NSString *) hexstring; 61 | */ 62 | @end 63 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/src/ubuntu/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/plugins/org.apache.cordova.camera/src/ubuntu/back.png -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/src/ubuntu/camera.h: -------------------------------------------------------------------------------- 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 | #ifndef CAMERA_H 23 | #define CAMERA_H 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | class Camera: public CPlugin { 34 | Q_OBJECT 35 | public: 36 | explicit Camera(Cordova *cordova); 37 | 38 | virtual const QString fullName() override { 39 | return Camera::fullID(); 40 | } 41 | 42 | virtual const QString shortName() override { 43 | return "Camera"; 44 | } 45 | 46 | static const QString fullID() { 47 | return "Camera"; 48 | } 49 | 50 | public slots: 51 | void takePicture(int scId, int ecId, int quality, int destinationType, int/*sourceType*/, int targetWidth, int targetHeight, int encodingType, 52 | int/*mediaType*/, bool/*allowEdit*/, bool/*correctOrientation*/, bool/*saveToPhotoAlbum*/, const QVariantMap &popoverOptions, int cameraDirection); 53 | void cancel(); 54 | 55 | void onImageSaved(QString path); 56 | 57 | private: 58 | bool preprocessImage(QString &path); 59 | 60 | int _lastScId; 61 | int _lastEcId; 62 | QSharedPointer _camera; 63 | 64 | QVariantMap _options; 65 | protected: 66 | enum DestinationType { 67 | DATA_URL = 0, 68 | FILE_URI = 1 69 | }; 70 | enum EncodingType { 71 | JPEG = 0, 72 | PNG = 1 73 | }; 74 | }; 75 | 76 | #endif // CAMERA_H 77 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/src/ubuntu/shoot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/plugins/org.apache.cordova.camera/src/ubuntu/shoot.png -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/src/ubuntu/toolbar-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/plugins/org.apache.cordova.camera/src/ubuntu/toolbar-left.png -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/src/ubuntu/toolbar-middle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/plugins/org.apache.cordova.camera/src/ubuntu/toolbar-middle.png -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/src/ubuntu/toolbar-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/plugins/org.apache.cordova.camera/src/ubuntu/toolbar-right.png -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/www/Camera.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 | var argscheck = require('cordova/argscheck'), 23 | exec = require('cordova/exec'), 24 | Camera = require('./Camera'); 25 | // XXX: commented out 26 | //CameraPopoverHandle = require('./CameraPopoverHandle'); 27 | 28 | var cameraExport = {}; 29 | 30 | // Tack on the Camera Constants to the base camera plugin. 31 | for (var key in Camera) { 32 | cameraExport[key] = Camera[key]; 33 | } 34 | 35 | /** 36 | * Gets a picture from source defined by "options.sourceType", and returns the 37 | * image as defined by the "options.destinationType" option. 38 | 39 | * The defaults are sourceType=CAMERA and destinationType=FILE_URI. 40 | * 41 | * @param {Function} successCallback 42 | * @param {Function} errorCallback 43 | * @param {Object} options 44 | */ 45 | cameraExport.getPicture = function(successCallback, errorCallback, options) { 46 | argscheck.checkArgs('fFO', 'Camera.getPicture', arguments); 47 | options = options || {}; 48 | var getValue = argscheck.getValue; 49 | 50 | var quality = getValue(options.quality, 50); 51 | var destinationType = getValue(options.destinationType, Camera.DestinationType.FILE_URI); 52 | var sourceType = getValue(options.sourceType, Camera.PictureSourceType.CAMERA); 53 | var targetWidth = getValue(options.targetWidth, -1); 54 | var targetHeight = getValue(options.targetHeight, -1); 55 | var encodingType = getValue(options.encodingType, Camera.EncodingType.JPEG); 56 | var mediaType = getValue(options.mediaType, Camera.MediaType.PICTURE); 57 | var allowEdit = !!options.allowEdit; 58 | var correctOrientation = !!options.correctOrientation; 59 | var saveToPhotoAlbum = !!options.saveToPhotoAlbum; 60 | var popoverOptions = getValue(options.popoverOptions, null); 61 | var cameraDirection = getValue(options.cameraDirection, Camera.Direction.BACK); 62 | 63 | var args = [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType, 64 | mediaType, allowEdit, correctOrientation, saveToPhotoAlbum, popoverOptions, cameraDirection]; 65 | 66 | exec(successCallback, errorCallback, "Camera", "takePicture", args); 67 | // XXX: commented out 68 | //return new CameraPopoverHandle(); 69 | }; 70 | 71 | cameraExport.cleanup = function(successCallback, errorCallback) { 72 | exec(successCallback, errorCallback, "Camera", "cleanup", []); 73 | }; 74 | 75 | module.exports = cameraExport; 76 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/www/CameraConstants.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 | DestinationType:{ 24 | DATA_URL: 0, // Return base64 encoded string 25 | FILE_URI: 1, // Return file uri (content://media/external/images/media/2 for Android) 26 | NATIVE_URI: 2 // Return native uri (eg. asset-library://... for iOS) 27 | }, 28 | EncodingType:{ 29 | JPEG: 0, // Return JPEG encoded image 30 | PNG: 1 // Return PNG encoded image 31 | }, 32 | MediaType:{ 33 | PICTURE: 0, // allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType 34 | VIDEO: 1, // allow selection of video only, ONLY RETURNS URL 35 | ALLMEDIA : 2 // allow selection from all media types 36 | }, 37 | PictureSourceType:{ 38 | PHOTOLIBRARY : 0, // Choose image from picture library (same as SAVEDPHOTOALBUM for Android) 39 | CAMERA : 1, // Take picture from camera 40 | SAVEDPHOTOALBUM : 2 // Choose image from picture library (same as PHOTOLIBRARY for Android) 41 | }, 42 | PopoverArrowDirection:{ 43 | ARROW_UP : 1, // matches iOS UIPopoverArrowDirection constants to specify arrow location on popover 44 | ARROW_DOWN : 2, 45 | ARROW_LEFT : 4, 46 | ARROW_RIGHT : 8, 47 | ARROW_ANY : 15 48 | }, 49 | Direction:{ 50 | BACK: 0, 51 | FRONT: 1 52 | } 53 | }; 54 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/www/CameraPopoverHandle.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 | var exec = require('cordova/exec'); 23 | 24 | /** 25 | * A handle to an image picker popover. 26 | */ 27 | var CameraPopoverHandle = function() { 28 | this.setPosition = function(popoverOptions) { 29 | console.log('CameraPopoverHandle.setPosition is only supported on iOS.'); 30 | }; 31 | }; 32 | 33 | module.exports = CameraPopoverHandle; 34 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/www/CameraPopoverOptions.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 | var Camera = require('./Camera'); 23 | 24 | /** 25 | * Encapsulates options for iOS Popover image picker 26 | */ 27 | var CameraPopoverOptions = function(x,y,width,height,arrowDir){ 28 | // information of rectangle that popover should be anchored to 29 | this.x = x || 0; 30 | this.y = y || 32; 31 | this.width = width || 320; 32 | this.height = height || 480; 33 | // The direction of the popover arrow 34 | this.arrowDir = arrowDir || Camera.PopoverArrowDirection.ARROW_ANY; 35 | }; 36 | 37 | module.exports = CameraPopoverOptions; 38 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.camera/www/ios/CameraPopoverHandle.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 | var exec = require('cordova/exec'); 23 | 24 | /** 25 | * A handle to an image picker popover. 26 | */ 27 | var CameraPopoverHandle = function() { 28 | this.setPosition = function(popoverOptions) { 29 | var args = [ popoverOptions ]; 30 | exec(null, null, "Camera", "repositionPopover", args); 31 | }; 32 | }; 33 | 34 | module.exports = CameraPopoverHandle; 35 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.console/.fetch.json: -------------------------------------------------------------------------------- 1 | {"source":{"type":"local","path":"/var/folders/yc/wb4ct6qn5vl2r6hv8k3mck_w0000gq/T/org.apache.cordova.console/package"}} -------------------------------------------------------------------------------- /plugins/org.apache.cordova.console/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 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.console/README.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | # org.apache.cordova.console 21 | 22 | Plugin documentation: [doc/index.md](doc/index.md) 23 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.console/RELEASENOTES.md: -------------------------------------------------------------------------------- 1 | 21 | # Release Notes 22 | 23 | ### 0.2.3 (Sept 25, 2013) 24 | * CB-4889 bumping&resetting version 25 | * CB-4889 renaming org.apache.cordova.core.console to org.apache.cordova.console 26 | * Rename CHANGELOG.md -> RELEASENOTES.md 27 | * [CB-4752] Incremented plugin version on dev branch. 28 | 29 | ### 0.2.4 (Oct 28, 2013) 30 | * CB-5154 log formatting incorrectly to native 31 | * CB-5128: added repo + issue tag to plugin.xml for console plugin 32 | * [CB-4915] Incremented plugin version on dev branch. 33 | 34 | ### 0.2.5 (Dec 4, 2013) 35 | * add ubuntu platform 36 | 37 | ### 0.2.6 (Jan 02, 2014) 38 | * CB-5658 Add doc/index.md for Console plugin 39 | 40 | ### 0.2.7 (Feb 05, 2014) 41 | * Native console needs to be called DebugConsole to avoid ambiguous reference. This commit requires the 3.4.0 version of the native class factory 42 | * CB-4718 fixed Console plugin not working on wp 43 | 44 | ### 0.2.8 (Apr 17, 2014) 45 | * CB-6460: Update license headers 46 | * Add NOTICE file 47 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.console/doc/index.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | # org.apache.cordova.console 21 | 22 | This plugin is meant to ensure that console.log() is as useful as it can be. If 23 | you are not unhappy with how console.log() works for you, then you probably 24 | don't need this plugin. 25 | 26 | ## Installation 27 | 28 | cordova plugin add org.apache.cordova.console 29 | 30 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.console/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.8", 3 | "name": "org.apache.cordova.console", 4 | "cordova_name": "Console", 5 | "description": "Cordova Console Plugin", 6 | "license": "Apache 2.0", 7 | "repo": "https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git", 8 | "issue": "https://issues.apache.org/jira/browse/CB/component/12320644", 9 | "keywords": [ 10 | "cordova", 11 | "console" 12 | ], 13 | "platforms": [ 14 | "ios", 15 | "ubuntu", 16 | "wp7", 17 | "wp8", 18 | "windows8" 19 | ], 20 | "engines": [], 21 | "englishdoc": "\n\n# org.apache.cordova.console\n\nThis plugin is meant to ensure that console.log() is as useful as it can be. If\nyou are not unhappy with how console.log() works for you, then you probably\ndon't need this plugin.\n\n## Installation\n\n cordova plugin add org.apache.cordova.console\n\n" 22 | } -------------------------------------------------------------------------------- /plugins/org.apache.cordova.console/src/ios/CDVLogger.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 CDVLogger : CDVPlugin 23 | 24 | - (void)logLevel:(CDVInvokedUrlCommand*)command; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.console/src/ios/CDVLogger.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 "CDVLogger.h" 21 | #import 22 | 23 | @implementation CDVLogger 24 | 25 | /* log a message */ 26 | - (void)logLevel:(CDVInvokedUrlCommand*)command 27 | { 28 | id level = [command.arguments objectAtIndex:0]; 29 | id message = [command.arguments objectAtIndex:1]; 30 | 31 | if ([level isEqualToString:@"LOG"]) { 32 | NSLog(@"%@", message); 33 | } else { 34 | NSLog(@"%@: %@", level, message); 35 | } 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.console/src/ubuntu/console.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | #include "console.h" 16 | 17 | #include 18 | 19 | Console::Console(Cordova *cordova) : CPlugin(cordova) { 20 | } 21 | 22 | void Console::logLevel(int scId, int ecId, QString level, QString message) { 23 | Q_UNUSED(scId) 24 | Q_UNUSED(ecId) 25 | 26 | if (level != "LOG") 27 | std::cout << "[" << level.toStdString() << "] "; 28 | std::cout << message.toStdString() << std::endl; 29 | } 30 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.console/src/ubuntu/console.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | #ifndef CONSOLE_H_FDSVCXGFRS 16 | #define CONSOLE_H_FDSVCXGFRS 17 | 18 | #include 19 | 20 | #include 21 | 22 | class Console : public CPlugin { 23 | Q_OBJECT 24 | public: 25 | explicit Console(Cordova *cordova); 26 | 27 | virtual const QString fullName() override { 28 | return Console::fullID(); 29 | } 30 | 31 | virtual const QString shortName() override { 32 | return "Console"; 33 | } 34 | 35 | static const QString fullID() { 36 | return "Console"; 37 | } 38 | 39 | public slots: 40 | void logLevel(int scId, int ecId, QString level, QString message); 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.console/src/wp/DebugConsole.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | */ 14 | 15 | using System; 16 | using System.Net; 17 | using System.Windows; 18 | using System.Windows.Controls; 19 | using System.Windows.Documents; 20 | using System.Windows.Ink; 21 | using System.Windows.Input; 22 | using System.Windows.Media; 23 | using System.Windows.Media.Animation; 24 | using System.Windows.Shapes; 25 | using System.Diagnostics; 26 | 27 | namespace WPCordovaClassLib.Cordova.Commands 28 | { 29 | public class DebugConsole : BaseCommand 30 | { 31 | public void logLevel(string options) 32 | { 33 | string[] args = JSON.JsonHelper.Deserialize(options); 34 | string level = args[0]; 35 | string msg = args[1]; 36 | 37 | if (level.Equals("LOG")) 38 | { 39 | Debug.WriteLine(msg); 40 | } 41 | else 42 | { 43 | Debug.WriteLine(level + ": " + msg); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.device/.fetch.json: -------------------------------------------------------------------------------- 1 | {"source":{"type":"local","path":"/var/folders/yc/wb4ct6qn5vl2r6hv8k3mck_w0000gq/T/org.apache.cordova.device/package"}} -------------------------------------------------------------------------------- /plugins/org.apache.cordova.device/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 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.device/README.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | # org.apache.cordova.device 21 | 22 | Plugin documentation: [doc/index.md](doc/index.md) 23 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.device/RELEASENOTES.md: -------------------------------------------------------------------------------- 1 | 21 | # Release Notes 22 | 23 | ### 0.2.1 (Sept 5, 2013) 24 | * removed extraneous print statement 25 | * [CB-4432] copyright notice change 26 | 27 | ### 0.2.3 (Sept 25, 2013) 28 | * CB-4889 bumping&resetting version 29 | * [windows8] commandProxy has moved 30 | * [BlackBerry10] removed uneeded permission tags in plugin.xml 31 | * CB-4889 renaming org.apache.cordova.core.device to org.apache.cordova.device 32 | * Rename CHANGELOG.md -> RELEASENOTES.md 33 | * updated to use commandProxy for ffos 34 | * add firefoxos support 35 | * [CB-4752] Incremented plugin version on dev branch. 36 | 37 | ### 0.2.4 (Oct 28, 2013) 38 | * CB-5128: added repo + issue tag in plugin.xml for device plugin 39 | * CB-5085 device.cordova returning wrong value 40 | * [CB-4915] Incremented plugin version on dev branch. 41 | 42 | ### 0.2.5 (Dec 4, 2013) 43 | * CB-5316 Spell Cordova as a brand unless it's a command or script 44 | * [ubuntu] use cordova/exec/proxy 45 | * add ubuntu platform 46 | * Modify Device.platform logic to use amazon-fireos as the platform for Amazon Devices 47 | * 1. Added amazon-fireos platform. 2. Change to use cordova-amazon-fireos as the platform if user agent contains 'cordova-amazon-fireos' 48 | 49 | ### 0.2.6 (Jan 02, 2014) 50 | * CB-5658 Add doc/index.md for Device plugin 51 | * CB-5504 Moving Telephony Logic out of Device 52 | 53 | ### 0.2.7 (Jan 07, 2014) 54 | * CB-5737 Fix exception on close caused by left over telephony code from CB-5504 55 | 56 | ### 0.2.8 (Feb 05, 2014) 57 | * Tizen support added 58 | 59 | ### 0.2.9 (Apr 17, 2014) 60 | * CB-5105: [Android, windows8, WP, BlackBerry10] Removed dead code for device.version 61 | * CB-6422: [windows8] use cordova/exec/proxy 62 | * CB-6460: Update license headers 63 | * Add NOTICE file 64 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.device/src/blackberry10/index.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 | function getModelName () { 23 | var modelName = window.qnx.webplatform.device.modelName; 24 | //Pre 10.2 (meaning Z10 or Q10) 25 | if (typeof modelName === "undefined") { 26 | if (window.screen.height === 720 && window.screen.width === 720) { 27 | if ( window.matchMedia("(-blackberry-display-technology: -blackberry-display-oled)").matches) { 28 | modelName = "Q10"; 29 | } else { 30 | modelName = "Q5"; 31 | } 32 | } else if ((window.screen.height === 1280 && window.screen.width === 768) || 33 | (window.screen.height === 768 && window.screen.width === 1280)) { 34 | modelName = "Z10"; 35 | } else { 36 | modelName = window.qnx.webplatform.deviceName; 37 | } 38 | } 39 | 40 | return modelName; 41 | } 42 | 43 | function getUUID () { 44 | var uuid = ""; 45 | try { 46 | //Must surround by try catch because this will throw if the app is missing permissions 47 | uuid = window.qnx.webplatform.device.devicePin; 48 | } catch (e) { 49 | //DO Nothing 50 | } 51 | return uuid; 52 | } 53 | 54 | module.exports = { 55 | getDeviceInfo: function (success, fail, args, env) { 56 | var result = new PluginResult(args, env), 57 | modelName = getModelName(), 58 | uuid = getUUID(), 59 | info = { 60 | platform: "blackberry10", 61 | version: window.qnx.webplatform.device.scmBundle, 62 | model: modelName, 63 | uuid: uuid 64 | }; 65 | 66 | result.ok(info); 67 | } 68 | }; 69 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.device/src/firefoxos/DeviceProxy.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 | var firefoxos = require('cordova/platform'); 23 | var cordova = require('cordova'); 24 | 25 | module.exports = { 26 | getDeviceInfo: function(success, error) { 27 | setTimeout(function () { 28 | success({ 29 | cordova: firefoxos.cordovaVersion, 30 | platform: 'firefoxos', 31 | model: null, 32 | version: null, 33 | uuid: null 34 | }); 35 | }, 0); 36 | } 37 | }; 38 | 39 | require("cordova/firefoxos/commandProxy").add("Device", module.exports); 40 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.device/src/ios/CDVDevice.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 CDVDevice : CDVPlugin 24 | {} 25 | 26 | + (NSString*)cordovaVersion; 27 | 28 | - (void)getDeviceInfo:(CDVInvokedUrlCommand*)command; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.device/src/tizen/DeviceProxy.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 | var tizen = require('cordova/platform'); 23 | var cordova = require('cordova'); 24 | 25 | module.exports = { 26 | getDeviceInfo: function(success, error) { 27 | setTimeout(function () { 28 | success({ 29 | cordova: tizen.cordovaVersion, 30 | platform: 'tizen', 31 | model: null, 32 | version: null, 33 | uuid: null 34 | }); 35 | }, 0); 36 | } 37 | }; 38 | 39 | require("cordova/tizen/commandProxy").add("Device", module.exports); 40 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.device/src/ubuntu/device.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Wolfgang Koller - http://www.gofg.at/ 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include"device.h" 21 | 22 | #define CORDOVA "3.0.0" 23 | 24 | Device::Device(Cordova *cordova) : CPlugin(cordova) { 25 | } 26 | 27 | static QString getOSName() { 28 | #ifdef Q_OS_SYMBIAN 29 | QString platform = "Symbian"; 30 | #endif 31 | #ifdef Q_OS_WIN 32 | QString platform = "Windows"; 33 | #endif 34 | #ifdef Q_OS_WINCE 35 | QString platform = "Windows CE"; 36 | #endif 37 | #ifdef Q_OS_LINUX 38 | QString platform = "Linux"; 39 | #endif 40 | return platform; 41 | } 42 | 43 | void Device::getInfo(int scId, int ecId) { 44 | Q_UNUSED(ecId) 45 | 46 | QDeviceInfo systemDeviceInfo; 47 | QDeviceInfo systemInfo; 48 | 49 | QString platform = getOSName(); 50 | 51 | QString uuid = systemDeviceInfo.uniqueDeviceID(); 52 | if (uuid.isEmpty()) { 53 | QString deviceDescription = systemInfo.imei(0) + ";" + systemInfo.manufacturer() + ";" + systemInfo.model() + ";" + systemInfo.productName() + ";" + platform; 54 | QString user = qgetenv("USER"); 55 | if (user.isEmpty()) { 56 | user = qgetenv("USERNAME"); 57 | if (user.isEmpty()) 58 | user = QDir::homePath(); 59 | } 60 | uuid = QString(QCryptographicHash::hash((deviceDescription + ";" + user).toUtf8(), QCryptographicHash::Md5).toHex()); 61 | } 62 | 63 | this->cb(scId, systemDeviceInfo.model(), CORDOVA, platform, uuid, systemInfo.version(QDeviceInfo::Os)); 64 | } 65 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.device/src/ubuntu/device.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Wolfgang Koller - http://www.gofg.at/ 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef DEVICE_H_FDSAFAS 18 | #define DEVICE_H_FDSAFAS 19 | 20 | #include 21 | 22 | #include 23 | 24 | class Device: public CPlugin { 25 | Q_OBJECT 26 | public: 27 | explicit Device(Cordova *cordova); 28 | 29 | virtual const QString fullName() override { 30 | return Device::fullID(); 31 | } 32 | 33 | virtual const QString shortName() override { 34 | return "Device"; 35 | } 36 | 37 | static const QString fullID() { 38 | return "com.cordova.Device"; 39 | } 40 | 41 | signals: 42 | 43 | public slots: 44 | void getInfo(int scId, int ecId); 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.device/src/ubuntu/device.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 | var cordova = require('cordova'); 23 | var exec = require('cordova/exec'); 24 | 25 | module.exports = { 26 | getInfo:function(win,fail,args) { 27 | Cordova.exec(function (model, cordova, platform, uuid, version) { 28 | win({name: name, model: model, cordova: cordova, 29 | platform: platform, uuid: uuid, version: version}); 30 | }, null, "com.cordova.Device", "getInfo", []); 31 | } 32 | }; 33 | 34 | require("cordova/exec/proxy").add("Device", module.exports); 35 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.device/src/windows8/DeviceProxy.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 | 23 | var cordova = require('cordova'); 24 | var utils = require('cordova/utils'); 25 | 26 | module.exports = { 27 | 28 | getDeviceInfo:function(win,fail,args) { 29 | 30 | // deviceId aka uuid, stored in Windows.Storage.ApplicationData.current.localSettings.values.deviceId 31 | var deviceId; 32 | 33 | var localSettings = Windows.Storage.ApplicationData.current.localSettings; 34 | 35 | if (localSettings.values.deviceId) { 36 | deviceId = localSettings.values.deviceId; 37 | } 38 | else { 39 | deviceId = localSettings.values.deviceId = utils.createUUID(); 40 | } 41 | 42 | setTimeout(function () { 43 | win({ platform: "windows8", version: "8", uuid: deviceId, model: window.clientInformation.platform }); 44 | }, 0); 45 | } 46 | 47 | }; 48 | 49 | require("cordova/exec/proxy").add("Device", module.exports); 50 | 51 | -------------------------------------------------------------------------------- /plugins/org.apache.cordova.device/www/device.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 | var argscheck = require('cordova/argscheck'), 23 | channel = require('cordova/channel'), 24 | utils = require('cordova/utils'), 25 | exec = require('cordova/exec'), 26 | cordova = require('cordova'); 27 | 28 | channel.createSticky('onCordovaInfoReady'); 29 | // Tell cordova channel to wait on the CordovaInfoReady event 30 | channel.waitForInitialization('onCordovaInfoReady'); 31 | 32 | /** 33 | * This represents the mobile device, and provides properties for inspecting the model, version, UUID of the 34 | * phone, etc. 35 | * @constructor 36 | */ 37 | function Device() { 38 | this.available = false; 39 | this.platform = null; 40 | this.version = null; 41 | this.uuid = null; 42 | this.cordova = null; 43 | this.model = null; 44 | 45 | var me = this; 46 | 47 | channel.onCordovaReady.subscribe(function() { 48 | me.getInfo(function(info) { 49 | //ignoring info.cordova returning from native, we should use value from cordova.version defined in cordova.js 50 | //TODO: CB-5105 native implementations should not return info.cordova 51 | var buildLabel = cordova.version; 52 | me.available = true; 53 | me.platform = info.platform; 54 | me.version = info.version; 55 | me.uuid = info.uuid; 56 | me.cordova = buildLabel; 57 | me.model = info.model; 58 | channel.onCordovaInfoReady.fire(); 59 | },function(e) { 60 | me.available = false; 61 | utils.alert("[ERROR] Error initializing Cordova: " + e); 62 | }); 63 | }); 64 | } 65 | 66 | /** 67 | * Get device info 68 | * 69 | * @param {Function} successCallback The function to call when the heading data is available 70 | * @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL) 71 | */ 72 | Device.prototype.getInfo = function(successCallback, errorCallback) { 73 | argscheck.checkArgs('fF', 'Device.getInfo', arguments); 74 | exec(successCallback, errorCallback, "Device", "getDeviceInfo", []); 75 | }; 76 | 77 | module.exports = new Device(); 78 | -------------------------------------------------------------------------------- /www/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/www/.gitignore -------------------------------------------------------------------------------- /www/.index.html.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/www/.index.html.swo -------------------------------------------------------------------------------- /www/.index.html.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/www/.index.html.swp -------------------------------------------------------------------------------- /www/README.md: -------------------------------------------------------------------------------- 1 | This is an addon starter template for the [Ionic Framework](http://ionicframework.com/). 2 | 3 | ## How to use this template 4 | 5 | *This template does not work on its own*. It is missing the Ionic library, and AngularJS. 6 | 7 | To use this, either create a new ionic project using the ionic node.js utility, or copy and paste this into an existing Cordova project and download a release of Ionic separately. 8 | 9 | ### With the Ionic tool: 10 | 11 | Take the name after `ionic-starter-`, and that is the name of the template to be used when using the `ionic start` command below: 12 | 13 | ```bash 14 | $ sudo npm install -g ionic cordova 15 | $ ionic start myApp tabs 16 | ``` 17 | 18 | Then, to run it, cd into `myApp` and run: 19 | 20 | ```bash 21 | $ ionic platform add ios 22 | $ ionic build ios 23 | $ ionic emulate ios 24 | ``` 25 | 26 | Substitute ios for android if not on a Mac, but if you can, the ios development toolchain is a lot easier to work with until you need to do anything custom to Android. 27 | 28 | ## Demo 29 | http://plnkr.co/edit/qYMCrt?p=preview 30 | 31 | ## Issues 32 | Issues have been disabled on this repo, if you do find an issue or have a question consider posting it on the [Ionic Forum](http://forum.ionicframework.com/). Or else if there is truly an error, follow our guidelines for [submitting an issue](http://ionicframework.com/contribute/#issues) to the main Ionic repository. On the other hand, pull requests are welcome here! 33 | -------------------------------------------------------------------------------- /www/css/style.css: -------------------------------------------------------------------------------- 1 | /* Empty. Add your own CSS if you like */ 2 | -------------------------------------------------------------------------------- /www/img/ionic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/www/img/ionic.png -------------------------------------------------------------------------------- /www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |

Photos

28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /www/js/app.js: -------------------------------------------------------------------------------- 1 | // Ionic Starter App 2 | 3 | // angular.module is a global place for creating, registering and retrieving Angular modules 4 | // 'starter' is the name of this angular module example (also set in a attribute in index.html) 5 | // the 2nd parameter is an array of 'requires' 6 | // 'starter.services' is found in services.js 7 | // 'starter.controllers' is found in controllers.js 8 | angular.module('starter', ['ionic', 'starter.services']) 9 | 10 | .config(function($compileProvider){ 11 | $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel):/); 12 | }) 13 | 14 | .run(function($ionicPlatform) { 15 | $ionicPlatform.ready(function() { 16 | if(window.StatusBar) { 17 | // org.apache.cordova.statusbar required 18 | StatusBar.styleDefault(); 19 | } 20 | }); 21 | }) 22 | 23 | .controller('MainCtrl', function($scope, Camera) { 24 | 25 | $scope.getPhoto = function() { 26 | Camera.getPicture().then(function(imageURI) { 27 | console.log(imageURI); 28 | $scope.lastPhoto = imageURI; 29 | }, function(err) { 30 | console.err(err); 31 | }, { 32 | quality: 75, 33 | targetWidth: 320, 34 | targetHeight: 320, 35 | saveToPhotoAlbum: false 36 | }); 37 | }; 38 | 39 | }) 40 | -------------------------------------------------------------------------------- /www/js/controllers.js: -------------------------------------------------------------------------------- 1 | angular.module('starter.controllers', []) 2 | 3 | .config(function($compileProvider){ 4 | $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel):/); 5 | }) 6 | 7 | .controller('DashCtrl', function($scope) { 8 | }) 9 | 10 | .controller('FriendsCtrl', function($scope, Friends, Camera) { 11 | $scope.friends = Friends.all(); 12 | $scope.getPhoto = function() { 13 | console.log('Getting camera'); 14 | Camera.getPicture({ 15 | quality: 75, 16 | targetWidth: 320, 17 | targetHeight: 320, 18 | saveToPhotoAlbum: false 19 | }).then(function(imageURI) { 20 | console.log(imageURI); 21 | $scope.lastPhoto = imageURI; 22 | }, function(err) { 23 | console.err(err); 24 | }); 25 | /* 26 | navigator.camera.getPicture(function(imageURI) { 27 | console.log(imageURI); 28 | }, function(err) { 29 | }, { 30 | quality: 50, 31 | destinationType: Camera.DestinationType.DATA_URL 32 | }); 33 | */ 34 | } 35 | }) 36 | 37 | .controller('FriendDetailCtrl', function($scope, $stateParams, Friends) { 38 | $scope.friend = Friends.get($stateParams.friendId); 39 | }) 40 | 41 | .controller('AccountCtrl', function($scope) { 42 | }); 43 | -------------------------------------------------------------------------------- /www/js/services.js: -------------------------------------------------------------------------------- 1 | angular.module('starter.services', []) 2 | 3 | .factory('Camera', ['$q', function($q) { 4 | 5 | return { 6 | getPicture: function(options) { 7 | var q = $q.defer(); 8 | 9 | navigator.camera.getPicture(function(result) { 10 | // Do any magic you need 11 | q.resolve(result); 12 | }, function(err) { 13 | q.reject(err); 14 | }, options); 15 | 16 | return q.promise; 17 | } 18 | } 19 | }]) 20 | 21 | /** 22 | * A simple example service that returns some data. 23 | */ 24 | .factory('Friends', function() { 25 | // Might use a resource here that returns a JSON array 26 | 27 | // Some fake testing data 28 | var friends = [ 29 | { id: 0, name: 'Scruff McGruff' }, 30 | { id: 1, name: 'G.I. Joe' }, 31 | { id: 2, name: 'Miss Frizzle' }, 32 | { id: 3, name: 'Ash Ketchum' } 33 | ]; 34 | 35 | return { 36 | all: function() { 37 | return friends; 38 | }, 39 | get: function(friendId) { 40 | // Simple index lookup 41 | return friends[friendId]; 42 | } 43 | } 44 | }); 45 | -------------------------------------------------------------------------------- /www/lib/ionic/fonts/ionicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/www/lib/ionic/fonts/ionicons.eot -------------------------------------------------------------------------------- /www/lib/ionic/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/www/lib/ionic/fonts/ionicons.ttf -------------------------------------------------------------------------------- /www/lib/ionic/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ionic-example-cordova-camera/b16b1c7baf89d358660957023760dc27f5a2ef46/www/lib/ionic/fonts/ionicons.woff -------------------------------------------------------------------------------- /www/lib/ionic/js/angular/angular-resource.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.2.12 3 | (c) 2010-2014 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(H,a,A){'use strict';function D(p,g){g=g||{};a.forEach(g,function(a,c){delete g[c]});for(var c in p)!p.hasOwnProperty(c)||"$"===c.charAt(0)&&"$"===c.charAt(1)||(g[c]=p[c]);return g}var v=a.$$minErr("$resource"),C=/^(\.[a-zA-Z_$][0-9a-zA-Z_$]*)+$/;a.module("ngResource",["ng"]).factory("$resource",["$http","$q",function(p,g){function c(a,c){this.template=a;this.defaults=c||{};this.urlParams={}}function t(n,w,l){function r(h,d){var e={};d=x({},w,d);s(d,function(b,d){u(b)&&(b=b());var k;if(b&& 7 | b.charAt&&"@"==b.charAt(0)){k=h;var a=b.substr(1);if(null==a||""===a||"hasOwnProperty"===a||!C.test("."+a))throw v("badmember",a);for(var a=a.split("."),f=0,c=a.length;f 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /www/templates/tab-account.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Account

4 |
5 |
6 | -------------------------------------------------------------------------------- /www/templates/tab-dash.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Dash

4 |
5 |
6 | -------------------------------------------------------------------------------- /www/templates/tab-friends.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{friend.name}} 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /www/templates/tabs.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | --------------------------------------------------------------------------------