You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/07/29 21:38:19 UTC
[6/6] js commit: [CB-4419] Remove non-CLI platforms from cordova-js.
[CB-4419] Remove non-CLI platforms from cordova-js.
They live on in the 2.9.x branch.
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/ad723456
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/ad723456
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/ad723456
Branch: refs/heads/master
Commit: ad7234568c223ce4b5725c76f22df907ae359499
Parents: ee2c1d2
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Jul 29 15:34:24 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Jul 29 15:34:24 2013 -0400
----------------------------------------------------------------------
Gruntfile.js | 8 +-
lib/bada/exec.js | 43 --
lib/bada/platform.js | 30 -
lib/bada/plugin/accelerometer/symbols.js | 25 -
lib/bada/plugin/bada/Accelerometer.js | 56 --
lib/bada/plugin/bada/Camera.js | 79 ---
lib/bada/plugin/bada/Capture.js | 91 ---
lib/bada/plugin/bada/Compass.js | 40 --
lib/bada/plugin/bada/Contacts.js | 276 ---------
lib/bada/plugin/bada/NetworkStatus.js | 61 --
lib/bada/plugin/bada/Notification.js | 71 ---
lib/bada/plugin/bada/device.js | 104 ----
lib/bada/plugin/camera/symbols.js | 26 -
lib/bada/plugin/capture/symbols.js | 31 -
lib/bada/plugin/device/symbols.js | 25 -
lib/bada/plugin/notification/symbols.js | 24 -
lib/blackberry/exec.js | 79 ---
lib/blackberry/platform.js | 47 --
lib/blackberry/plugin/air/DirectoryEntry.js | 278 ---------
lib/blackberry/plugin/air/DirectoryReader.js | 90 ---
lib/blackberry/plugin/air/Entry.js | 375 ------------
lib/blackberry/plugin/air/File.js | 39 --
lib/blackberry/plugin/air/FileEntry.js | 80 ---
lib/blackberry/plugin/air/FileReader.js | 262 --------
lib/blackberry/plugin/air/FileTransfer.js | 159 -----
lib/blackberry/plugin/air/FileWriter.js | 269 --------
lib/blackberry/plugin/air/battery.js | 57 --
lib/blackberry/plugin/air/camera.js | 40 --
lib/blackberry/plugin/air/capture.js | 114 ----
lib/blackberry/plugin/air/device.js | 48 --
lib/blackberry/plugin/air/file/bbsymbols.js | 33 -
lib/blackberry/plugin/air/manager.js | 57 --
lib/blackberry/plugin/air/network.js | 54 --
lib/blackberry/plugin/air/platform.js | 25 -
lib/blackberry/plugin/air/requestFileSystem.js | 80 ---
.../plugin/air/resolveLocalFileSystemURI.js | 102 ----
lib/blackberry/plugin/java/Contact.js | 406 ------------
lib/blackberry/plugin/java/ContactUtils.js | 382 ------------
lib/blackberry/plugin/java/DirectoryEntry.js | 260 --------
lib/blackberry/plugin/java/Entry.js | 109 ----
lib/blackberry/plugin/java/MediaError.js | 29 -
lib/blackberry/plugin/java/app.js | 72 ---
lib/blackberry/plugin/java/app/bbsymbols.js | 24 -
lib/blackberry/plugin/java/contacts.js | 84 ---
.../plugin/java/contacts/bbsymbols.js | 25 -
lib/blackberry/plugin/java/file/bbsymbols.js | 27 -
lib/blackberry/plugin/java/manager.js | 91 ---
lib/blackberry/plugin/java/media/bbsymbols.js | 27 -
lib/blackberry/plugin/java/notification.js | 74 ---
.../plugin/java/notification/bbsymbols.js | 24 -
lib/blackberry/plugin/java/platform.js | 148 -----
lib/blackberry/plugin/qnx/compass/bbsymbols.js | 24 -
.../plugin/qnx/inappbrowser/bbsymbols.js | 24 -
lib/blackberry/plugin/webworks/accelerometer.js | 43 --
lib/blackberry/plugin/webworks/logger.js | 30 -
lib/blackberry/plugin/webworks/media.js | 189 ------
lib/blackberry/plugin/webworks/notification.js | 52 --
lib/errgen/exec.js | 105 ----
lib/errgen/platform.js | 27 -
lib/errgen/plugin/errgen/device.js | 42 --
lib/firefoxos/exec.js | 55 --
lib/firefoxos/platform.js | 26 -
lib/firefoxos/plugin/firefoxos/accelerometer.js | 41 --
lib/firefoxos/plugin/firefoxos/device.js | 39 --
lib/firefoxos/plugin/firefoxos/network.js | 28 -
lib/firefoxos/plugin/firefoxos/notification.js | 34 --
lib/firefoxos/plugin/firefoxos/orientation.js | 31 -
lib/test/blackberryexec.js | 1 -
lib/test/blackberryplatform.js | 1 -
lib/tizen/exec.js | 133 ----
lib/tizen/platform.js | 45 --
lib/tizen/plugin/device/symbols.js | 25 -
lib/tizen/plugin/file/symbols.js | 28 -
lib/tizen/plugin/globalization/symbols.js | 24 -
lib/tizen/plugin/media/symbols.js | 26 -
lib/tizen/plugin/notification/symbols.js | 25 -
lib/tizen/plugin/splashscreen/symbol.js | 24 -
lib/tizen/plugin/tizen/Accelerometer.js | 52 --
lib/tizen/plugin/tizen/Battery.js | 48 --
lib/tizen/plugin/tizen/BufferLoader.js | 107 ----
lib/tizen/plugin/tizen/Camera.js | 108 ----
lib/tizen/plugin/tizen/Compass.js | 54 --
lib/tizen/plugin/tizen/Contact.js | 548 -----------------
lib/tizen/plugin/tizen/ContactUtils.js | 361 -----------
lib/tizen/plugin/tizen/Device.js | 61 --
lib/tizen/plugin/tizen/File.js | 610 -------------------
lib/tizen/plugin/tizen/FileTransfer.js | 203 ------
lib/tizen/plugin/tizen/Globalization.js | 495 ---------------
lib/tizen/plugin/tizen/Media.js | 217 -------
lib/tizen/plugin/tizen/MediaError.js | 29 -
lib/tizen/plugin/tizen/NetworkStatus.js | 97 ---
lib/tizen/plugin/tizen/Notification.js | 168 -----
lib/tizen/plugin/tizen/SoundBeat.js | 94 ---
lib/tizen/plugin/tizen/SplashScreen.js | 43 --
lib/tizen/plugin/tizen/contacts.js | 85 ---
lib/tizen/plugin/tizen/contacts/symbols.js | 26 -
lib/tizen/plugin/tizen/manager.js | 38 --
lib/webos/exec.js | 58 --
lib/webos/platform.js | 112 ----
lib/webos/plugin/file/symbols.js | 27 -
lib/webos/plugin/notification/symbols.js | 25 -
lib/webos/plugin/webos/accelerometer.js | 52 --
lib/webos/plugin/webos/application.js | 70 ---
lib/webos/plugin/webos/camera.js | 43 --
lib/webos/plugin/webos/compass.js | 40 --
lib/webos/plugin/webos/device.js | 44 --
lib/webos/plugin/webos/file.js | 39 --
lib/webos/plugin/webos/filereader.js | 119 ----
lib/webos/plugin/webos/geolocation.js | 51 --
lib/webos/plugin/webos/keyboard.js | 65 --
lib/webos/plugin/webos/network.js | 52 --
lib/webos/plugin/webos/notification.js | 156 -----
lib/webos/plugin/webos/orientation.js | 34 --
lib/webos/plugin/webos/requestfilesystem.js | 38 --
lib/webos/plugin/webos/service.js | 71 ---
lib/webos/plugin/webos/window.js | 89 ---
test/errgen/errgen-tests.js | 86 ---
test/errgen/index.html | 75 ---
118 files changed, 1 insertion(+), 10971 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 83f2b7d..94da640 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -26,16 +26,10 @@ module.exports = function(grunt) {
pkg: grunt.file.readJSON('package.json'),
cordovajs: {
"android": {},
- "bada": {},
- "blackberry": {},
"blackberry10": {},
- "errgen": {},
- "firefoxos": {},
"ios": {},
- "osx": {},
+ "osx": {},
"test": {},
- "tizen": {},
- "webos": {},
"windows8": { useWindowsLineEndings: true },
"windowsphone": { useWindowsLineEndings: true },
},
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/exec.js
----------------------------------------------------------------------
diff --git a/lib/bada/exec.js b/lib/bada/exec.js
deleted file mode 100644
index b78ef8a..0000000
--- a/lib/bada/exec.js
+++ /dev/null
@@ -1,43 +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.
- *
-*/
-
-var plugins = {
- "Device": require('cordova/plugin/bada/device'),
- "NetworkStatus": require('cordova/plugin/bada/NetworkStatus'),
-// "Accelerometer": require('cordova/plugin/bada/Accelerometer'),
- "Notification": require('cordova/plugin/bada/Notification'),
- "Compass": require('cordova/plugin/bada/Compass'),
- "Capture": require('cordova/plugin/bada/Capture'),
- "Camera": require('cordova/plugin/bada/Camera'),
- "Contacts": require('cordova/plugin/bada/Contacts')
-};
-
-module.exports = function(success, fail, service, action, args) {
- try {
- plugins[service][action](success, fail, args);
- }
- catch(e) {
- console.log("missing exec: " + service + "." + action);
- console.log(args);
- console.log(e);
- console.log(e.stack);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/platform.js
----------------------------------------------------------------------
diff --git a/lib/bada/platform.js b/lib/bada/platform.js
deleted file mode 100644
index a6087dd..0000000
--- a/lib/bada/platform.js
+++ /dev/null
@@ -1,30 +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.
- *
-*/
-
-module.exports = {
- id: "bada",
- initialize: function() {
- var modulemapper = require('cordova/modulemapper');
-
- modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
- modulemapper.mapModules(window);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/plugin/accelerometer/symbols.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/accelerometer/symbols.js b/lib/bada/plugin/accelerometer/symbols.js
deleted file mode 100644
index c6e1ecf..0000000
--- a/lib/bada/plugin/accelerometer/symbols.js
+++ /dev/null
@@ -1,25 +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.
- *
-*/
-
-
-var modulemapper = require('cordova/modulemapper');
-
-modulemapper.defaults('cordova/plugin/Acceleration', 'Acceleration');
-modulemapper.clobbers('cordova/plugin/bada/Accelerometer', 'navigator.accelerometer');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/plugin/bada/Accelerometer.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Accelerometer.js b/lib/bada/plugin/bada/Accelerometer.js
deleted file mode 100644
index 0413ee0..0000000
--- a/lib/bada/plugin/bada/Accelerometer.js
+++ /dev/null
@@ -1,56 +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.
- *
-*/
-
-var Acceleration = require('cordova/plugin/Acceleration');
-
-module.exports = {
- getCurrentAcceleration: function(successCallback, errorCallback, options) {
- var success = function(acceleration) {
- console.log("Accelerometer:getAcceleration:success");
- var accel = new Acceleration(acceleration.xAxis, acceleration.yAxis, acceleration.zAxis);
- successCallback(accel);
- };
- var error = function(err) {
- console.log("Accelerometer:getAcceleration:error");
- if (err.code == err.TYPE_MISMATCH_ERR) {
- console.log("TYPE MISMATCH ERROR");
- }
-
- errorCallback(err);
- };
- deviceapis.accelerometer.getCurrentAcceleration(success, error);
- },
- watchAcceleration: function(successCallback, errorCallback, options) {
- var success = function(acceleration) {
- console.log("accelerometer:watchAcceleration:success");
- var accel = new Acceleration(acceleration.xAxis, acceleration.yAxis, acceleration.zAxis);
- successCallback(accel);
- };
- var error = function(err) {
- console.log("accelerometer:watchAcceleration:error");
- errorCallback(err);
- };
- return deviceapis.accelerometer.watchAcceleration(success, error);
- },
- clearWatch: function(watchID) {
- deviceapis.accelerometer.clearWatch(watchID);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/plugin/bada/Camera.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Camera.js b/lib/bada/plugin/bada/Camera.js
deleted file mode 100644
index 48feefd..0000000
--- a/lib/bada/plugin/bada/Camera.js
+++ /dev/null
@@ -1,79 +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.
- *
-*/
-
-module.exports = {
- _mainCamera: null,
- _cams: [],
- takePicture: function(success, fail, cameraOptions) {
- var dataList = [];
- dataList[0] = "type:camera";
-
- var appcontrolobject = Osp.App.AppManager.findAppControl("osp.appcontrol.provider.camera", "osp.appcontrol.operation.capture");
-
- if(appcontrolobject) {
- appcontrolobject.start(dataList, function(cbtype, appControlId, operationId, resultList) {
- var i;
- if(cbtype === "onAppControlCompleted") {
- if(resultList.length > 1 && resultList[1]) {
- success(resultList[1]);
- }
- } else {
- var error = {message: "An error occurred while capturing image", code: 0};
- fail(error);
- }
- });
- }
- },
- showPreview: function(nodeId) {
- var self = this;
- var onCreatePreviewNodeSuccess = function(previewObject) {
- var previewDiv = document.getElementById(nodeId);
- previewDiv.appendChild(previewObject);
- previewObject.style.visibility = "visible";
- };
- var error = function(e) {
- alert("An error occurred: " + e.message);
- };
-
- var success = function(cams) {
- if (cams.length > 0) {
- self._cams = cams;
- self._mainCamera = cams[0];
- self._mainCamera.createPreviewNode(onCreatePreviewNodeSuccess, error);
- return;
- }
- alert("Sorry, no cameras available.");
- };
- if(nodeId) {
- deviceapis.camera.getCameras(success, error);
- } else {
- console.log("camera::getPreview: must provide a nodeId");
- }
- },
- hidePreview: function(nodeId) {
- var preview = document.getElementById(nodeId);
- if(preview.childNodes[0]) {
- preview.removeChild(preview.childNodes[0]);
- }
- }
-
-};
-
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/plugin/bada/Capture.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Capture.js b/lib/bada/plugin/bada/Capture.js
deleted file mode 100644
index 80a6592..0000000
--- a/lib/bada/plugin/bada/Capture.js
+++ /dev/null
@@ -1,91 +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.
- *
-*/
-
-module.exports = {
- startVideoCapture: function(success, fail, options) {
- var camera = navigator.camera._mainCamera;
- camera.startVideoCapture(success, fail, options);
- },
- stopVideoCapture: function() {
- navigator.camera._mainCamera.stopVideoCapture();
- },
- captureImage2: function(success, fail, options) {
- try {
- navigator.camera._mainCamera.captureImage(success, fail, options);
- } catch(exp) {
- alert("Exception :[" + exp.code + "] " + exp.message);
- }
- },
- captureAudio: function() {
- console.log("navigator.capture.captureAudio unsupported!");
- },
- captureImage: function(success, fail, options) {
- var dataList = [];
- dataList[0] = "type:camera";
-
- var appcontrolobject = Osp.App.AppManager.findAppControl("osp.appcontrol.provider.camera", "osp.appcontrol.operation.capture");
-
- if(appcontrolobject) {
- appcontrolobject.start(dataList, function(cbtype, appControlId, operationId, resultList) {
- var i;
- var pluginResult = [];
- if(cbtype === "onAppControlCompleted") {
- for(i = 1 ; i < resultList.length ; i += 1) {
- if(resultList[i]) {
- //console.log("resultList[" + i + "] = " + resultList[i]);
- pluginResult.push( {fullPath: resultList[i]} );
- }
- }
- success(pluginResult);
- } else {
- var error = {message: "An error occurred while capturing image", code: 0};
- fail(error);
- }
- });
- }
- },
- captureVideo: function(success, fail, options) {
- var dataList = [];
- dataList[0] = "type:camcorder";
-
- var appcontrolobject = Osp.App.AppManager.findAppControl("osp.appcontrol.provider.camera", "osp.appcontrol.operation.record");
-
- if(appcontrolobject) {
- appcontrolobject.start(dataList, function(cbtype, appControlId, operationId, resultList) {
- var i;
- var mediaFiles = [];
- if(cbtype === "onAppControlCompleted") {
- for(i = 1 ; i < resultList.length ; i += 1) {
- if(resultList[i]) {
- //console.log("resultList[" + i + "] = " + resultList[i]);
- mediaFiles.push( {fullPath: resultList[i]} );
- }
- }
- success(mediaFiles);
- } else {
- var error = {message: "An error occurred while capturing image", code: 0};
- fail(error);
- }
- });
- }
-
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/plugin/bada/Compass.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Compass.js b/lib/bada/plugin/bada/Compass.js
deleted file mode 100644
index e67e1e0..0000000
--- a/lib/bada/plugin/bada/Compass.js
+++ /dev/null
@@ -1,40 +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.
- *
-*/
-
-var CompassHeading = require('cordova/plugin/CompassHeading');
-
-module.exports = {
- getHeading: function(compassSuccess, compassError, compassOptions) {
- if(deviceapis.orientation === undefined) {
- console.log("navigator.compass.getHeading", "Operation not supported!");
- return -1;
- }
- var success = function(orientation) {
- var heading = 360 - orientation.alpha;
- var compassHeading = new CompassHeading(heading, heading, 0);
- compassSuccess(compassHeading);
- };
- var error = function(error) {
- compassError(error);
- };
- deviceapis.orientation.getCurrentOrientation(success, error);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/plugin/bada/Contacts.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Contacts.js b/lib/bada/plugin/bada/Contacts.js
deleted file mode 100644
index 925121c..0000000
--- a/lib/bada/plugin/bada/Contacts.js
+++ /dev/null
@@ -1,276 +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.
- *
-*/
-
-var allowedAddressTypes = ["WORK", "HOME", "PREF"];
-
-var allowedPhoneNumberTypes = ["WORK", "PREF", "HOME", "VOICE", "FAX", "MSG", "CELL", "PAGER","BBS", "MODEM", "CAR", "ISDN","VIDEO", "PCS"];
-
-var allowedFilters = ["firstName", "lastName", "phoneticName", "nickname", "phoneNumber", "email", "address"];
-
-function _pgToWac(contact) {
- var i, j;
- var wacContact = {};
-
- if(contact.id) {
- wacContact.id = contact.id;
- }
-
- // name
- if(contact.name) {
- wacContact.firstName = contact.name.givenName;
- wacContact.lastName = contact.name.familyName;
- }
-
- // nickname
- if(contact.nickname) {
- wacContact.nicknames = [contact.nickname];
- }
-
- // phoneNumbers
- if(contact.phoneNumbers && contact.phoneNumbers.length > 0) {
- wacContact.phoneNumbers = {};
- for(i = 0, j = contact.phoneNumbers.length ; i < j ; i += 1) {
- var wacPhoneNumber = {};
- wacPhoneNumber.number = contact.phoneNumbers[i].value;
- if(allowedPhoneNumberTypes.indexOf(contact.phoneNumbers[i].type) != -1) {
- wacPhoneNumber.types = [contact.phoneNumbers[i].type];
- if(contact.phoneNumbers[i].pref === true) {
- wacPhoneNumber.types.push('PREF');
- }
- wacContact.phoneNumbers.push(wacPhoneNumber);
- }
- }
- }
-
- // emails
- if(contact.emails && contact.emails.length > 0) {
- wacContact.emails = [];
- for(i = 0, j = contact.emails.length ; i < j ; i +=1) {
- var wacEmailAddress = {};
- wacEmailAddress.email = contact.emails[i].value;
- if(allowedAddressTypes.indexOf(contact.emails[i].type) != -1) {
- wacEmailAddress.types = [contact.emails[i].type];
- if(contact.emails[i].pref === true) {
- wacEmailAddress.types.push('PREF');
- }
- wacContact.emails.push(wacEmailAddress);
- }
- }
- }
- // addresses
- if(contact.addresses && contact.addresses.length > 0) {
- wacContact.addresses = [];
- for(i = 0, j = contact.emails.length ; i < j ; i +=1) {
- var wacAddress = {};
- wacAddress.country = contact.addresses[i].country;
- wacAddress.postalCode = contact.addresses[i].postalCode;
- wacAddress.region = contact.addresses[i].region;
- wacAddress.city = contact.addresses[i].locality;
- wacAddress.streetAddress = contact.addresses[i].streetAddress;
- if(allowedAddressTypes.indexOf(contact.addresses[i].type) != -1) {
- wacAddress.types = [contact.addresses[i].type];
- if(contact.addresses[i].pref === true) {
- wacAddress.types.push('PREF');
- }
- }
- wacContact.addresses.push(wacAddress);
- }
-
- }
-
- // photos
- // can only store one photo URL
- if(contact.photos && contact.photos.length > 0) {
- wacContact.photoURL = contact.photos[0].value;
- }
-
- return wacContact;
-
-}
-
-function _wacToPg(contact) {
- var i, j;
- var pgContact = {};
-
- if(contact.id) {
- pgContact.id = contact.id;
- }
-
- // name
- if(contact.firstName || contact.lastName) {
- pgContact.name = {};
- pgContact.name.givenName = contact.firstName;
- pgContact.name.familyName = contact.lastName;
- pgContact.displayName = contact.firstName + ' ' + contact.lastName;
- }
-
- // nicknames
- if(contact.nicknames && contact.nicknames.length > 0) {
- pgContact.nickname = contact.nicknames[0];
- }
-
- // phoneNumbers
- if(contact.phoneNumbers && contact.phoneNumbers.length > 0) {
- pgContact.phoneNumbers = [];
- for(i = 0, j = contact.phoneNumbers.length ; i < j ; i += 1) {
- var pgPhoneNumber = {};
- pgPhoneNumber.value = contact.phoneNumbers[i].number;
- if(contact.phoneNumbers[i].types &&
- contact.phoneNumbers[i].types.length > 0) {
- pgPhoneNumber.type = contact.phoneNumbers[i].types[0];
- if(contact.phoneNumbers[i].types.indexOf('PREF') != -1) {
- pgPhoneNumber.pref = true;
- }
- }
- pgContact.phoneNumbers.push(pgPhoneNumber);
- }
- }
-
- // emails
- if(contact.emails && contact.emails.length > 0) {
- pgContact.emails = [];
- for(i = 0, j = contact.emails.length ; i < j ; i += 1) {
- var pgEmailAddress = {};
- pgEmailAddress.value = contact.emails[i].email;
- if(contact.emails[i].types &&
- contact.emails[i].types.length > 0) {
- pgEmailAddress.type = contact.emails[i].types[0];
- if(contact.emails[i].types.indexOf('PREF') != -1) {
- pgEmailAddress.pref = true;
- }
- }
- pgContact.emails.push(pgEmailAddress);
- }
- }
-
- // addresses
- if(contact.addresses && contact.addresses.length > 0) {
- pgContact.addresses = [];
- for(i = 0, j = contact.addresses.length ; i < j ; i += 1) {
- var pgAddress = {};
- pgAddress.country = contact.addresses[i].country;
- pgAddress.postalCode = contact.addresses[i].postalCode;
- pgAddress.region = contact.addresses[i].region;
- pgAddress.locality = contact.addresses[i].city;
- pgAddress.streetAddress = contact.addresses[i].streetAddress;
- if(contact.addresses[i].types &&
- contact.addresses[i].types.length > 0) {
- pgAddress.type = contact.addresses[i].types[0];
- if(contact.addresses[i].types.indexOf('PREF') != -1) {
- pgAddress.pref = true;
- }
- }
- pgContact.addresses.push(pgAddress);
- }
- }
-
- // photos
- // can only store one photo URL
- if(contact.photoURL) {
- pgContact.photos = [{value: contact.photoURL, type: "DEFAULT"}];
- }
-
- return pgContact;
-}
-
-function _buildWacFilters(fields, options) {
- var i, j;
- var wacFilters = {};
- for(i = 0, j = fields.length ; i < j ; i += 1) {
- if(allowedFilters.indexOf(fields[i]) != -1) {
- wacFilters[fields[i]] = options.filter;
- }
- }
-}
-
-module.exports = {
- save: function(success, fail, params) {
- var pContact = params[0];
- var gotBooks = function(books) {
- var book = books[0];
- var i, j;
- var saveSuccess = function(wContact) {
- success(_wacToPg(wContact));
- };
- var saveError = function(e) {
- fail(e);
- };
- if(pContact.id) {
- book.updateContact(saveSuccess, saveError, _pgToWac(pContact));
- } else {
- var wContact = book.createContact(_pgToWac(pContact));
- book.addContact(saveSuccess, saveError, wContact);
- }
- };
- var gotError = function(e) {
- fail(e);
- };
- deviceapis.pim.contact.getAddressBooks(gotBooks, gotError);
- },
- remove: function(success, fail, params) {
- var id = params[0];
- var gotBooks = function(books) {
- var book = books[0];
- var removeSuccess = function() {
- success();
- };
- var removeError = function(e) {
- fail(e);
- };
- var toDelete = function(contacts) {
- if(contacts.length === 1) {
- book.deleteContact(removeSuccess, removeError, contacts[0].id);
- }
- };
- if(id) {
- book.findContacts(toDelete, removeError, {id: id});
- }
- };
- var gotError = function(e) {
- fail(e);
- };
- deviceapis.pim.contact.getAddressBooks(gotBooks, gotError);
- },
- search: function(success, fail, params) {
- var fields = params[0];
- var options = params[1];
- var wacFilters = _buildWacFilters(fields, options);
- var gotBooks = function(books) {
- var book = books[0];
- var gotContacts = function(contacts) {
- var i, j;
- var pgContacts = [];
- for(i = 0, j = contacts.length ; i < j ; i += 1) {
- pgContacts.push(_wacToPg(contacts[i]));
- }
- success(pgContacts);
- };
- var gotError = function(e) {
- fail(e);
- };
- book.findContacts(gotContacts, gotError, wacFilters);
- };
- var gotError = function(e) {
- fail(e);
- };
- deviceapis.pim.contact.getAddressBooks(gotBooks, gotError);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/plugin/bada/NetworkStatus.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/NetworkStatus.js b/lib/bada/plugin/bada/NetworkStatus.js
deleted file mode 100644
index 61025f3..0000000
--- a/lib/bada/plugin/bada/NetworkStatus.js
+++ /dev/null
@@ -1,61 +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.
- *
-*/
-
-var channel = require('cordova/channel'),
- Connection = require("cordova/plugin/Connection");
-
-// We can't tell if a cell connection is 2, 3 or 4G.
-// We just know if it's connected and the signal strength
-// if it's roaming and the network name etc..so unless WiFi we default to CELL_2G
-// if connected to cellular network
-
-module.exports = {
- getConnectionInfo: function(success, fail) {
- var connectionType = Connection.NONE;
- var networkInfo = ["cellular", "wifi"]; // might be a better way to do this
- var gotConnectionInfo = function() {
- networkInfo.pop();
- if(networkInfo.length === 0) {
- channel.onCordovaConnectionReady.fire();
- success(connectionType);
- }
- };
- var error = function(e) {
- console.log("Error "+e.message);
- gotConnectionInfo();
- };
- deviceapis.devicestatus.getPropertyValue(function(value) {
- console.log("Device Cellular network status: "+value);
- if(connectionType === Connection.NONE) {
- connectionType = Connection.CELL_2G;
- }
- gotConnectionInfo();
- }, error, {aspect: "CellularNetwork", property: "signalStrength"});
-
- deviceapis.devicestatus.getPropertyValue(function(value) {
- console.log("Device WiFi network status: "+value);
- if(value == "connected") {
- connectionType = Connection.WIFI;
- }
- gotConnectionInfo();
- }, error, {aspect: "WiFiNetwork", property: "networkStatus"});
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/plugin/bada/Notification.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Notification.js b/lib/bada/plugin/bada/Notification.js
deleted file mode 100644
index ec455e9..0000000
--- a/lib/bada/plugin/bada/Notification.js
+++ /dev/null
@@ -1,71 +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.
- *
-*/
-
-module.exports = {
- alert: function(message, alertCallback, title, buttonName) {
- alert(message);
- },
- confirm: function(message, confirmCallback, title, buttonLabels) {
- alert(message);
- },
- beep: function(times, milliseconds) {
- try {
- deviceapis.deviceinteraction.stopNotify();
- if(times === 0) {
- return;
- }
- deviceapis.deviceinteraction.startNotify(function() {
- console.log("Notifying");
- },
- function(e) {
- console.log("Failed to notify: " + e);
- },
- milliseconds);
- Osp.Core.Function.delay(this.beep, 1000+milliseconds, this, times - 1, milliseconds);
- }
- catch(e) {
- console.log("Exception thrown: " + e);
- }
- },
- vibrate: function(milliseconds) {
- try {
- deviceapis.deviceinteraction.startVibrate(function() {
- console.log("Vibrating...");
- },
- function(e) {
- console.log("Failed to vibrate: " + e);
- },
- milliseconds);
- }
- catch(e) {
- console.log("Exception thrown: " + e);
- }
- },
- lightOn: function(milliseconds) {
- deviceapis.deviceinteraction.lightOn(function() {
- console.log("Lighting for "+milliseconds+" second");
- },
- function() {
- console.log("Failed to light");
- },
- milliseconds);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/plugin/bada/device.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/device.js b/lib/bada/plugin/bada/device.js
deleted file mode 100644
index 8fed9b1..0000000
--- a/lib/bada/plugin/bada/device.js
+++ /dev/null
@@ -1,104 +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.
- *
-*/
-
-var channel = require('cordova/channel'),
- utils = require('cordova/utils');
-
-function Device() {
- this.platform = null;
- this.version = null;
- this.name = null;
- this.uuid = null;
- this.cordova = null;
-
- var me = this;
-
- channel.onCordovaReady.subscribe(function() {
- me.getDeviceInfo(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) {
- me.available = false;
- utils.alert("error initializing cordova: " + e);
- });
- });
-}
-
-
-Device.prototype.getDeviceInfo = function(success, fail, args) {
- var info = deviceapis.devicestatus;
- var properties = ["name", "uuid", "os_name", "os_vendor", "os_version"];
-
- var me = this;
-
- var name = null,
- platform = null,
- uuid = null,
- os_name = null,
- os_version = null,
- os_vendor = null;
-
- var checkProperties = function() {
- properties.pop();
- if(properties.length === 0) {
- me.name = name;
- me.platform = os_vendor + " " + os_name;
- me.version = os_version;
- me.uuid = uuid;
- me.cordova = CORDOVA_JS_BUILD_LABEL;
- success(me);
- }
- };
-
- info.getPropertyValue(function(value) {
- //console.log("Device IMEI: "+value);
- uuid = value;
- checkProperties();
- }, fail, {aspect: "Device", property: "imei"});
- info.getPropertyValue(function(value) {
- //console.log("Device name: "+value);
- name = value;
- checkProperties();
- }, fail, {aspect: "Device", property: "version"});
- info.getPropertyValue(function(value) {
- //console.log("OperatingSystem name: "+value);
- os_name = value;
- checkProperties();
- }, fail, {aspect: "OperatingSystem", property: "name"});
- info.getPropertyValue(function(value) {
- //console.log("OperatingSystem version: "+value);
- os_version = value;
- checkProperties();
- }, fail, {aspect: "OperatingSystem", property: "version"});
- info.getPropertyValue(function(value) {
- //console.log("OperatingSystem vendor: "+value);
- os_vendor = value;
- checkProperties();
- }, fail, {aspect: "OperatingSystem", property: "vendor"});
-};
-
-module.exports = new Device();
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/plugin/camera/symbols.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/camera/symbols.js b/lib/bada/plugin/camera/symbols.js
deleted file mode 100644
index b071213..0000000
--- a/lib/bada/plugin/camera/symbols.js
+++ /dev/null
@@ -1,26 +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.
- *
-*/
-
-
-var modulemapper = require('cordova/modulemapper');
-
-modulemapper.defaults('cordova/plugin/bada/Camera', 'navigator.camera');
-modulemapper.defaults('cordova/plugin/CameraConstants', 'Camera');
-modulemapper.defaults('cordova/plugin/CameraPopoverOptions', 'CameraPopoverOptions');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/plugin/capture/symbols.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/capture/symbols.js b/lib/bada/plugin/capture/symbols.js
deleted file mode 100644
index e90fcec..0000000
--- a/lib/bada/plugin/capture/symbols.js
+++ /dev/null
@@ -1,31 +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.
- *
-*/
-
-var modulemapper = require('cordova/modulemapper');
-
-modulemapper.clobbers('cordova/plugin/CaptureError', 'CaptureError');
-modulemapper.clobbers('cordova/plugin/CaptureAudioOptions', 'CaptureAudioOptions');
-modulemapper.clobbers('cordova/plugin/CaptureImageOptions', 'CaptureImageOptions');
-modulemapper.clobbers('cordova/plugin/CaptureVideoOptions', 'CaptureVideoOptions');
-modulemapper.clobbers('cordova/plugin/MediaFile', 'MediaFile');
-modulemapper.clobbers('cordova/plugin/MediaFileData', 'MediaFileData');
-modulemapper.clobbers('cordova/plugin/capture', 'navigator.device.capture');
-
-modulemapper.merges('cordova/plugin/bada/Capture', 'navigator.capture');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/plugin/device/symbols.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/device/symbols.js b/lib/bada/plugin/device/symbols.js
deleted file mode 100644
index 68f91fa..0000000
--- a/lib/bada/plugin/device/symbols.js
+++ /dev/null
@@ -1,25 +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.
- *
-*/
-
-
-var modulemapper = require('cordova/modulemapper');
-
-modulemapper.clobbers('cordova/plugin/bada/device', 'device');
-modulemapper.merges('cordova/plugin/bada/device', 'navigator.device');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/bada/plugin/notification/symbols.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/notification/symbols.js b/lib/bada/plugin/notification/symbols.js
deleted file mode 100644
index 578f5df..0000000
--- a/lib/bada/plugin/notification/symbols.js
+++ /dev/null
@@ -1,24 +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.
- *
-*/
-
-
-var modulemapper = require('cordova/modulemapper');
-
-modulemapper.clobbers('cordova/plugin/bada/Notification', 'navigator.notification');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/exec.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/exec.js b/lib/blackberry/exec.js
deleted file mode 100644
index 7ef7344..0000000
--- a/lib/blackberry/exec.js
+++ /dev/null
@@ -1,79 +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.
- *
-*/
-
-var cordova = require('cordova'),
- platform = require('cordova/platform'),
- utils = require('cordova/utils');
-
-/**
- * Execute a cordova command. It is up to the native side whether this action
- * is synchronous or asynchronous. The native side can return:
- * Synchronous: PluginResult object as a JSON string
- * Asynchronous: Empty string ""
- * If async, the native side will cordova.callbackSuccess or cordova.callbackError,
- * depending upon the result of the action.
- *
- * @param {Function} success The success callback
- * @param {Function} fail The fail callback
- * @param {String} service The name of the service to use
- * @param {String} action Action to be run in cordova
- * @param {String[]} [args] Zero or more arguments to pass to the method
- */
-
-module.exports = function(success, fail, service, action, args) {
- try {
- var manager = require('cordova/plugin/' + platform.runtime() + '/manager'),
- v = manager.exec(success, fail, service, action, args);
-
- // If status is OK, then return value back to caller
- if (v.status == cordova.callbackStatus.OK) {
-
- // If there is a success callback, then call it now with returned value
- if (success) {
- try {
- success(v.message);
- }
- catch (e) {
- console.log("Error in success callback: "+cordova.callbackId+" = "+e);
- }
- }
- return v.message;
- } else if (v.status == cordova.callbackStatus.NO_RESULT) {
-
- } else {
- // If error, then display error
- console.log("Error: Status="+v.status+" Message="+v.message);
-
- // If there is a fail callback, then call it now with returned value
- if (fail) {
- try {
- fail(v.message);
- }
- catch (e) {
- console.log("Error in error callback: "+cordova.callbackId+" = "+e);
- }
- }
- return null;
- }
- } catch (e) {
- utils.alert("Error: "+e);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/platform.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/platform.js b/lib/blackberry/platform.js
deleted file mode 100644
index c6bdddd..0000000
--- a/lib/blackberry/platform.js
+++ /dev/null
@@ -1,47 +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.
- *
-*/
-
-module.exports = {
- id: "blackberry",
- runtime: function () {
- if (navigator.userAgent.indexOf("PlayBook") > -1) {
- return 'air';
- }
- else if (navigator.userAgent.indexOf("BlackBerry") > -1) {
- return 'java';
- }
- else {
- console.log("Unknown user agent?!?!? defaulting to java");
- return 'java';
- }
- },
- initialize: function() {
- var modulemapper = require('cordova/modulemapper'),
- platform = require('cordova/plugin/' + this.runtime() + '/platform');
-
- modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
- modulemapper.loadMatchingModules(new RegExp('cordova/.*' + this.runtime() + '/.*bbsymbols$'));
- modulemapper.mapModules(this.contextObj);
-
- platform.initialize();
- },
- contextObj: this // Used for testing.
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/DirectoryEntry.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/DirectoryEntry.js b/lib/blackberry/plugin/air/DirectoryEntry.js
deleted file mode 100644
index bb74f9f..0000000
--- a/lib/blackberry/plugin/air/DirectoryEntry.js
+++ /dev/null
@@ -1,278 +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.
- *
-*/
-
-var DirectoryEntry = require('cordova/plugin/DirectoryEntry'),
- DirectoryReader = require('cordova/plugin/air/DirectoryReader'),
- FileEntry = require('cordova/plugin/FileEntry'),
- FileError = require('cordova/plugin/FileError');
-
-var validFileRe = new RegExp('^[a-zA-Z][0-9a-zA-Z._ ]*$');
-
-module.exports = {
- createReader : function() {
- return new DirectoryReader(this.fullPath);
- },
- /**
- * 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));
- }
- };
-
- // invalid path
- if(!validFileRe.exec(path)){
- fail(FileError.ENCODING_ERR);
- return;
- }
-
- // 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
- // TODO this will not work on playbook - need to think how to find invalid urls
- 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 += '/';
- }
- console.log('creating dir path at: ' + 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));
- }
- };
-
- // invalid path
- if(!validFileRe.exec(path)){
- fail(FileError.ENCODING_ERR);
- return;
- }
- // 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
- var emptyBlob = blackberry.utils.stringToBlob('');
- blackberry.io.file.saveFile(path,emptyBlob);
- createEntry();
- }
- // 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
- //exec(null, null, "File", "isFileSystemRoot", [ path ]) === true
- if (false) {
- 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/cordova-js/blob/ad723456/lib/blackberry/plugin/air/DirectoryReader.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/DirectoryReader.js b/lib/blackberry/plugin/air/DirectoryReader.js
deleted file mode 100644
index fcd701e..0000000
--- a/lib/blackberry/plugin/air/DirectoryReader.js
+++ /dev/null
@@ -1,90 +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.
- *
-*/
-
-var FileError = require('cordova/plugin/FileError');
-
-/**
- * An interface that lists the files and directories in a directory.
- */
-function DirectoryReader(path) {
- this.path = path || null;
-}
-
-/**
- * Returns a list of entries from a directory.
- *
- * @param {Function} successCallback is called with a list of entries
- * @param {Function} errorCallback is called with a FileError
- */
-DirectoryReader.prototype.readEntries = function(successCallback, errorCallback) {
- var win = typeof successCallback !== 'function' ? null : function(result) {
- var retVal = [];
- for (var i=0; i<result.length; i++) {
- var entry = null;
- if (result[i].isDirectory) {
- entry = new (require('cordova/plugin/DirectoryEntry'))();
- }
- else if (result[i].isFile) {
- entry = new (require('cordova/plugin/FileEntry'))();
- }
- entry.isDirectory = result[i].isDirectory;
- entry.isFile = result[i].isFile;
- entry.name = result[i].name;
- entry.fullPath = result[i].fullPath;
- retVal.push(entry);
- }
- successCallback(retVal);
- };
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
- errorCallback(new FileError(code));
- };
-
- var theEntries = [];
- // Entry object is borked - unable to instantiate a new Entry object so just create one
- var anEntry = function (isDirectory, name, fullPath) {
- this.isDirectory = (isDirectory ? true : false);
- this.isFile = (isDirectory ? false : true);
- this.name = name;
- this.fullPath = fullPath;
- };
-
- if(blackberry.io.dir.exists(this.path)){
- var theDirectories = blackberry.io.dir.listDirectories(this.path);
- var theFiles = blackberry.io.dir.listFiles(this.path);
-
- var theDirectoriesLength = theDirectories.length;
- var theFilesLength = theFiles.length;
- for(var i=0;i<theDirectoriesLength;i++){
- theEntries.push(new anEntry(true, theDirectories[i], this.path+theDirectories[i]));
- }
-
- for(var j=0;j<theFilesLength;j++){
- theEntries.push(new anEntry(false, theFiles[j], this.path+theFiles[j]));
- }
- win(theEntries);
- }else{
- fail(FileError.NOT_FOUND_ERR);
- }
-
-
-};
-
-module.exports = DirectoryReader;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/Entry.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/Entry.js b/lib/blackberry/plugin/air/Entry.js
deleted file mode 100644
index 55a56f4..0000000
--- a/lib/blackberry/plugin/air/Entry.js
+++ /dev/null
@@ -1,375 +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.
- *
-*/
-
-var FileError = require('cordova/plugin/FileError'),
- LocalFileSystem = require('cordova/plugin/LocalFileSystem'),
- Metadata = require('cordova/plugin/Metadata'),
- resolveLocalFileSystemURI = require('cordova/plugin/air/resolveLocalFileSystemURI'),
- DirectoryEntry = require('cordova/plugin/DirectoryEntry'),
- FileEntry = require('cordova/plugin/FileEntry'),
- requestFileSystem = require('cordova/plugin/air/requestFileSystem');
-
-var recursiveCopy = function(srcDirPath, dstDirPath){
- // get all the contents (file+dir) of the dir
- var files = blackberry.io.dir.listFiles(srcDirPath);
- var dirs = blackberry.io.dir.listDirectories(srcDirPath);
-
- for(var i=0;i<files.length;i++){
- blackberry.io.file.copy(srcDirPath + '/' + files[i], dstDirPath + '/' + files[i]);
- }
-
- for(var j=0;j<dirs.length;j++){
- if(!blackberry.io.dir.exists(dstDirPath + '/' + dirs[j])){
- blackberry.io.dir.createNewDir(dstDirPath + '/' + dirs[j]);
- }
- recursiveCopy(srcDirPath + '/' + dirs[j], dstDirPath + '/' + dirs[j]);
- }
-};
-
-var validFileRe = new RegExp('^[a-zA-Z][0-9a-zA-Z._ ]*$');
-
-module.exports = {
- getMetadata : function(successCallback, errorCallback){
- var success = typeof successCallback !== 'function' ? null : function(lastModified) {
- var metadata = new Metadata(lastModified);
- successCallback(metadata);
- };
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
- errorCallback(new FileError(code));
- };
-
- if(this.isFile){
- if(blackberry.io.file.exists(this.fullPath)){
- var theFileProperties = blackberry.io.file.getFileProperties(this.fullPath);
- success(theFileProperties.dateModified);
- }
- }else{
- console.log('Unsupported for directories');
- fail(FileError.INVALID_MODIFICATION_ERR);
- }
- },
-
- setMetadata : function(successCallback, errorCallback , metadataObject){
- console.log('setMetadata is unsupported for PlayBook');
- },
-
- moveTo : function(parent, newName, successCallback, errorCallback){
- var fail = function(code) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(code));
- }
- };
- // user must specify parent Entry
- if (!parent) {
- fail(FileError.NOT_FOUND_ERR);
- return;
- }
- // source path
- var srcPath = this.fullPath,
- // entry name
- name = newName || this.name,
- success = function(entry) {
- if (entry) {
- if (typeof successCallback === 'function') {
- // create appropriate Entry object
- var result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath) : new FileEntry(entry.name, entry.fullPath);
- try {
- successCallback(result);
- }
- catch (e) {
- console.log('Error invoking callback: ' + e);
- }
- }
- }
- else {
- // no Entry object returned
- fail(FileError.NOT_FOUND_ERR);
- }
- };
-
-
- // Entry object is borked
- var theEntry = {};
- var dstPath = parent.fullPath + '/' + name;
-
- // invalid path
- if(!validFileRe.exec(name)){
- fail(FileError.ENCODING_ERR);
- return;
- }
-
- if(this.isFile){
- if(srcPath != dstPath){
- if(blackberry.io.file.exists(dstPath)){
- blackberry.io.file.deleteFile(dstPath);
- blackberry.io.file.copy(srcPath,dstPath);
- blackberry.io.file.deleteFile(srcPath);
-
- theEntry.fullPath = dstPath;
- theEntry.name = name;
- theEntry.isDirectory = false;
- theEntry.isFile = true;
- success(theEntry);
- }else if(blackberry.io.dir.exists(dstPath)){
- // destination path is a directory
- fail(FileError.INVALID_MODIFICATION_ERR);
- }else{
- // make sure the directory that we are moving to actually exists
- if(blackberry.io.dir.exists(parent.fullPath)){
- blackberry.io.file.copy(srcPath,dstPath);
- blackberry.io.file.deleteFile(srcPath);
-
- theEntry.fullPath = dstPath;
- theEntry.name = name;
- theEntry.isDirectory = false;
- theEntry.isFile = true;
- success(theEntry);
- }else{
- fail(FileError.NOT_FOUND_ERR);
- }
- }
- }else{
- // file onto itself
- fail(FileError.INVALID_MODIFICATION_ERR);
- }
- }else{
- if(srcPath != dstPath){
- if(blackberry.io.file.exists(dstPath) || srcPath == parent.fullPath){
- // destination path is either a file path or moving into parent
- fail(FileError.INVALID_MODIFICATION_ERR);
- }else{
- if(!blackberry.io.dir.exists(dstPath)){
- blackberry.io.dir.createNewDir(dstPath);
- recursiveCopy(srcPath,dstPath);
- blackberry.io.dir.deleteDirectory(srcPath, true);
- theEntry.fullPath = dstPath;
- theEntry.name = name;
- theEntry.isDirectory = true;
- theEntry.isFile = false;
- success(theEntry);
- }else{
- var numOfEntries = 0;
- numOfEntries += blackberry.io.dir.listDirectories(dstPath).length;
- numOfEntries += blackberry.io.dir.listFiles(dstPath).length;
- if(numOfEntries === 0){
- blackberry.io.dir.createNewDir(dstPath);
- recursiveCopy(srcPath,dstPath);
- blackberry.io.dir.deleteDirectory(srcPath, true);
- theEntry.fullPath = dstPath;
- theEntry.name = name;
- theEntry.isDirectory = true;
- theEntry.isFile = false;
- success(theEntry);
- }else{
- // destination directory not empty
- fail(FileError.INVALID_MODIFICATION_ERR);
- }
- }
- }
- }else{
- // directory onto itself
- fail(FileError.INVALID_MODIFICATION_ERR);
- }
- }
-
- },
-
- copyTo : function(parent, newName, successCallback, errorCallback) {
- var fail = function(code) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(code));
- }
- };
- // user must specify parent Entry
- if (!parent) {
- fail(FileError.NOT_FOUND_ERR);
- return;
- }
- // source path
- var srcPath = this.fullPath,
- // entry name
- name = newName || this.name,
- success = function(entry) {
- if (entry) {
- if (typeof successCallback === 'function') {
- // create appropriate Entry object
- var result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath) : new FileEntry(entry.name, entry.fullPath);
- try {
- successCallback(result);
- }
- catch (e) {
- console.log('Error invoking callback: ' + e);
- }
- }
- }
- else {
- // no Entry object returned
- fail(FileError.NOT_FOUND_ERR);
- }
- };
-
- // Entry object is borked
- var theEntry = {};
- var dstPath = parent.fullPath + '/' + name;
-
- // invalid path
- if(!validFileRe.exec(name)){
- fail(FileError.ENCODING_ERR);
- return;
- }
-
- if(this.isFile){
- if(srcPath != dstPath){
- if(blackberry.io.file.exists(dstPath)){
- if(blackberry.io.dir.exists(dstPath)){
- blackberry.io.file.copy(srcPath,dstPath);
-
- theEntry.fullPath = dstPath;
- theEntry.name = name;
- theEntry.isDirectory = false;
- theEntry.isFile = true;
- success(theEntry);
- }else{
- // destination directory doesn't exist
- fail(FileError.NOT_FOUND_ERR);
- }
-
- }else{
- blackberry.io.file.copy(srcPath,dstPath);
-
- theEntry.fullPath = dstPath;
- theEntry.name = name;
- theEntry.isDirectory = false;
- theEntry.isFile = true;
- success(theEntry);
- }
- }else{
- // file onto itself
- fail(FileError.INVALID_MODIFICATION_ERR);
- }
- }else{
- if(srcPath != dstPath){
- // allow back up to the root but not child dirs
- if((parent.name != "root" && dstPath.indexOf(srcPath)>=0) || blackberry.io.file.exists(dstPath)){
- // copying directory into child or is file path
- fail(FileError.INVALID_MODIFICATION_ERR);
- }else{
- recursiveCopy(srcPath, dstPath);
-
- theEntry.fullPath = dstPath;
- theEntry.name = name;
- theEntry.isDirectory = true;
- theEntry.isFile = false;
- success(theEntry);
- }
- }else{
- // directory onto itself
- fail(FileError.INVALID_MODIFICATION_ERR);
- }
- }
-
- },
-
- 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
- console.log('entry directory');
- // TODO: gotta figure out how to get root dirs on playbook -
- // getRootDirs doesn't work
- if (false) {
- 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/cordova-js/blob/ad723456/lib/blackberry/plugin/air/File.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/File.js b/lib/blackberry/plugin/air/File.js
deleted file mode 100644
index 7a3ff3e..0000000
--- a/lib/blackberry/plugin/air/File.js
+++ /dev/null
@@ -1,39 +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.
- *
-*/
-
-/**
- * Constructor.
- * name {DOMString} name of the file, without path information
- * fullPath {DOMString} the full path of the file, including the name
- * type {DOMString} mime type
- * lastModifiedDate {Date} last modified date
- * size {Number} size of the file in bytes
- */
-
-var File = function(name, fullPath, type, lastModifiedDate, size){
- this.name = name || '';
- this.fullPath = fullPath || null;
- this.type = type || null;
- this.lastModifiedDate = lastModifiedDate || null;
- this.size = size || 0;
-};
-
-module.exports = File;