├── .gitignore ├── Contribution.md ├── LICENSE ├── README.md ├── apigee.js ├── apigee.min.js ├── bower.json ├── new-project-template └── index.html └── samples ├── Readme.md ├── assets ├── apigee.ico ├── css │ ├── jquery.mobile.icons.min.css │ └── theme.min.css ├── index.html └── js │ └── index.js ├── books └── index.html ├── collections ├── css │ ├── apigee.min.css │ ├── jquery.mobile.icons.min.css │ └── theme.min.css ├── index.html └── js │ └── index.js ├── entities ├── css │ ├── jquery.mobile.icons.min.css │ └── theme.min.css ├── index.html └── js │ └── index.js ├── geolocation ├── css │ ├── jquery.mobile.icons.min.css │ └── theme.min.css ├── index.html └── js │ └── index.js ├── messagee ├── app.js ├── index.html └── usergrid.validation.js ├── monitoring └── index.html ├── push ├── README.md ├── android │ ├── AndroidManifest.xml │ ├── README.md │ ├── ant.properties │ ├── assets │ │ └── www │ │ │ ├── PushNotification.js │ │ │ ├── cordova-2.7.0.js │ │ │ ├── css │ │ │ └── index.css │ │ │ ├── img │ │ │ ├── cordova.png │ │ │ └── logo.png │ │ │ ├── index.html │ │ │ ├── js │ │ │ ├── apigee.js │ │ │ └── index.js │ │ │ ├── main.js │ │ │ ├── master.css │ │ │ ├── res │ │ │ ├── icon │ │ │ │ └── android │ │ │ │ │ ├── icon-36-ldpi.png │ │ │ │ │ ├── icon-48-mdpi.png │ │ │ │ │ ├── icon-72-hdpi.png │ │ │ │ │ └── icon-96-xhdpi.png │ │ │ └── screen │ │ │ │ └── android │ │ │ │ ├── screen-hdpi-landscape.png │ │ │ │ ├── screen-hdpi-portrait.png │ │ │ │ ├── screen-ldpi-landscape.png │ │ │ │ ├── screen-ldpi-portrait.png │ │ │ │ ├── screen-mdpi-landscape.png │ │ │ │ ├── screen-mdpi-portrait.png │ │ │ │ ├── screen-xhdpi-landscape.png │ │ │ │ └── screen-xhdpi-portrait.png │ │ │ ├── spec.html │ │ │ └── spec │ │ │ ├── helper.js │ │ │ ├── index.js │ │ │ └── lib │ │ │ └── jasmine-1.2.0 │ │ │ ├── MIT.LICENSE │ │ │ ├── jasmine-html.js │ │ │ ├── jasmine.css │ │ │ └── jasmine.js │ ├── build.xml │ ├── cordova │ │ ├── appinfo.jar │ │ ├── build │ │ ├── clean │ │ ├── cordova │ │ ├── log │ │ ├── release │ │ └── run │ ├── libs │ │ ├── android-support-v13.jar │ │ ├── cordova-2.7.0.jar │ │ └── gcm.jar │ ├── proguard-project.txt │ ├── project.properties │ ├── res │ │ ├── drawable-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── icon.png │ │ ├── drawable-ldpi │ │ │ ├── ic_launcher.png │ │ │ └── icon.png │ │ ├── drawable-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── icon.png │ │ ├── drawable-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── icon.png │ │ ├── drawable │ │ │ └── icon.png │ │ ├── layout │ │ │ └── main.xml │ │ ├── values │ │ │ └── strings.xml │ │ └── xml │ │ │ └── config.xml │ └── src │ │ ├── com │ │ └── plugin │ │ │ └── gcm │ │ │ ├── CordovaGCMBroadcastReceiver.java │ │ │ ├── GCMIntentService.java │ │ │ ├── PushHandlerActivity.java │ │ │ └── PushPlugin.java │ │ └── me │ │ └── mdob │ │ └── android │ │ └── androidpush.java └── ios │ ├── CordovaLib │ ├── Classes │ │ ├── CDV.h │ │ ├── CDVAccelerometer.h │ │ ├── CDVAccelerometer.m │ │ ├── CDVAvailability.h │ │ ├── CDVBattery.h │ │ ├── CDVBattery.m │ │ ├── CDVCamera.h │ │ ├── CDVCamera.m │ │ ├── CDVCapture.h │ │ ├── CDVCapture.m │ │ ├── CDVCommandDelegate.h │ │ ├── CDVCommandDelegateImpl.h │ │ ├── CDVCommandDelegateImpl.m │ │ ├── CDVCommandQueue.h │ │ ├── CDVCommandQueue.m │ │ ├── CDVConfigParser.h │ │ ├── CDVConfigParser.m │ │ ├── CDVConnection.h │ │ ├── CDVConnection.m │ │ ├── CDVContact.h │ │ ├── CDVContact.m │ │ ├── CDVContacts.h │ │ ├── CDVContacts.m │ │ ├── CDVDebug.h │ │ ├── CDVDebugConsole.h │ │ ├── CDVDebugConsole.m │ │ ├── CDVDevice.h │ │ ├── CDVDevice.m │ │ ├── CDVEcho.h │ │ ├── CDVEcho.m │ │ ├── CDVExif.h │ │ ├── CDVFile.h │ │ ├── CDVFile.m │ │ ├── CDVFileTransfer.h │ │ ├── CDVFileTransfer.m │ │ ├── CDVGlobalization.h │ │ ├── CDVGlobalization.m │ │ ├── CDVInAppBrowser.h │ │ ├── CDVInAppBrowser.m │ │ ├── CDVInvokedUrlCommand.h │ │ ├── CDVInvokedUrlCommand.m │ │ ├── CDVJSON.h │ │ ├── CDVJSON.m │ │ ├── CDVJpegHeaderWriter.h │ │ ├── CDVJpegHeaderWriter.m │ │ ├── CDVLocalStorage.h │ │ ├── CDVLocalStorage.m │ │ ├── CDVLocation.h │ │ ├── CDVLocation.m │ │ ├── CDVLogger.h │ │ ├── CDVLogger.m │ │ ├── CDVNotification.h │ │ ├── CDVNotification.m │ │ ├── CDVPlugin.h │ │ ├── CDVPlugin.m │ │ ├── CDVPluginResult.h │ │ ├── CDVPluginResult.m │ │ ├── CDVReachability.h │ │ ├── CDVReachability.m │ │ ├── CDVScreenOrientationDelegate.h │ │ ├── CDVSound.h │ │ ├── CDVSound.m │ │ ├── CDVSplashScreen.h │ │ ├── CDVSplashScreen.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 │ │ └── compatibility │ │ │ ├── 0.9.6 │ │ │ ├── CDV.h │ │ │ ├── CDVPlugin.h │ │ │ └── CDVPlugin.m │ │ │ ├── 1.5.0 │ │ │ ├── CDV.h │ │ │ └── CDVPlugin.h │ │ │ └── README.txt │ ├── CordovaLib.xcodeproj │ │ └── project.pbxproj │ ├── CordovaLib_Prefix.pch │ └── VERSION │ ├── README.md │ ├── cordova │ ├── build │ ├── emulate │ ├── log │ ├── release │ └── run │ ├── iospush.xcodeproj │ └── project.pbxproj │ ├── iospush │ ├── Classes │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── MainViewController.h │ │ ├── MainViewController.m │ │ └── MainViewController.xib │ ├── Plugins │ │ ├── AppDelegate+notification.h │ │ ├── AppDelegate+notification.m │ │ ├── PushPlugin.h │ │ ├── PushPlugin.m │ │ └── README │ ├── Resources │ │ ├── Capture.bundle │ │ │ ├── controls_bg.png │ │ │ ├── controls_bg@2x.png │ │ │ ├── controls_bg@2x~ipad.png │ │ │ ├── controls_bg~ipad.png │ │ │ ├── microphone-568h@2x~iphone.png │ │ │ ├── microphone.png │ │ │ ├── microphone@2x.png │ │ │ ├── microphone@2x~ipad.png │ │ │ ├── microphone~ipad.png │ │ │ ├── record_button.png │ │ │ ├── record_button@2x.png │ │ │ ├── record_button@2x~ipad.png │ │ │ ├── record_button~ipad.png │ │ │ ├── recording_bg.png │ │ │ ├── recording_bg@2x.png │ │ │ ├── recording_bg@2x~ipad.png │ │ │ ├── recording_bg~ipad.png │ │ │ ├── stop_button.png │ │ │ ├── stop_button@2x.png │ │ │ ├── stop_button@2x~ipad.png │ │ │ └── stop_button~ipad.png │ │ ├── de.lproj │ │ │ └── Localizable.strings │ │ ├── en.lproj │ │ │ └── Localizable.strings │ │ ├── es.lproj │ │ │ └── Localizable.strings │ │ ├── icons │ │ │ ├── icon-72.png │ │ │ ├── icon-72@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 │ ├── iospush-Info.plist │ ├── iospush-Prefix.pch │ └── main.m │ └── www │ ├── PushNotification.js │ ├── cordova-2.6.0.js │ ├── css │ └── index.css │ ├── img │ └── logo.png │ ├── index.html │ ├── js │ ├── apigee.js │ └── index.js │ ├── res │ ├── icon │ │ └── ios │ │ │ ├── icon-57-2x.png │ │ │ ├── icon-57.png │ │ │ ├── icon-72-2x.png │ │ │ └── icon-72.png │ └── screen │ │ └── ios │ │ ├── screen-ipad-landscape-2x.png │ │ ├── screen-ipad-landscape.png │ │ ├── screen-ipad-portrait-2x.png │ │ ├── screen-ipad-portrait.png │ │ ├── screen-iphone-landscape-2x.png │ │ ├── screen-iphone-landscape.png │ │ ├── screen-iphone-portrait-2x.png │ │ └── screen-iphone-portrait.png │ ├── spec.html │ └── spec │ ├── helper.js │ ├── index.js │ └── lib │ └── jasmine-1.2.0 │ ├── MIT.LICENSE │ ├── jasmine-html.js │ ├── jasmine.css │ └── jasmine.js ├── readmeSample └── index.html └── usersAndGroups ├── README.txt ├── css ├── codiqa.ext.min.css ├── images │ ├── ajax-loader.gif │ ├── icons-18-black.png │ ├── icons-18-white.png │ ├── icons-36-black.png │ └── icons-36-white.png └── jquery.mobile-1.3.1.min.css ├── index.html └── js ├── codiqa.ext.min.js ├── index.js ├── jquery-1.9.1.min.js └── jquery.mobile-1.3.1.min.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | zip/ 3 | lib/ 4 | build/ 5 | instrument/ 6 | report/ 7 | node_modules/ 8 | bower_components/ 9 | *.old 10 | *.bak 11 | *.orig 12 | -------------------------------------------------------------------------------- /Contribution.md: -------------------------------------------------------------------------------- 1 | ## Contributing We welcome your enhancements! Like [Usergrid](https://github.com/apigee/usergrid-node-module), the Usergrid Javascript SDK is open source and licensed under the Apache License, Version 2.0. 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Added some feature'`) 4. Push your changes to the upstream branch (`git push origin my-new-feature`) 5. Create new Pull Request (make sure you describe what you did and why your mod is needed) ##More information For more information on Apigee App Services, visit . ## Copyright Copyright 2013 Apigee Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "apigee.sdk", 3 | "version": "1.0.0", 4 | "main": ["apigee.js","apigee.min.js"], 5 | "ignore": [ 6 | "Gruntfile.js", 7 | "*.md", 8 | "package.json", 9 | "LICENSE", 10 | ".gitignore" 11 | ] 12 | 13 | } -------------------------------------------------------------------------------- /new-project-template/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | App Services HTML5 Template 6 | 7 | 8 | 9 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /samples/Readme.md: -------------------------------------------------------------------------------- 1 | #Apigee JavaScript SDK Sample Apps 2 | 3 | The sample apps in this directory are intended to show basic usage of some of the major features of App Services using the Apigee JavaScript SDK. By default, all of the sample apps are set up to use the unsecured 'sandbox' application that was created for you when you created your Apigee account. 4 | 5 | ##Included Samples Apps 6 | 7 | * **messagee** - A Twitter-like app that uses data store, social and user management features. 8 | * **push** - An app that sends push notifications to mobile devices using APNS or GCM. 9 | * **books** - A 'list' app that lets the user create, retrieve and perform geolocation queries on a list of books. This sample also makes use of jQuery and jQuery mobile. 10 | * **collections** - An app that shows you how to perform basic CRUD operations on collections in your account. 11 | * **entities** - An app that shows you how to perform basic CRUD operations on entities in your account. 12 | * **geolocation** - An app that shows you how to creates entities with location data, and perform geolocation queries to retrieve them. 13 | * **monitoring** - An app that lets you test the App Monitoring feature by sending logging, crash and error reports to your account. 14 | * **readme** - Similar to the booksSample app. This app retrieves the 'books' collection from your account and displays all the title of each 'book' entity as a JavaScript alert. 15 | * **usersAndGroups** - An app that illustrates SDK APIs through which you can manage users and group in your app services application. 16 | 17 | ##Running the sample apps 18 | 19 | To run the sample apps, simply open the project's index.html file in your browser! 20 | -------------------------------------------------------------------------------- /samples/assets/apigee.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/assets/apigee.ico -------------------------------------------------------------------------------- /samples/push/README.md: -------------------------------------------------------------------------------- 1 | ## Apigee Push Notification Samples Featuring PhoneGap 2.x 2 | 3 | The samples here illustrate how you can add push notifications support to an app implemented in HTML5 and JavaScript. The samples use PhoneGap (Apache Cordova) to provide native support for the samples' respective platforms, along with a plugin (included) for push notifications support. 4 | 5 | For more specific instructions on running each of the samples, see their readmes. 6 | -------------------------------------------------------------------------------- /samples/push/android/README.md: -------------------------------------------------------------------------------- 1 | ##Apigee Push Notifications for Android using PhoneGap 2 | 3 | This sample illustrates how you can add support for push notifications in an HTML5/JavaScript app run on an Android device. In the [Apigee documentation](http://apigee.com/docs/app-services/content/tutorial-push-notifications-sample-app), you'll find more information in a complete walkthrough on adding push notifications support. 4 | 5 | The sample features the following: 6 | 7 | - HTML5 for a simple UI and JavaScript for logic. 8 | - The Apigee JavaScript SDK for access to app services. 9 | - PhoneGap (based on Apache Cordova) for native mobile device support. 10 | - A PhoneGap plugin to support push notifications. 11 | 12 | ### Prerequisites 13 | 14 | To use this sample, you should first: 15 | 16 | - Create an app services account, organization, and application. 17 | - Have an app services application that requires no authentication (such as your sandbox). 18 | - Create a Google API account through which to send notifications. 19 | - Create an app services notifier through which you can create notifications and target recipients. 20 | - Have an Android device to test with or configure the Android emulator so that it supports push notifications. 21 | 22 | ### Configuring the app 23 | 24 | When you open the sample in your IDE, do the following before running the project as an Android Application: 25 | 26 | - In AndroidManifest.xml, be sure the proper Android permissions are included. This includes READ_PHONE_STATE and VIBRATE. 27 | - In your project properties, go to Java Build Path > Libraries and add all the JAR files from the project's /libs directory. 28 | - If you're using an emulator, configure the emulator to use the Google APIs Level 16 target or above. Be sure your emulator supports receiving push notifications, as described in Apigee documentation linked above. 29 | 30 | Finally, edit the JavaScript code so that it will access your app services account: 31 | 32 | - Make the following changes in assets/www/js/index.js: 33 | - orgName: Your Apigee organization. 34 | - appName: The app in your organization where you created the notifier (for example, "sandbox"). 35 | - notifier: Name of the app services notifier you created. 36 | - senderID: Your API project number (the project must support Google Cloud Messaging for Android (GCM)). 37 | -------------------------------------------------------------------------------- /samples/push/android/ant.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked into Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /samples/push/android/assets/www/PushNotification.js: -------------------------------------------------------------------------------- 1 | 2 | var PushNotification = function() { 3 | }; 4 | 5 | 6 | // Call this to register for push notifications. Content of [options] depends on whether we are working with APNS (iOS) or GCM (Android) 7 | PushNotification.prototype.register = function(successCallback, errorCallback, options) { 8 | if (errorCallback == null) { errorCallback = function() {}} 9 | 10 | if (typeof errorCallback != "function") { 11 | console.log("PushNotification.register failure: failure parameter not a function"); 12 | return 13 | } 14 | 15 | if (typeof successCallback != "function") { 16 | console.log("PushNotification.register failure: success callback parameter must be a function"); 17 | return 18 | } 19 | 20 | cordova.exec(successCallback, errorCallback, "PushPlugin", "register", [options]); 21 | }; 22 | 23 | // Call this to unregister for push notifications 24 | PushNotification.prototype.unregister = function(successCallback, errorCallback) { 25 | if (errorCallback == null) { errorCallback = function() {}} 26 | 27 | if (typeof errorCallback != "function") { 28 | console.log("PushNotification.unregister failure: failure parameter not a function"); 29 | return 30 | } 31 | 32 | if (typeof successCallback != "function") { 33 | console.log("PushNotification.unregister failure: success callback parameter must be a function"); 34 | return 35 | } 36 | 37 | cordova.exec(successCallback, errorCallback, "PushPlugin", "unregister", []); 38 | }; 39 | 40 | 41 | // Call this to set the application icon badge 42 | PushNotification.prototype.setApplicationIconBadgeNumber = function(successCallback, errorCallback, badge) { 43 | if (errorCallback == null) { errorCallback = function() {}} 44 | 45 | if (typeof errorCallback != "function") { 46 | console.log("PushNotification.setApplicationIconBadgeNumber failure: failure parameter not a function"); 47 | return 48 | } 49 | 50 | if (typeof successCallback != "function") { 51 | console.log("PushNotification.setApplicationIconBadgeNumber failure: success callback parameter must be a function"); 52 | return 53 | } 54 | 55 | cordova.exec(successCallback, successCallback, "PushPlugin", "setApplicationIconBadgeNumber", [{badge: badge}]); 56 | }; 57 | 58 | //------------------------------------------------------------------- 59 | 60 | if(!window.plugins) { 61 | window.plugins = {}; 62 | } 63 | if (!window.plugins.pushNotification) { 64 | window.plugins.pushNotification = new PushNotification(); 65 | } 66 | -------------------------------------------------------------------------------- /samples/push/android/assets/www/img/cordova.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/assets/www/img/cordova.png -------------------------------------------------------------------------------- /samples/push/android/assets/www/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/assets/www/img/logo.png -------------------------------------------------------------------------------- /samples/push/android/assets/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Hello World 27 | 28 | 29 |
30 |

Apache Cordova

31 |
    32 |
33 | 37 | 38 |
39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /samples/push/android/assets/www/master.css: -------------------------------------------------------------------------------- 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 | body { 22 | background:#222 none repeat scroll 0 0; 23 | color:#666; 24 | font-family:Helvetica; 25 | font-size:72%; 26 | line-height:1.5em; 27 | margin:0; 28 | border-top:1px solid #393939; 29 | } 30 | 31 | #info{ 32 | background:#ffa; 33 | border: 1px solid #ffd324; 34 | -webkit-border-radius: 5px; 35 | border-radius: 5px; 36 | clear:both; 37 | margin:15px 6px 0; 38 | width:295px; 39 | padding:4px 0px 2px 10px; 40 | } 41 | 42 | #info > h4{ 43 | font-size:.95em; 44 | margin:5px 0; 45 | } 46 | 47 | #stage.theme{ 48 | padding-top:3px; 49 | } 50 | 51 | /* Definition List */ 52 | #stage.theme > dl{ 53 | padding-top:10px; 54 | clear:both; 55 | margin:0; 56 | list-style-type:none; 57 | padding-left:10px; 58 | overflow:auto; 59 | } 60 | 61 | #stage.theme > dl > dt{ 62 | font-weight:bold; 63 | float:left; 64 | margin-left:5px; 65 | } 66 | 67 | #stage.theme > dl > dd{ 68 | width:45px; 69 | float:left; 70 | color:#a87; 71 | font-weight:bold; 72 | } 73 | 74 | /* Content Styling */ 75 | #stage.theme > h1, #stage.theme > h2, #stage.theme > p{ 76 | margin:1em 0 .5em 13px; 77 | } 78 | 79 | #stage.theme > h1{ 80 | color:#eee; 81 | font-size:1.6em; 82 | text-align:center; 83 | margin:0; 84 | margin-top:15px; 85 | padding:0; 86 | } 87 | 88 | #stage.theme > h2{ 89 | clear:both; 90 | margin:0; 91 | padding:3px; 92 | font-size:1em; 93 | text-align:center; 94 | } 95 | 96 | /* Stage Buttons */ 97 | #stage.theme a.btn{ 98 | border: 1px solid #555; 99 | -webkit-border-radius: 5px; 100 | border-radius: 5px; 101 | text-align:center; 102 | display:block; 103 | float:left; 104 | background:#444; 105 | width:150px; 106 | color:#9ab; 107 | font-size:1.1em; 108 | text-decoration:none; 109 | padding:1.2em 0; 110 | margin:3px 0px 3px 5px; 111 | } 112 | #stage.theme a.btn.large{ 113 | width:308px; 114 | padding:1.2em 0; 115 | } 116 | 117 | -------------------------------------------------------------------------------- /samples/push/android/assets/www/res/icon/android/icon-36-ldpi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/assets/www/res/icon/android/icon-36-ldpi.png -------------------------------------------------------------------------------- /samples/push/android/assets/www/res/icon/android/icon-48-mdpi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/assets/www/res/icon/android/icon-48-mdpi.png -------------------------------------------------------------------------------- /samples/push/android/assets/www/res/icon/android/icon-72-hdpi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/assets/www/res/icon/android/icon-72-hdpi.png -------------------------------------------------------------------------------- /samples/push/android/assets/www/res/icon/android/icon-96-xhdpi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/assets/www/res/icon/android/icon-96-xhdpi.png -------------------------------------------------------------------------------- /samples/push/android/assets/www/res/screen/android/screen-hdpi-landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/assets/www/res/screen/android/screen-hdpi-landscape.png -------------------------------------------------------------------------------- /samples/push/android/assets/www/res/screen/android/screen-hdpi-portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/assets/www/res/screen/android/screen-hdpi-portrait.png -------------------------------------------------------------------------------- /samples/push/android/assets/www/res/screen/android/screen-ldpi-landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/assets/www/res/screen/android/screen-ldpi-landscape.png -------------------------------------------------------------------------------- /samples/push/android/assets/www/res/screen/android/screen-ldpi-portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/assets/www/res/screen/android/screen-ldpi-portrait.png -------------------------------------------------------------------------------- /samples/push/android/assets/www/res/screen/android/screen-mdpi-landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/assets/www/res/screen/android/screen-mdpi-landscape.png -------------------------------------------------------------------------------- /samples/push/android/assets/www/res/screen/android/screen-mdpi-portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/assets/www/res/screen/android/screen-mdpi-portrait.png -------------------------------------------------------------------------------- /samples/push/android/assets/www/res/screen/android/screen-xhdpi-landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/assets/www/res/screen/android/screen-xhdpi-landscape.png -------------------------------------------------------------------------------- /samples/push/android/assets/www/res/screen/android/screen-xhdpi-portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/assets/www/res/screen/android/screen-xhdpi-portrait.png -------------------------------------------------------------------------------- /samples/push/android/assets/www/spec.html: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | Jasmine Spec Runner 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /samples/push/android/assets/www/spec/helper.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | afterEach(function() { 20 | document.getElementById('stage').innerHTML = ''; 21 | }); 22 | 23 | var helper = { 24 | trigger: function(obj, name) { 25 | var e = document.createEvent('Event'); 26 | e.initEvent(name, true, true); 27 | obj.dispatchEvent(e); 28 | }, 29 | getComputedStyle: function(querySelector, property) { 30 | var element = document.querySelector(querySelector); 31 | return window.getComputedStyle(element).getPropertyValue(property); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /samples/push/android/assets/www/spec/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | describe('app', function() { 20 | describe('initialize', function() { 21 | it('should bind deviceready', function() { 22 | runs(function() { 23 | spyOn(app, 'onDeviceReady'); 24 | app.initialize(); 25 | helper.trigger(window.document, 'deviceready'); 26 | }); 27 | 28 | waitsFor(function() { 29 | return (app.onDeviceReady.calls.length > 0); 30 | }, 'onDeviceReady should be called once', 500); 31 | 32 | runs(function() { 33 | expect(app.onDeviceReady).toHaveBeenCalled(); 34 | }); 35 | }); 36 | }); 37 | 38 | describe('onDeviceReady', function() { 39 | it('should report that it fired', function() { 40 | spyOn(app, 'receivedEvent'); 41 | app.onDeviceReady(); 42 | expect(app.receivedEvent).toHaveBeenCalledWith('deviceready'); 43 | }); 44 | }); 45 | 46 | describe('receivedEvent', function() { 47 | beforeEach(function() { 48 | var el = document.getElementById('stage'); 49 | el.innerHTML = ['
', 50 | '

Listening

', 51 | '

Received

', 52 | '
'].join('\n'); 53 | }); 54 | 55 | it('should hide the listening element', function() { 56 | app.receivedEvent('deviceready'); 57 | var displayStyle = helper.getComputedStyle('#deviceready .listening', 'display'); 58 | expect(displayStyle).toEqual('none'); 59 | }); 60 | 61 | it('should show the received element', function() { 62 | app.receivedEvent('deviceready'); 63 | var displayStyle = helper.getComputedStyle('#deviceready .received', 'display'); 64 | expect(displayStyle).toEqual('block'); 65 | }); 66 | }); 67 | }); 68 | -------------------------------------------------------------------------------- /samples/push/android/assets/www/spec/lib/jasmine-1.2.0/MIT.LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008-2011 Pivotal Labs 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /samples/push/android/cordova/appinfo.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/cordova/appinfo.jar -------------------------------------------------------------------------------- /samples/push/android/cordova/build: -------------------------------------------------------------------------------- 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 | #!/bin/bash 19 | 20 | set -e 21 | 22 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd ) 23 | 24 | bash "$CORDOVA_PATH"/cordova build 25 | -------------------------------------------------------------------------------- /samples/push/android/cordova/clean: -------------------------------------------------------------------------------- 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 | #!/bin/bash 19 | 20 | set -e 21 | 22 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd ) 23 | 24 | bash "$CORDOVA_PATH"/cordova clean 25 | -------------------------------------------------------------------------------- /samples/push/android/cordova/log: -------------------------------------------------------------------------------- 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 | #!/bin/bash 19 | 20 | set -e 21 | 22 | CORDOVA_PATH=$( cd "$( dirname "$0" )/.." && pwd ) 23 | 24 | bash "$CORDOVA_PATH"/cordova/cordova log 25 | -------------------------------------------------------------------------------- /samples/push/android/cordova/release: -------------------------------------------------------------------------------- 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 | #!/bin/bash 19 | 20 | set -e 21 | 22 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd ) 23 | 24 | bash "$CORDOVA_PATH"/cordova release 25 | -------------------------------------------------------------------------------- /samples/push/android/cordova/run: -------------------------------------------------------------------------------- 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 | #!/bin/bash 19 | 20 | set -e 21 | 22 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd ) 23 | 24 | bash "$CORDOVA_PATH"/cordova run 25 | -------------------------------------------------------------------------------- /samples/push/android/libs/android-support-v13.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/libs/android-support-v13.jar -------------------------------------------------------------------------------- /samples/push/android/libs/cordova-2.7.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/libs/cordova-2.7.0.jar -------------------------------------------------------------------------------- /samples/push/android/libs/gcm.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/libs/gcm.jar -------------------------------------------------------------------------------- /samples/push/android/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /samples/push/android/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=Google Inc.:Google APIs:17 15 | -------------------------------------------------------------------------------- /samples/push/android/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/push/android/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /samples/push/android/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/push/android/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /samples/push/android/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/push/android/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /samples/push/android/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/push/android/res/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/res/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /samples/push/android/res/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/android/res/drawable/icon.png -------------------------------------------------------------------------------- /samples/push/android/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /samples/push/android/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | androidpush 4 | 5 | -------------------------------------------------------------------------------- /samples/push/android/res/xml/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /samples/push/android/src/com/plugin/gcm/CordovaGCMBroadcastReceiver.java: -------------------------------------------------------------------------------- 1 | package com.plugin.gcm; 2 | 3 | import android.content.Context; 4 | 5 | import com.google.android.gcm.GCMBroadcastReceiver; 6 | import static com.google.android.gcm.GCMConstants.DEFAULT_INTENT_SERVICE_CLASS_NAME; 7 | 8 | /* 9 | * Implementation of GCMBroadcastReceiver that hard-wires the intent service to be 10 | * com.plugin.gcm.GCMIntentService, instead of your_package.GCMIntentService 11 | */ 12 | public class CordovaGCMBroadcastReceiver extends GCMBroadcastReceiver { 13 | 14 | @Override 15 | protected String getGCMIntentServiceClassName(Context context) { 16 | return "com.plugin.gcm" + DEFAULT_INTENT_SERVICE_CLASS_NAME; 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /samples/push/android/src/com/plugin/gcm/PushHandlerActivity.java: -------------------------------------------------------------------------------- 1 | package com.plugin.gcm; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.content.pm.PackageManager; 6 | import android.os.Bundle; 7 | import android.util.Log; 8 | 9 | public class PushHandlerActivity extends Activity 10 | { 11 | private static String TAG = "PushHandlerActivity"; 12 | 13 | /* 14 | * this activity will be started if the user touches a notification that we own. 15 | * We send it's data off to the push plugin for processing. 16 | * If needed, we boot up the main activity to kickstart the application. 17 | * @see android.app.Activity#onCreate(android.os.Bundle) 18 | */ 19 | @Override 20 | public void onCreate(Bundle savedInstanceState) 21 | { 22 | super.onCreate(savedInstanceState); 23 | Log.v(TAG, "onCreate"); 24 | 25 | boolean isPushPluginActive = PushPlugin.isActive(); 26 | if (!isPushPluginActive) { 27 | forceMainActivityReload(); 28 | } 29 | processPushBundle(isPushPluginActive); 30 | 31 | GCMIntentService.cancelNotification(this); 32 | 33 | finish(); 34 | } 35 | 36 | /** 37 | * Takes the pushBundle extras from the intent, 38 | * and sends it through to the PushPlugin for processing. 39 | */ 40 | private void processPushBundle(boolean isPushPluginActive) 41 | { 42 | Bundle extras = getIntent().getExtras(); 43 | 44 | if (extras != null) { 45 | 46 | Bundle originalExtras = extras.getBundle("pushBundle"); 47 | 48 | if ( !isPushPluginActive ) { 49 | originalExtras.putBoolean("coldstart", true); 50 | } 51 | 52 | PushPlugin.sendExtras(originalExtras); 53 | } 54 | } 55 | 56 | /** 57 | * Forces the main activity to re-launch if it's unloaded. 58 | */ 59 | private void forceMainActivityReload() 60 | { 61 | PackageManager pm = getPackageManager(); 62 | Intent launchIntent = pm.getLaunchIntentForPackage(getApplicationContext().getPackageName()); 63 | startActivity(launchIntent); 64 | } 65 | 66 | } -------------------------------------------------------------------------------- /samples/push/android/src/me/mdob/android/androidpush.java: -------------------------------------------------------------------------------- 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 | package me.mdob.android; 21 | 22 | import android.os.Bundle; 23 | import org.apache.cordova.*; 24 | 25 | public class androidpush extends DroidGap 26 | { 27 | @Override 28 | public void onCreate(Bundle savedInstanceState) 29 | { 30 | super.onCreate(savedInstanceState); 31 | // Set by in config.xml 32 | super.loadUrl(Config.getStartUrl()); 33 | //super.loadUrl("file:///android_asset/www/index.html") 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /samples/push/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 "CDVAccelerometer.h" 29 | #import "CDVBattery.h" 30 | #import "CDVCamera.h" 31 | #import "CDVCapture.h" 32 | #import "CDVConnection.h" 33 | #import "CDVContact.h" 34 | #import "CDVContacts.h" 35 | #import "CDVDebug.h" 36 | #import "CDVDebugConsole.h" 37 | #import "CDVDevice.h" 38 | #import "CDVFile.h" 39 | #import "CDVFileTransfer.h" 40 | #import "CDVLocation.h" 41 | #import "CDVNotification.h" 42 | #import "CDVPluginResult.h" 43 | #import "CDVReachability.h" 44 | #import "CDVSound.h" 45 | #import "CDVSplashScreen.h" 46 | #import "CDVWhitelist.h" 47 | #import "CDVLocalStorage.h" 48 | #import "CDVInAppBrowser.h" 49 | #import "CDVScreenOrientationDelegate.h" 50 | 51 | #import "NSArray+Comparisons.h" 52 | #import "NSData+Base64.h" 53 | #import "NSDictionary+Extensions.h" 54 | #import "NSMutableArray+QueueAdditions.h" 55 | #import "UIDevice+Extensions.h" 56 | 57 | #import "CDVJSON.h" 58 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVAccelerometer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "CDVPlugin.h" 22 | 23 | @interface CDVAccelerometer : CDVPlugin 24 | { 25 | double x; 26 | double y; 27 | double z; 28 | NSTimeInterval timestamp; 29 | } 30 | 31 | @property (readonly, assign) BOOL isRunning; 32 | @property (nonatomic, strong) NSString* callbackId; 33 | 34 | - (CDVAccelerometer*)init; 35 | 36 | - (void)start:(CDVInvokedUrlCommand*)command; 37 | - (void)stop:(CDVInvokedUrlCommand*)command; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVAvailability.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 | #define __CORDOVA_IOS__ 21 | 22 | #define __CORDOVA_0_9_6 906 23 | #define __CORDOVA_1_0_0 10000 24 | #define __CORDOVA_1_1_0 10100 25 | #define __CORDOVA_1_2_0 10200 26 | #define __CORDOVA_1_3_0 10300 27 | #define __CORDOVA_1_4_0 10400 28 | #define __CORDOVA_1_4_1 10401 29 | #define __CORDOVA_1_5_0 10500 30 | #define __CORDOVA_1_6_0 10600 31 | #define __CORDOVA_1_6_1 10601 32 | #define __CORDOVA_1_7_0 10700 33 | #define __CORDOVA_1_8_0 10800 34 | #define __CORDOVA_1_8_1 10801 35 | #define __CORDOVA_1_9_0 10900 36 | #define __CORDOVA_2_0_0 20000 37 | #define __CORDOVA_2_1_0 20100 38 | #define __CORDOVA_2_2_0 20200 39 | #define __CORDOVA_2_3_0 20300 40 | #define __CORDOVA_2_4_0 20400 41 | #define __CORDOVA_2_5_0 20500 42 | #define __CORDOVA_2_6_0 20600 43 | #define __CORDOVA_NA 99999 /* not available */ 44 | 45 | /* 46 | #if CORDOVA_VERSION_MIN_REQUIRED >= __CORDOVA_1_7_0 47 | // do something when its at least 1.7.0 48 | #else 49 | // do something else (non 1.7.0) 50 | #endif 51 | */ 52 | #ifndef CORDOVA_VERSION_MIN_REQUIRED 53 | #define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_2_6_0 54 | #endif 55 | 56 | /* 57 | Returns YES if it is at least version specified as NSString(X) 58 | Usage: 59 | if (IsAtLeastiOSVersion(@"5.1")) { 60 | // do something for iOS 5.1 or greater 61 | } 62 | */ 63 | #define IsAtLeastiOSVersion(X) ([[[UIDevice currentDevice] systemVersion] compare:X options:NSNumericSearch] != NSOrderedAscending) 64 | 65 | #define CDV_IsIPad() ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] && ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)) 66 | 67 | #define CDV_IsIPhone5() ([[UIScreen mainScreen] bounds].size.height == 568 && [[UIScreen mainScreen] bounds].size.width == 320) 68 | 69 | /* Return the string version of the decimal version */ 70 | #define CDV_VERSION [NSString stringWithFormat:@"%d.%d.%d", \ 71 | (CORDOVA_VERSION_MIN_REQUIRED / 10000), \ 72 | (CORDOVA_VERSION_MIN_REQUIRED % 10000) / 100, \ 73 | (CORDOVA_VERSION_MIN_REQUIRED % 10000) % 100] 74 | 75 | #ifdef __clang__ 76 | #define CDV_DEPRECATED(version, msg) __attribute__((deprecated("Deprecated in Cordova " #version ". " msg))) 77 | #else 78 | #define CDV_DEPRECATED(version, msg) __attribute__((deprecated())) 79 | #endif 80 | 81 | // Enable this to log all exec() calls. 82 | #define CDV_ENABLE_EXEC_LOGGING 0 83 | #if CDV_ENABLE_EXEC_LOGGING 84 | #define CDV_EXEC_LOG NSLog 85 | #else 86 | #define CDV_EXEC_LOG(...) do {} while (NO) 87 | #endif 88 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVBattery.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "CDVPlugin.h" 22 | 23 | @interface CDVBattery : CDVPlugin { 24 | UIDeviceBatteryState state; 25 | float level; 26 | bool isPlugged; 27 | NSString* callbackId; 28 | } 29 | 30 | @property (nonatomic) UIDeviceBatteryState state; 31 | @property (nonatomic) float level; 32 | @property (nonatomic) bool isPlugged; 33 | @property (strong) NSString* callbackId; 34 | 35 | - (void)updateBatteryStatus:(NSNotification*)notification; 36 | - (NSDictionary*)getBatteryStatus; 37 | - (void)start:(CDVInvokedUrlCommand*)command; 38 | - (void)stop:(CDVInvokedUrlCommand*)command; 39 | - (void)dealloc; 40 | @end 41 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVCamera.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "CDVPlugin.h" 22 | 23 | enum CDVDestinationType { 24 | DestinationTypeDataUrl = 0, 25 | DestinationTypeFileUri, 26 | DestinationTypeNativeUri 27 | }; 28 | typedef NSUInteger CDVDestinationType; 29 | 30 | enum CDVEncodingType { 31 | EncodingTypeJPEG = 0, 32 | EncodingTypePNG 33 | }; 34 | typedef NSUInteger CDVEncodingType; 35 | 36 | enum CDVMediaType { 37 | MediaTypePicture = 0, 38 | MediaTypeVideo, 39 | MediaTypeAll 40 | }; 41 | typedef NSUInteger CDVMediaType; 42 | 43 | @interface CDVCameraPicker : UIImagePickerController 44 | {} 45 | 46 | @property (assign) NSInteger quality; 47 | @property (copy) NSString* callbackId; 48 | @property (copy) NSString* postUrl; 49 | @property (nonatomic) enum CDVDestinationType returnType; 50 | @property (nonatomic) enum CDVEncodingType encodingType; 51 | @property (strong) UIPopoverController* popoverController; 52 | @property (assign) CGSize targetSize; 53 | @property (assign) bool correctOrientation; 54 | @property (assign) bool saveToPhotoAlbum; 55 | @property (assign) bool cropToSize; 56 | @property (strong) UIWebView* webView; 57 | @property (assign) BOOL popoverSupported; 58 | 59 | @end 60 | 61 | // ======================================================================= // 62 | 63 | @interface CDVCamera : CDVPlugin 66 | {} 67 | 68 | @property (strong) CDVCameraPicker* pickerController; 69 | 70 | /* 71 | * getPicture 72 | * 73 | * arguments: 74 | * 1: this is the javascript function that will be called with the results, the first parameter passed to the 75 | * javascript function is the picture as a Base64 encoded string 76 | * 2: this is the javascript function to be called if there was an error 77 | * options: 78 | * quality: integer between 1 and 100 79 | */ 80 | - (void)takePicture:(CDVInvokedUrlCommand*)command; 81 | - (void)postImage:(UIImage*)anImage withFilename:(NSString*)filename toUrl:(NSURL*)url; 82 | - (void)cleanup:(CDVInvokedUrlCommand*)command; 83 | - (void)repositionPopover:(CDVInvokedUrlCommand*)command; 84 | 85 | - (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info; 86 | - (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image editingInfo:(NSDictionary*)editingInfo; 87 | - (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker; 88 | - (UIImage*)imageByScalingAndCroppingForSize:(UIImage*)anImage toSize:(CGSize)targetSize; 89 | - (UIImage*)imageByScalingNotCroppingForSize:(UIImage*)anImage toSize:(CGSize)frameSize; 90 | - (UIImage*)imageCorrectedForCaptureOrientation:(UIImage*)anImage; 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/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 | @protected 30 | __weak CDVCommandQueue* _commandQueue; 31 | } 32 | - (id)initWithViewController:(CDVViewController*)viewController; 33 | @end 34 | -------------------------------------------------------------------------------- /samples/push/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)enqueCommandBatch:(NSString*)batchJSON; 34 | 35 | - (void)maybeFetchCommandsFromJs:(NSNumber*)requestId; 36 | - (void)fetchCommandsFromJs; 37 | - (void)executePending; 38 | - (BOOL)execute:(CDVInvokedUrlCommand*)command; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /samples/push/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 | @property (nonatomic, readonly, strong) NSMutableDictionary* pluginsDict; 23 | @property (nonatomic, readonly, strong) NSMutableDictionary* settings; 24 | @property (nonatomic, readonly, strong) NSMutableArray* whitelistHosts; 25 | @property (nonatomic, readonly, strong) NSMutableArray* startupPluginNames; 26 | @property (nonatomic, readonly, strong) NSString* startPage; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVConfigParser.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 "CDVConfigParser.h" 21 | 22 | @interface CDVConfigParser () 23 | 24 | @property (nonatomic, readwrite, strong) NSMutableDictionary* pluginsDict; 25 | @property (nonatomic, readwrite, strong) NSMutableDictionary* settings; 26 | @property (nonatomic, readwrite, strong) NSMutableArray* whitelistHosts; 27 | @property (nonatomic, readwrite, strong) NSMutableArray* startupPluginNames; 28 | @property (nonatomic, readwrite, strong) NSString* startPage; 29 | 30 | @end 31 | 32 | @implementation CDVConfigParser 33 | 34 | @synthesize pluginsDict, settings, whitelistHosts, startPage, startupPluginNames; 35 | 36 | - (id)init 37 | { 38 | self = [super init]; 39 | if (self != nil) { 40 | self.pluginsDict = [[NSMutableDictionary alloc] initWithCapacity:30]; 41 | self.settings = [[NSMutableDictionary alloc] initWithCapacity:30]; 42 | self.whitelistHosts = [[NSMutableArray alloc] initWithCapacity:30]; 43 | self.startupPluginNames = [[NSMutableArray alloc] initWithCapacity:8]; 44 | } 45 | return self; 46 | } 47 | 48 | - (void)parser:(NSXMLParser*)parser didStartElement:(NSString*)elementName namespaceURI:(NSString*)namespaceURI qualifiedName:(NSString*)qualifiedName attributes:(NSDictionary*)attributeDict 49 | { 50 | if ([elementName isEqualToString:@"preference"]) { 51 | settings[attributeDict[@"name"]] = attributeDict[@"value"]; 52 | } else if ([elementName isEqualToString:@"plugin"]) { 53 | NSString* name = [attributeDict[@"name"] lowercaseString]; 54 | pluginsDict[name] = attributeDict[@"value"]; 55 | if ([@"true" isEqualToString : attributeDict[@"onload"]]) { 56 | [self.startupPluginNames addObject:name]; 57 | } 58 | } else if ([elementName isEqualToString:@"access"]) { 59 | [whitelistHosts addObject:attributeDict[@"origin"]]; 60 | } else if ([elementName isEqualToString:@"content"]) { 61 | self.startPage = attributeDict[@"src"]; 62 | } 63 | } 64 | 65 | - (void)parser:(NSXMLParser*)parser parseErrorOccurred:(NSError*)parseError 66 | { 67 | NSAssert(NO, @"config.xml parse error line %d col %d", [parser lineNumber], [parser columnNumber]); 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVConnection.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "CDVPlugin.h" 22 | #import "CDVReachability.h" 23 | 24 | @interface CDVConnection : CDVPlugin { 25 | NSString* type; 26 | NSString* _callbackId; 27 | 28 | CDVReachability* internetReach; 29 | } 30 | 31 | @property (copy) NSString* connectionType; 32 | @property (strong) CDVReachability* internetReach; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVDebugConsole.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 "CDVPlugin.h" 23 | 24 | @interface CDVDebugConsole : CDVPlugin {} 25 | 26 | - (void)log:(CDVInvokedUrlCommand*)command; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVDebugConsole.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 "CDVDebugConsole.h" 21 | 22 | @implementation CDVDebugConsole 23 | 24 | - (void)log:(CDVInvokedUrlCommand*)command 25 | { 26 | NSString* message = [command.arguments objectAtIndex:0]; 27 | NSDictionary* options = [command.arguments objectAtIndex:1]; 28 | NSString* log_level = @"INFO"; 29 | 30 | if ([options objectForKey:@"logLevel"]) { 31 | log_level = [options objectForKey:@"logLevel"]; 32 | } 33 | 34 | NSLog(@"[%@] %@", log_level, message); 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/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 "CDVPlugin.h" 22 | 23 | @interface CDVDevice : CDVPlugin 24 | {} 25 | 26 | + (NSString*)cordovaVersion; 27 | 28 | - (void)getDeviceInfo:(CDVInvokedUrlCommand*)command; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVDevice.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 | #include 21 | #include 22 | 23 | #import "CDV.h" 24 | 25 | @implementation UIDevice (ModelVersion) 26 | 27 | - (NSString*)modelVersion 28 | { 29 | size_t size; 30 | 31 | sysctlbyname("hw.machine", NULL, &size, NULL, 0); 32 | char* machine = malloc(size); 33 | sysctlbyname("hw.machine", machine, &size, NULL, 0); 34 | NSString* platform = [NSString stringWithUTF8String:machine]; 35 | free(machine); 36 | 37 | return platform; 38 | } 39 | 40 | @end 41 | 42 | @interface CDVDevice () {} 43 | @end 44 | 45 | @implementation CDVDevice 46 | 47 | - (void)getDeviceInfo:(CDVInvokedUrlCommand*)command 48 | { 49 | NSDictionary* deviceProperties = [self deviceProperties]; 50 | CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:deviceProperties]; 51 | 52 | /* Settings.plist 53 | * Read the optional Settings.plist file and push these user-defined settings down into the web application. 54 | * This can be useful for supplying build-time configuration variables down to the app to change its behavior, 55 | * such as specifying Full / Lite version, or localization (English vs German, for instance). 56 | */ 57 | // TODO: turn this into an iOS only plugin 58 | NSDictionary* temp = [CDVViewController getBundlePlist:@"Settings"]; 59 | 60 | if ([temp respondsToSelector:@selector(JSONString)]) { 61 | NSLog(@"Deprecation warning: window.Setting will be removed Aug 2013. Refer to https://issues.apache.org/jira/browse/CB-2433"); 62 | NSString* js = [NSString stringWithFormat:@"window.Settings = %@;", [temp JSONString]]; 63 | [self.commandDelegate evalJs:js]; 64 | } 65 | 66 | [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; 67 | } 68 | 69 | - (NSDictionary*)deviceProperties 70 | { 71 | UIDevice* device = [UIDevice currentDevice]; 72 | NSMutableDictionary* devProps = [NSMutableDictionary dictionaryWithCapacity:4]; 73 | 74 | [devProps setObject:[device modelVersion] forKey:@"model"]; 75 | [devProps setObject:@"iOS" forKey:@"platform"]; 76 | [devProps setObject:[device systemVersion] forKey:@"version"]; 77 | [devProps setObject:[device uniqueAppInstanceIdentifier] forKey:@"uuid"]; 78 | [devProps setObject:[device model] forKey:@"name"]; 79 | [devProps setObject:[[self class] cordovaVersion] forKey:@"cordova"]; 80 | 81 | NSDictionary* devReturn = [NSDictionary dictionaryWithDictionary:devProps]; 82 | return devReturn; 83 | } 84 | 85 | + (NSString*)cordovaVersion 86 | { 87 | return CDV_VERSION; 88 | } 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVEcho.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVPlugin.h" 21 | 22 | @interface CDVEcho : CDVPlugin 23 | @end 24 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVEcho.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 "CDVEcho.h" 21 | #import "CDV.h" 22 | 23 | @implementation CDVEcho 24 | 25 | - (void)echo:(CDVInvokedUrlCommand*)command 26 | { 27 | id message = [command.arguments objectAtIndex:0]; 28 | CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message]; 29 | 30 | [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; 31 | } 32 | 33 | - (void)echoAsyncHelper:(NSArray*)args 34 | { 35 | [self.commandDelegate sendPluginResult:[args objectAtIndex:0] callbackId:[args objectAtIndex:1]]; 36 | } 37 | 38 | - (void)echoAsync:(CDVInvokedUrlCommand*)command 39 | { 40 | id message = [command.arguments objectAtIndex:0]; 41 | CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message]; 42 | 43 | [self performSelector:@selector(echoAsyncHelper:) withObject:[NSArray arrayWithObjects:pluginResult, command.callbackId, nil] afterDelay:0]; 44 | } 45 | 46 | - (void)echoArrayBuffer:(CDVInvokedUrlCommand*)command 47 | { 48 | id message = [command.arguments objectAtIndex:0]; 49 | CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArrayBuffer:message]; 50 | 51 | [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; 52 | } 53 | 54 | - (void)echoMultiPart:(CDVInvokedUrlCommand*)command 55 | { 56 | CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsMultipart:command.arguments]; 57 | 58 | [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/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 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVFileTransfer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "CDVPlugin.h" 22 | 23 | enum CDVFileTransferError { 24 | FILE_NOT_FOUND_ERR = 1, 25 | INVALID_URL_ERR = 2, 26 | CONNECTION_ERR = 3, 27 | CONNECTION_ABORTED = 4 28 | }; 29 | typedef int CDVFileTransferError; 30 | 31 | enum CDVFileTransferDirection { 32 | CDV_TRANSFER_UPLOAD = 1, 33 | CDV_TRANSFER_DOWNLOAD = 2, 34 | }; 35 | typedef int CDVFileTransferDirection; 36 | 37 | // Magic value within the options dict used to set a cookie. 38 | extern NSString* const kOptionsKeyCookie; 39 | 40 | @interface CDVFileTransfer : CDVPlugin {} 41 | 42 | - (void)upload:(CDVInvokedUrlCommand*)command; 43 | - (void)download:(CDVInvokedUrlCommand*)command; 44 | - (NSString*)escapePathComponentForUrlString:(NSString*)urlString; 45 | 46 | // Visible for testing. 47 | - (NSURLRequest*)requestForUploadCommand:(CDVInvokedUrlCommand*)command fileData:(NSData*)fileData; 48 | - (NSMutableDictionary*)createFileTransferError:(int)code AndSource:(NSString*)source AndTarget:(NSString*)target; 49 | 50 | - (NSMutableDictionary*)createFileTransferError:(int)code 51 | AndSource:(NSString*)source 52 | AndTarget:(NSString*)target 53 | AndHttpStatus:(int)httpStatus 54 | AndBody:(NSString*)body; 55 | @property (readonly) NSMutableDictionary* activeTransfers; 56 | @end 57 | 58 | @interface CDVFileTransferDelegate : NSObject {} 59 | 60 | @property (strong) NSMutableData* responseData; // atomic 61 | @property (nonatomic, strong) CDVFileTransfer* command; 62 | @property (nonatomic, assign) CDVFileTransferDirection direction; 63 | @property (nonatomic, strong) NSURLConnection* connection; 64 | @property (nonatomic, copy) NSString* callbackId; 65 | @property (nonatomic, copy) NSString* objectId; 66 | @property (nonatomic, copy) NSString* source; 67 | @property (nonatomic, copy) NSString* target; 68 | @property (nonatomic, copy) NSString* mimeType; 69 | @property (assign) int responseCode; // atomic 70 | @property (nonatomic, assign) NSInteger bytesTransfered; 71 | @property (nonatomic, assign) NSInteger bytesExpected; 72 | @property (nonatomic, assign) BOOL trustAllHosts; 73 | 74 | @end; 75 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVInAppBrowser.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVPlugin.h" 21 | #import "CDVInvokedUrlCommand.h" 22 | #import "CDVScreenOrientationDelegate.h" 23 | #import "CDVWebViewDelegate.h" 24 | 25 | @class CDVInAppBrowserViewController; 26 | 27 | @protocol CDVInAppBrowserNavigationDelegate 28 | 29 | - (void)browserLoadStart:(NSURL*)url; 30 | - (void)browserLoadStop:(NSURL*)url; 31 | - (void)browserLoadError:(NSError*)error forUrl:(NSURL*)url; 32 | - (void)browserExit; 33 | 34 | @end 35 | 36 | @interface CDVInAppBrowser : CDVPlugin 37 | 38 | @property (nonatomic, retain) CDVInAppBrowserViewController* inAppBrowserViewController; 39 | @property (nonatomic, copy) NSString* callbackId; 40 | 41 | - (void)open:(CDVInvokedUrlCommand*)command; 42 | - (void)close:(CDVInvokedUrlCommand*)command; 43 | 44 | @end 45 | 46 | @interface CDVInAppBrowserViewController : UIViewController { 47 | @private 48 | NSURL* _requestedURL; 49 | NSString* _userAgent; 50 | NSString* _prevUserAgent; 51 | NSInteger _userAgentLockToken; 52 | CDVWebViewDelegate* _webViewDelegate; 53 | } 54 | 55 | @property (nonatomic, strong) IBOutlet UIWebView* webView; 56 | @property (nonatomic, strong) IBOutlet UIBarButtonItem* closeButton; 57 | @property (nonatomic, strong) IBOutlet UILabel* addressLabel; 58 | @property (nonatomic, strong) IBOutlet UIBarButtonItem* backButton; 59 | @property (nonatomic, strong) IBOutlet UIBarButtonItem* forwardButton; 60 | @property (nonatomic, strong) IBOutlet UIActivityIndicatorView* spinner; 61 | @property (nonatomic, strong) IBOutlet UIToolbar* toolbar; 62 | 63 | @property (nonatomic, weak) id orientationDelegate; 64 | @property (nonatomic, weak) id navigationDelegate; 65 | 66 | - (void)close; 67 | - (void)navigateTo:(NSURL*)url; 68 | - (void)showLocationBar:(BOOL)show; 69 | 70 | - (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent; 71 | 72 | @end 73 | 74 | @interface CDVInAppBrowserOptions : NSObject {} 75 | 76 | @property (nonatomic, assign) BOOL location; 77 | @property (nonatomic, copy) NSString* presentationstyle; 78 | @property (nonatomic, copy) NSString* transitionstyle; 79 | 80 | @property (nonatomic, assign) BOOL enableviewportscale; 81 | @property (nonatomic, assign) BOOL mediaplaybackrequiresuseraction; 82 | @property (nonatomic, assign) BOOL allowinlinemediaplayback; 83 | @property (nonatomic, assign) BOOL keyboarddisplayrequiresuseraction; 84 | @property (nonatomic, assign) BOOL suppressesincrementalrendering; 85 | 86 | + (CDVInAppBrowserOptions*)parseOptions:(NSString*)options; 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /samples/push/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 | // The first NSDictionary found in the arguments will be returned in legacyDict. 44 | // The arguments array with be prepended with the callbackId and have the first 45 | // dict removed from it. 46 | - (void)legacyArguments:(NSMutableArray**)legacyArguments andDict:(NSMutableDictionary**)legacyDict; 47 | 48 | // Returns the argument at the given index. 49 | // If index >= the number of arguments, returns nil. 50 | // If the argument at the given index is NSNull, returns nil. 51 | - (id)argumentAtIndex:(NSUInteger)index; 52 | // Same as above, but returns defaultValue instead of nil. 53 | - (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue; 54 | // Same as above, but returns defaultValue instead of nil, and if the argument is not of the expected class, returns defaultValue 55 | - (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue andClass:(Class)aClass; 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/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:kNilOptions 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 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/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 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/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 "CDVPlugin.h" 21 | 22 | @interface CDVLogger : CDVPlugin 23 | 24 | - (void)logLevel:(CDVInvokedUrlCommand*)command; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/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 "CDV.h" 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 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVNotification.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 23 | #import "CDVPlugin.h" 24 | 25 | @interface CDVNotification : CDVPlugin {} 26 | 27 | - (void)alert:(CDVInvokedUrlCommand*)command; 28 | - (void)confirm:(CDVInvokedUrlCommand*)command; 29 | - (void)prompt:(CDVInvokedUrlCommand*)command; 30 | - (void)vibrate:(CDVInvokedUrlCommand*)command; 31 | 32 | @end 33 | 34 | @interface CDVAlertView : UIAlertView {} 35 | @property (nonatomic, copy) NSString* callbackId; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /samples/push/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 | NSString* const CDVPageDidLoadNotification; 27 | NSString* const CDVPluginHandleOpenURLNotification; 28 | NSString* const CDVPluginResetNotification; 29 | 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 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVPluginResult.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | typedef enum { 23 | CDVCommandStatus_NO_RESULT = 0, 24 | CDVCommandStatus_OK, 25 | CDVCommandStatus_CLASS_NOT_FOUND_EXCEPTION, 26 | CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION, 27 | CDVCommandStatus_INSTANTIATION_EXCEPTION, 28 | CDVCommandStatus_MALFORMED_URL_EXCEPTION, 29 | CDVCommandStatus_IO_EXCEPTION, 30 | CDVCommandStatus_INVALID_ACTION, 31 | CDVCommandStatus_JSON_EXCEPTION, 32 | CDVCommandStatus_ERROR 33 | } CDVCommandStatus; 34 | 35 | @interface CDVPluginResult : NSObject {} 36 | 37 | @property (nonatomic, strong, readonly) NSNumber* status; 38 | @property (nonatomic, strong, readonly) id message; 39 | @property (nonatomic, strong) NSNumber* keepCallback; 40 | // This property can be used to scope the lifetime of another object. For example, 41 | // Use it to store the associated NSData when `message` is created using initWithBytesNoCopy. 42 | @property (nonatomic, strong) id associatedObject; 43 | 44 | - (CDVPluginResult*)init; 45 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal; 46 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsString:(NSString*)theMessage; 47 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArray:(NSArray*)theMessage; 48 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsInt:(int)theMessage; 49 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDouble:(double)theMessage; 50 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsBool:(BOOL)theMessage; 51 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDictionary:(NSDictionary*)theMessage; 52 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArrayBuffer:(NSData*)theMessage; 53 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsMultipart:(NSArray*)theMessages; 54 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageToErrorObject:(int)errorCode; 55 | 56 | + (void)setVerbose:(BOOL)verbose; 57 | + (BOOL)isVerbose; 58 | 59 | - (void)setKeepCallbackAsBool:(BOOL)bKeepCallback; 60 | 61 | - (NSString*)argumentsAsJSON; 62 | 63 | // These methods are used by the legacy plugin return result method 64 | - (NSString*)toJSONString; 65 | - (NSString*)toSuccessCallbackString:(NSString*)callbackId; 66 | - (NSString*)toErrorCallbackString:(NSString*)callbackId; 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/CDVSplashScreen.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "CDVPlugin.h" 22 | 23 | @interface CDVSplashScreen : CDVPlugin { 24 | UIActivityIndicatorView* _activityView; 25 | UIImageView* _imageView; 26 | NSString* _curImageName; 27 | BOOL _visible; 28 | } 29 | 30 | - (void)show:(CDVInvokedUrlCommand*)command; 31 | - (void)hide:(CDVInvokedUrlCommand*)command; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/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 | @property (nonatomic, readwrite, assign) BOOL useSplashScreen CDV_DEPRECATED(2.5, "Add/Remove the SplashScreen plugin instead of setting this property."); 47 | 48 | @property (nonatomic, readwrite, copy) NSString* wwwFolderName; 49 | @property (nonatomic, readwrite, copy) NSString* startPage; 50 | @property (nonatomic, readonly, strong) CDVCommandQueue* commandQueue; 51 | @property (nonatomic, readonly, strong) id commandDelegate; 52 | @property (nonatomic, readonly) NSString* userAgent; 53 | 54 | + (NSDictionary*)getBundlePlist:(NSString*)plistName; 55 | + (NSString*)applicationDocumentsDirectory; 56 | 57 | - (void)printMultitaskingInfo; 58 | - (void)createGapView; 59 | - (UIWebView*)newCordovaViewWithFrame:(CGRect)bounds; 60 | 61 | - (void)javascriptAlert:(NSString*)text; 62 | - (NSString*)appURLScheme; 63 | 64 | - (NSArray*)parseInterfaceOrientations:(NSArray*)orientations; 65 | - (BOOL)supportsOrientation:(UIInterfaceOrientation)orientation; 66 | 67 | - (id)getCommandInstance:(NSString*)pluginName; 68 | - (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className; 69 | - (void)registerPlugin:(CDVPlugin*)plugin withPluginName:(NSString*)pluginName; 70 | 71 | - (BOOL)URLisAllowed:(NSURL*)url; 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /samples/push/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 | } 34 | 35 | - (id)initWithDelegate:(NSObject *)delegate; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /samples/push/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, readonly, strong) NSArray* whitelist; 27 | @property (nonatomic, readonly, strong) NSArray* expandedWhitelist; 28 | @property (nonatomic, readonly, assign) BOOL allowAll; 29 | @property (nonatomic, copy) NSString* whitelistRejectionFormatString; 30 | 31 | - (id)initWithArray:(NSArray*)array; 32 | - (BOOL)URLIsAllowed:(NSURL*)url; 33 | - (BOOL)schemeIsAllowed:(NSString*)scheme; 34 | - (NSString*)errorStringForURL:(NSURL*)url; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/compatibility/0.9.6/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 | // Bridge implementation file for using Cordova plugins in PhoneGap 0.9.6. 21 | // 22 | 23 | /* 24 | Returns YES if it is at least version specified as NSString(X) 25 | Usage: 26 | if (IsAtLeastiOSVersion(@"5.1")) { 27 | // do something for iOS 5.1 or greater 28 | } 29 | */ 30 | #define IsAtLeastiOSVersion(X) ([[[UIDevice currentDevice] systemVersion] compare:X options:NSNumericSearch] != NSOrderedAscending) 31 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/compatibility/0.9.6/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 | // Bridge implementation file for using Cordova plugins in PhoneGap 0.9.6. 21 | // 22 | 23 | #ifdef PHONEGAP_FRAMEWORK 24 | #import 25 | #else 26 | #import "PGPlugin.h" 27 | #endif 28 | 29 | typedef enum { 30 | CDVCommandStatus_NO_RESULT = 0, 31 | CDVCommandStatus_OK, 32 | CDVCommandStatus_CLASS_NOT_FOUND_EXCEPTION, 33 | CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION, 34 | CDVCommandStatus_INSTANTIATION_EXCEPTION, 35 | CDVCommandStatus_MALFORMED_URL_EXCEPTION, 36 | CDVCommandStatus_IO_EXCEPTION, 37 | CDVCommandStatus_INVALID_ACTION, 38 | CDVCommandStatus_JSON_EXCEPTION, 39 | CDVCommandStatus_ERROR 40 | } CDVCommandStatus; 41 | 42 | @interface CDVPlugin : PGPlugin 43 | @end 44 | 45 | @interface CDVPluginResult : PluginResult 46 | @end 47 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/compatibility/0.9.6/CDVPlugin.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 | // Bridge implementation file for using Cordova plugins in PhoneGap 0.9.6. 21 | // 22 | 23 | #import "CDVPlugin.h" 24 | 25 | @implementation CDVPlugin 26 | @end 27 | 28 | @implementation CDVPluginResult 29 | @end 30 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/compatibility/1.5.0/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 | // Bridge implementation file for using Cordova > 1.5 plugins in 1.5.0. 21 | // 22 | 23 | #import 24 | 25 | /* 26 | Returns YES if it is at least version specified as NSString(X) 27 | Usage: 28 | if (IsAtLeastiOSVersion(@"5.1")) { 29 | // do something for iOS 5.1 or greater 30 | } 31 | */ 32 | #define IsAtLeastiOSVersion(X) ([[[UIDevice currentDevice] systemVersion] compare:X options:NSNumericSearch] != NSOrderedAscending) 33 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/compatibility/1.5.0/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 | // Bridge implementation file for using Cordova > 1.5 plugins in 1.5.0. 21 | // 22 | 23 | #import 24 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/Classes/compatibility/README.txt: -------------------------------------------------------------------------------- 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 | Include these headers if you are using a bleeding edge plugin in an older version of Cordova. 21 | 22 | 1.5.0 -- only for 1.5.0 projects 23 | 0.9.6 -- for projects between 0.9.6 and 1.4.1 -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/ios/CordovaLib/VERSION: -------------------------------------------------------------------------------- 1 | 2.6.0 2 | -------------------------------------------------------------------------------- /samples/push/ios/README.md: -------------------------------------------------------------------------------- 1 | ## Apigee Push Notifications for iOS with Phonegap! 2 | 3 | This sample illustrates how you can add support for push notifications in an HTML5/JavaScript app run on an iOS device. In the [Apigee documentation](http://apigee.com/docs/app-services/content/tutorial-push-notifications-sample-app), you'll find more information in a complete walkthrough on adding push notifications support. 4 | 5 | The sample features the following: 6 | 7 | - HTML5 for a simple UI and JavaScript for logic. 8 | - The Apigee JavaScript SDK for access to app services. 9 | - PhoneGap (based on Apache Cordova) for native mobile device support. 10 | - A PhoneGap plugin to support push notifications. 11 | 12 | ### Prerequisites 13 | 14 | To use this sample, you should first: 15 | 16 | - Create an app services account, organization, and application. 17 | - Have an app services application that requires no authentication (such as your sandbox). 18 | - Create an Apple APNs account through which to send notifications. 19 | - Create an app services notifier through which you can create notifications and target recipients. 20 | - Have an iOS device to test with. Push notifications aren't supported in the Xcode emulator. 21 | 22 | ### Configuring the app 23 | 24 | When you open the sample in Xcode, do the following to get things running: 25 | 26 | - In Xcode, on the General tab, in the Bundle Identifer box, enter the App ID associated with your APNs provisioning profile. 27 | - In the Build Settings tab, under Deployment, for the iOS Deployment Target select the iOS version on your connected device. The version is displayed in the Xcode Organizer. 28 | - In the Build Settings tab, under Code Signing, under Code Signing Identity > Debug, select the Apple signing certificate corresponding to your developer identity. 29 | 30 | Finally, edit the JavaScript code so that it will access your app services account: 31 | 32 | - Make the following changes in /www/js/index.js: 33 | - orgName: Your Apigee organization. 34 | - appName: The app in your organization where you created the notifier (for example, "sandbox"). 35 | - notifier: Name of the app services notifier you created. 36 | -------------------------------------------------------------------------------- /samples/push/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 | set -e 27 | 28 | XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //') 29 | XCODE_MIN_VERSION="4.5" 30 | 31 | if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then 32 | echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater." 33 | exit 1 34 | fi 35 | 36 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 37 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 38 | XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) 39 | PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) 40 | 41 | cd "$PROJECT_PATH" 42 | 43 | APP=build/$PROJECT_NAME.app 44 | SDK=`xcodebuild -showsdks | grep Sim | tail -1 | awk '{print $6}'` 45 | 46 | xcodebuild -project $PROJECT_NAME.xcodeproj -arch i386 -target $PROJECT_NAME -configuration Debug -sdk $SDK clean build VALID_ARCHS="i386" CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build" 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /samples/push/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 | set -e 22 | 23 | XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //') 24 | XCODE_MIN_VERSION="4.5" 25 | 26 | if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then 27 | echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater." 28 | exit 1 29 | fi 30 | 31 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 32 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 33 | XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) 34 | PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) 35 | 36 | APP_PATH=${1:-$PROJECT_PATH/build/$PROJECT_NAME.app} 37 | DEVICE_FAMILY=${2:-${DEVICE_FAMILY:-iphone}} 38 | 39 | if [ ! -d "$APP_PATH" ]; then 40 | echo "Project '$APP_PATH' is not built. Building." 41 | $CORDOVA_PATH/build || exit $? 42 | fi 43 | 44 | if [ ! -d "$APP_PATH" ]; then 45 | echo "$APP_PATH not found to emulate." 46 | exit 1 47 | fi 48 | 49 | # launch using ios-sim 50 | if which ios-sim >/dev/null; then 51 | ios-sim launch "$APP_PATH" --family "$DEVICE_FAMILY" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" & 52 | else 53 | echo -e '\033[31mError: ios-sim was not found. Please download, build and install version 1.4 or greater from https://github.com/phonegap/ios-sim into your path. Or "brew install ios-sim" using homebrew: http://mxcl.github.com/homebrew/\033[m'; exit 1; 54 | fi 55 | 56 | -------------------------------------------------------------------------------- /samples/push/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 | -------------------------------------------------------------------------------- /samples/push/ios/cordova/release: -------------------------------------------------------------------------------- 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 | set -e 27 | 28 | XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //') 29 | XCODE_MIN_VERSION="4.5" 30 | 31 | if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then 32 | echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater." 33 | exit 1 34 | fi 35 | 36 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 37 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 38 | XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) 39 | PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) 40 | 41 | cd "$PROJECT_PATH" 42 | 43 | APP=build/$PROJECT_NAME.app 44 | SDK=`xcodebuild -showsdks | grep Sim | tail -1 | awk '{print $6}'` 45 | 46 | xcodebuild -project $PROJECT_NAME.xcodeproj -arch i386 -target $PROJECT_NAME -configuration Release -sdk $SDK clean build VALID_ARCHS="i386" CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build" 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /samples/push/ios/cordova/run: -------------------------------------------------------------------------------- 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 | set -e 22 | 23 | XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //') 24 | XCODE_MIN_VERSION="4.5" 25 | 26 | if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then 27 | echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater." 28 | exit 1 29 | fi 30 | 31 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 32 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 33 | XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) 34 | PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) 35 | 36 | APP_PATH=$1 37 | 38 | if [ $# -lt 1 ]; then 39 | APP_PATH="$PROJECT_PATH/build/$PROJECT_NAME.app" 40 | fi 41 | 42 | if [ ! -d "$APP_PATH" ]; then 43 | echo "Project '$APP_PATH' is not built. Building." 44 | $CORDOVA_PATH/build || exit $? 45 | fi 46 | 47 | if [ ! -d "$APP_PATH" ]; then 48 | echo "$APP_PATH not found to emulate." 49 | exit 1 50 | fi 51 | 52 | # launch using ios-sim 53 | if which ios-sim >/dev/null; then 54 | ios-sim launch "$APP_PATH" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" & 55 | else 56 | echo -e '\033[31mError: ios-sim was not found. Please download, build and install version 1.4 or greater from https://github.com/phonegap/ios-sim into your path. Or "brew install ios-sim" using homebrew: http://mxcl.github.com/homebrew/\033[m'; exit 1; 57 | fi 58 | 59 | -------------------------------------------------------------------------------- /samples/push/ios/iospush/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 | // iospush 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 iospush-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 | -------------------------------------------------------------------------------- /samples/push/ios/iospush/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 | // iospush 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 | -------------------------------------------------------------------------------- /samples/push/ios/iospush/Plugins/AppDelegate+notification.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate+notification.h 3 | // pushtest 4 | // 5 | // Created by Robert Easterday on 10/26/12. 6 | // 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate (notification) 12 | - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken; 13 | - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error; 14 | - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo; 15 | - (void)applicationDidBecomeActive:(UIApplication *)application; 16 | - (id) getCommandInstance:(NSString*)className; 17 | 18 | @property (nonatomic, retain) NSDictionary *launchNotification; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /samples/push/ios/iospush/Plugins/PushPlugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2009-2011 Urban Airship Inc. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binaryform must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided withthe distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE URBAN AIRSHIP INC``AS IS'' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL URBAN AIRSHIP INC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #import 27 | #import 28 | 29 | @interface PushPlugin : CDVPlugin 30 | { 31 | NSDictionary *notificationMessage; 32 | BOOL isInline; 33 | NSString *notificationCallbackId; 34 | NSString *callback; 35 | 36 | BOOL ready; 37 | } 38 | 39 | @property (nonatomic, copy) NSString *callbackId; 40 | @property (nonatomic, copy) NSString *notificationCallbackId; 41 | @property (nonatomic, copy) NSString *callback; 42 | 43 | @property (nonatomic, retain) NSDictionary *notificationMessage; 44 | @property BOOL isInline; 45 | 46 | - (void)register:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options; 47 | 48 | - (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken; 49 | - (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error; 50 | 51 | - (void)setNotificationMessage:(NSDictionary *)notification; 52 | - (void)notificationReceived; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /samples/push/ios/iospush/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. -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/controls_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/controls_bg.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/controls_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/controls_bg@2x.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/controls_bg@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/controls_bg@2x~ipad.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/controls_bg~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/controls_bg~ipad.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/microphone-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/microphone-568h@2x~iphone.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/microphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/microphone.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/microphone@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/microphone@2x.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/microphone@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/microphone@2x~ipad.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/microphone~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/microphone~ipad.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/record_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/record_button.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/record_button@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/record_button@2x.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/record_button@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/record_button@2x~ipad.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/record_button~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/record_button~ipad.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/recording_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/recording_bg.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/recording_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/recording_bg@2x.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/recording_bg@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/recording_bg@2x~ipad.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/recording_bg~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/recording_bg~ipad.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/stop_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/stop_button.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/stop_button@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/stop_button@2x.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/stop_button@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/stop_button@2x~ipad.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/Capture.bundle/stop_button~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/Capture.bundle/stop_button~ipad.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/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 | // accessibility label for recording button 22 | "toggle audio recording" = "starten/beenden der Tonaufnahme"; 23 | // notification spoken by VoiceOver when timed recording finishes 24 | "timed recording complete" = "programmierte Aufnahme beendet"; 25 | // accessibility hint for display of recorded elapsed time 26 | "recorded time in minutes and seconds" = "aufgenommene Zeit in Minuten und Sekunden"; -------------------------------------------------------------------------------- /samples/push/ios/iospush/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 | // accessibility label for recording button 21 | "toggle audio recording" = "toggle audio recording"; 22 | // notification spoken by VoiceOver when timed recording finishes 23 | "timed recording complete" = "timed recording complete"; 24 | // accessibility hint for display of recorded elapsed time 25 | "recorded time in minutes and seconds" = "recorded time in minutes and seconds"; -------------------------------------------------------------------------------- /samples/push/ios/iospush/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 | // accessibility label for recording button 21 | "toggle audio recording" = "grabación de audio cambiar"; 22 | // notification spoken by VoiceOver when timed recording finishes 23 | "timed recording complete" = "tiempo de grabación completo"; 24 | // accessibility hint for display of recorded elapsed time 25 | "recorded time in minutes and seconds" = "tiempo registrado en minutos y segundos"; -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/icons/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/icons/icon-72.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/icons/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/icons/icon-72@2x.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/icons/icon.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/icons/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/icons/icon@2x.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/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 | // accessibility label for recording button 22 | "toggle audio recording" = "börja/avsluta inspelning"; 23 | // notification spoken by VoiceOver when timed recording finishes 24 | "timed recording complete" = "inspelning har avslutad"; 25 | // accessibility hint for display of recorded elapsed time 26 | "recorded time in minutes and seconds" = "inspelad tid in minuter och sekund"; -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/splash/Default-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/splash/Default-568h@2x~iphone.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/splash/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/splash/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/splash/Default-Landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/splash/Default-Landscape~ipad.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/splash/Default-Portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/splash/Default-Portrait@2x~ipad.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/splash/Default-Portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/splash/Default-Portrait~ipad.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/splash/Default@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/splash/Default@2x~iphone.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/Resources/splash/Default~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/iospush/Resources/splash/Default~iphone.png -------------------------------------------------------------------------------- /samples/push/ios/iospush/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /samples/push/ios/iospush/iospush-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 23 | 24 | 25 | CFBundleIcons 26 | 27 | CFBundlePrimaryIcon 28 | 29 | CFBundleIconFiles 30 | 31 | icon.png 32 | icon@2x.png 33 | icon-72.png 34 | icon-72@2x.png 35 | 36 | UIPrerenderedIcon 37 | 38 | 39 | 40 | UISupportedInterfaceOrientations~ipad 41 | 42 | UIInterfaceOrientationPortrait 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeRight 46 | 47 | UISupportedInterfaceOrientations 48 | 49 | UIInterfaceOrientationPortrait 50 | 51 | CFBundleDevelopmentRegion 52 | English 53 | CFBundleDisplayName 54 | ${PRODUCT_NAME} 55 | CFBundleExecutable 56 | ${EXECUTABLE_NAME} 57 | CFBundleIconFile 58 | icon.png 59 | CFBundleIdentifier 60 | me.mdob.instapic 61 | CFBundleInfoDictionaryVersion 62 | 6.0 63 | CFBundleName 64 | ${PRODUCT_NAME} 65 | CFBundlePackageType 66 | APPL 67 | CFBundleSignature 68 | ???? 69 | CFBundleVersion 70 | 1.0 71 | LSRequiresIPhoneOS 72 | 73 | NSMainNibFile 74 | 75 | NSMainNibFile~ipad 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /samples/push/ios/iospush/iospush-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 'iospush' target in the 'iospush' project 21 | // 22 | 23 | #ifdef __OBJC__ 24 | #import 25 | #import 26 | #endif 27 | -------------------------------------------------------------------------------- /samples/push/ios/iospush/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 | // iospush 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 | -------------------------------------------------------------------------------- /samples/push/ios/www/PushNotification.js: -------------------------------------------------------------------------------- 1 | 2 | var PushNotification = function() { 3 | }; 4 | 5 | 6 | // Call this to register for push notifications. Content of [options] depends on whether we are working with APNS (iOS) or GCM (Android) 7 | PushNotification.prototype.register = function(successCallback, errorCallback, options) { 8 | if (errorCallback == null) { errorCallback = function() {}} 9 | 10 | if (typeof errorCallback != "function") { 11 | console.log("PushNotification.register failure: failure parameter not a function"); 12 | return 13 | } 14 | 15 | if (typeof successCallback != "function") { 16 | console.log("PushNotification.register failure: success callback parameter must be a function"); 17 | return 18 | } 19 | 20 | cordova.exec(successCallback, errorCallback, "PushPlugin", "register", [options]); 21 | }; 22 | 23 | // Call this to unregister for push notifications 24 | PushNotification.prototype.unregister = function(successCallback, errorCallback) { 25 | if (errorCallback == null) { errorCallback = function() {}} 26 | 27 | if (typeof errorCallback != "function") { 28 | console.log("PushNotification.unregister failure: failure parameter not a function"); 29 | return 30 | } 31 | 32 | if (typeof successCallback != "function") { 33 | console.log("PushNotification.unregister failure: success callback parameter must be a function"); 34 | return 35 | } 36 | 37 | cordova.exec(successCallback, errorCallback, "PushPlugin", "unregister", []); 38 | }; 39 | 40 | 41 | // Call this to set the application icon badge 42 | PushNotification.prototype.setApplicationIconBadgeNumber = function(successCallback, errorCallback, badge) { 43 | if (errorCallback == null) { errorCallback = function() {}} 44 | 45 | if (typeof errorCallback != "function") { 46 | console.log("PushNotification.setApplicationIconBadgeNumber failure: failure parameter not a function"); 47 | return 48 | } 49 | 50 | if (typeof successCallback != "function") { 51 | console.log("PushNotification.setApplicationIconBadgeNumber failure: success callback parameter must be a function"); 52 | return 53 | } 54 | 55 | cordova.exec(successCallback, successCallback, "PushPlugin", "setApplicationIconBadgeNumber", [{badge: badge}]); 56 | }; 57 | 58 | //------------------------------------------------------------------- 59 | 60 | if(!window.plugins) { 61 | window.plugins = {}; 62 | } 63 | if (!window.plugins.pushNotification) { 64 | window.plugins.pushNotification = new PushNotification(); 65 | } 66 | -------------------------------------------------------------------------------- /samples/push/ios/www/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/www/img/logo.png -------------------------------------------------------------------------------- /samples/push/ios/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Hello World 27 | 28 | 29 |
30 |

Apache Cordova

31 |
    32 |
33 | 37 | 38 |
39 | 40 | 41 | 42 | 43 | 44 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /samples/push/ios/www/res/icon/ios/icon-57-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/www/res/icon/ios/icon-57-2x.png -------------------------------------------------------------------------------- /samples/push/ios/www/res/icon/ios/icon-57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/www/res/icon/ios/icon-57.png -------------------------------------------------------------------------------- /samples/push/ios/www/res/icon/ios/icon-72-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/www/res/icon/ios/icon-72-2x.png -------------------------------------------------------------------------------- /samples/push/ios/www/res/icon/ios/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/www/res/icon/ios/icon-72.png -------------------------------------------------------------------------------- /samples/push/ios/www/res/screen/ios/screen-ipad-landscape-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/www/res/screen/ios/screen-ipad-landscape-2x.png -------------------------------------------------------------------------------- /samples/push/ios/www/res/screen/ios/screen-ipad-landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/www/res/screen/ios/screen-ipad-landscape.png -------------------------------------------------------------------------------- /samples/push/ios/www/res/screen/ios/screen-ipad-portrait-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/www/res/screen/ios/screen-ipad-portrait-2x.png -------------------------------------------------------------------------------- /samples/push/ios/www/res/screen/ios/screen-ipad-portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/www/res/screen/ios/screen-ipad-portrait.png -------------------------------------------------------------------------------- /samples/push/ios/www/res/screen/ios/screen-iphone-landscape-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/www/res/screen/ios/screen-iphone-landscape-2x.png -------------------------------------------------------------------------------- /samples/push/ios/www/res/screen/ios/screen-iphone-landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/www/res/screen/ios/screen-iphone-landscape.png -------------------------------------------------------------------------------- /samples/push/ios/www/res/screen/ios/screen-iphone-portrait-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/www/res/screen/ios/screen-iphone-portrait-2x.png -------------------------------------------------------------------------------- /samples/push/ios/www/res/screen/ios/screen-iphone-portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/push/ios/www/res/screen/ios/screen-iphone-portrait.png -------------------------------------------------------------------------------- /samples/push/ios/www/spec.html: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | Jasmine Spec Runner 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /samples/push/ios/www/spec/helper.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | afterEach(function() { 20 | document.getElementById('stage').innerHTML = ''; 21 | }); 22 | 23 | var helper = { 24 | trigger: function(obj, name) { 25 | var e = document.createEvent('Event'); 26 | e.initEvent(name, true, true); 27 | obj.dispatchEvent(e); 28 | }, 29 | getComputedStyle: function(querySelector, property) { 30 | var element = document.querySelector(querySelector); 31 | return window.getComputedStyle(element).getPropertyValue(property); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /samples/push/ios/www/spec/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | describe('app', function() { 20 | describe('initialize', function() { 21 | it('should bind deviceready', function() { 22 | runs(function() { 23 | spyOn(app, 'onDeviceReady'); 24 | app.initialize(); 25 | helper.trigger(window.document, 'deviceready'); 26 | }); 27 | 28 | waitsFor(function() { 29 | return (app.onDeviceReady.calls.length > 0); 30 | }, 'onDeviceReady should be called once', 500); 31 | 32 | runs(function() { 33 | expect(app.onDeviceReady).toHaveBeenCalled(); 34 | }); 35 | }); 36 | }); 37 | 38 | describe('onDeviceReady', function() { 39 | it('should report that it fired', function() { 40 | spyOn(app, 'receivedEvent'); 41 | app.onDeviceReady(); 42 | expect(app.receivedEvent).toHaveBeenCalledWith('deviceready'); 43 | }); 44 | }); 45 | 46 | describe('receivedEvent', function() { 47 | beforeEach(function() { 48 | var el = document.getElementById('stage'); 49 | el.innerHTML = ['
', 50 | '

Listening

', 51 | '

Received

', 52 | '
'].join('\n'); 53 | }); 54 | 55 | it('should hide the listening element', function() { 56 | app.receivedEvent('deviceready'); 57 | var displayStyle = helper.getComputedStyle('#deviceready .listening', 'display'); 58 | expect(displayStyle).toEqual('none'); 59 | }); 60 | 61 | it('should show the received element', function() { 62 | app.receivedEvent('deviceready'); 63 | var displayStyle = helper.getComputedStyle('#deviceready .received', 'display'); 64 | expect(displayStyle).toEqual('block'); 65 | }); 66 | }); 67 | }); 68 | -------------------------------------------------------------------------------- /samples/push/ios/www/spec/lib/jasmine-1.2.0/MIT.LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008-2011 Pivotal Labs 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /samples/readmeSample/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 23 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /samples/usersAndGroups/README.txt: -------------------------------------------------------------------------------- 1 | UsersAndGroups Sample App 2 | 3 | This sample illustrates how to call and handle response values from JavaScript SDK methods that work with users and groups in an app services application. 4 | 5 | This sample shows: 6 | 7 | - How to add users and groups to the application. 8 | - How to list users and groups. 9 | - How to add users to a group. 10 | 11 | To get started, do the following: 12 | 13 | 1. Copy either the apigee.js (easier for debugging) or apigee.min.js into the app's js directory. 14 | 2. In index.html, enter your app services org name and app name in the places provided at the top of the file. 15 | 3. Open index.html in a browser to use the app. 16 | 17 | In order for this sample to work as is, you will need to: 18 | 19 | - Change the ORGNAME value in index.html to your app services organization name. 20 | - Ensure that the app services application you're using provides full permission for 21 | user and group entities. Your sandbox is best. This sample does not feature 22 | authentication. 23 | -------------------------------------------------------------------------------- /samples/usersAndGroups/css/codiqa.ext.min.css: -------------------------------------------------------------------------------- 1 | .text-align-center{text-align:center}.text-align-right{text-align:right}.split-wrapper{width:100%;min-height:200px;clear:both}@media all and (min-width:650px){.content-secondary{text-align:left;float:left;width:45%;background:0;padding:1.5em 6% 3em 0;margin:0}.content-secondary{background:0;border-top:0}.content-primary{width:45%;float:right;margin-right:1%;padding-right:1%}.content-primary ul:first-child{margin-top:0}.content-secondary ul.ui-listview,.content-secondary ul.ui-listview-inset{margin:0}.content-secondary ul.ui-listview .ui-li-divider,.content-secondary ul.ui-listview .ui-li{border-radius:0}.content-secondary ul.ui-listview .ui-li{border-left:0;border-right:0}.content-secondary h2{position:absolute;left:-9999px}.content-secondary .ui-li-divider{padding-top:1em;padding-bottom:1em}.content-secondary{margin:0;padding:0}}@media all and (min-width:750px){.content-secondary{width:34%}.content-primary{width:60%;padding-right:1%}}@media all and (min-width:1200px){.content-secondary{width:30%;padding-right:6%;margin:0 0 20px 5%}.content-secondary ul{margin:0}.content-secondary{margin:0;padding:0}.content-primary{width:50%;margin-right:5%;padding-right:3%}.content-primary{width:60%}} -------------------------------------------------------------------------------- /samples/usersAndGroups/css/images/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/usersAndGroups/css/images/ajax-loader.gif -------------------------------------------------------------------------------- /samples/usersAndGroups/css/images/icons-18-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/usersAndGroups/css/images/icons-18-black.png -------------------------------------------------------------------------------- /samples/usersAndGroups/css/images/icons-18-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/usersAndGroups/css/images/icons-18-white.png -------------------------------------------------------------------------------- /samples/usersAndGroups/css/images/icons-36-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/usersAndGroups/css/images/icons-36-black.png -------------------------------------------------------------------------------- /samples/usersAndGroups/css/images/icons-36-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/apigee-javascript-sdk/39f3aea5e91cedc0a1885f6f5171e2ffc333f962/samples/usersAndGroups/css/images/icons-36-white.png -------------------------------------------------------------------------------- /samples/usersAndGroups/js/codiqa.ext.min.js: -------------------------------------------------------------------------------- 1 | window.CodiqaControls={types:{},instances:{},define:function(a,b){b._type=a;this.types[a]=b},register:function(a,b,d){var c=new this.types[a];c._type=a;c._id=b;c._opts=d;this.instances[b]=c;this.types[a].prototype._isInited||this.types[a].prototype.initType();return c},init:function(){for(var a in this.types)this.types[a].prototype.initType()},refresh:function(){for(var a in this.instances)this.instances[a].refresh&&this.instances[a].refresh()},callbackInit:function(){},getInstances:function(a){var b, 2 | d,c=[];for(b in this.instances)d=this.instances[b],d._type===a&&c.push(d);return c}};CodiqaControls.GoogleMap=function(){}; 3 | CodiqaControls.GoogleMap.prototype.initType=function(){if(window.CodiqaControls.getInstances("googlemaps").length)if(this._isInited)window.google&&window.google.maps&&CodiqaControls.GoogleMap.prototype.callbackInit();else{var a=document.createElement("script");a.type="text/javascript";a.src="https://maps.googleapis.com/maps/api/js?sensor=true&callback=CodiqaControls.types.googlemaps.prototype.callbackInit";document.getElementsByTagName("head")[0].appendChild(a);this._isInited=!0}}; 4 | CodiqaControls.GoogleMap.prototype.callbackInit=function(){var a,b=window.CodiqaControls.getInstances("googlemaps");for(a=0;a