diff --git a/framework/assets/js/accelerometer.js b/framework/assets/js/accelerometer.js index cc5ccc58..5c091710 100755 --- a/framework/assets/js/accelerometer.js +++ b/framework/assets/js/accelerometer.js @@ -55,7 +55,7 @@ Accelerometer.prototype.getCurrentAcceleration = function(successCallback, error } // Get acceleration - PhoneGap.execAsync(successCallback, errorCallback, "Accelerometer", "getAcceleration", []); + PhoneGap.exec(successCallback, errorCallback, "Accelerometer", "getAcceleration", []); }; /** @@ -84,10 +84,10 @@ Accelerometer.prototype.watchAcceleration = function(successCallback, errorCallb } // Make sure accelerometer timeout > frequency + 10 sec - PhoneGap.execAsync( + PhoneGap.exec( function(timeout) { if (timeout < (frequency + 10000)) { - PhoneGap.execAsync(null, null, "Accelerometer", "setTimeout", [frequency + 10000]); + PhoneGap.exec(null, null, "Accelerometer", "setTimeout", [frequency + 10000]); } }, function(e) { }, "Accelerometer", "getTimeout", []); @@ -95,7 +95,7 @@ Accelerometer.prototype.watchAcceleration = function(successCallback, errorCallb // Start watch timer var id = PhoneGap.createUUID(); navigator.accelerometer.timers[id] = setInterval(function() { - PhoneGap.execAsync(successCallback, errorCallback, "Accelerometer", "getAcceleration", []); + PhoneGap.exec(successCallback, errorCallback, "Accelerometer", "getAcceleration", []); }, (frequency ? frequency : 1)); return id; diff --git a/framework/assets/js/camera.js b/framework/assets/js/camera.js index 3eddeec0..e49777aa 100755 --- a/framework/assets/js/camera.js +++ b/framework/assets/js/camera.js @@ -85,7 +85,7 @@ Camera.prototype.getPicture = function(successCallback, errorCallback, options) if (typeof this.options.sourceType == "number") { sourceType = this.options.sourceType; } - PhoneGap.execAsync(null, null, "Camera", "takePicture", [quality, destinationType, sourceType]); + PhoneGap.exec(null, null, "Camera", "takePicture", [quality, destinationType, sourceType]); }; /** diff --git a/framework/assets/js/compass.js b/framework/assets/js/compass.js index 5e73aa7b..eefff79f 100755 --- a/framework/assets/js/compass.js +++ b/framework/assets/js/compass.js @@ -46,7 +46,7 @@ Compass.prototype.getCurrentHeading = function(successCallback, errorCallback, o } // Get heading - PhoneGap.execAsync(successCallback, errorCallback, "Compass", "getHeading", []); + PhoneGap.exec(successCallback, errorCallback, "Compass", "getHeading", []); }; /** @@ -75,10 +75,10 @@ Compass.prototype.watchHeading= function(successCallback, errorCallback, options } // Make sure compass timeout > frequency + 10 sec - PhoneGap.execAsync( + PhoneGap.exec( function(timeout) { if (timeout < (frequency + 10000)) { - PhoneGap.execAsync(null, null, "Compass", "setTimeout", [frequency + 10000]); + PhoneGap.exec(null, null, "Compass", "setTimeout", [frequency + 10000]); } }, function(e) { }, "Compass", "getTimeout", []); @@ -87,7 +87,7 @@ Compass.prototype.watchHeading= function(successCallback, errorCallback, options var id = PhoneGap.createUUID(); navigator.compass.timers[id] = setInterval( function() { - PhoneGap.execAsync(successCallback, errorCallback, "Compass", "getHeading", []); + PhoneGap.exec(successCallback, errorCallback, "Compass", "getHeading", []); }, (frequency ? frequency : 1)); return id; diff --git a/framework/assets/js/contact.js b/framework/assets/js/contact.js index 19d60e8b..974b9f65 100755 --- a/framework/assets/js/contact.js +++ b/framework/assets/js/contact.js @@ -66,13 +66,13 @@ var Contact = function(id, displayName, name, nickname, phoneNumbers, emails, ad * @param errorCB error callback */ Contact.prototype.remove = function(successCB, errorCB) { - if (this.id == null) { - var errorObj = new ContactError(); - errorObj.code = ContactError.NOT_FOUND_ERROR; - errorCB(errorObj); - } - - PhoneGap.execAsync(successCB, errorCB, "Contacts", "remove", [this.id]); + if (this.id == null) { + var errorObj = new ContactError(); + errorObj.code = ContactError.NOT_FOUND_ERROR; + errorCB(errorObj); + } + + PhoneGap.exec(successCB, errorCB, "Contacts", "remove", [this.id]); }; /** @@ -81,8 +81,8 @@ Contact.prototype.remove = function(successCB, errorCB) { * @return copy of this Contact */ Contact.prototype.clone = function() { - var clonedContact = PhoneGap.clone(this); - clonedContact.id = null; + var clonedContact = PhoneGap.clone(this); + clonedContact.id = null; return clonedContact; }; @@ -183,14 +183,14 @@ var Contacts = function() { } /** * Returns an array of Contacts matching the search criteria. -* @param fields that should be searched +* @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 */ Contacts.prototype.find = function(fields, successCB, errorCB, options) { - PhoneGap.execAsync(successCB, errorCB, "Contacts", "search", [fields, options]); + PhoneGap.exec(successCB, errorCB, "Contacts", "search", [fields, options]); }; /** @@ -201,13 +201,13 @@ Contacts.prototype.find = function(fields, successCB, errorCB, options) { * @returns new Contact object */ Contacts.prototype.create = function(properties) { - var contact = new Contact(); - for (i in properties) { - if (contact[i]!='undefined') { - contact[i]=properties[i]; - } - } - return contact; + var contact = new Contact(); + for (i in properties) { + if (contact[i]!='undefined') { + contact[i]=properties[i]; + } + } + return contact; }; /** @@ -232,7 +232,7 @@ var ContactError = function() { this.code=null; }; -/** +/** * Error codes */ ContactError.UNKNOWN_ERROR = 0; diff --git a/framework/assets/js/crypto.js b/framework/assets/js/crypto.js index 5e2f9504..d4114fdc 100755 --- a/framework/assets/js/crypto.js +++ b/framework/assets/js/crypto.js @@ -13,12 +13,12 @@ var Crypto = function() { Crypto.prototype.encrypt = function(seed, string, callback) { this.encryptWin = callback; - PhoneGap.execAsync(null, null, "Crypto", "encrypt", [seed, string]); + PhoneGap.exec(null, null, "Crypto", "encrypt", [seed, string]); }; Crypto.prototype.decrypt = function(seed, string, callback) { this.decryptWin = callback; - PhoneGap.execAsync(null, null, "Crypto", "decrypt", [seed, string]); + PhoneGap.exec(null, null, "Crypto", "decrypt", [seed, string]); }; Crypto.prototype.gotCryptedString = function(string) { diff --git a/framework/assets/js/device.js b/framework/assets/js/device.js index d1c52758..796000f0 100755 --- a/framework/assets/js/device.js +++ b/framework/assets/js/device.js @@ -57,7 +57,7 @@ Device.prototype.getInfo = function(successCallback, errorCallback) { } // Get info - PhoneGap.execAsync(successCallback, errorCallback, "Device", "getDeviceInfo", []); + PhoneGap.exec(successCallback, errorCallback, "Device", "getDeviceInfo", []); }; /* diff --git a/framework/assets/js/file.js b/framework/assets/js/file.js index 90d5aa73..888284ce 100755 --- a/framework/assets/js/file.js +++ b/framework/assets/js/file.js @@ -68,43 +68,43 @@ FileMgr.prototype.getFileBasePaths = function() { }; FileMgr.prototype.testSaveLocationExists = function(successCallback, errorCallback) { - PhoneGap.execAsync(successCallback, errorCallback, "File", "testSaveLocationExists", []); + PhoneGap.exec(successCallback, errorCallback, "File", "testSaveLocationExists", []); }; FileMgr.prototype.testFileExists = function(fileName, successCallback, errorCallback) { - PhoneGap.execAsync(successCallback, errorCallback, "File", "testFileExists", [fileName]); + PhoneGap.exec(successCallback, errorCallback, "File", "testFileExists", [fileName]); }; FileMgr.prototype.testDirectoryExists = function(dirName, successCallback, errorCallback) { - PhoneGap.execAsync(successCallback, errorCallback, "File", "testDirectoryExists", [dirName]); + PhoneGap.exec(successCallback, errorCallback, "File", "testDirectoryExists", [dirName]); }; FileMgr.prototype.createDirectory = function(dirName, successCallback, errorCallback) { - PhoneGap.execAsync(successCallback, errorCallback, "File", "createDirectory", [dirName]); + PhoneGap.exec(successCallback, errorCallback, "File", "createDirectory", [dirName]); }; FileMgr.prototype.deleteDirectory = function(dirName, successCallback, errorCallback) { - PhoneGap.execAsync(successCallback, errorCallback, "File", "deleteDirectory", [dirName]); + PhoneGap.exec(successCallback, errorCallback, "File", "deleteDirectory", [dirName]); }; FileMgr.prototype.deleteFile = function(fileName, successCallback, errorCallback) { - PhoneGap.execAsync(successCallback, errorCallback, "File", "deleteFile", [fileName]); + PhoneGap.exec(successCallback, errorCallback, "File", "deleteFile", [fileName]); }; FileMgr.prototype.getFreeDiskSpace = function(successCallback, errorCallback) { - PhoneGap.execAsync(successCallback, errorCallback, "File", "getFreeDiskSpace", []); + PhoneGap.exec(successCallback, errorCallback, "File", "getFreeDiskSpace", []); }; FileMgr.prototype.writeAsText = function(fileName, data, append, successCallback, errorCallback) { - PhoneGap.execAsync(successCallback, errorCallback, "File", "writeAsText", [fileName, data, append]); + PhoneGap.exec(successCallback, errorCallback, "File", "writeAsText", [fileName, data, append]); }; FileMgr.prototype.readAsText = function(fileName, encoding, successCallback, errorCallback) { - PhoneGap.execAsync(successCallback, errorCallback, "File", "readAsText", [fileName, encoding]); + PhoneGap.exec(successCallback, errorCallback, "File", "readAsText", [fileName, encoding]); }; FileMgr.prototype.readAsDataURL = function(fileName, successCallback, errorCallback) { - PhoneGap.execAsync(successCallback, errorCallback, "File", "readAsDataURL", [fileName]); + PhoneGap.exec(successCallback, errorCallback, "File", "readAsDataURL", [fileName]); }; PhoneGap.addConstructor(function() { diff --git a/framework/assets/js/geolocation.js b/framework/assets/js/geolocation.js index 6cee7b64..78bb5d43 100755 --- a/framework/assets/js/geolocation.js +++ b/framework/assets/js/geolocation.js @@ -65,7 +65,7 @@ Geolocation.prototype.getCurrentPosition = function(successCallback, errorCallba } } navigator._geo.listeners["global"] = {"success" : successCallback, "fail" : errorCallback }; - PhoneGap.execAsync(null, null, "Geolocation", "getCurrentLocation", [enableHighAccuracy, timeout, maximumAge]); + PhoneGap.exec(null, null, "Geolocation", "getCurrentLocation", [enableHighAccuracy, timeout, maximumAge]); } /** @@ -97,7 +97,7 @@ Geolocation.prototype.watchPosition = function(successCallback, errorCallback, o } var id = PhoneGap.createUUID(); navigator._geo.listeners[id] = {"success" : successCallback, "fail" : errorCallback }; - PhoneGap.execAsync(null, null, "Geolocation", "start", [id, enableHighAccuracy, timeout, maximumAge]); + PhoneGap.exec(null, null, "Geolocation", "start", [id, enableHighAccuracy, timeout, maximumAge]); return id; }; @@ -158,7 +158,7 @@ Geolocation.prototype.fail = function(id, code, msg) { * @param {String} id The ID of the watch returned from #watchPosition */ Geolocation.prototype.clearWatch = function(id) { - PhoneGap.execAsync(null, null, "Geolocation", "stop", [id]); + PhoneGap.exec(null, null, "Geolocation", "stop", [id]); delete navigator._geo.listeners[id]; }; diff --git a/framework/assets/js/media.js b/framework/assets/js/media.js index 6b3f10c3..eae033f6 100755 --- a/framework/assets/js/media.js +++ b/framework/assets/js/media.js @@ -142,21 +142,21 @@ MediaError.MEDIA_ERR_NONE_SUPPORTED = 4; * Start or resume playing audio file. */ Media.prototype.play = function() { - PhoneGap.execAsync(null, null, "Media", "startPlayingAudio", [this.id, this.src]); + PhoneGap.exec(null, null, "Media", "startPlayingAudio", [this.id, this.src]); }; /** * Stop playing audio file. */ Media.prototype.stop = function() { - return PhoneGap.execAsync(null, null, "Media", "stopPlayingAudio", [this.id]); + return PhoneGap.exec(null, null, "Media", "stopPlayingAudio", [this.id]); }; /** * Pause playing audio file. */ Media.prototype.pause = function() { - PhoneGap.execAsync(null, null, "Media", "pausePlayingAudio", [this.id]); + PhoneGap.exec(null, null, "Media", "pausePlayingAudio", [this.id]); }; /** @@ -175,20 +175,20 @@ Media.prototype.getDuration = function() { * @return */ Media.prototype.getCurrentPosition = function(success, fail) { - PhoneGap.execAsync(success, fail, "Media", "getCurrentPositionAudio", [this.id]); + PhoneGap.exec(success, fail, "Media", "getCurrentPositionAudio", [this.id]); }; /** * Start recording audio file. */ Media.prototype.startRecord = function() { - PhoneGap.execAsync(null, null, "Media", "startRecordingAudio", [this.id, this.src]); + PhoneGap.exec(null, null, "Media", "startRecordingAudio", [this.id, this.src]); }; /** * Stop recording audio file. */ Media.prototype.stopRecord = function() { - PhoneGap.execAsync(null, null, "Media", "stopRecordingAudio", [this.id]); + PhoneGap.exec(null, null, "Media", "stopRecordingAudio", [this.id]); }; diff --git a/framework/assets/js/network.js b/framework/assets/js/network.js index d7b70618..77090056 100755 --- a/framework/assets/js/network.js +++ b/framework/assets/js/network.js @@ -26,10 +26,10 @@ NetworkStatus.REACHABLE_VIA_WIFI_NETWORK = 2; function Network() { /** * The last known Network status. - * { hostName: string, ipAddress: string, - remoteHostStatus: int(0/1/2), internetConnectionStatus: int(0/1/2), localWiFiConnectionStatus: int (0/2) } + * { hostName: string, ipAddress: string, + remoteHostStatus: int(0/1/2), internetConnectionStatus: int(0/1/2), localWiFiConnectionStatus: int (0/2) } */ - this.lastReachability = null; + this.lastReachability = null; }; /** @@ -53,7 +53,7 @@ Network.prototype.isReachable = function(uri, callback, options) { if (options && options.isIpAddress) { isIpAddress = options.isIpAddress; } - PhoneGap.execAsync(callback, null, "Network Status", "isReachable", [uri, isIpAddress]); + PhoneGap.exec(callback, null, "Network Status", "isReachable", [uri, isIpAddress]); }; PhoneGap.addConstructor(function() { diff --git a/framework/assets/js/notification.js b/framework/assets/js/notification.js index bac5d740..0fab516c 100755 --- a/framework/assets/js/notification.js +++ b/framework/assets/js/notification.js @@ -22,7 +22,7 @@ function Notification() { Notification.prototype.alert = function(message, title, buttonLabel) { var _title = (title || "Alert"); var _buttonLabel = (buttonLabel || "OK"); - PhoneGap.execAsync(null, null, "Notification", "alert", [message,_title,_buttonLabel]); + PhoneGap.exec(null, null, "Notification", "alert", [message,_title,_buttonLabel]); }; /** @@ -36,21 +36,21 @@ Notification.prototype.alert = function(message, title, buttonLabel) { Notification.prototype.confirm = function(message, title, buttonLabels) { var _title = (title || "Confirm"); var _buttonLabels = (buttonLabels || "OK,Cancel"); - return PhoneGap.execAsync(null, null, "Notification", "confirm", [message,_title,_buttonLabels]); + return PhoneGap.exec(null, null, "Notification", "confirm", [message,_title,_buttonLabels]); }; /** * Start spinning the activity indicator on the statusbar */ Notification.prototype.activityStart = function() { - PhoneGap.execAsync(null, null, "Notification", "activityStart", ["Busy","Please wait..."]); + PhoneGap.exec(null, null, "Notification", "activityStart", ["Busy","Please wait..."]); }; /** * Stop spinning the activity indicator on the statusbar, if it's currently spinning */ Notification.prototype.activityStop = function() { - PhoneGap.execAsync(null, null, "Notification", "activityStop", []); + PhoneGap.exec(null, null, "Notification", "activityStop", []); }; /** @@ -60,7 +60,7 @@ Notification.prototype.activityStop = function() { * @param {String} message Message to display in the dialog. */ Notification.prototype.progressStart = function(title, message) { - PhoneGap.execAsync(null, null, "Notification", "progressStart", [title, message]); + PhoneGap.exec(null, null, "Notification", "progressStart", [title, message]); }; /** @@ -69,14 +69,14 @@ Notification.prototype.progressStart = function(title, message) { * @param {Number} value 0-100 */ Notification.prototype.progressValue = function(value) { - PhoneGap.execAsync(null, null, "Notification", "progressValue", [value]); + PhoneGap.exec(null, null, "Notification", "progressValue", [value]); }; /** * Close the progress dialog. */ Notification.prototype.progressStop = function() { - PhoneGap.execAsync(null, null, "Notification", "progressStop", []); + PhoneGap.exec(null, null, "Notification", "progressStop", []); }; /** @@ -95,7 +95,7 @@ Notification.prototype.blink = function(count, colour) { * @param {Integer} mills The number of milliseconds to vibrate for. */ Notification.prototype.vibrate = function(mills) { - PhoneGap.execAsync(null, null, "Notification", "vibrate", [mills]); + PhoneGap.exec(null, null, "Notification", "vibrate", [mills]); }; /** @@ -105,7 +105,7 @@ Notification.prototype.vibrate = function(mills) { * @param {Integer} count The number of beeps. */ Notification.prototype.beep = function(count) { - PhoneGap.execAsync(null, null, "Notification", "beep", [count]); + PhoneGap.exec(null, null, "Notification", "beep", [count]); }; PhoneGap.addConstructor(function() { diff --git a/framework/assets/js/phonegap.js.base b/framework/assets/js/phonegap.js.base index 4e9e88b2..c71dbfbc 100755 --- a/framework/assets/js/phonegap.js.base +++ b/framework/assets/js/phonegap.js.base @@ -376,35 +376,6 @@ PhoneGap.clone = function(obj) { PhoneGap.callbackId = 0; PhoneGap.callbacks = {}; -/** - * Execute a PhoneGap command in a queued fashion, to ensure commands do not - * execute with any race conditions, and only run when PhoneGap is ready to - * recieve them. - * @param {String} command Command to be run in PhoneGap, e.g. "ClassName.method" - * @param {String[]} [args] Zero or more arguments to pass to the method - */ -// TODO: Not used anymore, should be removed. -PhoneGap.exec = function(clazz, action, args) { - try { - var callbackId = 0; - var r = PluginManager.exec(clazz, action, callbackId, this.stringify(args), false); - eval("var v="+r+";"); - - // If status is OK, then return value back to caller - if (v.status == 0) { - return v.message; - } - - // If error, then display error - else { - console.log("Error: Status="+r.status+" Message="+v.message); - return null; - } - } catch (e) { - console.log("Error: "+e); - } -}; - /** * Execute a PhoneGap command. It is up to the native side whether this action is synch or async. * The native side can return: diff --git a/framework/assets/js/storage.js b/framework/assets/js/storage.js index 86f2975d..792dbca4 100755 --- a/framework/assets/js/storage.js +++ b/framework/assets/js/storage.js @@ -263,7 +263,7 @@ DroidDB_Tx.prototype.executeSql = function(sql, params, successCallback, errorCa query.errorCallback = errorCallback; // Call native code - PhoneGap.execAsync(null, null, "Storage", "executeSql", [sql, params, query.id]); + PhoneGap.exec(null, null, "Storage", "executeSql", [sql, params, query.id]); }; /** @@ -303,7 +303,7 @@ DroidDB_Rows.prototype.item = function(row) { * @return Database object */ DroidDB_openDatabase = function(name, version, display_name, size) { - PhoneGap.execAsync(null, null, "Storage", "openDatabase", [name, version, display_name, size]); + PhoneGap.exec(null, null, "Storage", "openDatabase", [name, version, display_name, size]); var db = new DatabaseShell(); return db; };