You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pm...@apache.org on 2012/03/22 21:43:06 UTC
[6/7] [CB-280] Improve layout of cordova-js scripts
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/android/storage.js
----------------------------------------------------------------------
diff --git a/lib/plugin/android/storage.js b/lib/plugin/android/storage.js
deleted file mode 100644
index 000612b..0000000
--- a/lib/plugin/android/storage.js
+++ /dev/null
@@ -1,377 +0,0 @@
-var utils = require('cordova/utils'),
- exec = require('cordova/exec');
- channel = require('cordova/channel');
-
-var queryQueue = {};
-
-/**
- * SQL result set object
- * PRIVATE METHOD
- * @constructor
- */
-var DroidDB_Rows = function() {
- this.resultSet = []; // results array
- this.length = 0; // number of rows
-};
-
-/**
- * Get item from SQL result set
- *
- * @param row The row number to return
- * @return The row object
- */
-DroidDB_Rows.prototype.item = function(row) {
- return this.resultSet[row];
-};
-
-/**
- * SQL result set that is returned to user.
- * PRIVATE METHOD
- * @constructor
- */
-var DroidDB_Result = function() {
- this.rows = new DroidDB_Rows();
-};
-
-/**
- * Callback from native code when query is complete.
- * PRIVATE METHOD
- *
- * @param id Query id
- */
-function completeQuery(id, data) {
- var query = queryQueue[id];
- if (query) {
- try {
- delete queryQueue[id];
-
- // Get transaction
- var tx = query.tx;
-
- // If transaction hasn't failed
- // Note: We ignore all query results if previous query
- // in the same transaction failed.
- if (tx && tx.queryList[id]) {
-
- // Save query results
- var r = new DroidDB_Result();
- r.rows.resultSet = data;
- r.rows.length = data.length;
- try {
- if (typeof query.successCallback === 'function') {
- query.successCallback(query.tx, r);
- }
- } catch (ex) {
- console.log("executeSql error calling user success callback: "+ex);
- }
-
- tx.queryComplete(id);
- }
- } catch (e) {
- console.log("executeSql error: "+e);
- }
- }
-}
-
-/**
- * Callback from native code when query fails
- * PRIVATE METHOD
- *
- * @param reason Error message
- * @param id Query id
- */
-function failQuery(reason, id) {
- var query = queryQueue[id];
- if (query) {
- try {
- delete queryQueue[id];
-
- // Get transaction
- var tx = query.tx;
-
- // If transaction hasn't failed
- // Note: We ignore all query results if previous query
- // in the same transaction failed.
- if (tx && tx.queryList[id]) {
- tx.queryList = {};
-
- try {
- if (typeof query.errorCallback === 'function') {
- query.errorCallback(query.tx, reason);
- }
- } catch (ex) {
- console.log("executeSql error calling user error callback: "+ex);
- }
-
- tx.queryFailed(id, reason);
- }
-
- } catch (e) {
- console.log("executeSql error: "+e);
- }
- }
-}
-
-/**
- * SQL query object
- * PRIVATE METHOD
- *
- * @constructor
- * @param tx The transaction object that this query belongs to
- */
-var DroidDB_Query = function(tx) {
-
- // Set the id of the query
- this.id = utils.createUUID();
-
- // Add this query to the queue
- queryQueue[this.id] = this;
-
- // Init result
- this.resultSet = [];
-
- // Set transaction that this query belongs to
- this.tx = tx;
-
- // Add this query to transaction list
- this.tx.queryList[this.id] = this;
-
- // Callbacks
- this.successCallback = null;
- this.errorCallback = null;
-
-};
-
-/**
- * Transaction object
- * PRIVATE METHOD
- * @constructor
- */
-var DroidDB_Tx = function() {
-
- // Set the id of the transaction
- this.id = utils.createUUID();
-
- // Callbacks
- this.successCallback = null;
- this.errorCallback = null;
-
- // Query list
- this.queryList = {};
-};
-
-/**
- * Mark query in transaction as complete.
- * If all queries are complete, call the user's transaction success callback.
- *
- * @param id Query id
- */
-DroidDB_Tx.prototype.queryComplete = function(id) {
- delete this.queryList[id];
-
- // If no more outstanding queries, then fire transaction success
- if (this.successCallback) {
- var count = 0;
- var i;
- for (i in this.queryList) {
- if (this.queryList.hasOwnProperty(i)) {
- count++;
- }
- }
- if (count === 0) {
- try {
- this.successCallback();
- } catch(e) {
- console.log("Transaction error calling user success callback: " + e);
- }
- }
- }
-};
-
-/**
- * Mark query in transaction as failed.
- *
- * @param id Query id
- * @param reason Error message
- */
-DroidDB_Tx.prototype.queryFailed = function(id, reason) {
-
- // The sql queries in this transaction have already been run, since
- // we really don't have a real transaction implemented in native code.
- // However, the user callbacks for the remaining sql queries in transaction
- // will not be called.
- this.queryList = {};
-
- if (this.errorCallback) {
- try {
- this.errorCallback(reason);
- } catch(e) {
- console.log("Transaction error calling user error callback: " + e);
- }
- }
-};
-
-/**
- * Execute SQL statement
- *
- * @param sql SQL statement to execute
- * @param params Statement parameters
- * @param successCallback Success callback
- * @param errorCallback Error callback
- */
-DroidDB_Tx.prototype.executeSql = function(sql, params, successCallback, errorCallback) {
-
- // Init params array
- if (typeof params === 'undefined') {
- params = [];
- }
-
- // Create query and add to queue
- var query = new DroidDB_Query(this);
- queryQueue[query.id] = query;
-
- // Save callbacks
- query.successCallback = successCallback;
- query.errorCallback = errorCallback;
-
- // Call native code
- exec(null, null, "Storage", "executeSql", [sql, params, query.id]);
-};
-
-var DatabaseShell = function() {
-};
-
-/**
- * Start a transaction.
- * Does not support rollback in event of failure.
- *
- * @param process {Function} The transaction function
- * @param successCallback {Function}
- * @param errorCallback {Function}
- */
-DatabaseShell.prototype.transaction = function(process, errorCallback, successCallback) {
- var tx = new DroidDB_Tx();
- tx.successCallback = successCallback;
- tx.errorCallback = errorCallback;
- try {
- process(tx);
- } catch (e) {
- console.log("Transaction error: "+e);
- if (tx.errorCallback) {
- try {
- tx.errorCallback(e);
- } catch (ex) {
- console.log("Transaction error calling user error callback: "+e);
- }
- }
- }
-};
-
-/**
- * Open database
- *
- * @param name Database name
- * @param version Database version
- * @param display_name Database display name
- * @param size Database size in bytes
- * @return Database object
- */
-var DroidDB_openDatabase = function(name, version, display_name, size) {
- exec(null, null, "Storage", "openDatabase", [name, version, display_name, size]);
- var db = new DatabaseShell();
- return db;
-};
-
-/**
- * For browsers with no localStorage we emulate it with SQLite. Follows the w3c api.
- * TODO: Do similar for sessionStorage.
- * @constructor
- */
-var CupcakeLocalStorage = function() {
- channel.waitForInitialization("cupcakeStorage");
-
- try {
-
- this.db = openDatabase('localStorage', '1.0', 'localStorage', 2621440);
- var storage = {};
- this.length = 0;
- function setLength (length) {
- this.length = length;
- localStorage.length = length;
- }
- this.db.transaction(
- function (transaction) {
- var i;
- transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
- transaction.executeSql('SELECT * FROM storage', [], function(tx, result) {
- for(var i = 0; i < result.rows.length; i++) {
- storage[result.rows.item(i)['id']] = result.rows.item(i)['body'];
- }
- setLength(result.rows.length);
- channel.initializationComplete("cupcakeStorage");
- });
-
- },
- function (err) {
- alert(err.message);
- }
- );
- this.setItem = function(key, val) {
- if (typeof(storage[key])=='undefined') {
- this.length++;
- }
- storage[key] = val;
- this.db.transaction(
- function (transaction) {
- transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
- transaction.executeSql('REPLACE INTO storage (id, body) values(?,?)', [key,val]);
- }
- );
- };
- this.getItem = function(key) {
- return storage[key];
- };
- this.removeItem = function(key) {
- delete storage[key];
- this.length--;
- this.db.transaction(
- function (transaction) {
- transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
- transaction.executeSql('DELETE FROM storage where id=?', [key]);
- }
- );
- };
- this.clear = function() {
- storage = {};
- this.length = 0;
- this.db.transaction(
- function (transaction) {
- transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
- transaction.executeSql('DELETE FROM storage', []);
- }
- );
- };
- this.key = function(index) {
- var i = 0;
- for (var j in storage) {
- if (i==index) {
- return j;
- } else {
- i++;
- }
- }
- return null;
- };
-
- } catch(e) {
- alert("Database error "+e+".");
- return;
- }
-};
-
-module.exports = {
- openDatabase:DroidDB_openDatabase,
- CupcakeLocalStorage:CupcakeLocalStorage,
- failQuery:failQuery,
- completeQuery:completeQuery
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/battery.js
----------------------------------------------------------------------
diff --git a/lib/plugin/battery.js b/lib/plugin/battery.js
deleted file mode 100644
index 5649356..0000000
--- a/lib/plugin/battery.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * This class contains information about the current battery status.
- * @constructor
- */
-var cordova = require('cordova'),
- exec = require('cordova/exec');
-
-function handlers() {
- return battery.channels.batterystatus.numHandlers +
- battery.channels.batterylow.numHandlers +
- battery.channels.batterycritical.numHandlers;
-}
-
-var Battery = function() {
- this._level = null;
- this._isPlugged = null;
- // Create new event handlers on the window (returns a channel instance)
- var subscriptionEvents = {
- onSubscribe:this.onSubscribe,
- onUnsubscribe:this.onUnsubscribe
- };
- this.channels = {
- batterystatus:cordova.addWindowEventHandler("batterystatus", subscriptionEvents),
- batterylow:cordova.addWindowEventHandler("batterylow", subscriptionEvents),
- batterycritical:cordova.addWindowEventHandler("batterycritical", subscriptionEvents)
- };
-};
-/**
- * Event handlers for when callbacks get registered for the battery.
- * Keep track of how many handlers we have so we can start and stop the native battery listener
- * appropriately (and hopefully save on battery life!).
- */
-Battery.prototype.onSubscribe = function() {
- var me = battery;
- // If we just registered the first handler, make sure native listener is started.
- if (handlers() === 1) {
- exec(me._status, me._error, "Battery", "start", []);
- }
-};
-
-Battery.prototype.onUnsubscribe = function() {
- var me = battery;
-
- // If we just unregistered the last handler, make sure native listener is stopped.
- if (handlers() === 0) {
- exec(null, null, "Battery", "stop", []);
- }
-};
-
-/**
- * Callback for battery status
- *
- * @param {Object} info keys: level, isPlugged
- */
-Battery.prototype._status = function(info) {
- if (info) {
- var me = battery;
- var level = info.level;
- if (me._level !== level || me._isPlugged !== info.isPlugged) {
- // Fire batterystatus event
- cordova.fireWindowEvent("batterystatus", info);
-
- // Fire low battery event
- if (level === 20 || level === 5) {
- if (level === 20) {
- cordova.fireWindowEvent("batterylow", info);
- }
- else {
- cordova.fireWindowEvent("batterycritical", info);
- }
- }
- }
- me._level = level;
- me._isPlugged = info.isPlugged;
- }
-};
-
-/**
- * Error callback for battery start
- */
-Battery.prototype._error = function(e) {
- console.log("Error initializing Battery: " + e);
-};
-
-var battery = new Battery();
-
-module.exports = battery;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/blackberry/Contact.js
----------------------------------------------------------------------
diff --git a/lib/plugin/blackberry/Contact.js b/lib/plugin/blackberry/Contact.js
deleted file mode 100644
index bbc0937..0000000
--- a/lib/plugin/blackberry/Contact.js
+++ /dev/null
@@ -1,386 +0,0 @@
-var ContactError = require('cordova/plugin/ContactError'),
- ContactUtils = require('cordova/plugin/blackberry/ContactUtils'),
- exec = require('cordova/exec');
-
-// ------------------
-// Utility functions
-// ------------------
-
-/**
- * Retrieves a BlackBerry contact from the device by unique id.
- *
- * @param uid
- * Unique id of the contact on the device
- * @return {blackberry.pim.Contact} BlackBerry contact or null if contact with
- * specified id is not found
- */
-var findByUniqueId = function(uid) {
- if (!uid) {
- return null;
- }
- var bbContacts = blackberry.pim.Contact
- .find(new blackberry.find.FilterExpression("uid", "==", uid));
- return bbContacts[0] || null;
-};
-
-/**
- * Creates a BlackBerry contact object from the W3C Contact object and persists
- * it to device storage.
- *
- * @param {Contact}
- * contact The contact to save
- * @return a new contact object with all properties set
- */
-var saveToDevice = function(contact) {
-
- if (!contact) {
- return;
- }
-
- var bbContact = null;
- var update = false;
-
- // if the underlying BlackBerry contact already exists, retrieve it for
- // update
- if (contact.id) {
- // we must attempt to retrieve the BlackBerry contact from the device
- // because this may be an update operation
- bbContact = findByUniqueId(contact.id);
- }
-
- // contact not found on device, create a new one
- if (!bbContact) {
- bbContact = new blackberry.pim.Contact();
- }
- // update the existing contact
- else {
- update = true;
- }
-
- // NOTE: The user may be working with a partial Contact object, because only
- // user-specified Contact fields are returned from a find operation (blame
- // the W3C spec). If this is an update to an existing Contact, we don't
- // want to clear an attribute from the contact database simply because the
- // Contact object that the user passed in contains a null value for that
- // attribute. So we only copy the non-null Contact attributes to the
- // BlackBerry contact object before saving.
- //
- // This means that a user must explicitly set a Contact attribute to a
- // non-null value in order to update it in the contact database.
- //
- // name
- if (contact.name !== null) {
- if (contact.name.givenName) {
- bbContact.firstName = contact.name.givenName;
- }
- if (contact.name.familyName) {
- bbContact.lastName = contact.name.familyName;
- }
- if (contact.name.honorificPrefix) {
- bbContact.title = contact.name.honorificPrefix;
- }
- }
-
- // display name
- if (contact.displayName !== null) {
- bbContact.user1 = contact.displayName;
- }
-
- // note
- if (contact.note !== null) {
- bbContact.note = contact.note;
- }
-
- // birthday
- //
- // user may pass in Date object or a string representation of a date
- // if it is a string, we don't know the date format, so try to create a
- // new Date with what we're given
- //
- // NOTE: BlackBerry's Date.parse() does not work well, so use new Date()
- //
- if (contact.birthday !== null) {
- if (contact.birthday instanceof Date) {
- bbContact.birthday = contact.birthday;
- } else {
- var bday = contact.birthday.toString();
- bbContact.birthday = (bday.length > 0) ? new Date(bday) : "";
- }
- }
-
- // BlackBerry supports three email addresses
- if (contact.emails && contact.emails instanceof Array) {
-
- // if this is an update, re-initialize email addresses
- if (update) {
- bbContact.email1 = "";
- bbContact.email2 = "";
- bbContact.email3 = "";
- }
-
- // copy the first three email addresses found
- var email = null;
- for ( var i = 0; i < contact.emails.length; i += 1) {
- email = contact.emails[i];
- if (!email || !email.value) {
- continue;
- }
- if (bbContact.email1 === "") {
- bbContact.email1 = email.value;
- } else if (bbContact.email2 === "") {
- bbContact.email2 = email.value;
- } else if (bbContact.email3 === "") {
- bbContact.email3 = email.value;
- }
- }
- }
-
- // BlackBerry supports a finite number of phone numbers
- // copy into appropriate fields based on type
- if (contact.phoneNumbers && contact.phoneNumbers instanceof Array) {
-
- // if this is an update, re-initialize phone numbers
- if (update) {
- bbContact.homePhone = "";
- bbContact.homePhone2 = "";
- bbContact.workPhone = "";
- bbContact.workPhone2 = "";
- bbContact.mobilePhone = "";
- bbContact.faxPhone = "";
- bbContact.pagerPhone = "";
- bbContact.otherPhone = "";
- }
-
- var type = null;
- var number = null;
- for ( var i = 0; i < contact.phoneNumbers.length; i += 1) {
- if (!contact.phoneNumbers[i] || !contact.phoneNumbers[i].value) {
- continue;
- }
- type = contact.phoneNumbers[i].type;
- number = contact.phoneNumbers[i].value;
- if (type === 'home') {
- if (bbContact.homePhone === "") {
- bbContact.homePhone = number;
- } else if (bbContact.homePhone2 === "") {
- bbContact.homePhone2 = number;
- }
- } else if (type === 'work') {
- if (bbContact.workPhone === "") {
- bbContact.workPhone = number;
- } else if (bbContact.workPhone2 === "") {
- bbContact.workPhone2 = number;
- }
- } else if (type === 'mobile' && bbContact.mobilePhone === "") {
- bbContact.mobilePhone = number;
- } else if (type === 'fax' && bbContact.faxPhone === "") {
- bbContact.faxPhone = number;
- } else if (type === 'pager' && bbContact.pagerPhone === "") {
- bbContact.pagerPhone = number;
- } else if (bbContact.otherPhone === "") {
- bbContact.otherPhone = number;
- }
- }
- }
-
- // BlackBerry supports two addresses: home and work
- // copy the first two addresses found from Contact
- if (contact.addresses && contact.addresses instanceof Array) {
-
- // if this is an update, re-initialize addresses
- if (update) {
- bbContact.homeAddress = null;
- bbContact.workAddress = null;
- }
-
- var address = null;
- var bbHomeAddress = null;
- var bbWorkAddress = null;
- for ( var i = 0; i < contact.addresses.length; i += 1) {
- address = contact.addresses[i];
- if (!address || address instanceof ContactAddress === false) {
- continue;
- }
-
- if (bbHomeAddress === null
- && (!address.type || address.type === "home")) {
- bbHomeAddress = createBlackBerryAddress(address);
- bbContact.homeAddress = bbHomeAddress;
- } else if (bbWorkAddress === null
- && (!address.type || address.type === "work")) {
- bbWorkAddress = createBlackBerryAddress(address);
- bbContact.workAddress = bbWorkAddress;
- }
- }
- }
-
- // copy first url found to BlackBerry 'webpage' field
- if (contact.urls && contact.urls instanceof Array) {
-
- // if this is an update, re-initialize web page
- if (update) {
- bbContact.webpage = "";
- }
-
- var url = null;
- for ( var i = 0; i < contact.urls.length; i += 1) {
- url = contact.urls[i];
- if (!url || !url.value) {
- continue;
- }
- if (bbContact.webpage === "") {
- bbContact.webpage = url.value;
- break;
- }
- }
- }
-
- // copy fields from first organization to the
- // BlackBerry 'company' and 'jobTitle' fields
- if (contact.organizations && contact.organizations instanceof Array) {
-
- // if this is an update, re-initialize org attributes
- if (update) {
- bbContact.company = "";
- }
-
- var org = null;
- for ( var i = 0; i < contact.organizations.length; i += 1) {
- org = contact.organizations[i];
- if (!org) {
- continue;
- }
- if (bbContact.company === "") {
- bbContact.company = org.name || "";
- bbContact.jobTitle = org.title || "";
- break;
- }
- }
- }
-
- // categories
- if (contact.categories && contact.categories instanceof Array) {
- bbContact.categories = [];
- var category = null;
- for ( var i = 0; i < contact.categories.length; i += 1) {
- category = contact.categories[i];
- if (typeof category == "string") {
- bbContact.categories.push(category);
- }
- }
- }
-
- // save to device
- bbContact.save();
-
- // invoke native side to save photo
- // fail gracefully if photo URL is no good, but log the error
- if (contact.photos && contact.photos instanceof Array) {
- var photo = null;
- for ( var i = 0; i < contact.photos.length; i += 1) {
- photo = contact.photos[i];
- if (!photo || !photo.value) {
- continue;
- }
- exec(
- // success
- function() {
- },
- // fail
- function(e) {
- console.log('Contact.setPicture failed:' + e);
- }, "Contact", "setPicture", [ bbContact.uid, photo.type,
- photo.value ]);
- break;
- }
- }
-
- // Use the fully populated BlackBerry contact object to create a
- // corresponding W3C contact object.
- return ContactUtils.createContact(bbContact, [ "*" ]);
-};
-
-/**
- * Creates a BlackBerry Address object from a W3C ContactAddress.
- *
- * @return {blackberry.pim.Address} a BlackBerry address object
- */
-var createBlackBerryAddress = function(address) {
- var bbAddress = new blackberry.pim.Address();
-
- if (!address) {
- return bbAddress;
- }
-
- bbAddress.address1 = address.streetAddress || "";
- bbAddress.city = address.locality || "";
- bbAddress.stateProvince = address.region || "";
- bbAddress.zipPostal = address.postalCode || "";
- bbAddress.country = address.country || "";
-
- return bbAddress;
-};
-
-module.exports = {
- /**
- * Persists contact to device storage.
- */
- save : function(success, fail) {
- try {
- // save the contact and store it's unique id
- var fullContact = saveToDevice(this);
- this.id = fullContact.id;
-
- // This contact object may only have a subset of properties
- // if the save was an update of an existing contact. This is
- // because the existing contact was likely retrieved using a
- // subset of properties, so only those properties were set in the
- // object. For this reason, invoke success with the contact object
- // returned by saveToDevice since it is fully populated.
- if (typeof success === 'function') {
- success(fullContact);
- }
- } catch (e) {
- console.log('Error saving contact: ' + e);
- if (typeof fail === 'function') {
- fail(new ContactError(ContactError.UNKNOWN_ERROR));
- }
- }
- },
-
- /**
- * Removes contact from device storage.
- *
- * @param success
- * success callback
- * @param fail
- * error callback
- */
- remove : function(success, fail) {
- try {
- // retrieve contact from device by id
- var bbContact = null;
- if (this.id) {
- bbContact = findByUniqueId(this.id);
- }
-
- // if contact was found, remove it
- if (bbContact) {
- console.log('removing contact: ' + bbContact.uid);
- bbContact.remove();
- if (typeof success === 'function') {
- success(this);
- }
- }
- // attempting to remove a contact that hasn't been saved
- else if (typeof fail === 'function') {
- fail(new ContactError(ContactError.UNKNOWN_ERROR));
- }
- } catch (e) {
- console.log('Error removing contact ' + this.id + ": " + e);
- if (typeof fail === 'function') {
- fail(new ContactError(ContactError.UNKNOWN_ERROR));
- }
- }
- }
-};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/blackberry/ContactUtils.js
----------------------------------------------------------------------
diff --git a/lib/plugin/blackberry/ContactUtils.js b/lib/plugin/blackberry/ContactUtils.js
deleted file mode 100644
index 3ef7a04..0000000
--- a/lib/plugin/blackberry/ContactUtils.js
+++ /dev/null
@@ -1,353 +0,0 @@
-/**
- * Mappings for each Contact field that may be used in a find operation. Maps
- * W3C Contact fields to one or more fields in a BlackBerry contact object.
- *
- * Example: user searches with a filter on the Contact 'name' field:
- *
- * <code>Contacts.find(['name'], onSuccess, onFail, {filter:'Bob'});</code>
- *
- * The 'name' field does not exist in a BlackBerry contact. Instead, a filter
- * expression will be built to search the BlackBerry contacts using the
- * BlackBerry 'title', 'firstName' and 'lastName' fields.
- */
-var fieldMappings = {
- "id" : "uid",
- "displayName" : "user1",
- "name" : [ "title", "firstName", "lastName" ],
- "name.formatted" : [ "title", "firstName", "lastName" ],
- "name.givenName" : "firstName",
- "name.familyName" : "lastName",
- "name.honorificPrefix" : "title",
- "phoneNumbers" : [ "faxPhone", "homePhone", "homePhone2", "mobilePhone",
- "pagerPhone", "otherPhone", "workPhone", "workPhone2" ],
- "phoneNumbers.value" : [ "faxPhone", "homePhone", "homePhone2",
- "mobilePhone", "pagerPhone", "otherPhone", "workPhone",
- "workPhone2" ],
- "emails" : [ "email1", "email2", "email3" ],
- "addresses" : [ "homeAddress.address1", "homeAddress.address2",
- "homeAddress.city", "homeAddress.stateProvince",
- "homeAddress.zipPostal", "homeAddress.country",
- "workAddress.address1", "workAddress.address2", "workAddress.city",
- "workAddress.stateProvince", "workAddress.zipPostal",
- "workAddress.country" ],
- "addresses.formatted" : [ "homeAddress.address1", "homeAddress.address2",
- "homeAddress.city", "homeAddress.stateProvince",
- "homeAddress.zipPostal", "homeAddress.country",
- "workAddress.address1", "workAddress.address2", "workAddress.city",
- "workAddress.stateProvince", "workAddress.zipPostal",
- "workAddress.country" ],
- "addresses.streetAddress" : [ "homeAddress.address1",
- "homeAddress.address2", "workAddress.address1",
- "workAddress.address2" ],
- "addresses.locality" : [ "homeAddress.city", "workAddress.city" ],
- "addresses.region" : [ "homeAddress.stateProvince",
- "workAddress.stateProvince" ],
- "addresses.country" : [ "homeAddress.country", "workAddress.country" ],
- "organizations" : [ "company", "jobTitle" ],
- "organizations.name" : "company",
- "organizations.title" : "jobTitle",
- "birthday" : "birthday",
- "note" : "note",
- "categories" : "categories",
- "urls" : "webpage",
- "urls.value" : "webpage"
-};
-
-/*
- * Build an array of all of the valid W3C Contact fields. This is used to
- * substitute all the fields when ["*"] is specified.
- */
-var allFields = [];
-for ( var key in fieldMappings) {
- if (fieldMappings.hasOwnProperty(key)) {
- allFields.push(key);
- }
-}
-
-/**
- * Create a W3C ContactAddress object from a BlackBerry Address object.
- *
- * @param {String}
- * type the type of address (e.g. work, home)
- * @param {blackberry.pim.Address}
- * bbAddress a BlakcBerry Address object
- * @return {ContactAddress} a contact address object or null if the specified
- * address is null
- */
-var createContactAddress = function(type, bbAddress) {
-
- if (!bbAddress) {
- return null;
- }
-
- var address1 = bbAddress.address1 || "";
- var address2 = bbAddress.address2 || "";
- var streetAddress = address1 + ", " + address2;
- var locality = bbAddress.city || "";
- var region = bbAddress.stateProvince || "";
- var postalCode = bbAddress.zipPostal || "";
- var country = bbAddress.country || "";
- var formatted = streetAddress + ", " + locality + ", " + region + ", "
- + postalCode + ", " + country;
-
- return new ContactAddress(null, type, formatted, streetAddress, locality,
- region, postalCode, country);
-};
-
-module.exports = {
- /**
- * Builds a BlackBerry filter expression for contact search using the
- * contact fields and search filter provided.
- *
- * @param {String[]}
- * fields Array of Contact fields to search
- * @param {String}
- * filter Filter, or search string
- * @return filter expression or null if fields is empty or filter is null or
- * empty
- */
- buildFilterExpression : function(fields, filter) {
-
- // ensure filter exists
- if (!filter || filter === "") {
- return null;
- }
-
- if (fields.length == 1 && fields[0] === "*") {
- // Cordova enhancement to allow fields value of ["*"] to indicate
- // all supported fields.
- fields = allFields;
- }
-
- // BlackBerry API uses specific operators to build filter expressions
- // for
- // querying Contact lists. The operators are
- // ["!=","==","<",">","<=",">="].
- // Use of regex is also an option, and the only one we can use to
- // simulate
- // an SQL '%LIKE%' clause.
- //
- // Note: The BlackBerry regex implementation doesn't seem to support
- // conventional regex switches that would enable a case insensitive
- // search.
- // It does not honor the (?i) switch (which causes Contact.find() to
- // fail).
- // We need case INsensitivity to match the W3C Contacts API spec.
- // So the guys at RIM proposed this method:
- //
- // original filter = "norm"
- // case insensitive filter = "[nN][oO][rR][mM]"
- //
- var ciFilter = "";
- for ( var i = 0; i < filter.length; i++) {
- ciFilter = ciFilter + "[" + filter[i].toLowerCase()
- + filter[i].toUpperCase() + "]";
- }
-
- // match anything that contains our filter string
- filter = ".*" + ciFilter + ".*";
-
- // build a filter expression using all Contact fields provided
- var filterExpression = null;
- if (fields && fields instanceof Array) {
- var fe = null;
- for ( var i in fields) {
- if (!fields[i]) {
- continue;
- }
-
- // retrieve the BlackBerry contact fields that map to the one
- // specified
- var bbFields = fieldMappings[fields[i]];
-
- // BlackBerry doesn't support the field specified
- if (!bbFields) {
- continue;
- }
-
- // construct the filter expression using the BlackBerry fields
- for ( var j in bbFields) {
- fe = new blackberry.find.FilterExpression(bbFields[j],
- "REGEX", filter);
- if (filterExpression === null) {
- filterExpression = fe;
- } else {
- // combine the filters
- filterExpression = new blackberry.find.FilterExpression(
- filterExpression, "OR", fe);
- }
- }
- }
- }
-
- return filterExpression;
- },
-
- /**
- * Creates a Contact object from a BlackBerry Contact object, copying only
- * the fields specified.
- *
- * This is intended as a privately used function but it is made globally
- * available so that a Contact.save can convert a BlackBerry contact object
- * into its W3C equivalent.
- *
- * @param {blackberry.pim.Contact}
- * bbContact BlackBerry Contact object
- * @param {String[]}
- * fields array of contact fields that should be copied
- * @return {Contact} a contact object containing the specified fields or
- * null if the specified contact is null
- */
- createContact : function(bbContact, fields) {
-
- if (!bbContact) {
- return null;
- }
-
- // construct a new contact object
- // always copy the contact id and displayName fields
- var contact = new Contact(bbContact.uid, bbContact.user1);
-
- // nothing to do
- if (!fields || !(fields instanceof Array) || fields.length == 0) {
- return contact;
- } else if (fields.length == 1 && fields[0] === "*") {
- // Cordova enhancement to allow fields value of ["*"] to indicate
- // all supported fields.
- fields = allFields;
- }
-
- // add the fields specified
- for ( var i in fields) {
- var field = fields[i];
-
- if (!field) {
- continue;
- }
-
- // name
- if (field.indexOf('name') === 0) {
- var formattedName = bbContact.title + ' ' + bbContact.firstName
- + ' ' + bbContact.lastName;
- contact.name = new ContactName(formattedName,
- bbContact.lastName, bbContact.firstName, null,
- bbContact.title, null);
- }
- // phone numbers
- else if (field.indexOf('phoneNumbers') === 0) {
- var phoneNumbers = [];
- if (bbContact.homePhone) {
- phoneNumbers.push(new ContactField('home',
- bbContact.homePhone));
- }
- if (bbContact.homePhone2) {
- phoneNumbers.push(new ContactField('home',
- bbContact.homePhone2));
- }
- if (bbContact.workPhone) {
- phoneNumbers.push(new ContactField('work',
- bbContact.workPhone));
- }
- if (bbContact.workPhone2) {
- phoneNumbers.push(new ContactField('work',
- bbContact.workPhone2));
- }
- if (bbContact.mobilePhone) {
- phoneNumbers.push(new ContactField('mobile',
- bbContact.mobilePhone));
- }
- if (bbContact.faxPhone) {
- phoneNumbers.push(new ContactField('fax',
- bbContact.faxPhone));
- }
- if (bbContact.pagerPhone) {
- phoneNumbers.push(new ContactField('pager',
- bbContact.pagerPhone));
- }
- if (bbContact.otherPhone) {
- phoneNumbers.push(new ContactField('other',
- bbContact.otherPhone));
- }
- contact.phoneNumbers = phoneNumbers.length > 0 ? phoneNumbers
- : null;
- }
- // emails
- else if (field.indexOf('emails') === 0) {
- var emails = [];
- if (bbContact.email1) {
- emails.push(new ContactField(null, bbContact.email1, null));
- }
- if (bbContact.email2) {
- emails.push(new ContactField(null, bbContact.email2, null));
- }
- if (bbContact.email3) {
- emails.push(new ContactField(null, bbContact.email3, null));
- }
- contact.emails = emails.length > 0 ? emails : null;
- }
- // addresses
- else if (field.indexOf('addresses') === 0) {
- var addresses = [];
- if (bbContact.homeAddress) {
- addresses.push(createContactAddress("home",
- bbContact.homeAddress));
- }
- if (bbContact.workAddress) {
- addresses.push(createContactAddress("work",
- bbContact.workAddress));
- }
- contact.addresses = addresses.length > 0 ? addresses : null;
- }
- // birthday
- else if (field.indexOf('birthday') === 0) {
- if (bbContact.birthday) {
- contact.birthday = bbContact.birthday;
- }
- }
- // note
- else if (field.indexOf('note') === 0) {
- if (bbContact.note) {
- contact.note = bbContact.note;
- }
- }
- // organizations
- else if (field.indexOf('organizations') === 0) {
- var organizations = [];
- if (bbContact.company || bbContact.jobTitle) {
- organizations.push(new ContactOrganization(null, null,
- bbContact.company, null, bbContact.jobTitle));
- }
- contact.organizations = organizations.length > 0 ? organizations
- : null;
- }
- // categories
- else if (field.indexOf('categories') === 0) {
- if (bbContact.categories && bbContact.categories.length > 0) {
- contact.categories = bbContact.categories;
- } else {
- contact.categories = null;
- }
- }
- // urls
- else if (field.indexOf('urls') === 0) {
- var urls = [];
- if (bbContact.webpage) {
- urls.push(new ContactField(null, bbContact.webpage));
- }
- contact.urls = urls.length > 0 ? urls : null;
- }
- // photos
- else if (field.indexOf('photos') === 0) {
- var photos = [];
- // The BlackBerry Contact object will have a picture attribute
- // with Base64 encoded image
- if (bbContact.picture) {
- photos.push(new ContactField('base64', bbContact.picture));
- }
- contact.photos = photos.length > 0 ? photos : null;
- }
- }
-
- return contact;
- }
-};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/blackberry/DirectoryEntry.js
----------------------------------------------------------------------
diff --git a/lib/plugin/blackberry/DirectoryEntry.js b/lib/plugin/blackberry/DirectoryEntry.js
deleted file mode 100644
index 76acaf7..0000000
--- a/lib/plugin/blackberry/DirectoryEntry.js
+++ /dev/null
@@ -1,239 +0,0 @@
-var DirectoryEntry = require('cordova/plugin/DirectoryEntry'),
- FileEntry = require('cordova/plugin/FileEntry'),
- FileError = require('cordova/plugin/FileError'),
- exec = require('cordova/exec');
-
-module.exports = {
- /**
- * Creates or looks up a directory; override for BlackBerry.
- *
- * @param path
- * {DOMString} either a relative or absolute path from this
- * directory in which to look up or create a directory
- * @param options
- * {Flags} options to create or exclusively create the directory
- * @param successCallback
- * {Function} called with the new DirectoryEntry
- * @param errorCallback
- * {Function} called with a FileError
- */
- getDirectory : function(path, options, successCallback, errorCallback) {
- // create directory if it doesn't exist
- var create = (options && options.create === true) ? true : false,
- // if true, causes failure if create is true and path already exists
- exclusive = (options && options.exclusive === true) ? true : false,
- // directory exists
- exists,
- // create a new DirectoryEntry object and invoke success callback
- createEntry = function() {
- var path_parts = path.split('/'),
- name = path_parts[path_parts.length - 1],
- dirEntry = new DirectoryEntry(name, path);
-
- // invoke success callback
- if (typeof successCallback === 'function') {
- successCallback(dirEntry);
- }
- };
-
- var fail = function(error) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(error));
- }
- };
-
- // determine if path is relative or absolute
- if (!path) {
- fail(FileError.ENCODING_ERR);
- return;
- } else if (path.indexOf(this.fullPath) !== 0) {
- // path does not begin with the fullPath of this directory
- // therefore, it is relative
- path = this.fullPath + '/' + path;
- }
-
- // determine if directory exists
- try {
- // will return true if path exists AND is a directory
- exists = blackberry.io.dir.exists(path);
- } catch (e) {
- // invalid path
- fail(FileError.ENCODING_ERR);
- return;
- }
-
- // path is a directory
- if (exists) {
- if (create && exclusive) {
- // can't guarantee exclusivity
- fail(FileError.PATH_EXISTS_ERR);
- } else {
- // create entry for existing directory
- createEntry();
- }
- }
- // will return true if path exists AND is a file
- else if (blackberry.io.file.exists(path)) {
- // the path is a file
- fail(FileError.TYPE_MISMATCH_ERR);
- }
- // path does not exist, create it
- else if (create) {
- try {
- // directory path must have trailing slash
- var dirPath = path;
- if (dirPath.substr(-1) !== '/') {
- dirPath += '/';
- }
- blackberry.io.dir.createNewDir(dirPath);
- createEntry();
- } catch (eone) {
- // unable to create directory
- fail(FileError.NOT_FOUND_ERR);
- }
- }
- // path does not exist, don't create
- else {
- // directory doesn't exist
- fail(FileError.NOT_FOUND_ERR);
- }
- },
- /**
- * Create or look up a file.
- *
- * @param path {DOMString}
- * either a relative or absolute path from this directory in
- * which to look up or create a file
- * @param options {Flags}
- * options to create or exclusively create the file
- * @param successCallback {Function}
- * called with the new FileEntry object
- * @param errorCallback {Function}
- * called with a FileError object if error occurs
- */
- getFile:function(path, options, successCallback, errorCallback) {
- // create file if it doesn't exist
- var create = (options && options.create === true) ? true : false,
- // if true, causes failure if create is true and path already exists
- exclusive = (options && options.exclusive === true) ? true : false,
- // file exists
- exists,
- // create a new FileEntry object and invoke success callback
- createEntry = function() {
- var path_parts = path.split('/'),
- name = path_parts[path_parts.length - 1],
- fileEntry = new FileEntry(name, path);
-
- // invoke success callback
- if (typeof successCallback === 'function') {
- successCallback(fileEntry);
- }
- };
-
- var fail = function(error) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(error));
- }
- };
-
- // determine if path is relative or absolute
- if (!path) {
- fail(FileError.ENCODING_ERR);
- return;
- }
- else if (path.indexOf(this.fullPath) !== 0) {
- // path does not begin with the fullPath of this directory
- // therefore, it is relative
- path = this.fullPath + '/' + path;
- }
-
- // determine if file exists
- try {
- // will return true if path exists AND is a file
- exists = blackberry.io.file.exists(path);
- }
- catch (e) {
- // invalid path
- fail(FileError.ENCODING_ERR);
- return;
- }
-
- // path is a file
- if (exists) {
- if (create && exclusive) {
- // can't guarantee exclusivity
- fail(FileError.PATH_EXISTS_ERR);
- }
- else {
- // create entry for existing file
- createEntry();
- }
- }
- // will return true if path exists AND is a directory
- else if (blackberry.io.dir.exists(path)) {
- // the path is a directory
- fail(FileError.TYPE_MISMATCH_ERR);
- }
- // path does not exist, create it
- else if (create) {
- // create empty file
- exec(
- function(result) {
- // file created
- createEntry();
- },
- fail, "File", "write", [ path, "", 0 ]);
- }
- // path does not exist, don't create
- else {
- // file doesn't exist
- fail(FileError.NOT_FOUND_ERR);
- }
- },
-
- /**
- * Delete a directory and all of it's contents.
- *
- * @param successCallback {Function} called with no parameters
- * @param errorCallback {Function} called with a FileError
- */
- removeRecursively : function(successCallback, errorCallback) {
- // we're removing THIS directory
- var path = this.fullPath;
-
- var fail = function(error) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(error));
- }
- };
-
- // attempt to delete directory
- if (blackberry.io.dir.exists(path)) {
- // it is an error to attempt to remove the file system root
- if (exec(null, null, "File", "isFileSystemRoot", [ path ]) === true) {
- fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
- }
- else {
- try {
- // delete the directory, setting recursive flag to true
- blackberry.io.dir.deleteDirectory(path, true);
- if (typeof successCallback === "function") {
- successCallback();
- }
- } catch (e) {
- // permissions don't allow deletion
- console.log(e);
- fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
- }
- }
- }
- // it's a file, not a directory
- else if (blackberry.io.file.exists(path)) {
- fail(FileError.TYPE_MISMATCH_ERR);
- }
- // not found
- else {
- fail(FileError.NOT_FOUND_ERR);
- }
- }
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/blackberry/Entry.js
----------------------------------------------------------------------
diff --git a/lib/plugin/blackberry/Entry.js b/lib/plugin/blackberry/Entry.js
deleted file mode 100644
index cc9626d..0000000
--- a/lib/plugin/blackberry/Entry.js
+++ /dev/null
@@ -1,87 +0,0 @@
-var FileError = require('cordova/plugin/FileError'),
- LocalFileSystem = require('cordova/plugin/LocalFileSystem'),
- resolveLocalFileSystemURI = require('cordova/plugin/resolveLocalFileSystemURI'),
- exec = require('cordova/exec');
-
-module.exports = {
- remove : function(successCallback, errorCallback) {
- var path = this.fullPath,
- // directory contents
- contents = [];
-
- var fail = function(error) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(error));
- }
- };
-
- // file
- if (blackberry.io.file.exists(path)) {
- try {
- blackberry.io.file.deleteFile(path);
- if (typeof successCallback === "function") {
- successCallback();
- }
- } catch (e) {
- // permissions don't allow
- fail(FileError.INVALID_MODIFICATION_ERR);
- }
- }
- // directory
- else if (blackberry.io.dir.exists(path)) {
- // it is an error to attempt to remove the file system root
- if (exec(null, null, "File", "isFileSystemRoot", [ path ]) === true) {
- fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
- } else {
- // check to see if directory is empty
- contents = blackberry.io.dir.listFiles(path);
- if (contents.length !== 0) {
- fail(FileError.INVALID_MODIFICATION_ERR);
- } else {
- try {
- // delete
- blackberry.io.dir.deleteDirectory(path, false);
- if (typeof successCallback === "function") {
- successCallback();
- }
- } catch (eone) {
- // permissions don't allow
- fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
- }
- }
- }
- }
- // not found
- else {
- fail(FileError.NOT_FOUND_ERR);
- }
- },
- getParent : function(successCallback, errorCallback) {
- var that = this;
-
- try {
- // On BlackBerry, the TEMPORARY file system is actually a temporary
- // directory that is created on a per-application basis. This is
- // to help ensure that applications do not share the same temporary
- // space. So we check to see if this is the TEMPORARY file system
- // (directory). If it is, we must return this Entry, rather than
- // the Entry for its parent.
- requestFileSystem(LocalFileSystem.TEMPORARY, 0,
- function(fileSystem) {
- if (fileSystem.root.fullPath === that.fullPath) {
- if (typeof successCallback === 'function') {
- successCallback(fileSystem.root);
- }
- } else {
- resolveLocalFileSystemURI(blackberry.io.dir
- .getParentDirectory(that.fullPath),
- successCallback, errorCallback);
- }
- }, errorCallback);
- } catch (e) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(FileError.NOT_FOUND_ERR));
- }
- }
- }
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/blackberry/app.js
----------------------------------------------------------------------
diff --git a/lib/plugin/blackberry/app.js b/lib/plugin/blackberry/app.js
deleted file mode 100644
index 6c58e30..0000000
--- a/lib/plugin/blackberry/app.js
+++ /dev/null
@@ -1,51 +0,0 @@
-var exec = require('cordova/exec');
-var manager = require('cordova/plugin/blackberry/manager');
-
-module.exports = {
- /**
- * Clear the resource cache.
- */
- clearCache:function() {
- if (typeof blackberry.widgetcache === "undefined"
- || blackberry.widgetcache === null) {
- console.log("blackberry.widgetcache permission not found. Cache clear denied.");
- return;
- }
- blackberry.widgetcache.clearAll();
- },
-
- /**
- * Clear web history in this web view.
- * Instead of BACK button loading the previous web page, it will exit the app.
- */
- clearHistory:function() {
- exec(null, null, "App", "clearHistory", []);
- },
-
- /**
- * Go to previous page displayed.
- * This is the same as pressing the backbutton on Android device.
- */
- backHistory:function() {
- // window.history.back() behaves oddly on BlackBerry, so use
- // native implementation.
- exec(null, null, "App", "backHistory", []);
- },
-
- /**
- * Exit and terminate the application.
- */
- exitApp:function() {
- // Call onunload if it is defined since BlackBerry does not invoke
- // on application exit.
- if (typeof window.onunload === "function") {
- window.onunload();
- }
-
- // allow Cordova JavaScript Extension opportunity to cleanup
- manager.destroy();
-
- // exit the app
- blackberry.app.exit();
- }
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/blackberry/contacts.js
----------------------------------------------------------------------
diff --git a/lib/plugin/blackberry/contacts.js b/lib/plugin/blackberry/contacts.js
deleted file mode 100644
index 14dcfcd..0000000
--- a/lib/plugin/blackberry/contacts.js
+++ /dev/null
@@ -1,62 +0,0 @@
-var ContactError = require('cordova/plugin/ContactError'),
- ContactUtils = require('cordova/plugin/blackberry/ContactUtils');
-
-module.exports = {
- /**
- * Returns an array of Contacts matching the search criteria.
- *
- * @return array of Contacts matching search criteria
- */
- find : function(fields, success, fail, options) {
- // Success callback is required. Throw exception if not specified.
- if (typeof success !== 'function') {
- throw new TypeError(
- "You must specify a success callback for the find command.");
- }
-
- // Search qualifier is required and cannot be empty.
- if (!fields || !(fields instanceof Array) || fields.length == 0) {
- if (typeof fail === 'function') {
- fail(new ContactError(ContactError.INVALID_ARGUMENT_ERROR));
- }
- return;
- }
-
- // default is to return a single contact match
- var numContacts = 1;
-
- // search options
- var filter = null;
- if (options) {
- // return multiple objects?
- if (options.multiple === true) {
- // -1 on BlackBerry will return all contact matches.
- numContacts = -1;
- }
- filter = options.filter;
- }
-
- // build the filter expression to use in find operation
- var filterExpression = ContactUtils.buildFilterExpression(fields, filter);
-
- // find matching contacts
- // Note: the filter expression can be null here, in which case, the find
- // won't filter
- var bbContacts = blackberry.pim.Contact.find(filterExpression, null, numContacts);
-
- // convert to Contact from blackberry.pim.Contact
- var contacts = [];
- for ( var i in bbContacts) {
- if (bbContacts[i]) {
- // W3C Contacts API specification states that only the fields
- // in the search filter should be returned, so we create
- // a new Contact object, copying only the fields specified
- contacts.push(ContactUtils.createContact(bbContacts[i], fields));
- }
- }
-
- // return results
- success(contacts);
- }
-
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/blackberry/device.js
----------------------------------------------------------------------
diff --git a/lib/plugin/blackberry/device.js b/lib/plugin/blackberry/device.js
deleted file mode 100644
index 42a0647..0000000
--- a/lib/plugin/blackberry/device.js
+++ /dev/null
@@ -1,23 +0,0 @@
-var me = {},
- channel = require('cordova/channel'),
- exec = require('cordova/exec');
-
-exec(
- function (device) {
- me.platform = device.platform;
- me.version = device.version;
- me.name = device.name;
- me.uuid = device.uuid;
- me.cordova = device.cordova;
-
- channel.onCordovaInfoReady.fire();
- },
- function (e) {
- console.log("error initializing cordova: " + e);
- },
- "Device",
- "getDeviceInfo",
- []
-);
-
-module.exports = me;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/blackberry/manager.js
----------------------------------------------------------------------
diff --git a/lib/plugin/blackberry/manager.js b/lib/plugin/blackberry/manager.js
deleted file mode 100644
index ef353bb..0000000
--- a/lib/plugin/blackberry/manager.js
+++ /dev/null
@@ -1,87 +0,0 @@
-var webworks = require('cordova/plugin/webworks/manager'),
- Cordova = require('cordova'),
- plugins = {};
-
-function _exec(win, fail, clazz, action, args) {
- var callbackId = clazz + Cordova.callbackId++,
- origResult,
- evalResult,
- execResult;
-
- try {
-
- if (win || fail) {
- Cordova.callbacks[callbackId] = {success: win, fail: fail};
- }
-
- // Note: Device returns string, but for some reason emulator returns object - so convert to string.
- origResult = "" + org.apache.cordova.JavaPluginManager.exec(clazz, action, callbackId, JSON.stringify(args), true);
-
- // If a result was returned
- if (origResult.length > 0) {
- eval("evalResult = " + origResult + ";");
-
- // If status is OK, then return evalResultalue back to caller
- if (evalResult.status === Cordova.callbackStatus.OK) {
-
- // If there is a success callback, then call it now with returned evalResultalue
- if (win) {
- // Clear callback if not expecting any more results
- if (!evalResult.keepCallback) {
- delete Cordova.callbacks[callbackId];
- }
- }
- } else if (evalResult.status === Cordova.callbackStatus.NO_RESULT) {
-
- // Clear callback if not expecting any more results
- if (!evalResult.keepCallback) {
- delete Cordova.callbacks[callbackId];
- }
- } else {
- // If there is a fail callback, then call it now with returned evalResultalue
- if (fail) {
-
- // Clear callback if not expecting any more results
- if (!evalResult.keepCallback) {
- delete Cordova.callbacks[callbackId];
- }
- }
- }
- execResult = evalResult;
- } else {
- // Asynchronous calls return an empty string. Return a NO_RESULT
- // status for those executions.
- execResult = {"status" : Cordova.callbackStatus.NO_RESULT,
- "message" : ""};
- }
- } catch (e) {
- console.log("BlackBerryPluginManager Error: " + e);
- execResult = {"status" : Cordova.callbackStatus.ERROR,
- "message" : e.message};
- }
-
- return execResult;
-}
-
-module.exports = {
- exec: function (win, fail, clazz, action, args) {
- var result = webworks.exec(win, fail, clazz, action, args);
-
- //We got a sync result or a not found from WW that we can pass on to get a native mixin
- //For async calls there's nothing to do
- if (result.status === Cordova.callbackStatus.CLASS_NOT_FOUND_EXCEPTION ||
- result.status === Cordova.callbackStatus.INVALID_ACTION ||
- result.status === Cordova.callbackStatus.OK) {
- if (plugins[clazz]) {
- return plugins[clazz].execute(result.message, action, args, win, fail);
- } else {
- result = _exec(win, fail, clazz, action, args);
- }
- }
-
- return result;
- },
- resume: org.apache.cordova.JavaPluginManager.resume,
- pause: org.apache.cordova.JavaPluginManager.pause,
- destroy: org.apache.cordova.JavaPluginManager.destroy
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/blackberry/notification.js
----------------------------------------------------------------------
diff --git a/lib/plugin/blackberry/notification.js b/lib/plugin/blackberry/notification.js
deleted file mode 100644
index 83bc77c..0000000
--- a/lib/plugin/blackberry/notification.js
+++ /dev/null
@@ -1,53 +0,0 @@
-var exec = require('cordova/exec');
-
-/**
- * Provides BlackBerry enhanced notification API.
- */
-module.exports = {
- activityStart : function(title, message) {
- // If title and message not specified then mimic Android behavior of
- // using default strings.
- if (typeof title === "undefined" && typeof message == "undefined") {
- title = "Busy";
- message = 'Please wait...';
- }
-
- exec(null, null, 'Notification', 'activityStart', [ title, message ]);
- },
-
- /**
- * Close an activity dialog
- */
- activityStop : function() {
- exec(null, null, 'Notification', 'activityStop', []);
- },
-
- /**
- * Display a progress dialog with progress bar that goes from 0 to 100.
- *
- * @param {String}
- * title Title of the progress dialog.
- * @param {String}
- * message Message to display in the dialog.
- */
- progressStart : function(title, message) {
- exec(null, null, 'Notification', 'progressStart', [ title, message ]);
- },
-
- /**
- * Close the progress dialog.
- */
- progressStop : function() {
- exec(null, null, 'Notification', 'progressStop', []);
- },
-
- /**
- * Set the progress dialog value.
- *
- * @param {Number}
- * value 0-100
- */
- progressValue : function(value) {
- exec(null, null, 'Notification', 'progressValue', [ value ]);
- },
-};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/capture.js
----------------------------------------------------------------------
diff --git a/lib/plugin/capture.js b/lib/plugin/capture.js
deleted file mode 100644
index e088ba6..0000000
--- a/lib/plugin/capture.js
+++ /dev/null
@@ -1,72 +0,0 @@
-var exec = require('cordova/exec'),
- MediaFile = require('cordova/plugin/MediaFile');
-
-/**
- * Launches a capture of different types.
- *
- * @param (DOMString} type
- * @param {Function} successCB
- * @param {Function} errorCB
- * @param {CaptureVideoOptions} options
- */
-function _capture(type, successCallback, errorCallback, options) {
- var win = function(pluginResult) {
- var mediaFiles = [];
- var i;
- for (i = 0; i < pluginResult.length; i++) {
- var mediaFile = new MediaFile();
- mediaFile.name = pluginResult[i].name;
- mediaFile.fullPath = pluginResult[i].fullPath;
- mediaFile.type = pluginResult[i].type;
- mediaFile.lastModifiedDate = pluginResult[i].lastModifiedDate;
- mediaFile.size = pluginResult[i].size;
- mediaFiles.push(mediaFile);
- }
- successCallback(mediaFiles);
- };
- exec(win, errorCallback, "Capture", type, [options]);
-}
-/**
- * The Capture interface exposes an interface to the camera and microphone of the hosting device.
- */
-function Capture() {
- this.supportedAudioModes = [];
- this.supportedImageModes = [];
- this.supportedVideoModes = [];
-}
-
-/**
- * Launch audio recorder application for recording audio clip(s).
- *
- * @param {Function} successCB
- * @param {Function} errorCB
- * @param {CaptureAudioOptions} options
- */
-Capture.prototype.captureAudio = function(successCallback, errorCallback, options){
- _capture("captureAudio", successCallback, errorCallback, options);
-};
-
-/**
- * Launch camera application for taking image(s).
- *
- * @param {Function} successCB
- * @param {Function} errorCB
- * @param {CaptureImageOptions} options
- */
-Capture.prototype.captureImage = function(successCallback, errorCallback, options){
- _capture("captureImage", successCallback, errorCallback, options);
-};
-
-/**
- * Launch device camera application for recording video(s).
- *
- * @param {Function} successCB
- * @param {Function} errorCB
- * @param {CaptureVideoOptions} options
- */
-Capture.prototype.captureVideo = function(successCallback, errorCallback, options){
- _capture("captureVideo", successCallback, errorCallback, options);
-};
-
-
-module.exports = new Capture();
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/compass.js
----------------------------------------------------------------------
diff --git a/lib/plugin/compass.js b/lib/plugin/compass.js
deleted file mode 100644
index 1685f2d..0000000
--- a/lib/plugin/compass.js
+++ /dev/null
@@ -1,90 +0,0 @@
-var exec = require('cordova/exec'),
- utils = require('cordova/utils'),
- CompassHeading = require('cordova/plugin/CompassHeading'),
- CompassError = require('cordova/plugin/CompassError'),
- timers = {},
- compass = {
- /**
- * Asynchronously acquires the current heading.
- * @param {Function} successCallback The function to call when the heading
- * data is available
- * @param {Function} errorCallback The function to call when there is an error
- * getting the heading data.
- * @param {CompassOptions} options The options for getting the heading data (not used).
- */
- getCurrentHeading:function(successCallback, errorCallback) {
- // successCallback required
- if (typeof successCallback !== "function") {
- console.log("Compass Error: successCallback is not a function");
- return;
- }
-
- // errorCallback optional
- if (errorCallback && (typeof errorCallback !== "function")) {
- console.log("Compass Error: errorCallback is not a function");
- return;
- }
-
- var win = function(result) {
- var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp);
- successCallback(ch);
- };
- var fail = function(code) {
- var ce = new CompassError(code);
- errorCallback(ce);
- }
-
- // Get heading
- exec(win, fail, "Compass", "getHeading", []);
- },
-
- /**
- * Asynchronously acquires the heading repeatedly at a given interval.
- * @param {Function} successCallback The function to call each time the heading
- * data is available
- * @param {Function} errorCallback The function to call when there is an error
- * getting the heading data.
- * @param {HeadingOptions} options The options for getting the heading data
- * such as timeout and the frequency of the watch.
- */
- watchHeading:function(successCallback, errorCallback, options) {
- // Default interval (100 msec)
- var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100;
-
- // successCallback required
- if (typeof successCallback !== "function") {
- console.log("Compass Error: successCallback is not a function");
- return;
- }
-
- // errorCallback optional
- if (errorCallback && (typeof errorCallback !== "function")) {
- console.log("Compass Error: errorCallback is not a function");
- return;
- }
-
- // Start watch timer to get headings
- var id = utils.createUUID();
-
- timers[id] = window.setInterval(function() {
- compass.getCurrentHeading(successCallback, errorCallback);
- }, frequency);
-
- return id;
- },
-
- /**
- * Clears the specified heading watch.
- * @param {String} watchId The ID of the watch returned from #watchHeading.
- */
- clearWatch:function(id) {
- // Stop javascript timer & remove from timer list
- if (id && timers[id]) {
- clearInterval(timers[id]);
- delete timers[id];
- }
- }
- // TODO: add the filter-based iOS-only methods
- };
-
-module.exports = compass;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/contacts.js
----------------------------------------------------------------------
diff --git a/lib/plugin/contacts.js b/lib/plugin/contacts.js
deleted file mode 100644
index 7212f7b..0000000
--- a/lib/plugin/contacts.js
+++ /dev/null
@@ -1,57 +0,0 @@
-var exec = require('cordova/exec'),
- ContactError = require('cordova/plugin/ContactError'),
- Contact = require('cordova/plugin/Contact');
-
-/**
-* Represents a group of Contacts.
-* @constructor
-*/
-var contacts = {
- /**
- * Returns an array of Contacts matching the search criteria.
- * @param fields that should be searched
- * @param successCB success callback
- * @param errorCB error callback
- * @param {ContactFindOptions} options that can be applied to contact searching
- * @return array of Contacts matching search criteria
- */
- find:function(fields, successCB, errorCB, options) {
- if (!successCB) {
- throw new TypeError("You must specify a success callback for the find command.");
- }
- if (!fields || (fields instanceof Array && fields.length === 0)) {
- if (typeof errorCB === "function") {
- errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR));
- }
- } else {
- var win = function(result) {
- var cs = [];
- for (var i = 0, l = result.length; i < l; i++) {
- cs.push(contacts.create(result[i]));
- }
- successCB(cs);
- };
- exec(win, errorCB, "Contacts", "search", [fields, options]);
- }
- },
-
- /**
- * This function creates a new contact, but it does not persist the contact
- * to device storage. To persist the contact to device storage, invoke
- * contact.save().
- * @param properties an object who's properties will be examined to create a new Contact
- * @returns new Contact object
- */
- create:function(properties) {
- var i;
- var contact = new Contact();
- for (i in properties) {
- if (typeof contact[i] !== 'undefined' && properties.hasOwnProperty(i)) {
- contact[i] = properties[i];
- }
- }
- return contact;
- }
-};
-
-module.exports = contacts;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/errgen/device.js
----------------------------------------------------------------------
diff --git a/lib/plugin/errgen/device.js b/lib/plugin/errgen/device.js
deleted file mode 100644
index 4e05777..0000000
--- a/lib/plugin/errgen/device.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * this represents the mobile device, and provides properties for inspecting the model, version, UUID of the
- * phone, etc.
- * @constructor
- */
-
-//------------------------------------------------------------------------------
-function Device() {
- window.DeviceInfo = {}
-
- this.platform = "errgen"
- this.version = "any"
- this.name = "errgen"
- this.phonegap = {}
- this.gap = this.phonegap
- this.uuid = "1234-5678-9012-3456"
- this.available = true
-
- require('cordova/channel').onCordovaInfoReady.fire()
-}
-
-//------------------------------------------------------------------------------
-module.exports = window.DeviceInfo = new Device()
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/geolocation.js
----------------------------------------------------------------------
diff --git a/lib/plugin/geolocation.js b/lib/plugin/geolocation.js
deleted file mode 100644
index e1169f6..0000000
--- a/lib/plugin/geolocation.js
+++ /dev/null
@@ -1,94 +0,0 @@
-var utils = require('cordova/utils'),
- exec = require('cordova/exec'),
- PositionError = require('cordova/plugin/PositionError'),
- Position = require('cordova/plugin/Position');
-
-var timers = {}; // list of timers in use
-
-// Returns default params, overrides if provided with values
-function parseParameters(options) {
- var opt = {
- maximumAge: 10000,
- enableHighAccuracy: false,
- timeout: 10000
- };
-
- if (options) {
- if (options.maximumAge !== undefined) {
- opt.maximumAge = options.maximumAge;
- }
- if (options.enableHighAccuracy !== undefined) {
- opt.enableHighAccuracy = options.enableHighAccuracy;
- }
- if (options.timeout !== undefined) {
- opt.timeout = options.timeout;
- }
- }
-
- return opt;
-}
-
-var geolocation = {
- /**
- * Asynchronously aquires the current position.
- *
- * @param {Function} successCallback The function to call when the position data is available
- * @param {Function} errorCallback The function to call when there is an error getting the heading position. (OPTIONAL)
- * @param {PositionOptions} options The options for getting the position data. (OPTIONAL)
- */
- getCurrentPosition:function(successCallback, errorCallback, options) {
- options = parseParameters(options);
-
- var win = function(p) {
- successCallback(new Position(
- {
- latitude:p.latitude,
- longitude:p.longitude,
- altitude:p.altitude,
- accuracy:p.accuracy,
- heading:p.heading,
- velocity:p.velocity,
- altitudeAccuracy:p.altitudeAccuracy
- },
- p.timestamp || new Date()
- ));
- };
- var fail = function(e) {
- errorCallback(new PositionError(e.code, e.message));
- };
-
- exec(win, fail, "Geolocation", "getLocation", [options.enableHighAccuracy, options.timeout, options.maximumAge]);
- },
- /**
- * Asynchronously watches the geolocation for changes to geolocation. When a change occurs,
- * the successCallback is called with the new location.
- *
- * @param {Function} successCallback The function to call each time the location data is available
- * @param {Function} errorCallback The function to call when there is an error getting the location data. (OPTIONAL)
- * @param {PositionOptions} options The options for getting the location data such as frequency. (OPTIONAL)
- * @return String The watch id that must be passed to #clearWatch to stop watching.
- */
- watchPosition:function(successCallback, errorCallback, options) {
- options = parseParameters(options);
-
- var id = utils.createUUID();
- timers[id] = window.setInterval(function() {
- geolocation.getCurrentPosition(successCallback, errorCallback, options);
- }, options.timeout);
-
- return id;
- },
- /**
- * Clears the specified heading watch.
- *
- * @param {String} id The ID of the watch returned from #watchPosition
- */
- clearWatch:function(id) {
- if (id && timers[id] !== undefined) {
- window.clearInterval(timers[id]);
- delete timers[id];
- }
- }
-};
-
-module.exports = geolocation;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/ios/Entry.js
----------------------------------------------------------------------
diff --git a/lib/plugin/ios/Entry.js b/lib/plugin/ios/Entry.js
deleted file mode 100644
index 230da8a..0000000
--- a/lib/plugin/ios/Entry.js
+++ /dev/null
@@ -1,7 +0,0 @@
-module.exports = {
- toURL:function() {
- // TODO: refactor path in a cross-platform way so we can eliminate
- // these kinds of platform-specific hacks.
- return "file://localhost" + this.fullPath;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/ios/FileReader.js
----------------------------------------------------------------------
diff --git a/lib/plugin/ios/FileReader.js b/lib/plugin/ios/FileReader.js
deleted file mode 100644
index 5711393..0000000
--- a/lib/plugin/ios/FileReader.js
+++ /dev/null
@@ -1,87 +0,0 @@
-var exec = require('cordova/exec'),
- FileError = require('cordova/plugin/FileError'),
- FileReader = require('cordova/plugin/FileReader'),
- ProgressEvent = require('cordova/plugin/ProgressEvent');
-
-module.exports = {
- readAsText:function(file, encoding) {
- // Figure out pathing
- this.fileName = '';
- if (typeof file.fullPath === 'undefined') {
- this.fileName = file;
- } else {
- this.fileName = file.fullPath;
- }
-
- // Already loading something
- if (this.readyState == FileReader.LOADING) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- // LOADING state
- this.readyState = FileReader.LOADING;
-
- // If loadstart callback
- if (typeof this.onloadstart === "function") {
- this.onloadstart(new ProgressEvent("loadstart", {target:this}));
- }
-
- // Default encoding is UTF-8
- var enc = encoding ? encoding : "UTF-8";
-
- var me = this;
-
- // Read file
- exec(
- // Success callback
- function(r) {
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileReader.DONE) {
- return;
- }
-
- // Save result
- me.result = decodeURIComponent(r);
-
- // If onload callback
- if (typeof me.onload === "function") {
- me.onload(new ProgressEvent("load", {target:me}));
- }
-
- // DONE state
- me.readyState = FileReader.DONE;
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- },
- // Error callback
- function(e) {
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileReader.DONE) {
- return;
- }
-
- // DONE state
- me.readyState = FileReader.DONE;
-
- // null result
- me.result = null;
-
- // Save error
- me.error = new FileError(e);
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror(new ProgressEvent("error", {target:me}));
- }
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- },
- "File", "readAsText", [this.fileName, enc]);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/ios/console.js
----------------------------------------------------------------------
diff --git a/lib/plugin/ios/console.js b/lib/plugin/ios/console.js
deleted file mode 100644
index 8651591..0000000
--- a/lib/plugin/ios/console.js
+++ /dev/null
@@ -1,102 +0,0 @@
-var exec = require('cordova/exec');
-
-/**
- * String indentation/formatting
- */
-function indent(str) {
- return str.replace(/^/mg, " ");
-}
-/**
- * Format a string for pretty logging
- */
-function makeStructured(obj, depth) {
- var str = "";
- for (var i in obj) {
- try {
- if (typeof(obj[i]) == 'object' && depth < maxDepth) {
- str += i + ":\n" + indent(makeStructured(obj[i])) + "\n";
- } else {
- str += i + " = " + indent(String(obj[i])).replace(/^ {4}/, "") + "\n";
- }
- } catch(e) {
- str += i + " = EXCEPTION: " + e.message + "\n";
- }
- }
- return str;
-}
-
-/**
- * This class provides access to the debugging console.
- * @constructor
- */
-var DebugConsole = function() {
- this.winConsole = window.console;
- this.logLevel = DebugConsole.INFO_LEVEL;
-};
-
-// from most verbose, to least verbose
-DebugConsole.ALL_LEVEL = 1; // same as first level
-DebugConsole.INFO_LEVEL = 1;
-DebugConsole.WARN_LEVEL = 2;
-DebugConsole.ERROR_LEVEL = 4;
-DebugConsole.NONE_LEVEL = 8;
-
-DebugConsole.prototype.setLevel = function(level) {
- this.logLevel = level;
-};
-
-/**
- * Utility function for rendering and indenting strings, or serializing
- * objects to a string capable of being printed to the console.
- * @param {Object|String} message The string or object to convert to an indented string
- * @private
- */
-DebugConsole.prototype.processMessage = function(message, maxDepth) {
- if (maxDepth === undefined) maxDepth = 0;
- if (typeof(message) != 'object') {
- return (this.isDeprecated ? "WARNING: debug object is deprecated, please use console object \n" + message : message);
- } else {
- return ("Object:\n" + makeStructured(message, maxDepth));
- }
-};
-
-/**
- * Print a normal log message to the console
- * @param {Object|String} message Message or object to print to the console
- */
-DebugConsole.prototype.log = function(message, maxDepth) {
- if (this.logLevel <= DebugConsole.INFO_LEVEL)
- exec(null, null, 'Debug Console', 'log',
- [ this.processMessage(message, maxDepth), { logLevel: 'INFO' } ]
- );
- else
- this.winConsole.log(message);
-};
-
-/**
- * Print a warning message to the console
- * @param {Object|String} message Message or object to print to the console
- */
-DebugConsole.prototype.warn = function(message, maxDepth) {
- if (this.logLevel <= DebugConsole.WARN_LEVEL)
- exec(null, null, 'Debug Console', 'log',
- [ this.processMessage(message, maxDepth), { logLevel: 'WARN' } ]
- );
- else
- this.winConsole.error(message);
-};
-
-/**
- * Print an error message to the console
- * @param {Object|String} message Message or object to print to the console
- */
-DebugConsole.prototype.error = function(message, maxDepth) {
- if (this.logLevel <= DebugConsole.ERROR_LEVEL)
- exec(null, null, 'Debug Console', 'log',
- [ this.processMessage(message, maxDepth), { logLevel: 'ERROR' } ]
- );
- else
- this.winConsole.error(message);
-};
-
-module.exports = new DebugConsole();
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/ios/device.js
----------------------------------------------------------------------
diff --git a/lib/plugin/ios/device.js b/lib/plugin/ios/device.js
deleted file mode 100644
index c6d117b..0000000
--- a/lib/plugin/ios/device.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * this represents the mobile device, and provides properties for inspecting the model, version, UUID of the
- * phone, etc.
- * @constructor
- */
-var exec = require('cordova/exec'),
- channel = require('cordova/channel');
-
-var Device = function() {
- this.platform = null;
- this.version = null;
- this.name = null;
- this.cordova = null;
- this.uuid = null;
-};
-
-Device.prototype.setInfo = function(info) {
- try {
- this.platform = info.platform;
- this.version = info.version;
- this.name = info.name;
- this.cordova = info.gap;
- this.uuid = info.uuid;
- channel.onCordovaInfoReady.fire();
- } catch(e) {
- alert('Error during device info setting in cordova/plugin/ios/device!');
- }
-};
-
-module.exports = new Device();
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/ios/nativecomm.js
----------------------------------------------------------------------
diff --git a/lib/plugin/ios/nativecomm.js b/lib/plugin/ios/nativecomm.js
deleted file mode 100644
index 938a68c..0000000
--- a/lib/plugin/ios/nativecomm.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var cordova = require('cordova');
-
-/**
- * Called by native code to retrieve all queued commands and clear the queue.
- */
-module.exports = function() {
- var json = JSON.stringify(cordova.commandQueue);
- cordova.commandQueue = [];
- return json;
-};