updating network status plugin label and updating cordova-js to latest

This commit is contained in:
Fil Maj 2012-03-28 13:47:45 -07:00
parent dfc86b1af1
commit 993fb296d6
2 changed files with 88 additions and 9 deletions

View File

@ -262,8 +262,9 @@ var cordova = {
} }
} }
}, },
// TODO: remove in 2.0.
addPlugin: function(name, obj) { addPlugin: function(name, obj) {
console.log("[DEPRECATION NOTICE] window.addPlugin and window.plugins will be removed in version 2.0.");
if (!window.plugins[name]) { if (!window.plugins[name]) {
window.plugins[name] = obj; window.plugins[name] = obj;
} }
@ -285,6 +286,7 @@ var cordova = {
/** /**
* Legacy variable for plugin support * Legacy variable for plugin support
* TODO: remove in 2.0.
*/ */
if (!window.PhoneGap) { if (!window.PhoneGap) {
window.PhoneGap = cordova; window.PhoneGap = cordova;
@ -292,6 +294,7 @@ if (!window.PhoneGap) {
/** /**
* Plugins object * Plugins object
* TODO: remove in 2.0.
*/ */
if (!window.plugins) { if (!window.plugins) {
window.plugins = {}; window.plugins = {};
@ -347,7 +350,7 @@ function include(parent, objects, clobber, merge) {
include(result, obj.children, clobber, merge); include(result, obj.children, clobber, merge);
} }
} catch(e) { } catch(e) {
alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"'); utils.alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"');
} }
}); });
} }
@ -1007,6 +1010,15 @@ module.exports = {
MediaError: { // exists natively on Android WebView on Android 4.x MediaError: { // exists natively on Android WebView on Android 4.x
path: "cordova/plugin/MediaError" path: "cordova/plugin/MediaError"
} }
},
merges: {
navigator: {
children: {
notification: {
path: 'cordova/plugin/android/notification'
}
}
}
} }
}; };
@ -3483,6 +3495,7 @@ module.exports = callback;
// file: lib/android/plugin/android/device.js // file: lib/android/plugin/android/device.js
define("cordova/plugin/android/device", function(require, exports, module) { define("cordova/plugin/android/device", function(require, exports, module) {
var channel = require('cordova/channel'), var channel = require('cordova/channel'),
utils = require('cordova/utils'),
exec = require('cordova/exec'); exec = require('cordova/exec');
/** /**
@ -3511,8 +3524,7 @@ function Device() {
}, },
function(e) { function(e) {
me.available = false; me.available = false;
console.log("Error initializing Cordova: " + e); utils.alert("[ERROR] Error initializing Cordova: " + e);
alert("Error initializing Cordova: "+e);
}); });
} }
@ -3577,6 +3589,63 @@ module.exports = new Device();
}) })
// file: lib/android/plugin/android/notification.js
define("cordova/plugin/android/notification", function(require, exports, module) {
var exec = require('cordova/exec');
/**
* Provides Android 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 ]);
},
};
})
// file: lib/android/plugin/android/polling.js // file: lib/android/plugin/android/polling.js
define("cordova/plugin/android/polling", function(require, exports, module) { define("cordova/plugin/android/polling", function(require, exports, module) {
var cordova = require('cordova'), var cordova = require('cordova'),
@ -3932,7 +4001,7 @@ var CupcakeLocalStorage = function() {
}, },
function (err) { function (err) {
alert(err.message); utils.alert(err.message);
} }
); );
this.setItem = function(key, val) { this.setItem = function(key, val) {
@ -3983,7 +4052,7 @@ var CupcakeLocalStorage = function() {
}; };
} catch(e) { } catch(e) {
alert("Database error "+e+"."); utils.alert("Database error "+e+".");
return; return;
} }
}; };
@ -4729,8 +4798,18 @@ var _self = {
Child.__super__ = Parent.prototype; Child.__super__ = Parent.prototype;
Child.prototype.constructor = Child; Child.prototype.constructor = Child;
}; };
}()) }()),
/**
* Alerts a message in any available way: alert or console.log.
*/
alert:function(msg) {
if (alert) {
alert(msg);
} else if (console && console.log) {
console.log(msg);
}
}
}; };
module.exports = _self; module.exports = _self;