Skip to content

Commit

Permalink
Complete rename of phonegap to cordova.
Browse files Browse the repository at this point in the history
  • Loading branch information
Drew Walters committed Feb 15, 2012
1 parent 1c617e6 commit 4cb58e4
Show file tree
Hide file tree
Showing 49 changed files with 174 additions and 203 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ Final testing should always be done with the [Mobile Spec test application](http

## Cordova

Build the .js file and drop it in as a replacement for phonegap.js or
Build the .js file and drop it in as a replacement for cordova.js or
cordova.js!

## Ripple

Load this in Ripple to play with it. You will have to use the phonegap
Load this in Ripple to play with it. You will have to use the cordova
prototype branch to better simulate the phone environment and use this
javascript rather than Ripples emulated code.

Expand All @@ -103,7 +103,7 @@ javascript rather than Ripples emulated code.
jake

and then load the upacked extension in chrome in the pkg/chromium folder.
Use the phonegap.proto platform in ripple.
Use the cordova.proto platform in ripple.

# Adding a New Platform

Expand Down Expand Up @@ -181,7 +181,7 @@ Use the phonegap.proto platform in ripple.
calling `start` (starting the listener) in the native code on its own.
However, Compass requires that JS initiates a `start`. This is dumb.
- Media (and other plugin) implementations across platforms need to use the established
phonegap/exec callback method (instead of triggering globally-accessible functions to
cordova/exec callback method (instead of triggering globally-accessible functions to
dispatch listeners). On iOS and Android, grep for "cast" in the native
code - you'll see a bunch of invoked JavaScript from native, which
shouldn't be there.
Expand All @@ -190,7 +190,7 @@ Use the phonegap.proto platform in ripple.
Some methods not documented (setVolume on Android). Consolidate /
implement properly across platforms.
- Storage shim on Android needs to change its win/fail callbacks to
`require('phonegap/plugin/android/storage').failQuery / completeQuery`
`require('cordova/plugin/android/storage').failQuery / completeQuery`
(away from droiddb.fail / completeQuery)
- Make sure all of the service + action parameters in each `exec` call
is consistent across all platforms. Specifically, iOS needs to update
Expand All @@ -212,7 +212,7 @@ Use the phonegap.proto platform in ripple.
undocumented procedures, etc.
- Initialization of `device` in iOS needs to be upgraded. No more
`DeviceInfo` global object if possible. Also need to make sure to fire
the appropriate phonegap channel after `device` is ready on iOS.
the appropriate cordova channel after `device` is ready on iOS.

# TODO / Hacking / Contributing

Expand Down
2 changes: 1 addition & 1 deletion build/packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module.exports = {
//include channel
output += drop('lib/channel.js', 'cordova/channel');

//include phonegap
//include cordova
output += drop('lib/cordova.js', 'cordova');

//include exec
Expand Down
2 changes: 1 addition & 1 deletion lib/platform/blackberry.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
var cordova = require('cordova'),
exec = require('cordova/exec'),
channel = require('cordova/channel'),
blackberryManager = require('cordova/plugin/blackberry/manager/blackberry');
blackberryManager = require('cordova/plugin/blackberry/manager');

// TODO: is there a better way to do this? build-time
// convention? how can we save the few bytes from
Expand Down
4 changes: 2 additions & 2 deletions lib/plugin/Camera.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var exec = require('phonegap/exec'),
Camera = require('phonegap/plugin/CameraConstants');
var exec = require('cordova/exec'),
Camera = require('cordova/plugin/CameraConstants');

module.exports = {
/**
Expand Down
6 changes: 3 additions & 3 deletions lib/plugin/Contact.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var exec = require('phonegap/exec'),
ContactError = require('phonegap/plugin/ContactError'),
utils = require('phonegap/utils');
var exec = require('cordova/exec'),
ContactError = require('cordova/plugin/ContactError'),
utils = require('cordova/utils');

/**
* Contains information about a single contact.
Expand Down
8 changes: 4 additions & 4 deletions lib/plugin/DirectoryEntry.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var utils = require('phonegap/utils'),
exec = require('phonegap/exec'),
Entry = require('phonegap/plugin/Entry'),
DirectoryReady = require('phonegap/plugin/DirectoryReader');
var utils = require('cordova/utils'),
exec = require('cordova/exec'),
Entry = require('cordova/plugin/Entry'),
DirectoryReady = require('cordova/plugin/DirectoryReader');

/**
* An interface representing a directory on the file system.
Expand Down
2 changes: 1 addition & 1 deletion lib/plugin/DirectoryReader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var exec = require('phonegap/exec');
var exec = require('cordova/exec');

/**
* An interface that lists the files and directories in a directory.
Expand Down
10 changes: 5 additions & 5 deletions lib/plugin/Entry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var exec = require('phonegap/exec'),
FileError = require('phonegap/plugin/FileError'),
Metadata = require('phonegap/plugin/Metadata');
var exec = require('cordova/exec'),
FileError = require('cordova/plugin/FileError'),
Metadata = require('cordova/plugin/Metadata');

/**
* Represents a file or directory on the local file system.
Expand Down Expand Up @@ -65,7 +65,7 @@ Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallbac

if (entry) {
// create appropriate Entry object
result = (entry.isDirectory) ? new require('phonegap/plugin/DirectoryEntry')(entry) : new require('phonegap/plugin/FileEntry')(entry);
result = (entry.isDirectory) ? new require('cordova/plugin/DirectoryEntry')(entry) : new require('cordova/plugin/FileEntry')(entry);
try {
successCallback(result);
}
Expand Down Expand Up @@ -112,7 +112,7 @@ Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallbac

if (entry) {
// create appropriate Entry object
result = (entry.isDirectory) ? new require('phonegap/plugin/DirectoryEntry')(entry) : new require('phonegap/plugin/FileEntry')(entry);
result = (entry.isDirectory) ? new require('cordova/plugin/DirectoryEntry')(entry) : new require('cordova/plugin/FileEntry')(entry);
try {
successCallback(result);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/plugin/FileEntry.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var utils = require('phonegap/utils'),
Entry = require('phonegap/plugin/Entry'),
FileWriter = require('phonegap/plugin/FileWriter'),
FileError = require('phonegap/plugin/FileError');
var utils = require('cordova/utils'),
Entry = require('cordova/plugin/Entry'),
FileWriter = require('cordova/plugin/FileWriter'),
FileError = require('cordova/plugin/FileError');

/**
* An interface representing a file on the file system.
Expand Down
6 changes: 3 additions & 3 deletions lib/plugin/FileReader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var exec = require('phonegap/exec'),
FileError = require('phonegap/plugin/FileError'),
var exec = require('cordova/exec'),
FileError = require('cordova/plugin/FileError'),
// if ProgressEvent exists natively in global context then use that, otherwise use our polyfill
ProgressEvent = window.ProgressEvent || require('phonegap/plugin/ProgressEvent');
ProgressEvent = window.ProgressEvent || require('cordova/plugin/ProgressEvent');

/**
* This class reads the mobile device file system.
Expand Down
2 changes: 1 addition & 1 deletion lib/plugin/FileTransfer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var exec = require('phonegap/exec');
var exec = require('cordova/exec');

/**
* FileTransfer uploads a file to a remote server.
Expand Down
6 changes: 3 additions & 3 deletions lib/plugin/FileWriter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var exec = require('phonegap/exec'),
FileError = require('phonegap/plugin/FileError'),
var exec = require('cordova/exec'),
FileError = require('cordova/plugin/FileError'),
// if ProgressEvent exists in global context, use it already, otherwise use our own polyfill
ProgressEvent = window.ProgressEvent || require('phonegap/plugin/ProgressEvent');
ProgressEvent = window.ProgressEvent || require('cordova/plugin/ProgressEvent');

/**
* This class writes to the mobile device file system.
Expand Down
2 changes: 1 addition & 1 deletion lib/plugin/LocalFileSystem.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var exec = require('phonegap/exec');
var exec = require('cordova/exec');

/**
* Represents a local file system.
Expand Down
4 changes: 2 additions & 2 deletions lib/plugin/Media.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var utils = require('phonegap/utils'),
exec = require('phonegap/exec');
var utils = require('cordova/utils'),
exec = require('cordova/exec');

var mediaObjects = {};

Expand Down
8 changes: 4 additions & 4 deletions lib/plugin/MediaFile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var utils = require('phonegap/utils'),
exec = require('phonegap/exec'),
File = require('phonegap/plugin/File'),
CaptureError = require('phonegap/plugin/CaptureError');
var utils = require('cordova/utils'),
exec = require('cordova/exec'),
File = require('cordova/plugin/File'),
CaptureError = require('cordova/plugin/CaptureError');
/**
* Represents a single file.
*
Expand Down
4 changes: 2 additions & 2 deletions lib/plugin/accelerometer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* This class provides access to device accelerometer data.
* @constructor
*/
var utils = require("phonegap/utils"),
exec = require("phonegap/exec");
var utils = require("cordova/utils"),
exec = require("cordova/exec");

// Local singleton variables.
var timers = {};
Expand Down
2 changes: 1 addition & 1 deletion lib/plugin/android/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var exec = require('phonegap/exec');
var exec = require('cordova/exec');

module.exports = {
/**
Expand Down
12 changes: 6 additions & 6 deletions lib/plugin/android/callback.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
var port = null,
token = null,
phonegap = require('phonegap'),
polling = require('phonegap/plugin/android/polling'),
cordova = require('cordova'),
polling = require('cordova/plugin/android/polling'),
callback = function() {
// Exit if shutting down app
if (phonegap.shuttingDown) {
if (cordova.shuttingDown) {
return;
}

// If polling flag was changed, start using polling from now on
if (phonegap.UsePolling) {
if (cordova.UsePolling) {
polling();
return;
}
Expand All @@ -21,7 +21,7 @@ var port = null,
if(xmlhttp.readyState === 4){

// Exit if shutting down app
if (phonegap.shuttingDown) {
if (cordova.shuttingDown) {
return;
}

Expand Down Expand Up @@ -66,7 +66,7 @@ var port = null,
// If error, revert to polling
else {
console.log("JSCallback Error: Request failed.");
phonegap.UsePolling = true;
cordova.UsePolling = true;
polling();
}
}
Expand Down
14 changes: 7 additions & 7 deletions lib/plugin/android/device.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var channel = require('phonegap/channel'),
exec = require('phonegap/exec');
var channel = require('cordova/channel'),
exec = require('cordova/exec');

/**
* This represents the mobile device, and provides properties for inspecting the model, version, UUID of the
Expand All @@ -12,7 +12,7 @@ function Device() {
this.version = null;
this.name = null;
this.uuid = null;
this.phonegap = null;
this.cordova = null;

var me = this;
this.getInfo(
Expand All @@ -22,13 +22,13 @@ function Device() {
me.version = info.version;
me.name = info.name;
me.uuid = info.uuid;
me.phonegap = info.phonegap;
channel.onPhoneGapInfoReady.fire();
me.cordova = info.cordova;
channel.onCordovaInfoReady.fire();
},
function(e) {
me.available = false;
console.log("Error initializing PhoneGap: " + e);
alert("Error initializing PhoneGap: "+e);
console.log("Error initializing Cordova: " + e);
alert("Error initializing Cordova: "+e);
});
}

Expand Down
8 changes: 4 additions & 4 deletions lib/plugin/android/polling.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
var phonegap = require('phonegap'),
var cordova = require('cordova'),
period = 50,
polling = function() {
// Exit if shutting down app
if (phonegap.shuttingDown) {
if (cordova.shuttingDown) {
return;
}

// If polling flag was changed, stop using polling from now on and switch to XHR server / callback
if (!phonegap.UsePolling) {
require('phonegap/plugin/android/callback')();
if (!cordova.UsePolling) {
require('cordova/plugin/android/callback')();
return;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/plugin/android/storage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var utils = require('phonegap/utils'),
exec = require('phonegap/exec');
var utils = require('cordova/utils'),
exec = require('cordova/exec');

var queryQueue = {};

Expand Down
16 changes: 8 additions & 8 deletions lib/plugin/battery.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* This class contains information about the current battery status.
* @constructor
*/
var phonegap = require('phonegap'),
exec = require('phonegap/exec');
var cordova = require('cordova'),
exec = require('cordova/exec');

function handlers() {
var count = function (a) {
Expand All @@ -24,9 +24,9 @@ var Battery = function() {
onUnsubscribe:this.onUnsubscribe
};
this.channels = {
batterystatus:phonegap.addWindowEventHandler("batterystatus", subscriptionEvents),
batterylow:phonegap.addWindowEventHandler("batterylow", subscriptionEvents),
batterycritical:phonegap.addWindowEventHandler("batterycritical", subscriptionEvents)
batterystatus:cordova.addWindowEventHandler("batterystatus", subscriptionEvents),
batterylow:cordova.addWindowEventHandler("batterylow", subscriptionEvents),
batterycritical:cordova.addWindowEventHandler("batterycritical", subscriptionEvents)
};
};
/**
Expand Down Expand Up @@ -64,15 +64,15 @@ Battery.prototype._status = function(info) {
var level = info.level;
if (me._level !== level || me._isPlugged !== info.isPlugged) {
// Fire batterystatus event
phonegap.fireWindowEvent("batterystatus", info);
cordova.fireWindowEvent("batterystatus", info);

// Fire low battery event
if (level === 20 || level === 5) {
if (level === 20) {
phonegap.fireWindowEvent("batterylow", info);
cordova.fireWindowEvent("batterylow", info);
}
else {
phonegap.fireWindowEvent("batterycritical", info);
cordova.fireWindowEvent("batterycritical", info);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/plugin/blackberry/DirectoryEntry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DirectoryEntry = require('phonegap/plugin/DirectoryEntry'),
FileEntry = require('phonegap/plugin/FileEntry'),
FileError = require('phonegap/plugin/FileError');
var DirectoryEntry = require('cordova/plugin/DirectoryEntry'),
FileEntry = require('cordova/plugin/FileEntry'),
FileError = require('cordova/plugin/FileError');

var BB_DirectoryEntry = {
/**
Expand Down
6 changes: 3 additions & 3 deletions lib/plugin/blackberry/Entry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var FileError = require('phonegap/plugin/FileError'),
LocalFileSystem = require('phonegap/plugin/LocalFileSystem'),
resolveLocalFileSystemURI = require('phonegap/plugin/resolveLocalFileSystemURI');
var FileError = require('cordova/plugin/FileError'),
LocalFileSystem = require('cordova/plugin/LocalFileSystem'),
resolveLocalFileSystemURI = require('cordova/plugin/resolveLocalFileSystemURI');

module.exports = {
remove:function(successCallback, errorCallback) {
Expand Down
Loading

0 comments on commit 4cb58e4

Please sign in to comment.