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:14 UTC
[1/6] [CB-4419] Remove non-CLI platforms from cordova-js.
Updated Branches:
refs/heads/master ee2c1d20c -> ad7234568
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/notification.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/notification.js b/lib/webos/plugin/webos/notification.js
deleted file mode 100644
index 01b8b5e..0000000
--- a/lib/webos/plugin/webos/notification.js
+++ /dev/null
@@ -1,156 +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 = {
- /*
- * adds a dashboard to the WebOS app
- * @param {String} url
- * @param {String} html
- * Example:
- * navigator.notification.newDashboard("dashboard.html");
- */
- newDashboard: function(url, html) {
- var win = window.open(url, "_blank", "attributes={\"window\":\"dashboard\"}");
- html && win.document.write(html);
- win.PalmSystem.stageReady();
- },
-
- /*
- * Displays a banner notification. If specified, will send your 'response' object as data via the 'palmsystem' DOM event.
- * If no 'icon' filename is specified, will use a small version of your application icon.
- * @param {String} message
- * @param {Object} response
- * @param {String} icon
- * @param {String} soundClass class of the sound; supported classes are: "ringtones", "alerts", "alarm", "calendar", "notification"
- * @param {String} soundFile partial or full path to the sound file
- * @param {String} soundDurationMs of sound in ms
- * Example:
- * navigator.notification.showBanner('test message');
- */
- showBanner: function(message, response, icon, soundClass, soundFile, soundDurationMs) {
- response = response || {
- banner: true
- };
- PalmSystem.addBannerMessage(message, JSON.stringify(response), icon, soundClass, soundFile, soundDurationMs);
- },
-
- /**
- * Remove a banner from the banner area. The category parameter defaults to 'banner'. Will not remove
- * messages that are already displayed.
- * @param {String} category
- Value defined by the application and usually same one used in {@link showBanner}.
- It is used if you have more than one kind of banner message.
- */
- removeBannerMessage: function(category) {
- var bannerKey = category || 'banner';
- var bannerId = this.banners.get(bannerKey);
- if (bannerId) {
- try {
- PalmSystem.removeBannerMessage(bannerId);
- } catch(removeBannerException) {
- window.debug.error(removeBannerException.toString());
- }
- }
- },
-
- /*
- * Remove all pending banner messages from the banner area. Will not remove messages that are already displayed.
- */
- clearBannerMessage: function() {
- PalmSystem.clearBannerMessage();
- },
-
- /*
- * This function vibrates the device
- * @param {number} duration The duration in ms to vibrate for.
- * @param {number} intensity The intensity of the vibration
- */
- vibrate_private: function(duration, intensity) {
- //the intensity for palm is inverted; 0=high intensity, 100=low intensity
- //this is opposite from our api, so we invert
- if (isNaN(intensity) || intensity > 100 || intensity <= 0)
- intensity = 0;
- else
- intensity = 100 - intensity;
-
- // if the app id does not have the namespace "com.palm.", an error will be thrown here
- //this.vibhandle = new Mojo.Service.Request("palm://com.palm.vibrate", {
- this.vibhandle = navigator.service.Request("palm://com.palm.vibrate", {
- method: 'vibrate',
- parameters: {
- 'period': intensity,
- 'duration': duration
- }
- },
- false);
- },
-
- vibrate: function(param) {
- PalmSystem.playSoundNotification('vibrate');
- },
- /*
- * Plays the specified sound
- * @param {String} soundClass class of the sound; supported classes are: "ringtones", "alerts", "alarm", "calendar", "notification"
- * @param {String} soundFile partial or full path to the sound file
- * @param {String} soundDurationMs of sound in ms
- */
- beep: function(param) {
- PalmSystem.playSoundNotification('alerts');
- },
-
- getRootWindow: function() {
- var w = window.opener || window.rootWindow || window.top || window;
- if(!w.setTimeout) { // use this window as the root if we don't have access to the real root.
- w = window;
- }
- return w;
- },
-
- open: function(inOpener, inUrl, inName, inAttributes, inWindowInfo) {
- var url = inUrl;
- var a = inAttributes && JSON.stringify(inAttributes);
- a = "attributes=" + a;
- var i = inWindowInfo ? inWindowInfo + ", " : "";
- return inOpener.open(url, inName, i + a);
- },
-
- openWindow: function(inUrl, inName, inParams, inAttributes, inWindowInfo) {
- //var attributes = inAttributes || {};
- //attributes.window = attributes.window || "card";
- // NOTE: make the root window open all windows.
- return this.open(this.getRootWindow(), inUrl, inName || "", inAttributes, inWindowInfo);
- },
-
- alert: function(message,callback,title,buttonName) {
- var inAttributes = {};
- //inAttributes.window = "card"; // create card
- inAttributes.window = "popupalert"; // create popup
- //inAttributes.window="dashboard"; // create dashboard
- var html='<html><head><script>setTimeout(function(f){var el=window.document.getElementById("b1");console.error(el);el.addEventListener("click",function(f){window.close();},false);},500);</script></head><body>'+message+'<br/><button id="b1">'+buttonName+'</button></body></html>';
- var inName="PopupAlert";
- var inUrl="";
- var inParams={};
- var inHeight=120;
- var w = this.openWindow(inUrl, inName, inParams, inAttributes, "height=" + (inHeight || 200));
- w.document.write(html);
- w.PalmSystem.stageReady();
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/orientation.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/orientation.js b/lib/webos/plugin/webos/orientation.js
deleted file mode 100644
index 3c05d9b..0000000
--- a/lib/webos/plugin/webos/orientation.js
+++ /dev/null
@@ -1,34 +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 = {
- setOrientation: function(orientation) {
- PalmSystem.setWindowOrientation(orientation);
- },
-
- /*
- * Returns the current window orientation
- * orientation is one of 'up', 'down', 'left', 'right', or 'free'
- */
- getCurrentOrientation: function() {
- return PalmSystem.windowOrientation;
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/requestfilesystem.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/requestfilesystem.js b/lib/webos/plugin/webos/requestfilesystem.js
deleted file mode 100644
index 82a6232..0000000
--- a/lib/webos/plugin/webos/requestfilesystem.js
+++ /dev/null
@@ -1,38 +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 = function(type,size,successCallback,errorCallback) {
- console.error("requestFileSystem");
-
- var theFileSystem={};
- theFileSystem.name="webOS";
- theFileSystem.root={};
- theFileSystem.root.name="Root";
-
- theFileSystem.root.getFile=function(filename,options,successCallback,errorCallback) {
- console.error("getFile");
- if (options.create) { errorCallback(); }
- var theFile=filename;
- successCallback(theFile);
- };
-
- successCallback(theFileSystem);
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/service.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/service.js b/lib/webos/plugin/webos/service.js
deleted file mode 100644
index 55ad144..0000000
--- a/lib/webos/plugin/webos/service.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.
- *
-*/
-
-function Service() { }
-
-Service.prototype.Request = function (uri, params) {
- var req = new PalmServiceBridge();
- var url = uri + "/" + (params.method || "");
- req.url = url;
-
- this.req = req;
- this.url = url;
- this.params = params || {};
-
- this.call(params);
-
- return this;
-};
-
-Service.prototype.call = function(params) {
- var onsuccess = null;
- var onfailure = null;
- var oncomplete = null;
-
- if (typeof params.onSuccess === 'function')
- onsuccess = params.onSuccess;
-
- if (typeof params.onFailure === 'function')
- onerror = params.onFailure;
-
- if (typeof params.onComplete === 'function')
- oncomplete = params.onComplete;
-
- this.req.onservicecallback = callback;
-
- function callback(msg) {
- var response = JSON.parse(msg);
-
- if ((response.errorCode) && onfailure)
- onfailure(response);
- else if (onsuccess)
- onsuccess(response);
-
- if (oncomplete)
- oncomplete(response);
- }
-
- this.data = (typeof params.parameters === 'object') ? JSON.stringify(params.parameters) : '{}';
-
- this.req.call(this.url, this.data);
-};
-
-module.exports = new Service();
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/window.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/window.js b/lib/webos/plugin/webos/window.js
deleted file mode 100644
index dc87f55..0000000
--- a/lib/webos/plugin/webos/window.js
+++ /dev/null
@@ -1,89 +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={
- launchParams: function() {
- return JSON.parse(PalmSystem.launchParams) || {};
- },
- /*
- * This is a thin wrapper for 'window.open()' which optionally sets document contents to 'html', and calls 'PalmSystem.stageReady()'
- * on your new card. Note that this new card will not come with your framework (if any) or anything for that matter.
- * @param {String} url
- * @param {String} html
- * Example:
- * navigator.window.newCard('about:blank', '<html><body>Hello again!</body></html>');
- */
- newCard: function(url, html) {
- var win = window.open(url || "");
- if (html)
- win.document.write(html);
- win.PalmSystem.stageReady();
- },
-
- /*
- * Enable or disable full screen display (full screen removes the app menu bar and the rounded corners of the screen).
- * @param {Boolean} state
- * Example:
- * navigator.window.setFullScreen(true);
- */
- setFullScreen: function(state) {
- // valid state values are: true or false
- PalmSystem.enableFullScreenMode(state);
- },
-
- /*
- * used to set the window properties of the WebOS app
- * @param {Object} props
- * Example:
- * private method used by other member functions - ideally we shouldn't call this method
- */
- setWindowProperties: function(inWindow, inProps) {
- if(arguments.length==1) {
- inProps = inWindow;
- inWindow = window;
- }
- if(inWindow.PalmSystem) {
- inWindow.PalmSystem.setWindowProperties(inProps);
- }
- },
-
- /*
- * Enable or disable screen timeout. When enabled, the device screen will not dim. This is useful for navigation, clocks or other "dock" apps.
- * @param {Boolean} state
- * Example:
- * navigator.window.blockScreenTimeout(true);
- */
- blockScreenTimeout: function(state) {
- navigator.windowProperties.blockScreenTimeout = state;
- this.setWindowProperties();
- },
-
- /*
- * Sets the lightbar to be a little dimmer for screen locked notifications.
- * @param {Boolean} state
- * Example:
- * navigator.window.setSubtleLightbar(true);
- */
- setSubtleLightbar: function(state) {
- navigator.windowProperties.setSubtleLightbar = state;
- this.setWindowProperties();
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/test/errgen/errgen-tests.js
----------------------------------------------------------------------
diff --git a/test/errgen/errgen-tests.js b/test/errgen/errgen-tests.js
deleted file mode 100644
index bc8ad27..0000000
--- a/test/errgen/errgen-tests.js
+++ /dev/null
@@ -1,86 +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.
- */
-
-document.addEventListener("deviceready", onDeviceReady, false)
-
-//------------------------------------------------------------------------------
-function onDeviceReady() {
- // TODO: finish the tests
- testAccelerometer();
- testCamera();
- // testCapture();
- testCompass();
- // testConnection();
- // testContacts();
- // testDevice();
- // testEvents();
- // testFile();
- // testGeolocation();
- // testMedia();
- // testNotification();
- // testStorage();
-}
-
-//------------------------------------------------------------------------------
-function getSuccessCB(api) {
- return function() {
- reportFailure(api + ": success callback was called")
- }
-}
-
-//------------------------------------------------------------------------------
-function getErrorCB(api) {
- return function() {
- reportSuccess(api + ": error callback was called")
- }
-}
-
-//------------------------------------------------------------------------------
-function testAPI(receiver, func, args) {
- if (!args) args = []
- var origArgs = args
-
- var receiverObject = eval(receiver)
- var funcObject = receiverObject[func]
-
- var api = receiver + "." + func
-
- args.unshift(getErrorCB(api))
- args.unshift(getSuccessCB(api))
-
- return funcObject.apply(receiverObject, origArgs)
-}
-
-//------------------------------------------------------------------------------
-function testAccelerometer() {
- testAPI("navigator.accelerometer", "getCurrentAcceleration")
-}
-
-//------------------------------------------------------------------------------
-function testCamera() {
- testAPI("navigator.camera", "getPicture", [{
- quality: 100,
- destinationType: Camera.DestinationType.FILE_URI
- }])
-}
-
-//------------------------------------------------------------------------------
-function testCompass() {
- testAPI("navigator.compass", "getCurrentHeading")
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/test/errgen/index.html
----------------------------------------------------------------------
diff --git a/test/errgen/index.html b/test/errgen/index.html
deleted file mode 100644
index cee46ba..0000000
--- a/test/errgen/index.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<!doctype html>
-
-<!--
- * 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.
--->
-
-<html>
-
-<!-- ======================================================================= -->
-<head>
-<title>cordova errgen tester</title>
-<script src='../../pkg/cordova.errgen.js'></script>
-<script src='./errgen-tests.js'></script>
-</head>
-
-<!-- ======================================================================= -->
-<body>
-<h1>cordova errgen tester</h1>
-<div id="results">
-</div>
-</body>
-
-<!-- ======================================================================= -->
-<script>
-var resultsDiv = null
-
-function reportSuccess(message) {
- reportMessage(message, 'success')
-}
-
-function reportFailure(message) {
- reportMessage(message, 'failure')
-}
-
-function reportMessage(message, className) {
- var div = document.createElement('div')
- div.className = className
- div.innerText = message
-
- if (!resultsDiv) {
- resultsDiv = document.getElementById('results')
- }
-
- resultsDiv.appendChild(div)
-}
-</script>
-
-<!-- ======================================================================= -->
-<style>
-.success {
- color: green;
-}
-.failure {
- color: red;
-}
-
-</style>
-
-<!-- ======================================================================= -->
-</html>
\ No newline at end of file
[6/6] js commit: [CB-4419] Remove non-CLI platforms from cordova-js.
Posted by ag...@apache.org.
[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;
[3/6] [CB-4419] Remove non-CLI platforms from cordova-js.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/globalization/symbols.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/globalization/symbols.js b/lib/tizen/plugin/globalization/symbols.js
deleted file mode 100644
index 24e6ac5..0000000
--- a/lib/tizen/plugin/globalization/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.merges('cordova/plugin/tizen/Globalization', 'navigator.globalization');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/media/symbols.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/media/symbols.js b/lib/tizen/plugin/media/symbols.js
deleted file mode 100644
index 2e12a08..0000000
--- a/lib/tizen/plugin/media/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/Media', 'Media');
-modulemapper.defaults('cordova/plugin/MediaError', 'MediaError');
-modulemapper.merges('cordova/plugin/tizen/MediaError', 'MediaError');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/notification/symbols.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/notification/symbols.js b/lib/tizen/plugin/notification/symbols.js
deleted file mode 100644
index 92fafbf..0000000
--- a/lib/tizen/plugin/notification/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/notification', 'navigator.notification');
-modulemapper.merges('cordova/plugin/tizen/Notification', 'navigator.notification');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/splashscreen/symbol.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/splashscreen/symbol.js b/lib/tizen/plugin/splashscreen/symbol.js
deleted file mode 100644
index 54eac85..0000000
--- a/lib/tizen/plugin/splashscreen/symbol.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.merges('cordova/plugin/tizen/SplashScreen', 'splashscreen'); /// is that correct??? PPL
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/Accelerometer.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Accelerometer.js b/lib/tizen/plugin/tizen/Accelerometer.js
deleted file mode 100644
index 18be54c..0000000
--- a/lib/tizen/plugin/tizen/Accelerometer.js
+++ /dev/null
@@ -1,52 +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 accelerometerCallback = null;
-
-//console.log("TIZEN ACCELEROMETER START");
-
-module.exports = {
-
- start: function (successCallback, errorCallback) {
-
- if (accelerometerCallback) {
- window.removeEventListener("devicemotion", accelerometerCallback, true);
- }
-
- accelerometerCallback = function (motion) {
- successCallback({
- x: motion.accelerationIncludingGravity.x,
- y: motion.accelerationIncludingGravity.y,
- z: motion.accelerationIncludingGravity.z,
- timestamp: new Date().getTime()
- });
- };
- window.addEventListener("devicemotion", accelerometerCallback, true);
- },
-
- stop: function (successCallback, errorCallback) {
- window.removeEventListener("devicemotion", accelerometerCallback, true);
- accelerometerCallback = null;
- }
-};
-
-//console.log("TIZEN ACCELEROMETER END");
-
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/Battery.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Battery.js b/lib/tizen/plugin/tizen/Battery.js
deleted file mode 100644
index f380a6d..0000000
--- a/lib/tizen/plugin/tizen/Battery.js
+++ /dev/null
@@ -1,48 +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.
- *
-*/
-
-/*global tizen:false */
-var batteryListenerId = null;
-
-//console.log("TIZEN BATTERY START");
-
-module.exports = {
- start: function(successCallback, errorCallback) {
- var batterySuccessCallback = function(power) {
- if (successCallback) {
- successCallback({level: Math.round(power.level * 100), isPlugged: power.isCharging});
- }
- };
-
- if (batteryListenerId === null) {
- batteryListenerId = tizen.systeminfo.addPropertyValueChangeListener("BATTERY", batterySuccessCallback);
- }
-
- tizen.systeminfo.getPropertyValue("BATTERY", batterySuccessCallback, errorCallback);
- },
-
- stop: function(successCallback, errorCallback) {
- tizen.systeminfo.removePropertyValueChangeListener(batteryListenerId);
- batteryListenerId = null;
- }
-};
-
-//console.log("TIZEN BATTERY END");
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/BufferLoader.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/BufferLoader.js b/lib/tizen/plugin/tizen/BufferLoader.js
deleted file mode 100644
index f4f7909..0000000
--- a/lib/tizen/plugin/tizen/BufferLoader.js
+++ /dev/null
@@ -1,107 +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.
- *
-*/
-
-/*
- * Buffer Loader Object
- * This class provides a sound buffer for one or more sounds
- * held in a local file located by an url
- *
- * uses W3C Web Audio API
- *
- * @constructor
- *
- * @param {AudioContext} audio context object
- * @param {Array} urlList, array of url for sound to load
- * @param {function} callback , called after buffer was loaded
- *
- */
-
-function BufferLoader(context, urlList, callback) {
- this.context = context;
- this.urlList = urlList;
- this.onload = callback;
- this.bufferList = [];
- this.loadCount = 0;
-}
-
-/*
- * This method loads a sound into a buffer
- * @param {Array} urlList, array of url for sound to load
- * @param {Number} index, buffer index in the array where to load the url sound
- *
- */
-
-BufferLoader.prototype.loadBuffer = function(url, index) {
- // Load buffer asynchronously
- var request = null,
- loader = null;
-
- request = new XMLHttpRequest();
-
- if (request === null) {
- console.log ("BufferLoader.prototype.loadBuffer, cannot allocate XML http request");
- return;
- }
-
- request.open("GET", url, true);
- request.responseType = "arraybuffer";
-
- loader = this;
-
- request.onload = function() {
- // Asynchronously decode the audio file data in request.response
- loader.context.decodeAudioData(
- request.response,
- function(buffer) {
- if (!buffer) {
- console.log ("BufferLoader.prototype.loadBuffer,error decoding file data: " + url);
- return;
- }
-
- loader.bufferList[index] = buffer;
-
- if (++loader.loadCount == loader.urlList.length) {
- loader.onload(loader.bufferList);
- }
- }
- );
- };
-
- request.onerror = function() {
- console.log ("BufferLoader.prototype.loadBuffer, XHR error");
- };
-
- request.send();
-};
-
-/*
- * This method loads all sounds identified by their url
- * and that where given to the object constructor
- *
- */
-
-BufferLoader.prototype.load = function() {
- for (var i = 0; i < this.urlList.length; ++i) {
- this.loadBuffer(this.urlList[i], i);
- }
-};
-
-module.exports = BufferLoader;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/Camera.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Camera.js b/lib/tizen/plugin/tizen/Camera.js
deleted file mode 100644
index 76918f0..0000000
--- a/lib/tizen/plugin/tizen/Camera.js
+++ /dev/null
@@ -1,108 +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.
- *
-*/
-
-/*global tizen:false */
-var Camera = require('cordova/plugin/CameraConstants');
-
-
-//console.log("TIZEN CAMERA START");
-
-function cameraMakeReplyCallback(successCallback, errorCallback) {
- return {
- onsuccess: function(reply) {
- if (reply.length > 0) {
- successCallback(reply[0].value);
- }
- else {
- errorCallback('Picture selection aborted');
- }
- },
- onfail: function() {
- console.log('The service launch failed');
- }
- };
-}
-
-module.exports = {
- takePicture: function(successCallback, errorCallback, args) {
- var destinationType = args[1],
- sourceType = args[2],
- encodingType = args[5],
- mediaType = args[6];
-
- // Not supported
- /*
- quality = args[0]
- targetWidth = args[3]
- targetHeight = args[4]
- allowEdit = args[7]
- correctOrientation = args[8]
- saveToPhotoAlbum = args[9]
- */
-
- if (destinationType !== Camera.DestinationType.FILE_URI) {
- errorCallback('DestinationType not supported');
- return;
- }
-
- if (mediaType !== Camera.MediaType.PICTURE) {
- errorCallback('MediaType not supported');
- return;
- }
-
- var mimeType;
- if (encodingType === Camera.EncodingType.JPEG) {
- mimeType = 'image/jpeg';
- }
- else if (encodingType === Camera.EncodingType.PNG) {
- mimeType = 'image/png';
- }
- else {
- mimeType = 'image/*';
- }
-
- var serviceId;
- if (sourceType === Camera.PictureSourceType.CAMERA) {
- serviceId = 'http://tizen.org/appcontrol/operation/create_content';
- }
- else {
- serviceId = 'http://tizen.org/appcontrol/operation/pick';
- }
-
- var serviceControl = new tizen.ApplicationControl(
- serviceId,
- null,
- mimeType,
- null);
-
- tizen.application.launchAppControl(
- serviceControl,
- null,
- null,
- function(error) {
- errorCallback(error.message);
- },
- cameraMakeReplyCallback(successCallback, errorCallback)
- );
- }
-};
-
-//console.log("TIZEN CAMERA END");
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/Compass.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Compass.js b/lib/tizen/plugin/tizen/Compass.js
deleted file mode 100644
index 4f7c634..0000000
--- a/lib/tizen/plugin/tizen/Compass.js
+++ /dev/null
@@ -1,54 +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 CompassError = require('cordova/plugin/CompassError'),
- CompassHeading = require('cordova/plugin/CompassHeading');
-
-var compassCallback = null,
- compassReady = false;
-
-//console.log("TIZEN COMPASS START");
-
-module.exports = {
- getHeading: function(successCallback, errorCallback) {
-
- if (window.DeviceOrientationEvent !== undefined) {
-
- compassCallback = function (orientation) {
- var heading = 360 - orientation.alpha;
-
- if (compassReady) {
- successCallback( new CompassHeading (heading, heading, 0, 0));
- window.removeEventListener("deviceorientation", compassCallback, true);
- }
- compassReady = true;
- };
- compassReady = false; // workaround invalid first event value returned by WRT
- window.addEventListener("deviceorientation", compassCallback, true);
- }
- else {
- errorCallback(CompassError.COMPASS_NOT_SUPPORTED);
- }
- }
-};
-
-//console.log("TIZEN COMPASS END");
-
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/Contact.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Contact.js b/lib/tizen/plugin/tizen/Contact.js
deleted file mode 100644
index 439893d..0000000
--- a/lib/tizen/plugin/tizen/Contact.js
+++ /dev/null
@@ -1,548 +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.
- *
-*/
-
-/*global tizen:false */
-//var ContactError = require('cordova/plugin/ContactError'),
-// ContactUtils = require('cordova/plugin/tizen/ContactUtils');
-
-// ------------------
-// Utility functions
-// ------------------
-
-
-//console.log("TIZEN CONTACT START");
-
-
-var ContactError = require('cordova/plugin/ContactError'),
- ContactUtils = require('cordova/plugin/tizen/ContactUtils'),
- utils = require('cordova/utils'),
- exec = require('cordova/exec');
-
-
-
-/**
- * Retrieves a Tizen Contact object from the device by its unique id.
- *
- * @param uid
- * Unique id of the contact on the device
- * @return {tizen.Contact} Tizen Contact object or null if contact with
- * specified id is not found
- */
-var findByUniqueId = function(id) {
-
- if (!id) {
- return null;
- }
-
- var tizenContact = null;
-
- tizen.contact.getDefaultAddressBook().find(
- function _successCallback(contacts){
- tizenContact = contacts[0];
- },
- function _errorCallback(error){
- console.log("tizen find error " + error);
- },
- new tizen.AttributeFilter('id', 'CONTAINS', id),
- new tizen.SortMode('id', 'ASC'));
-
- return tizenContact || null;
-};
-
-
-var traceTizenContact = function (tizenContact) {
- console.log("cordova/plugin/tizen/Contact/ tizenContact.id " + tizenContact.id);
- console.log("cordova/plugin/tizen/Contact/ tizenContact.personId " + tizenContact.personId); //Tizen 2.0
- console.log("cordova/plugin/tizen/Contact/ tizenContact.addressBookId " + tizenContact.addressBookId); //Tizen 2.0
-
- console.log("cordova/plugin/tizen/Contact/ tizenContact.lastUpdated " + tizenContact.lastUpdated);
- console.log("cordova/plugin/tizen/Contact/ tizenContact.isFavorite " + tizenContact.isFavorite); //Tizen 2.0
-
- console.log("cordova/plugin/tizen/Contact/ tizenContact.name " + tizenContact.name);
-
- //console.log("cordova/plugin/tizen/Contact/ tizenContact.account " + tizenContact.account); //Tizen 2.0
-
- console.log("cordova/plugin/tizen/Contact/ tizenContact.addresses " + tizenContact.addresses);
- console.log("cordova/plugin/tizen/Contact/ tizenContact.photoURI " + tizenContact.photoURI);
- console.log("cordova/plugin/tizen/Contact/ tizenContact.phoneNumbers " + tizenContact.phoneNumbers);
- console.log("cordova/plugin/tizen/Contact/ tizenContact.emails " + tizenContact.emails);
- console.log("cordova/plugin/tizen/Contact/ tizenContact.birthday " + tizenContact.birthday);
- console.log("cordova/plugin/tizen/Contact/ tizenContact.anniversaries " + tizenContact.anniversaries);
-
- console.log("cordova/plugin/tizen/Contact/ tizenContact.organizations " + tizenContact.organizations);
- console.log("cordova/plugin/tizen/Contact/ tizenContact.notes " + tizenContact.notes);
- console.log("cordova/plugin/tizen/Contact/ tizenContact.urls " + tizenContact.urls);
- console.log("cordova/plugin/tizen/Contact/ tizenContact.ringtonesURI " + tizenContact.ringtonesURI);
- console.log("cordova/plugin/tizen/Contact/ tizenContact.groupIds " + tizenContact.groupIds); //Tizen 2.0
-
- //console.log("cordova/plugin/tizen/Contact/ tizenContact.categories " + tizenContact.categories); //Tizen 2.0
-};
-
-
-/**
- * Creates a Tizen contact object from the W3C Contact object and persists
- * it to device storage.
- *
- * @param {Contact}
- * contact The contact to save
- * @return a new contact object with all properties set
- */
-var saveToDevice = function(contact) {
-
- if (!contact) {
- return;
- }
-
- var tizenContact = null;
- var update = false;
- var i = 0;
-
- // if the underlying Tizen Contact object already exists, retrieve it for
- // update
- if (contact.id) {
- // we must attempt to retrieve the BlackBerry contact from the device
- // because this may be an update operation
- tizenContact = findByUniqueId(contact.id);
- }
-
- // contact not found on device, create a new one
- if (!tizenContact) {
- tizenContact = new tizen.Contact();
- }
- // update the existing contact
- else {
- update = true;
- }
-
- // NOTE: The user may be working with a partial Contact object, because only
- // user-specified Contact fields are returned from a find operation (blame
- // the W3C spec). If this is an update to an existing Contact, we don't
- // want to clear an attribute from the contact database simply because the
- // Contact object that the user passed in contains a null value for that
- // attribute. So we only copy the non-null Contact attributes to the
- // Tizen Contact object before saving.
- //
- // This means that a user must explicitly set a Contact attribute to a
- // non-null value in order to update it in the contact database.
- //
- traceTizenContact (tizenContact);
-
- // display name
- if (contact.displayName !== null) {
- if (tizenContact.name === null) {
- tizenContact.name = new tizen.ContactName();
- }
- if (tizenContact.name !== null) {
- tizenContact.name.displayName = contact.displayName;
- }
- }
-
- // name
- if (contact.name !== null) {
- if (contact.name.givenName) {
- if (tizenContact.name === null) {
- tizenContact.name = new tizen.ContactName();
- }
- if (tizenContact.name !== null) {
- tizenContact.name.firstName = contact.name.givenName;
- }
- }
-
- if (contact.name.middleName) {
- if (tizenContact.name === null) {
- tizenContact.name = new tizen.ContactName();
- }
- if (tizenContact.name !== null) {
- tizenContact.name.middleName = contact.name.middleName;
- }
- }
-
- if (contact.name.familyName) {
- if (tizenContact.name === null) {
- tizenContact.name = new tizen.ContactName();
- }
- if (tizenContact.name !== null) {
- tizenContact.name.lastName = contact.name.familyName;
- }
- }
-
- if (contact.name.honorificPrefix) {
- if (tizenContact.name === null) {
- tizenContact.name = new tizen.ContactName();
- }
- if (tizenContact.name !== null) {
- tizenContact.name.prefix = contact.name.honorificPrefix;
- }
- }
-
- //Tizen 2.0
- if (contact.name.honorificSuffix) {
- if (tizenContact.name === null) {
- tizenContact.name = new tizen.ContactName();
- }
- if (tizenContact.name !== null) {
- tizenContact.name.suffix = contact.name.honorificSuffix;
- }
- }
- }
-
- // nickname
- if (contact.nickname !== null) {
- if (tizenContact.name === null) {
- tizenContact.name = new tizen.ContactName();
- }
- if (tizenContact.name !== null) {
- if (!utils.isArray(tizenContact.name.nicknames))
- {
- tizenContact.name.nicknames = [];
- }
- tizenContact.name.nicknames[0] = contact.nickname;
- }
- }
- else {
- tizenContact.name.nicknames = [];
- }
-
- // notes - Tizen 2.0 (was note)
- if (contact.note !== null) {
- if (tizenContact.notes === null) {
- tizenContact.notes = [];
- }
- if (tizenContact.notes !== null) {
- tizenContact.notes[0] = contact.note;
- }
- }
-
- // photos
- if (contact.photos && utils.isArray(contact.photos) && contact.photos.length > 0) {
- tizenContact.photoURI = contact.photos[0];
- }
-
- if (utils.isDate(contact.birthday)) {
- if (!utils.isDate(tizenContact.birthday)) {
- tizenContact.birthday = new Date();
- }
- if (utils.isDate(tizenContact.birthday)) {
- tizenContact.birthday.setDate(contact.birthday.getDate());
- }
- }
-
- // Tizen supports many email addresses
- if (utils.isArray(contact.emails)) {
-
- // if this is an update, re initialize email addresses
- if (update) {
- // doit on effacer sur un update??????
- }
-
- // copy the first three email addresses found
- var emails = [];
- for (i = 0; i < contact.emails.length; i += 1) {
- var emailTypes = [];
-
- emailTypes.push (contact.emails[i].type);
-
- emails.push(
- new tizen.ContactEmailAddress(
- contact.emails[i].value,
- emailTypes,
- contact.emails[i].pref)); //Tizen 2.0
-
- }
- tizenContact.emails = emails.length > 0 ? emails : [];
- }
- else {
- tizenContact.emails = [];
- }
-
- // Tizen supports many phone numbers
- // copy into appropriate fields based on type
- if (utils.isArray(contact.phoneNumbers)) {
- // if this is an update, re-initialize phone numbers
- if (update) {
- }
-
- var phoneNumbers = [];
-
- for (i = 0; i < contact.phoneNumbers.length; i += 1) {
-
- if (!contact.phoneNumbers[i]) {
- continue;
- }
-
- var phoneTypes = [];
- phoneTypes.push (contact.phoneNumbers[i].type);
-
-
- phoneNumbers.push(
- new tizen.ContactPhoneNumber(
- contact.phoneNumbers[i].value,
- phoneTypes,
- contact.phoneNumbers[i].pref) //Tizen 2.0
- );
- }
-
- tizenContact.phoneNumbers = phoneNumbers.length > 0 ? phoneNumbers : [];
- }
- else {
- tizenContact.phoneNumbers = [];
- }
-
- if (utils.isArray(contact.addresses)) {
- // if this is an update, re-initialize addresses
- if (update) {
- }
-
- var addresses = [],
- address = null;
-
- for ( i = 0; i < contact.addresses.length; i += 1) {
- address = contact.addresses[i];
-
- if (!address) {
- continue;
- }
-
- var addressTypes = [];
- addressTypes.push (address.type);
-
- addresses.push(
- new tizen.ContactAddress({
- country: address.country,
- region : address.region,
- city: address.locality,
- streetAddress: address.streetAddress,
- additionalInformation: "",
- postalCode: address.postalCode,
- isDefault: address.pref, //Tizen 2.0
- types : addressTypes
- })
- );
-
- }
- tizenContact.addresses = addresses.length > 0 ? addresses : [];
-
- }
- else{
- tizenContact.addresses = [];
- }
-
- // copy first url found to cordova 'urls' field
- if (utils.isArray(contact.urls)) {
- // if this is an update, re-initialize web page
- if (update) {
- }
-
- var url = null,
- urls = [];
-
- for ( i = 0; i< contact.urls.length; i+= 1) {
- url = contact.urls[i];
-
- if (!url || !url.value) {
- continue;
- }
-
- urls.push( new tizen.ContactWebSite(url.value, url.type));
- }
- tizenContact.urls = urls.length > 0 ? urls : [];
- }
- else{
- tizenContact.urls = [];
- }
-
- if (utils.isArray(contact.organizations) && contact.organizations.length > 0 ) {
- // if this is an update, re-initialize addresses
- if (update) {
- }
-
- var organizations = [],
- organization = null;
-
- for ( i = 0; i < contact.organizations.length; i += 1) {
- organization = contact.organizations[i];
-
- if (!organization) {
- continue;
- }
-
- organizations.push(
- new tizen.ContactOrganization({
- name: organization.name,
- department: organization.department,
- title: organization.title,
- role: "",
- logoURI: ""
- }));
-
- }
- tizenContact.organizations = organizations.length > 0 ? organizations : [];
-
- }
- else{
- tizenContact.organizations = [];
- }
-
- // categories
- if (utils.isArray(contact.categories)) {
- tizenContact.categories = [];
-
- var category = null;
-
- for (i = 0; i < contact.categories.length; i += 1) {
- category = contact.categories[i];
-
- if (typeof category === "string") {
- tizenContact.categories.push(category);
- }
- }
- }
- else {
- tizenContact.categories = [];
- }
-
- // save to device
- // in tizen contact mean update or add
- // later we might use addBatch and updateBatch
- if (update){
- tizen.contact.getDefaultAddressBook().update(tizenContact);
- }
- else {
- tizen.contact.getDefaultAddressBook().add(tizenContact);
- }
-
- // Use the fully populated Tizen contact object to create a
- // corresponding W3C contact object.
- return ContactUtils.createContact(tizenContact, [ "*" ]);
-};
-
-
-/**
- * Creates a Tizen ContactAddress object from a W3C ContactAddress.
- *
- * @return {tizen.ContactAddress} a Tizen ContactAddress object
- */
-var createTizenAddress = function(address) {
-
- var type = null,
- pref = null,
- typesAr = [];
-
- if (address === null) {
- return null;
- }
-
- var tizenAddress = new tizen.ContactAddress();
-
- if (tizenAddress === null) {
- return null;
- }
-
- typesAr.push(address.type);
-
- tizenAddress.country = address.country || "";
- tizenAddress.region = address.region || "";
- tizenAddress.city = address.locality || "";
- tizenAddress.streetAddress = address.streetAddress || "";
- tizenAddress.postalCode = address.postalCode || "";
- tizenAddress.isDefault = address.pref || false; //Tizen SDK 2.0
- tizenAddress.types = typesAr || "";
-
- return tizenAddress;
-};
-
-module.exports = {
- /**
- * Persists contact to device storage.
- */
-
- save : function(successCB, failCB) {
-
- try {
- // save the contact and store it's unique id
- var fullContact = saveToDevice(this);
-
- this.id = fullContact.id;
-
- // This contact object may only have a subset of properties
- // if the save was an update of an existing contact. This is
- // because the existing contact was likely retrieved using a
- // subset of properties, so only those properties were set in the
- // object. For this reason, invoke success with the contact object
- // returned by saveToDevice since it is fully populated.
-
- if (typeof successCB === 'function') {
- successCB(fullContact);
- }
- }
- catch (error) {
- console.log('Error saving contact: ' + error);
-
- if (typeof failCB === 'function') {
- failCB (new ContactError(ContactError.UNKNOWN_ERROR));
- }
- }
- },
-
- /**
- * Removes contact from device storage.
- *
- * @param successCB
- * successCB callback
- * @param failCB
- * error callback
- */
- remove : function (successCB, failCB) {
-
- try {
- // retrieve contact from device by id
- var tizenContact = null;
-
- if (this.id) {
- tizenContact = findByUniqueId(this.id);
- }
-
- // if contact was found, remove it
- if (tizenContact) {
- //var addressBook = tizen.contact.getDefaultAddressBook();
- var addressBook = tizen.contact.getAddressBook(tizenContact.addressBookId); //Tizen SDk 2.0
-
- addressBook.remove(tizenContact.id);
-
- if (typeof success === 'function') {
- successCB(this);
- }
- }
- // attempting to remove a contact that hasn't been saved
- else if (typeof failCB === 'function') {
- failCB(new ContactError(ContactError.UNKNOWN_ERROR));
- }
- }
- catch (error) {
- console.log('Error removing contact ' + this.id + ": " + error);
- if (typeof failCB === 'function') {
- failCB(new ContactError(ContactError.UNKNOWN_ERROR));
- }
- }
- }
-};
-
-//console.log("TIZEN CONTACT END");
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/ContactUtils.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/ContactUtils.js b/lib/tizen/plugin/tizen/ContactUtils.js
deleted file mode 100644
index 042dc80..0000000
--- a/lib/tizen/plugin/tizen/ContactUtils.js
+++ /dev/null
@@ -1,361 +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.
- *
-*/
-
-/*global tizen:false */
-var Contact = require('cordova/plugin/Contact'),
- ContactAddress = require('cordova/plugin/ContactAddress'),
- ContactName = require('cordova/plugin/ContactName'),
- ContactField = require('cordova/plugin/ContactField'),
- ContactOrganization = require('cordova/plugin/ContactOrganization'),
- utils = require('cordova/utils');
-
-
-
-/**
- * Mappings for each Contact field that may be used in a find operation. Maps
- * W3C Contact fields to one or more fields in a Tizen contact object.
- *
- * Example: user searches with a filter on the Contact 'name' field:
- *
- * <code>Contacts.find(['name'], onSuccess, onFail, {filter:'Bob'});</code>
- *
- * The 'name' field does not exist in a Tizen contact. Instead, a filter
- * expression will be built to search the Tizen contacts using the
- * Tizen 'title', 'firstName' and 'lastName' fields.
- */
-var fieldMappings = {
- "id" : ["id"],
- "displayName" : ["name.displayName"],
- "nickname": ["name.nicknames"],
- "name" : [ "name.prefix", "name.firstName", "name.lastName" ],
- "phoneNumbers" : ["phoneNumbers.number","phoneNumbers.types"],
- "emails" : ["emails.types", "emails.email"],
- "addresses" : ["addresses.country","addresses.region","addresses.city","addresses.streetAddress","addresses.postalCode","addresses.country","addresses.types"],
- "organizations" : ["organizations.name","organizations.department","organizations.office", "organizations.title"],
- "birthday" : ["birthday"],
- "note" : ["notes"],
- "photos" : ["photoURI"],
- "urls" : ["urls.url", "urls.type"]
-};
-
-/*
- * Build an array of all of the valid W3C Contact fields. This is used to
- * substitute all the fields when ["*"] is specified.
- */
-var allFields = [];
-
-(function() {
- for ( var key in fieldMappings) {
- allFields.push(key);
- }
-})();
-
-/**
- * Create a W3C ContactAddress object from a Tizen Address object
- *
- * @param {String}
- * type the type of address (e.g. work, home)
- * @param {tizen.ContactAddress}
- * tizenAddress a Tizen Address object
- * @return {ContactAddress} a contact address object or null if the specified
- * address is null
- */
-var createContactAddress = function(type, tizenAddress) {
- if (!tizenAddress) {
- return null;
- }
-
- var isDefault = tizenAddress.isDefault; //Tizen 2.0
- var streetAddress = tizenAddress.streetAddress;
- var locality = tizenAddress.city || "";
- var region = tizenAddress.region || "";
- var postalCode = tizenAddress.postalCode || "";
- var country = tizenAddress.country || "";
-
- //TODO improve formatted
- var formatted = streetAddress + ", " + locality + ", " + region + ", " + postalCode + ", " + country;
-
- var contact = new ContactAddress(isDefault, type, formatted, streetAddress, locality, region, postalCode, country);
-
- return contact;
-};
-
-module.exports = {
- /**
- * Builds Tizen filter expressions for contact search using the
- * contact fields and search filter provided.
- *
- * @param {String[]}
- * fields Array of Contact fields to search
- * @param {String}
- * filter Filter, or search string
- * @param {Boolean}
- * multiple, one contacts or more wanted as result
- * @return filter expression or null if fields is empty or filter is null or
- * empty
- */
-
- buildFilterExpression: function(fields, filter) {
- // ensure filter exists
- if (!filter || filter === "") {
- return null;
- }
-
- if ((fields.length === 1) && (fields[0] === "*")) {
- // Cordova enhancement to allow fields value of ["*"] to indicate
- // all supported fields.
- fields = allFields;
- }
-
- // build a filter expression using all Contact fields provided
- var compositeFilter = null,
- attributeFilter = null,
- filterExpression = null,
- matchFlag = "CONTAINS",
- matchValue = filter,
- attributesArray = [];
-
- if (fields && utils.isArray(fields)) {
-
- for ( var field in fields) {
-
- if (!fields[field]) {
- continue;
- }
-
- // retrieve Tizen contact fields that map Cordova fields specified
- // (tizenFields is a string or an array of strings)
- var tizenFields = fieldMappings[fields[field]];
-
- if (!tizenFields) {
- // does something maps
- continue;
- }
-
- // construct the filter expression using the Tizen fields
- for ( var index in tizenFields) {
- attributeFilter = new tizen.AttributeFilter(tizenFields[index], matchFlag, matchValue);
- if (attributeFilter !== null) {
- attributesArray.push(attributeFilter);
- }
- }
- }
- }
-
- // fulfill Tizen find attribute as a single or a composite attribute
- if (attributesArray.length == 1 ) {
- filterExpression = attributeFilter[0];
- } else if (attributesArray.length > 1) {
- // combine the filters as a Union
- filterExpression = new tizen.CompositeFilter("UNION", attributesArray);
- } else {
- filterExpression = null;
- }
-
- return filterExpression;
- },
-
-
- /**
- * Creates a Contact object from a Tizen Contact object, copying only
- * the fields specified.
- *
- * This is intended as a privately used function but it is made globally
- * available so that a Contact.save can convert a BlackBerry contact object
- * into its W3C equivalent.
- *
- * @param {tizen.Contact}
- * tizenContact Tizen Contact object
- * @param {String[]}
- * fields array of contact fields that should be copied
- * @return {Contact} a contact object containing the specified fields or
- * null if the specified contact is null
- */
- createContact: function(tizenContact, fields) {
-
- if (!tizenContact) {
- return null;
- }
-
- // construct a new contact object
- // always copy the contact id and displayName fields
- var contact = new Contact(tizenContact.id, tizenContact.name.displayName);
-
-
- // nothing to do
- if (!fields || !(utils.isArray(fields)) || fields.length === 0) {
- return contact;
- }
- else if (fields.length === 1 && fields[0] === "*") {
- // Cordova enhancement to allow fields value of ["*"] to indicate
- // all supported fields.
- fields = allFields;
- }
-
- // add the fields specified
- for ( var key in fields) {
-
- var field = fields[key],
- index = 0;
-
- if (!field) {
- continue;
- }
-
- // name
- if (field.indexOf('name') === 0) {
- var formattedName = (tizenContact.name.prefix || "");
-
- if (tizenContact.name.firstName) {
- formattedName += ' ';
- formattedName += (tizenContact.name.firstName || "");
- }
-
- if (tizenContact.name.middleName) {
- formattedName += ' ';
- formattedName += (tizenContact.name.middleName || "");
- }
-
- if (tizenContact.name.lastName) {
- formattedName += ' ';
- formattedName += (tizenContact.name.lastName || "");
- }
-
- //Tizen 2.0
- if (tizenContact.name.suffix) {
- formattedName += ' ';
- formattedName += (tizenContact.name.suffix || "");
- }
-
- contact.name = new ContactName(
- formattedName,
- tizenContact.name.lastName,
- tizenContact.name.firstName,
- tizenContact.name.middleName,
- tizenContact.name.prefix,
- tizenContact.name.suffix);
- }
- // phoneNumbers - Tizen 2.0
- else if (field.indexOf('phoneNumbers') === 0) {
- var phoneNumbers = [];
-
- for (index = 0 ; index < tizenContact.phoneNumbers.length ; ++index) {
- phoneNumbers.push(
- new ContactField(
- 'PHONE',
- tizenContact.phoneNumbers[index].number,
- tizenContact.phoneNumbers[index].isDefault));
- }
- contact.phoneNumbers = phoneNumbers.length > 0 ? phoneNumbers : null;
- }
-
- // emails - Tizen 2.0
- else if (field.indexOf('emails') === 0) {
- var emails = [];
-
- for (index = 0 ; index < tizenContact.emails.length ; ++index) {
- emails.push(
- new ContactField(
- 'EMAILS',
- tizenContact.emails[index].email,
- tizenContact.emails[index].isDefault));
- }
- contact.emails = emails.length > 0 ? emails : null;
- }
-
- // addresses Tizen 2.0
- else if (field.indexOf('addresses') === 0) {
- var addresses = [];
-
- for (index = 0 ; index < tizenContact.addresses.length ; ++index) {
- addresses.push(
- new ContactAddress(
- tizenContact.addresses[index].isDefault,
- tizenContact.addresses[index].types[0] ? tizenContact.addresses[index].types[0] : "HOME",
- null,
- tizenContact.addresses[index].streetAddress,
- tizenContact.addresses[index].city,
- tizenContact.addresses[index].region,
- tizenContact.addresses[index].postalCode,
- tizenContact.addresses[index].country ));
- }
- contact.addresses = addresses.length > 0 ? addresses : null;
- }
-
- // birthday
- else if (field.indexOf('birthday') === 0) {
- if (utils.isDate(tizenContact.birthday)) {
- contact.birthday = tizenContact.birthday;
- }
- }
-
- // note only one in Tizen Contact -Tizen 2.0
- else if (field.indexOf('note') === 0) {
- if (tizenContact.notes) {
- contact.note = tizenContact.notes[0];
- }
- }
- // organizations Tizen 2.0
- else if (field.indexOf('organizations') === 0) {
- var organizations = [];
-
- for (index = 0 ; index < tizenContact.organizations.length ; ++index) {
- organizations.push(
- new ContactOrganization(
- (index === 0),
- 'WORK',
- tizenContact.organizations.name,
- tizenContact.organizations.department,
- tizenContact.organizations.jobTitle));
- }
- contact.organizations = organizations.length > 0 ? organizations : null;
- }
-
- // urls
- else if (field.indexOf('urls') === 0) {
- var urls = [];
-
- if (tizenContact.urls) {
- for (index = 0 ; index <tizenContact.urls.length ; ++index) {
- urls.push(
- new ContactField(
- tizenContact.urls[index].type,
- tizenContact.urls[index].url,
- (index === 0)));
- }
- }
- contact.urls = urls.length > 0 ? urls : null;
- }
-
- // photos
- else if (field.indexOf('photos') === 0) {
- var photos = [];
-
- if (tizenContact.photoURI) {
- photos.push(new ContactField('URI', tizenContact.photoURI, true));
- }
- contact.photos = photos.length > 0 ? photos : null;
- }
- }
-
- return contact;
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/Device.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Device.js b/lib/tizen/plugin/tizen/Device.js
deleted file mode 100644
index fb8a694..0000000
--- a/lib/tizen/plugin/tizen/Device.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.
- *
-*/
-
-/*global tizen:false */
-var channel = require('cordova/channel');
-
-//console.log("TIZEN DEVICE START");
-
-
-// Tell cordova channel to wait on the CordovaInfoReady event - PPL is this useful?
-//channel.waitForInitialization('onCordovaInfoReady');
-
-function Device() {
- this.version = "2.1.0"; // waiting a working solution of the security error see below
- this.uuid = null;
- this.model = null;
- this.cordova = CORDOVA_JS_BUILD_LABEL;
- this.platform = "Tizen";
-
- this.getDeviceInfo();
-}
-
-Device.prototype.getDeviceInfo = function() {
-
- var deviceCapabilities = tizen.systeminfo.getCapabilities();
-
- if (deviceCapabilities) {
- this.version = deviceCapabilities.platformVersion; // requires http://tizen.org/privilege/system (and not "systeminfo") privileges to be added in config.xml
- this.uuid = deviceCapabilities.duid;
- this.model = deviceCapabilities.platformName;
-
- channel.onCordovaInfoReady.fire();
- }
- else {
- console.log("error initializing cordova: ");
- }
-};
-
-module.exports = new Device();
-
-//console.log("TIZEN DEVICE END");
-
-
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/File.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/File.js b/lib/tizen/plugin/tizen/File.js
deleted file mode 100644
index e99eef3..0000000
--- a/lib/tizen/plugin/tizen/File.js
+++ /dev/null
@@ -1,610 +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.
- *
-*/
-
-
-//console.log("TIZEN FILE START");
-
-/*global WebKitBlobBuilder:false */
-var FileError = require('cordova/plugin/FileError'),
- DirectoryEntry = require('cordova/plugin/DirectoryEntry'),
- FileEntry = require('cordova/plugin/FileEntry'),
- File = require('cordova/plugin/File'),
- FileSystem = require('cordova/plugin/FileSystem');
-
-var nativeRequestFileSystem = window.webkitRequestFileSystem,
- nativeResolveLocalFileSystemURI = window.webkitResolveLocalFileSystemURL,
- NativeFileReader = window.FileReader;
-
-function getFileSystemName(nativeFs) {
- return (nativeFs.name.indexOf("Persistent") != -1) ? "persistent" : "temporary";
-}
-
-function makeEntry(entry) {
- if (entry.isDirectory) {
- return new DirectoryEntry(entry.name, decodeURI(entry.toURL()));
- }
- else {
- return new FileEntry(entry.name, decodeURI(entry.toURL()));
- }
-}
-
-module.exports = {
- /* common/equestFileSystem.js, args = [type, size] */
- requestFileSystem: function(successCallback, errorCallback, args) {
- var type = args[0],
- size = args[1];
-
- nativeRequestFileSystem(
- type,
- size,
- function(nativeFs) {
- successCallback(new FileSystem(getFileSystemName(nativeFs), makeEntry(nativeFs.root)));
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* common/resolveLocalFileSystemURI.js, args= [uri] */
- resolveLocalFileSystemURI: function(successCallback, errorCallback, args) {
- var uri = args[0];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(entry) {
- successCallback(makeEntry(entry));
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* common/DirectoryReader.js, args = [this.path] */
- readEntries: function(successCallback, errorCallback, args) {
- var uri = args[0];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(dirEntry) {
- var reader = dirEntry.createReader();
-
- reader.readEntries(
- function(entries) {
- var retVal = [];
- for (var i = 0; i < entries.length; i++) {
- retVal.push(makeEntry(entries[i]));
- }
- successCallback(retVal);
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* common/Entry.js , args = [this.fullPath] */
- getMetadata: function(successCallback, errorCallback, args) {
- var uri = args[0];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(entry) {
- entry.getMetadata(
- function(metaData) {
- successCallback(metaData.modificationTime);
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* args = [this.fullPath, metadataObject] */
- /* PPL to be implemented */
- setMetadata: function(successCallback, errorCallback, args) {
- var uri = args[0],
- metadata = args[1];
-
- if (errorCallback) {
- errorCallback(FileError.NOT_FOUND_ERR);
- }
- },
-
-
- /* args = [srcPath, parent.fullPath, name] */
- moveTo: function(successCallback, errorCallback, args) {
- var srcUri = args[0],
- parentUri = args[1],
- name = args[2];
-
- nativeResolveLocalFileSystemURI(
- srcUri,
- function(source) {
- nativeResolveLocalFileSystemURI(
- parentUri,
- function(parent) {
- source.moveTo(
- parent,
- name,
- function(entry) {
- successCallback(makeEntry(entry));
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* args = [srcPath, parent.fullPath, name] */
- copyTo: function(successCallback, errorCallback, args) {
- var srcUri = args[0],
- parentUri = args[1],
- name = args[2];
-
- nativeResolveLocalFileSystemURI(
- srcUri,
- function(source) {
- nativeResolveLocalFileSystemURI(
- parentUri,
- function(parent) {
- source.copyTo(
- parent,
- name,
- function(entry) {
- successCallback(makeEntry(entry));
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
-
- /* args = [this.fullPath] */
- remove: function(successCallback, errorCallback, args) {
- var uri = args[0];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(entry) {
- if (entry.fullPath === "/") {
- errorCallback(FileError.NO_MODIFICATION_ALLOWED_ERR);
- }
- else {
- entry.remove(
- successCallback,
- function(error) {
- errorCallback(error.code);
- }
- );
- }
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* args = [this.fullPath] */
- getParent: function(successCallback, errorCallback, args) {
- var uri = args[0];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(entry) {
- entry.getParent(
- function(entry) {
- successCallback(makeEntry(entry));
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* common/FileEntry.js, args = [this.fullPath] */
- getFileMetadata: function(successCallback, errorCallback, args) {
- var uri = args[0];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(entry) {
- entry.file(
- function(file) {
- var retVal = new File(file.name, decodeURI(entry.toURL()), file.type, file.lastModifiedDate, file.size);
- successCallback(retVal);
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* common/DirectoryEntry.js , args = [this.fullPath, path, options] */
- getDirectory: function(successCallback, errorCallback, args) {
- var uri = args[0],
- path = args[1],
- options = args[2];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(entry) {
- entry.getDirectory(
- path,
- options,
- function(entry) {
- successCallback(makeEntry(entry));
- },
- function(error) {
- if (error.code === FileError.INVALID_MODIFICATION_ERR) {
- if (options.create) {
- errorCallback(FileError.PATH_EXISTS_ERR);
- }
- else {
- errorCallback(FileError.ENCODING_ERR);
- }
- }
- else {
- errorCallback(error.code);
- }
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* args = [this.fullPath] */
- removeRecursively: function(successCallback, errorCallback, args) {
- var uri = args[0];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(entry) {
- if (entry.fullPath === "/") {
- errorCallback(FileError.NO_MODIFICATION_ALLOWED_ERR);
- }
- else {
- entry.removeRecursively(
- successCallback,
- function(error) {
- errorCallback(error.code);
- }
- );
- }
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* args = [this.fullPath, path, options] */
- getFile: function(successCallback, errorCallback, args) {
- var uri = args[0],
- path = args[1],
- options = args[2];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(entry) {
- entry.getFile(
- path,
- options,
- function(entry) {
- successCallback(makeEntry(entry));
- },
- function(error) {
- if (error.code === FileError.INVALID_MODIFICATION_ERR) {
- if (options.create) {
- errorCallback(FileError.PATH_EXISTS_ERR);
- }
- else {
- errorCallback(FileError.ENCODING_ERR);
- }
- }
- else {
- errorCallback(error.code);
- }
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* common/FileReader.js, args = execArgs = [filepath, encoding, file.start, file.end] */
- readAsText: function(successCallback, errorCallback, args) {
- var uri = args[0],
- encoding = args[1];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(entry) {
- var onLoadEnd = function(evt) {
- if (!evt.target.error) {
- successCallback(evt.target.result);
- }
- },
- onError = function(evt) {
- errorCallback(evt.target.error.code);
- };
-
- var reader = new NativeFileReader();
-
- reader.onloadend = onLoadEnd;
- reader.onerror = onError;
-
- entry.file(
- function(file) {
- reader.readAsText(file, encoding);
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* args = execArgs = [this._fileName, file.start, file.end] */
- readAsDataURL: function(successCallback, errorCallback, args) {
- var uri = args[0];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(entry) {
- var onLoadEnd = function(evt) {
- if (!evt.target.error) {
- successCallback(evt.target.result);
- }
- },
- onError = function(evt) {
- errorCallback(evt.target.error.code);
- };
-
- var reader = new NativeFileReader();
-
- reader.onloadend = onLoadEnd;
- reader.onerror = onError;
- entry.file(
- function(file) {
- reader.readAsDataURL(file);
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* args = execArgs = [this._fileName, file.start, file.end] */
- /* PPL, to Be implemented , for now it is pasted from readAsText...*/
- readAsBinaryString: function(successCallback, errorCallback, args) {
- var uri = args[0];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(entry) {
- var onLoadEnd = function(evt) {
- if (!evt.target.error) {
- successCallback(evt.target.result);
- }
- },
- onError = function(evt) {
- errorCallback(evt.target.error.code);
- };
-
- var reader = new NativeFileReader();
-
- reader.onloadend = onLoadEnd;
- reader.onerror = onError;
-
- entry.file(
- function(file) {
- reader.readAsDataURL(file);
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
-
- /* args = execArgs = [this._fileName, file.start, file.end] */
- /* PPL, to Be implemented , for now it is pasted from readAsText...*/
- readAsArrayBuffer: function(successCallback, errorCallback, args) {
- var uri = args[0];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(entry) {
- var onLoadEnd = function(evt) {
- if (!evt.target.error) {
- successCallback(evt.target.result);
- }
- },
- onError = function(evt) {
- errorCallback(evt.target.error.code);
- };
-
- var reader = new NativeFileReader();
-
- reader.onloadend = onLoadEnd;
- reader.onerror = onError;
-
- entry.file(
- function(file) {
- reader.readAsDataURL(file);
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* common/FileWriter.js, args = [this.fileName, text, this.position] */
- write: function(successCallback, errorCallback, args) {
- var uri = args[0],
- text = args[1],
- position = args[2];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(entry) {
- var onWriteEnd = function(evt) {
- if(!evt.target.error) {
- successCallback(evt.target.position - position);
- }
- else {
- errorCallback(evt.target.error.code);
- }
- },
- onError = function(evt) {
- errorCallback(evt.target.error.code);
- };
-
- entry.createWriter(
- function(writer) {
- var blob = new WebKitBlobBuilder();
- blob.append(text);
-
- writer.onwriteend = onWriteEnd;
- writer.onerror = onError;
-
- writer.seek(position);
- writer.write(blob.getBlob('text/plain'));
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
-
- /* args = [this.fileName, size] */
- truncate: function(successCallback, errorCallback, args) {
- var uri = args[0],
- size = args[1];
-
- nativeResolveLocalFileSystemURI(
- uri,
- function(entry) {
- var onWriteEnd = function(evt) {
- if(!evt.target.error) {
- successCallback(evt.target.length);
- }
- else {
- errorCallback(evt.target.error.code);
- }
- },
- onError = function(evt) {
- errorCallback(evt.target.error.code);
- };
-
- entry.createWriter(
- function(writer) {
- writer.onwriteend = onWriteEnd;
- writer.onerror = onError;
- writer.truncate(size);
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- },
- function(error) {
- errorCallback(error.code);
- }
- );
- }
-};
-
-
-//console.log("TIZEN FILE END");
-
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/FileTransfer.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/FileTransfer.js b/lib/tizen/plugin/tizen/FileTransfer.js
deleted file mode 100644
index 8a59254..0000000
--- a/lib/tizen/plugin/tizen/FileTransfer.js
+++ /dev/null
@@ -1,203 +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.
- *
-*/
-
-/*global WebKitBlobBuilder:false */
-
-
-//console.log("TIZEN FILE TRANSFER START");
-
-var FileEntry = require('cordova/plugin/FileEntry'),
- FileTransferError = require('cordova/plugin/FileTransferError'),
- FileUploadResult = require('cordova/plugin/FileUploadResult');
-
-var nativeResolveLocalFileSystemURI = window.webkitResolveLocalFileSystemURL;
-
-function getParentPath(filePath) {
- var pos = filePath.lastIndexOf('/');
- return filePath.substring(0, pos + 1);
-}
-
-function getFileName(filePath) {
- var pos = filePath.lastIndexOf('/');
- return filePath.substring(pos + 1);
-}
-
-module.exports = {
- /* common/FileTransfer.js, args = [filePath, server, fileKey, fileName, mimeType, params, trustAllHosts, chunkedMode, headers, this._id, httpMethod] */
- upload: function(successCallback, errorCallback, args) {
- var filePath = args[0],
- server = args[1],
- fileKey = args[2],
- fileName = args[3],
- mimeType = args[4],
- params = args[5],
- /*trustAllHosts = args[6],*/
- chunkedMode = args[7];
-
- nativeResolveLocalFileSystemURI(
- filePath,
- function(entry) {
- entry.file(
- function(file) {
- function uploadFile(blobFile) {
- var fd = new FormData();
-
- fd.append(fileKey, blobFile, fileName);
-
- for (var prop in params) {
- if(params.hasOwnProperty(prop)) {
- fd.append(prop, params[prop]);
- }
- }
- var xhr = new XMLHttpRequest();
-
- xhr.open("POST", server);
-
- xhr.onload = function(evt) {
- if (xhr.status == 200) {
- var result = new FileUploadResult();
- result.bytesSent = file.size;
- result.responseCode = xhr.status;
- result.response = xhr.response;
- successCallback(result);
- }
- else if (xhr.status == 404) {
- errorCallback(new FileTransferError(FileTransferError.INVALID_URL_ERR));
- }
- else {
- errorCallback(new FileTransferError(FileTransferError.CONNECTION_ERR));
- }
- };
-
- xhr.ontimeout = function(evt) {
- errorCallback(new FileTransferError(FileTransferError.CONNECTION_ERR));
- };
-
- xhr.send(fd);
- }
-
- var bytesPerChunk;
-
- if (chunkedMode === true) {
- bytesPerChunk = 1024 * 1024; // 1MB chunk sizes.
- }
- else {
- bytesPerChunk = file.size;
- }
- var start = 0;
- var end = bytesPerChunk;
- while (start < file.size) {
- var chunk = file.webkitSlice(start, end, mimeType);
- uploadFile(chunk);
- start = end;
- end = start + bytesPerChunk;
- }
- },
- function(error) {
- errorCallback(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
- }
- );
- },
- function(error) {
- errorCallback(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
- }
- );
- },
-
- /* args = [source, target, trustAllHosts, this._id, headers] */
- download: function(successCallback, errorCallback, args) {
- var url = args[0],
- filePath = args[1];
-
- var xhr = new XMLHttpRequest();
-
- function writeFile(fileEntry) {
- fileEntry.createWriter(
- function(writer) {
- writer.onwriteend = function(evt) {
- if (!evt.target.error) {
- successCallback(new FileEntry(fileEntry.name, fileEntry.toURL()));
- } else {
- errorCallback(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
- }
- };
-
- writer.onerror = function(evt) {
- errorCallback(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
- };
-
- var builder = new WebKitBlobBuilder();
- builder.append(xhr.response);
-
- var blob = builder.getBlob();
- writer.write(blob);
- },
- function(error) {
- errorCallback(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
- }
- );
- }
-
- xhr.onreadystatechange = function () {
- if (xhr.readyState == xhr.DONE) {
- if (xhr.status == 200 && xhr.response) {
- nativeResolveLocalFileSystemURI(
- getParentPath(filePath),
- function(dir) {
- dir.getFile(
- getFileName(filePath),
- {create: true},
- writeFile,
- function(error) {
- errorCallback(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
- }
- );
- },
- function(error) {
- errorCallback(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
- }
- );
- }
- else if (xhr.status == 404) {
- errorCallback(new FileTransferError(FileTransferError.INVALID_URL_ERR));
- }
- else {
- errorCallback(new FileTransferError(FileTransferError.CONNECTION_ERR));
- }
- }
- };
-
- xhr.open("GET", url, true);
- xhr.responseType = "arraybuffer";
- xhr.send();
- },
-
-
- /* args = [this._id]); */
- abort: function(successCallback, errorCallback, args) {
- errorCallback(FileTransferError.ABORT_ERR);
- }
-
-};
-
-
-//console.log("TIZEN FILE TRANSFER END");
-
[4/6] [CB-4419] Remove non-CLI platforms from cordova-js.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/DirectoryEntry.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/DirectoryEntry.js b/lib/blackberry/plugin/java/DirectoryEntry.js
deleted file mode 100644
index d8315d2..0000000
--- a/lib/blackberry/plugin/java/DirectoryEntry.js
+++ /dev/null
@@ -1,260 +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'),
- FileEntry = require('cordova/plugin/FileEntry'),
- FileError = require('cordova/plugin/FileError'),
- exec = require('cordova/exec');
-
-module.exports = {
- /**
- * Creates or looks up a directory; override for BlackBerry.
- *
- * @param path
- * {DOMString} either a relative or absolute path from this
- * directory in which to look up or create a directory
- * @param options
- * {Flags} options to create or exclusively create the directory
- * @param successCallback
- * {Function} called with the new DirectoryEntry
- * @param errorCallback
- * {Function} called with a FileError
- */
- getDirectory : function(path, options, successCallback, errorCallback) {
- // create directory if it doesn't exist
- var create = (options && options.create === true) ? true : false,
- // if true, causes failure if create is true and path already exists
- exclusive = (options && options.exclusive === true) ? true : false,
- // directory exists
- exists,
- // create a new DirectoryEntry object and invoke success callback
- createEntry = function() {
- var path_parts = path.split('/'),
- name = path_parts[path_parts.length - 1],
- dirEntry = new DirectoryEntry(name, path);
-
- // invoke success callback
- if (typeof successCallback === 'function') {
- successCallback(dirEntry);
- }
- };
-
- var fail = function(error) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(error));
- }
- };
-
- // determine if path is relative or absolute
- if (!path) {
- fail(FileError.ENCODING_ERR);
- return;
- } else if (path.indexOf(this.fullPath) !== 0) {
- // path does not begin with the fullPath of this directory
- // therefore, it is relative
- path = this.fullPath + '/' + path;
- }
-
- // determine if directory exists
- try {
- // will return true if path exists AND is a directory
- exists = blackberry.io.dir.exists(path);
- } catch (e) {
- // invalid path
- fail(FileError.ENCODING_ERR);
- return;
- }
-
- // path is a directory
- if (exists) {
- if (create && exclusive) {
- // can't guarantee exclusivity
- fail(FileError.PATH_EXISTS_ERR);
- } else {
- // create entry for existing directory
- createEntry();
- }
- }
- // will return true if path exists AND is a file
- else if (blackberry.io.file.exists(path)) {
- // the path is a file
- fail(FileError.TYPE_MISMATCH_ERR);
- }
- // path does not exist, create it
- else if (create) {
- try {
- // directory path must have trailing slash
- var dirPath = path;
- if (dirPath.substr(-1) !== '/') {
- dirPath += '/';
- }
- blackberry.io.dir.createNewDir(dirPath);
- createEntry();
- } catch (eone) {
- // unable to create directory
- fail(FileError.NOT_FOUND_ERR);
- }
- }
- // path does not exist, don't create
- else {
- // directory doesn't exist
- fail(FileError.NOT_FOUND_ERR);
- }
- },
- /**
- * Create or look up a file.
- *
- * @param path {DOMString}
- * either a relative or absolute path from this directory in
- * which to look up or create a file
- * @param options {Flags}
- * options to create or exclusively create the file
- * @param successCallback {Function}
- * called with the new FileEntry object
- * @param errorCallback {Function}
- * called with a FileError object if error occurs
- */
- getFile:function(path, options, successCallback, errorCallback) {
- // create file if it doesn't exist
- var create = (options && options.create === true) ? true : false,
- // if true, causes failure if create is true and path already exists
- exclusive = (options && options.exclusive === true) ? true : false,
- // file exists
- exists,
- // create a new FileEntry object and invoke success callback
- createEntry = function() {
- var path_parts = path.split('/'),
- name = path_parts[path_parts.length - 1],
- fileEntry = new FileEntry(name, path);
-
- // invoke success callback
- if (typeof successCallback === 'function') {
- successCallback(fileEntry);
- }
- };
-
- var fail = function(error) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(error));
- }
- };
-
- // determine if path is relative or absolute
- if (!path) {
- fail(FileError.ENCODING_ERR);
- return;
- }
- else if (path.indexOf(this.fullPath) !== 0) {
- // path does not begin with the fullPath of this directory
- // therefore, it is relative
- path = this.fullPath + '/' + path;
- }
-
- // determine if file exists
- try {
- // will return true if path exists AND is a file
- exists = blackberry.io.file.exists(path);
- }
- catch (e) {
- // invalid path
- fail(FileError.ENCODING_ERR);
- return;
- }
-
- // path is a file
- if (exists) {
- if (create && exclusive) {
- // can't guarantee exclusivity
- fail(FileError.PATH_EXISTS_ERR);
- }
- else {
- // create entry for existing file
- createEntry();
- }
- }
- // will return true if path exists AND is a directory
- else if (blackberry.io.dir.exists(path)) {
- // the path is a directory
- fail(FileError.TYPE_MISMATCH_ERR);
- }
- // path does not exist, create it
- else if (create) {
- // create empty file
- exec(
- function(result) {
- // file created
- createEntry();
- },
- fail, "File", "write", [ path, "", 0 ]);
- }
- // path does not exist, don't create
- else {
- // file doesn't exist
- fail(FileError.NOT_FOUND_ERR);
- }
- },
-
- /**
- * Delete a directory and all of it's contents.
- *
- * @param successCallback {Function} called with no parameters
- * @param errorCallback {Function} called with a FileError
- */
- removeRecursively : function(successCallback, errorCallback) {
- // we're removing THIS directory
- var path = this.fullPath;
-
- var fail = function(error) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(error));
- }
- };
-
- // attempt to delete directory
- if (blackberry.io.dir.exists(path)) {
- // it is an error to attempt to remove the file system root
- if (exec(null, null, "File", "isFileSystemRoot", [ path ]) === true) {
- fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
- }
- else {
- try {
- // delete the directory, setting recursive flag to true
- blackberry.io.dir.deleteDirectory(path, true);
- if (typeof successCallback === "function") {
- successCallback();
- }
- } catch (e) {
- // permissions don't allow deletion
- console.log(e);
- fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
- }
- }
- }
- // it's a file, not a directory
- else if (blackberry.io.file.exists(path)) {
- fail(FileError.TYPE_MISMATCH_ERR);
- }
- // not found
- else {
- fail(FileError.NOT_FOUND_ERR);
- }
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/Entry.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/Entry.js b/lib/blackberry/plugin/java/Entry.js
deleted file mode 100644
index 5e2f313..0000000
--- a/lib/blackberry/plugin/java/Entry.js
+++ /dev/null
@@ -1,109 +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'),
- resolveLocalFileSystemURI = require('cordova/plugin/resolveLocalFileSystemURI'),
- requestFileSystem = require('cordova/plugin/requestFileSystem'),
- exec = require('cordova/exec');
-
-module.exports = {
- remove : function(successCallback, errorCallback) {
- var path = this.fullPath,
- // directory contents
- contents = [];
-
- var fail = function(error) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(error));
- }
- };
-
- // file
- if (blackberry.io.file.exists(path)) {
- try {
- blackberry.io.file.deleteFile(path);
- if (typeof successCallback === "function") {
- successCallback();
- }
- } catch (e) {
- // permissions don't allow
- fail(FileError.INVALID_MODIFICATION_ERR);
- }
- }
- // directory
- else if (blackberry.io.dir.exists(path)) {
- // it is an error to attempt to remove the file system root
- if (exec(null, null, "File", "isFileSystemRoot", [ path ]) === true) {
- fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
- } else {
- // check to see if directory is empty
- contents = blackberry.io.dir.listFiles(path);
- if (contents.length !== 0) {
- fail(FileError.INVALID_MODIFICATION_ERR);
- } else {
- try {
- // delete
- blackberry.io.dir.deleteDirectory(path, false);
- if (typeof successCallback === "function") {
- successCallback();
- }
- } catch (eone) {
- // permissions don't allow
- fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
- }
- }
- }
- }
- // not found
- else {
- fail(FileError.NOT_FOUND_ERR);
- }
- },
- getParent : function(successCallback, errorCallback) {
- var that = this;
-
- try {
- // On BlackBerry, the TEMPORARY file system is actually a temporary
- // directory that is created on a per-application basis. This is
- // to help ensure that applications do not share the same temporary
- // space. So we check to see if this is the TEMPORARY file system
- // (directory). If it is, we must return this Entry, rather than
- // the Entry for its parent.
- requestFileSystem(LocalFileSystem.TEMPORARY, 0,
- function(fileSystem) {
- if (fileSystem.root.fullPath === that.fullPath) {
- if (typeof successCallback === 'function') {
- successCallback(fileSystem.root);
- }
- } else {
- resolveLocalFileSystemURI(blackberry.io.dir
- .getParentDirectory(that.fullPath),
- successCallback, errorCallback);
- }
- }, errorCallback);
- } catch (e) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(FileError.NOT_FOUND_ERR));
- }
- }
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/MediaError.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/MediaError.js b/lib/blackberry/plugin/java/MediaError.js
deleted file mode 100644
index c7c1960..0000000
--- a/lib/blackberry/plugin/java/MediaError.js
+++ /dev/null
@@ -1,29 +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.
- *
-*/
-
-
-// The MediaError object exists on BB OS 6+ which prevents the Cordova version
-// from being defined. This object is used to merge in differences between the BB
-// MediaError object and the Cordova version.
-module.exports = {
- MEDIA_ERR_NONE_ACTIVE : 0,
- MEDIA_ERR_NONE_SUPPORTED : 4
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/app.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/app.js b/lib/blackberry/plugin/java/app.js
deleted file mode 100644
index 7596f0d..0000000
--- a/lib/blackberry/plugin/java/app.js
+++ /dev/null
@@ -1,72 +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 exec = require('cordova/exec'),
- platform = require('cordova/platform'),
- manager = require('cordova/plugin/' + platform.runtime() + '/manager');
-
-module.exports = {
- /**
- * Clear the resource cache.
- */
- clearCache:function() {
- if (typeof blackberry.widgetcache === "undefined" || blackberry.widgetcache === null) {
- console.log("blackberry.widgetcache permission not found. Cache clear request denied.");
- return;
- }
- blackberry.widgetcache.clearAll();
- },
-
- /**
- * Clear web history in this web view.
- * Instead of BACK button loading the previous web page, it will exit the app.
- */
- clearHistory:function() {
- exec(null, null, "App", "clearHistory", []);
- },
-
- /**
- * Go to previous page displayed.
- * This is the same as pressing the backbutton on Android device.
- */
- backHistory:function() {
- // window.history.back() behaves oddly on BlackBerry, so use
- // native implementation.
- exec(null, null, "App", "backHistory", []);
- },
-
- /**
- * Exit and terminate the application.
- */
- exitApp:function() {
- // Call onunload if it is defined since BlackBerry does not invoke
- // on application exit.
- if (typeof window.onunload === "function") {
- window.onunload();
- }
-
- // allow Cordova JavaScript Extension opportunity to cleanup
- manager.destroy();
-
- // exit the app
- blackberry.app.exit();
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/app/bbsymbols.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/app/bbsymbols.js b/lib/blackberry/plugin/java/app/bbsymbols.js
deleted file mode 100644
index 3ad17f7..0000000
--- a/lib/blackberry/plugin/java/app/bbsymbols.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/java/app', 'navigator.app');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/contacts.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/contacts.js b/lib/blackberry/plugin/java/contacts.js
deleted file mode 100644
index 522ad7a..0000000
--- a/lib/blackberry/plugin/java/contacts.js
+++ /dev/null
@@ -1,84 +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 ContactError = require('cordova/plugin/ContactError'),
- utils = require('cordova/utils'),
- ContactUtils = require('cordova/plugin/java/ContactUtils');
-
-module.exports = {
- /**
- * Returns an array of Contacts matching the search criteria.
- *
- * @return array of Contacts matching search criteria
- */
- find : function(fields, success, fail, options) {
- // Success callback is required. Throw exception if not specified.
- if (typeof success !== 'function') {
- throw new TypeError(
- "You must specify a success callback for the find command.");
- }
-
- // Search qualifier is required and cannot be empty.
- if (!fields || !(utils.isArray(fields)) || fields.length === 0) {
- if (typeof fail == 'function') {
- fail(new ContactError(ContactError.INVALID_ARGUMENT_ERROR));
- }
- return;
- }
-
- // default is to return a single contact match
- var numContacts = 1;
-
- // search options
- var filter = null;
- if (options) {
- // return multiple objects?
- if (options.multiple === true) {
- // -1 on BlackBerry will return all contact matches.
- numContacts = -1;
- }
- filter = options.filter;
- }
-
- // build the filter expression to use in find operation
- var filterExpression = ContactUtils.buildFilterExpression(fields, filter);
-
- // find matching contacts
- // Note: the filter expression can be null here, in which case, the find
- // won't filter
- var bbContacts = blackberry.pim.Contact.find(filterExpression, null, numContacts);
-
- // convert to Contact from blackberry.pim.Contact
- var contacts = [];
- for (var i = 0; i < bbContacts.length; i++) {
- if (bbContacts[i]) {
- // W3C Contacts API specification states that only the fields
- // in the search filter should be returned, so we create
- // a new Contact object, copying only the fields specified
- contacts.push(ContactUtils.createContact(bbContacts[i], fields));
- }
- }
-
- // return results
- success(contacts);
- }
-
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/contacts/bbsymbols.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/contacts/bbsymbols.js b/lib/blackberry/plugin/java/contacts/bbsymbols.js
deleted file mode 100644
index dee7dd8..0000000
--- a/lib/blackberry/plugin/java/contacts/bbsymbols.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.merges('cordova/plugin/java/contacts', 'navigator.contacts');
-modulemapper.merges('cordova/plugin/java/Contact', 'Contact');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/file/bbsymbols.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/file/bbsymbols.js b/lib/blackberry/plugin/java/file/bbsymbols.js
deleted file mode 100644
index c37c952..0000000
--- a/lib/blackberry/plugin/java/file/bbsymbols.js
+++ /dev/null
@@ -1,27 +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/File', 'File');
-modulemapper.merges('cordova/plugin/java/DirectoryEntry', 'DirectoryEntry');
-modulemapper.merges('cordova/plugin/java/Entry', 'Entry');
-
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/manager.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/manager.js b/lib/blackberry/plugin/java/manager.js
deleted file mode 100644
index aa93ef6..0000000
--- a/lib/blackberry/plugin/java/manager.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.
- *
-*/
-
-var cordova = require('cordova');
-
-function _exec(win, fail, clazz, action, args) {
- var callbackId = clazz + cordova.callbackId++,
- origResult,
- evalResult,
- execResult;
-
- try {
- if (win || fail) {
- cordova.callbacks[callbackId] = {success: win, fail: fail};
- }
-
- // Note: Device returns string, but for some reason emulator returns object - so convert to string.
- origResult = "" + org.apache.cordova.JavaPluginManager.exec(clazz, action, callbackId, JSON.stringify(args), true);
-
- // If a result was returned
- if (origResult.length > 0) {
- evalResult = JSON.parse(origResult);
-
- // If status is OK, then return evalResult value back to caller
- if (evalResult.status === cordova.callbackStatus.OK) {
-
- // If there is a success callback, then call it now with returned evalResult value
- if (win) {
- // Clear callback if not expecting any more results
- if (!evalResult.keepCallback) {
- delete cordova.callbacks[callbackId];
- }
- }
- } else if (evalResult.status === cordova.callbackStatus.NO_RESULT) {
-
- // Clear callback if not expecting any more results
- if (!evalResult.keepCallback) {
- delete cordova.callbacks[callbackId];
- }
- } else {
- // If there is a fail callback, then call it now with returned evalResult value
- if (fail) {
-
- // Clear callback if not expecting any more results
- if (!evalResult.keepCallback) {
- delete cordova.callbacks[callbackId];
- }
- }
- }
- execResult = evalResult;
- } else {
- // Asynchronous calls return an empty string. Return a NO_RESULT
- // status for those executions.
- execResult = {"status" : cordova.callbackStatus.NO_RESULT,
- "message" : ""};
- }
- } catch (e) {
- console.log("BlackBerryPluginManager Error: " + e);
- execResult = {"status" : cordova.callbackStatus.ERROR,
- "message" : e.message};
- }
-
- return execResult;
-}
-
-module.exports = {
- exec: function (win, fail, clazz, action, args) {
- return _exec(win, fail, clazz, action, args);
- },
- resume: org.apache.cordova.JavaPluginManager.resume,
- pause: org.apache.cordova.JavaPluginManager.pause,
- destroy: org.apache.cordova.JavaPluginManager.destroy
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/media/bbsymbols.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/media/bbsymbols.js b/lib/blackberry/plugin/java/media/bbsymbols.js
deleted file mode 100644
index 31d0d3a..0000000
--- a/lib/blackberry/plugin/java/media/bbsymbols.js
+++ /dev/null
@@ -1,27 +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/Media', 'Media');
-modulemapper.defaults('cordova/plugin/MediaError', 'MediaError');
-// Exists natively on BB OS 6+, merge in Cordova specifics
-modulemapper.merges('cordova/plugin/java/MediaError', 'MediaError');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/notification.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/notification.js b/lib/blackberry/plugin/java/notification.js
deleted file mode 100644
index 8586393..0000000
--- a/lib/blackberry/plugin/java/notification.js
+++ /dev/null
@@ -1,74 +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 exec = require('cordova/exec');
-
-/**
- * Provides BlackBerry enhanced notification API.
- */
-module.exports = {
- activityStart : function(title, message) {
- // If title and message not specified then mimic Android behavior of
- // using default strings.
- if (typeof title === "undefined" && typeof message == "undefined") {
- title = "Busy";
- message = 'Please wait...';
- }
-
- exec(null, null, 'Notification', 'activityStart', [ title, message ]);
- },
-
- /**
- * Close an activity dialog
- */
- activityStop : function() {
- exec(null, null, 'Notification', 'activityStop', []);
- },
-
- /**
- * Display a progress dialog with progress bar that goes from 0 to 100.
- *
- * @param {String}
- * title Title of the progress dialog.
- * @param {String}
- * message Message to display in the dialog.
- */
- progressStart : function(title, message) {
- exec(null, null, 'Notification', 'progressStart', [ title, message ]);
- },
-
- /**
- * Close the progress dialog.
- */
- progressStop : function() {
- exec(null, null, 'Notification', 'progressStop', []);
- },
-
- /**
- * Set the progress dialog value.
- *
- * @param {Number}
- * value 0-100
- */
- progressValue : function(value) {
- exec(null, null, 'Notification', 'progressValue', [ value ]);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/notification/bbsymbols.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/notification/bbsymbols.js b/lib/blackberry/plugin/java/notification/bbsymbols.js
deleted file mode 100644
index 31c8e0a..0000000
--- a/lib/blackberry/plugin/java/notification/bbsymbols.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.merges('cordova/plugin/java/notification', 'navigator.notification');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/platform.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/platform.js b/lib/blackberry/plugin/java/platform.js
deleted file mode 100644
index a28ae6b..0000000
--- a/lib/blackberry/plugin/java/platform.js
+++ /dev/null
@@ -1,148 +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",
- initialize:function() {
- var cordova = require('cordova'),
- exec = require('cordova/exec'),
- channel = require('cordova/channel'),
- platform = require('cordova/platform'),
- manager = require('cordova/plugin/' + platform.runtime() + '/manager'),
- app = require('cordova/plugin/java/app');
-
- // BB OS 5 does not define window.console.
- if (typeof window.console === 'undefined') {
- window.console = {};
- }
-
- // Override console.log with native logging ability.
- // BB OS 7 devices define console.log for use with web inspector
- // debugging. If console.log is already defined, invoke it in addition
- // to native logging.
- var origLog = window.console.log;
- window.console.log = function(msg) {
- if (typeof origLog === 'function') {
- origLog.call(window.console, msg);
- }
- org.apache.cordova.Logger.log(''+msg);
- };
-
- // Mapping of button events to BlackBerry key identifier.
- var buttonMapping = {
- 'backbutton' : blackberry.system.event.KEY_BACK,
- 'conveniencebutton1' : blackberry.system.event.KEY_CONVENIENCE_1,
- 'conveniencebutton2' : blackberry.system.event.KEY_CONVENIENCE_2,
- 'endcallbutton' : blackberry.system.event.KEY_ENDCALL,
- 'menubutton' : blackberry.system.event.KEY_MENU,
- 'startcallbutton' : blackberry.system.event.KEY_STARTCALL,
- 'volumedownbutton' : blackberry.system.event.KEY_VOLUMEDOWN,
- 'volumeupbutton' : blackberry.system.event.KEY_VOLUMEUP
- };
-
- // Generates a function which fires the specified event.
- var fireEvent = function(event) {
- return function() {
- cordova.fireDocumentEvent(event, null);
- };
- };
-
- var eventHandler = function(event) {
- return function() {
- // If we just attached the first handler, let native know we
- // need to override the hardware button.
- if (this.numHandlers) {
- blackberry.system.event.onHardwareKey(
- buttonMapping[event], fireEvent(event));
- }
- // If we just detached the last handler, let native know we
- // no longer override the hardware button.
- else {
- blackberry.system.event.onHardwareKey(
- buttonMapping[event], null);
- }
- };
- };
-
- // Inject listeners for buttons on the document.
- for (var button in buttonMapping) {
- if (buttonMapping.hasOwnProperty(button)) {
- var buttonChannel = cordova.addDocumentEventHandler(button);
- buttonChannel.onHasSubscribersChange = eventHandler(button);
- }
- }
-
- // Fires off necessary code to pause/resume app
- var resume = function() {
- cordova.fireDocumentEvent('resume');
- manager.resume();
- };
- var pause = function() {
- cordova.fireDocumentEvent('pause');
- manager.pause();
- };
-
- /************************************************
- * Patch up the generic pause/resume listeners. *
- ************************************************/
-
- // Unsubscribe handler - turns off native backlight change
- // listener
- var onHasSubscribersChange = function() {
- // If we just attached the first handler and there are
- // no pause handlers, start the backlight system
- // listener on the native side.
- if (this.numHandlers && (channel.onResume.numHandlers + channel.onPause.numHandlers === 1)) {
- exec(backlightWin, backlightFail, "App", "detectBacklight", []);
- } else if (channel.onResume.numHandlers === 0 && channel.onPause.numHandlers === 0) {
- exec(null, null, 'App', 'ignoreBacklight', []);
- }
- };
-
- // Native backlight detection win/fail callbacks
- var backlightWin = function(isOn) {
- if (isOn === true) {
- resume();
- } else {
- pause();
- }
- };
- var backlightFail = function(e) {
- console.log("Error detecting backlight on/off.");
- };
-
- // Override stock resume and pause listeners so we can trigger
- // some native methods during attach/remove
- channel.onResume = cordova.addDocumentEventHandler('resume');
- channel.onResume.onHasSubscribersChange = onHasSubscribersChange;
- channel.onPause = cordova.addDocumentEventHandler('pause');
- channel.onPause.onHasSubscribersChange = onHasSubscribersChange;
-
- // Fire resume event when application brought to foreground.
- blackberry.app.event.onForeground(resume);
-
- // Fire pause event when application sent to background.
- blackberry.app.event.onBackground(pause);
-
- // Trap BlackBerry WebWorks exit. Allow plugins to clean up before exiting.
- blackberry.app.event.onExit(app.exitApp);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/qnx/compass/bbsymbols.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/qnx/compass/bbsymbols.js b/lib/blackberry/plugin/qnx/compass/bbsymbols.js
deleted file mode 100644
index ad46a27..0000000
--- a/lib/blackberry/plugin/qnx/compass/bbsymbols.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.merges('cordova/plugin/qnx/compass', 'navigator.compass');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/qnx/inappbrowser/bbsymbols.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/qnx/inappbrowser/bbsymbols.js b/lib/blackberry/plugin/qnx/inappbrowser/bbsymbols.js
deleted file mode 100644
index 1b0866e..0000000
--- a/lib/blackberry/plugin/qnx/inappbrowser/bbsymbols.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/InAppBrowser', 'open');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/webworks/accelerometer.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/webworks/accelerometer.js b/lib/blackberry/plugin/webworks/accelerometer.js
deleted file mode 100644
index 70142fa..0000000
--- a/lib/blackberry/plugin/webworks/accelerometer.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 cordova = require('cordova'),
- callback;
-
-module.exports = {
- start: function (args, win, fail) {
- window.removeEventListener("devicemotion", callback);
- callback = function (motion) {
- win({
- x: motion.accelerationIncludingGravity.x,
- y: motion.accelerationIncludingGravity.y,
- z: motion.accelerationIncludingGravity.z,
- timestamp: motion.timestamp
- });
- };
- window.addEventListener("devicemotion", callback);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- },
- stop: function (args, win, fail) {
- window.removeEventListener("devicemotion", callback);
- return { "status" : cordova.callbackStatus.OK, "message" : "removed" };
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/webworks/logger.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/webworks/logger.js b/lib/blackberry/plugin/webworks/logger.js
deleted file mode 100644
index bd47a1e..0000000
--- a/lib/blackberry/plugin/webworks/logger.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.
- *
-*/
-
-var cordova = require('cordova');
-
-module.exports = {
- log: function (args, win, fail) {
- console.log(args);
- return {"status" : cordova.callbackStatus.OK,
- "message" : 'Message logged to console: ' + args};
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/webworks/media.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/webworks/media.js b/lib/blackberry/plugin/webworks/media.js
deleted file mode 100644
index a141a99..0000000
--- a/lib/blackberry/plugin/webworks/media.js
+++ /dev/null
@@ -1,189 +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'),
- audioObjects = {};
-
-module.exports = {
- create: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- src = args[1];
-
- if (typeof src == "undefined"){
- audioObjects[id] = new Audio();
- } else {
- audioObjects[id] = new Audio(src);
- }
-
- return {"status" : 1, "message" : "Audio object created" };
- },
- startPlayingAudio: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- audio = audioObjects[id],
- result;
-
- if (args.length === 1 || typeof args[1] == "undefined" ) {
- return {"status" : 9, "message" : "Media source argument not found"};
- }
-
- if (audio) {
- audio.pause();
- audioObjects[id] = undefined;
- }
-
- audio = audioObjects[id] = new Audio(args[1]);
- audio.play();
- return {"status" : 1, "message" : "Audio play started" };
- },
- stopPlayingAudio: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- audio = audioObjects[id],
- result;
-
- if (!audio) {
- return {"status" : 2, "message" : "Audio Object has not been initialized"};
- }
-
- audio.pause();
- audioObjects[id] = undefined;
-
- return {"status" : 1, "message" : "Audio play stopped" };
- },
- seekToAudio: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- audio = audioObjects[id],
- result;
-
- if (!audio) {
- result = {"status" : 2, "message" : "Audio Object has not been initialized"};
- } else if (args.length === 1) {
- result = {"status" : 9, "message" : "Media seek time argument not found"};
- } else {
- try {
- audio.currentTime = args[1];
- } catch (e) {
- console.log('Error seeking audio: ' + e);
- return {"status" : 3, "message" : "Error seeking audio: " + e};
- }
-
- result = {"status" : 1, "message" : "Seek to audio succeeded" };
- }
- return result;
- },
- pausePlayingAudio: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- audio = audioObjects[id],
- result;
-
- if (!audio) {
- return {"status" : 2, "message" : "Audio Object has not been initialized"};
- }
-
- audio.pause();
-
- return {"status" : 1, "message" : "Audio paused" };
- },
- getCurrentPositionAudio: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- audio = audioObjects[id],
- result;
-
- if (!audio) {
- return {"status" : 2, "message" : "Audio Object has not been initialized"};
- }
-
- return {"status" : 1, "message" : audio.currentTime };
- },
- getDuration: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- audio = audioObjects[id],
- result;
-
- if (!audio) {
- return {"status" : 2, "message" : "Audio Object has not been initialized"};
- }
-
- return {"status" : 1, "message" : audio.duration };
- },
- startRecordingAudio: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- if (args.length <= 1) {
- return {"status" : 9, "message" : "Media start recording, insufficient arguments"};
- }
-
- blackberry.media.microphone.record(args[1], win, fail);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- },
- stopRecordingAudio: function (args, win, fail) {
- },
- release: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- audio = audioObjects[id],
- result;
-
- if (audio) {
- if(audio.src !== ""){
- audio.src = undefined;
- }
- audioObjects[id] = undefined;
- //delete audio;
- }
-
- result = {"status" : 1, "message" : "Media resources released"};
-
- return result;
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/webworks/notification.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/webworks/notification.js b/lib/blackberry/plugin/webworks/notification.js
deleted file mode 100644
index 9de87b8..0000000
--- a/lib/blackberry/plugin/webworks/notification.js
+++ /dev/null
@@ -1,52 +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');
-
-module.exports = {
- alert: function (args, win, fail) {
- if (args.length !== 3) {
- return {"status" : 9, "message" : "Notification action - alert arguments not found"};
- }
-
- //Unpack and map the args
- var msg = args[0],
- title = args[1],
- btnLabel = args[2];
-
- blackberry.ui.dialog.customAskAsync.apply(this, [ msg, [ btnLabel ], win, { "title" : title } ]);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- },
- confirm: function (args, win, fail) {
- if (args.length !== 3) {
- return {"status" : 9, "message" : "Notification action - confirm arguments not found"};
- }
-
- //Unpack and map the args
- var msg = args[0],
- title = args[1],
- btnLabel = args[2],
- btnLabels = btnLabel.split(",");
-
- blackberry.ui.dialog.customAskAsync.apply(this, [msg, btnLabels, win, {"title" : title} ]);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/errgen/exec.js
----------------------------------------------------------------------
diff --git a/lib/errgen/exec.js b/lib/errgen/exec.js
deleted file mode 100644
index c192482..0000000
--- a/lib/errgen/exec.js
+++ /dev/null
@@ -1,105 +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.
- */
-
-/**
- * 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 exec(success, fail, service, action, args) {
- var signature = service + "::" + action;
-
- //--------------------------------------------------------------------------
- function callFail() {
- var args = "<unable to JSONify>";
-
- try {
- args = JSON.stringify(args);
- } catch (e) {}
-
- var call = signature + "(" + args + ")";
-
- if (!fail) {
- console.log("failure callback not set for " + call);
- return;
- }
-
- if (typeof(fail) != 'function') {
- console.log("failure callback not a function for " + call);
- return;
- }
-
- try {
- fail("expected errgen failure for " + call);
- } catch (e) {
- console.log("exception running failure callback for " + call);
- console.log(" exception: " + e);
- return;
- }
- }
-
- //--------------------------------------------------------------------------
- if (Overrides[signature]) {
- Overrides[signature].call(null, success, fail, args);
- return;
- }
-
- setTimeout(callFail, 10);
-};
-
-//------------------------------------------------------------------------------
-var Overrides = {};
-
-//------------------------------------------------------------------------------
-function addOverride(func) {
- var name = func.name.replace('__', '::');
- Overrides[name] = func;
-}
-
-//------------------------------------------------------------------------------
-addOverride(function Accelerometer__setTimeout(success, fail, args) {
- setTimeout(function() {
- fail("Accelerometer::setTimeout");
- }, 10);
-});
-
-//------------------------------------------------------------------------------
-addOverride(function Accelerometer__getTimeout(success, fail, args) {
- setTimeout(function() {
- fail("Accelerometer::getTimeout");
- }, 10);
-});
-
-//------------------------------------------------------------------------------
-addOverride(function Network_Status__getConnectionInfo(success, fail) {
- setTimeout(function() {
- success("none");
- }, 10);
-});
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/errgen/platform.js
----------------------------------------------------------------------
diff --git a/lib/errgen/platform.js b/lib/errgen/platform.js
deleted file mode 100644
index f87da20..0000000
--- a/lib/errgen/platform.js
+++ /dev/null
@@ -1,27 +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.
- */
-
-// required call to kick off the device ready callback
-require('cordova/plugin/errgen/device');
-
-//------------------------------------------------------------------------------
-module.exports = {
- id: "errgen",
- initialize: function() {}
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/errgen/plugin/errgen/device.js
----------------------------------------------------------------------
diff --git a/lib/errgen/plugin/errgen/device.js b/lib/errgen/plugin/errgen/device.js
deleted file mode 100644
index 80bcd56..0000000
--- a/lib/errgen/plugin/errgen/device.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * this represents the mobile device, and provides properties for inspecting the model, version, UUID of the
- * phone, etc.
- * @constructor
- */
-
-//------------------------------------------------------------------------------
-function Device() {
- window.DeviceInfo = {};
-
- this.platform = "errgen";
- this.version = "any";
- this.name = "errgen";
- this.phonegap = {};
- this.gap = this.phonegap;
- this.uuid = "1234-5678-9012-3456";
- this.available = true;
-
- require('cordova/channel').onCordovaInfoReady.fire();
-}
-
-//------------------------------------------------------------------------------
-module.exports = window.DeviceInfo = new Device();
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/firefoxos/exec.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/exec.js b/lib/firefoxos/exec.js
deleted file mode 100644
index 1796db3..0000000
--- a/lib/firefoxos/exec.js
+++ /dev/null
@@ -1,55 +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.
- *
-*/
-
-/**
- * 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
- * Asynchrounous: 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
- */
-
-var plugins = {
- "Device": require('cordova/plugin/firefoxos/device'),
- "NetworkStatus": require('cordova/plugin/firefoxos/network'),
- "Accelerometer" : require('cordova/plugin/firefoxos/accelerometer')
- //"Notification" : require('cordova/plugin/firefoxos/notification')
-};
-
-module.exports = function(success, fail, service, action, args) {
- try {
- console.error("exec:call plugin:"+service+":"+action);
- plugins[service][action](success, fail, args);
- }
- catch(e) {
- console.error("missing exec: " + service + "." + action);
- console.error(args);
- console.error(e);
- console.error(e.stack);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/firefoxos/platform.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/platform.js b/lib/firefoxos/platform.js
deleted file mode 100644
index 4c2f67b..0000000
--- a/lib/firefoxos/platform.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.
- *
-*/
-
-module.exports = {
- id: "firefoxos",
- initialize: function() {
- }
-};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/firefoxos/plugin/firefoxos/accelerometer.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/plugin/firefoxos/accelerometer.js b/lib/firefoxos/plugin/firefoxos/accelerometer.js
deleted file mode 100644
index 7437124..0000000
--- a/lib/firefoxos/plugin/firefoxos/accelerometer.js
+++ /dev/null
@@ -1,41 +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'),
- callback;
-
-module.exports = {
- start: function (win, fail, args) {
- window.removeEventListener("devicemotion", callback);
- callback = function (motion) {
- win({
- x: motion.accelerationIncludingGravity.x,
- y: motion.accelerationIncludingGravity.y,
- z: motion.accelerationIncludingGravity.z,
- timestamp: motion.timestamp
- });
- };
- window.addEventListener("devicemotion", callback);
- },
- stop: function (win, fail, args) {
- window.removeEventListener("devicemotion", callback);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/firefoxos/plugin/firefoxos/device.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/plugin/firefoxos/device.js b/lib/firefoxos/plugin/firefoxos/device.js
deleted file mode 100644
index 7de2209..0000000
--- a/lib/firefoxos/plugin/firefoxos/device.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.
- *
-*/
-
-var channel = require('cordova/channel'),
- cordova = require('cordova');
-
-// Tell cordova channel to wait on the CordovaInfoReady event
-channel.waitForInitialization('onCordovaInfoReady');
-
-module.exports = {
- getDeviceInfo : function(win, fail, args){
- win({
- platform: "Firefox OS",
- version: "0.0.1",
- model: "Beta Phone",
- name: "Beta Phone", // deprecated: please use device.model
- uuid: "somestring",
- cordova: CORDOVA_JS_BUILD_LABEL
- });
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/firefoxos/plugin/firefoxos/network.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/plugin/firefoxos/network.js b/lib/firefoxos/plugin/firefoxos/network.js
deleted file mode 100644
index f7e702b..0000000
--- a/lib/firefoxos/plugin/firefoxos/network.js
+++ /dev/null
@@ -1,28 +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');
-
-module.exports = {
- getConnectionInfo: function (win, fail, args) {
- win("3G");
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/firefoxos/plugin/firefoxos/notification.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/plugin/firefoxos/notification.js b/lib/firefoxos/plugin/firefoxos/notification.js
deleted file mode 100644
index 830997a..0000000
--- a/lib/firefoxos/plugin/firefoxos/notification.js
+++ /dev/null
@@ -1,34 +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 = {
-
- vibrate: function(milliseconds) {
- console.log ("milliseconds" , milliseconds);
-
- if (navigator.vibrate) {
- navigator.vibrate(milliseconds);
- } else {
- console.log ("cordova/plugin/firefoxos/notification, vibrate API does not exist");
- }
- }
-
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/firefoxos/plugin/firefoxos/orientation.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/plugin/firefoxos/orientation.js b/lib/firefoxos/plugin/firefoxos/orientation.js
deleted file mode 100644
index 3edfaff..0000000
--- a/lib/firefoxos/plugin/firefoxos/orientation.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.
- *
-*/
-
-// user must have event listener registered for orientation to work
-// window.addEventListener("orientationchange", onorientationchange, true);
-
-module.exports = {
-
- getCurrentOrientation: function() {
- return window.screen.orientation;
- }
-
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/test/blackberryexec.js
----------------------------------------------------------------------
diff --git a/lib/test/blackberryexec.js b/lib/test/blackberryexec.js
deleted file mode 120000
index f00795f..0000000
--- a/lib/test/blackberryexec.js
+++ /dev/null
@@ -1 +0,0 @@
-../blackberry/exec.js
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/test/blackberryplatform.js
----------------------------------------------------------------------
diff --git a/lib/test/blackberryplatform.js b/lib/test/blackberryplatform.js
deleted file mode 120000
index 7c28899..0000000
--- a/lib/test/blackberryplatform.js
+++ /dev/null
@@ -1 +0,0 @@
-../blackberry/platform.js
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/exec.js
----------------------------------------------------------------------
diff --git a/lib/tizen/exec.js b/lib/tizen/exec.js
deleted file mode 100644
index f7ae520..0000000
--- a/lib/tizen/exec.js
+++ /dev/null
@@ -1,133 +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.
- *
-*/
-
-/**
- * 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} successCB The success callback
- * @param {Function} failCB 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
- */
-/**
- * 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} successCB The success callback
- * @param {Function} failCB 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
- */
-
-//console.log("TIZEN EXEC START");
-
-
-var manager = require('cordova/plugin/tizen/manager'),
- cordova = require('cordova'),
- utils = require('cordova/utils');
-
-//console.log("TIZEN EXEC START bis");
-
-module.exports = function(successCB, failCB, service, action, args) {
-
- try {
- var v = manager.exec(successCB, failCB, 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 (successCB) {
- try {
- successCB(v.message);
- }
- catch (e) {
- console.log("Error in success callback: "+ service + "." + action + " = " + e);
- }
-
- }
- return v.message;
- } else if (v.status == cordova.callbackStatus.NO_RESULT) {
- // Nothing to do here
- } else {
- // If error, then display error
- console.log("Error: " + service + "." + action + " Status=" + v.status + " Message=" + v.message);
-
- // If there is a fail callback, then call it now with returned value
- if (failCB) {
- try {
- failCB(v.message);
- }
- catch (e) {
- console.log("Error in error callback: " + service + "." + action + " = "+e);
- }
- }
- return null;
- }
- } catch (e) {
- utils.alert("Error: " + e);
- }
-};
-
-//console.log("TIZEN EXEC END ");
-
-/*
-var plugins = {
- "Device": require('cordova/plugin/tizen/Device'),
- "NetworkStatus": require('cordova/plugin/tizen/NetworkStatus'),
- "Accelerometer": require('cordova/plugin/tizen/Accelerometer'),
- "Battery": require('cordova/plugin/tizen/Battery'),
- "Compass": require('cordova/plugin/tizen/Compass'),
- //"Capture": require('cordova/plugin/tizen/Capture'), not yet available
- "Camera": require('cordova/plugin/tizen/Camera'),
- "FileTransfer": require('cordova/plugin/tizen/FileTransfer'),
- "Media": require('cordova/plugin/tizen/Media'),
- "Notification": require('cordova/plugin/tizen/Notification')
-};
-
-console.log("TIZEN EXEC START");
-
-module.exports = function(success, fail, service, action, args) {
- try {
- console.log("exec: " + service + "." + action);
- plugins[service][action](success, fail, args);
- }
- catch(e) {
- console.log("missing exec: " + service + "." + action);
- console.log(args);
- console.log(e);
- console.log(e.stack);
- }
-};
-
-console.log("TIZEN EXEC START");
-*/
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/platform.js
----------------------------------------------------------------------
diff --git a/lib/tizen/platform.js b/lib/tizen/platform.js
deleted file mode 100644
index afaa691..0000000
--- a/lib/tizen/platform.js
+++ /dev/null
@@ -1,45 +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.
- *
-*/
-
-//console.log("TIZEN PLATFORM START");
-
-
-module.exports = {
- id: "tizen",
- initialize: function() {
-
- //console.log("TIZEN PLATFORM initialize start");
-
- var modulemapper = require('cordova/modulemapper');
-
- //modulemapper.loadMatchingModules(/cordova.*\/plugininit$/);
-
- modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
-
- modulemapper.mapModules(window);
-
- //console.log("TIZEN PLATFORM initialize end");
-
- }
-};
-
-//console.log("TIZEN PLATFORM START");
-
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/device/symbols.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/device/symbols.js b/lib/tizen/plugin/device/symbols.js
deleted file mode 100644
index 80d416b..0000000
--- a/lib/tizen/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/tizen/Device', 'device');
-modulemapper.merges('cordova/plugin/tizen/Device', 'navigator.device');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/file/symbols.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/file/symbols.js b/lib/tizen/plugin/file/symbols.js
deleted file mode 100644
index 0e726f4..0000000
--- a/lib/tizen/plugin/file/symbols.js
+++ /dev/null
@@ -1,28 +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'),
- symbolshelper = require('cordova/plugin/file/symbolshelper');
-
-symbolshelper(modulemapper.defaults);
-modulemapper.clobbers('cordova/plugin/File', 'File');
-modulemapper.clobbers('cordova/plugin/FileReader', 'FileReader');
-modulemapper.clobbers('cordova/plugin/FileError', 'FileError');
[5/6] [CB-4419] Remove non-CLI platforms from cordova-js.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/FileEntry.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/FileEntry.js b/lib/blackberry/plugin/air/FileEntry.js
deleted file mode 100644
index 8ac46a3..0000000
--- a/lib/blackberry/plugin/air/FileEntry.js
+++ /dev/null
@@ -1,80 +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 FileEntry = require('cordova/plugin/FileEntry'),
- Entry = require('cordova/plugin/air/Entry'),
- FileWriter = require('cordova/plugin/air/FileWriter'),
- File = require('cordova/plugin/air/File'),
- FileError = require('cordova/plugin/FileError');
-
-module.exports = {
- /**
- * Creates a new FileWriter associated with the file that this FileEntry represents.
- *
- * @param {Function} successCallback is called with the new FileWriter
- * @param {Function} errorCallback is called with a FileError
- */
- createWriter : function(successCallback, errorCallback) {
- this.file(function(filePointer) {
- var writer = new FileWriter(filePointer);
-
- if (writer.fileName === null || writer.fileName === "") {
- if (typeof errorCallback === "function") {
- errorCallback(new FileError(FileError.INVALID_STATE_ERR));
- }
- } else {
- if (typeof successCallback === "function") {
- successCallback(writer);
- }
- }
- }, errorCallback);
- },
-
- /**
- * Returns a File that represents the current state of the file that this FileEntry represents.
- *
- * @param {Function} successCallback is called with the new File object
- * @param {Function} errorCallback is called with a FileError
- */
- file : function(successCallback, errorCallback) {
- var win = typeof successCallback !== 'function' ? null : function(f) {
- var file = new File(f.name, f.fullPath, f.type, f.lastModifiedDate, f.size);
- successCallback(file);
- };
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
- errorCallback(new FileError(code));
- };
-
- if(blackberry.io.file.exists(this.fullPath)){
- var theFileProperties = blackberry.io.file.getFileProperties(this.fullPath);
- var theFile = {};
-
- theFile.fullPath = this.fullPath;
- theFile.type = theFileProperties.fileExtension;
- theFile.lastModifiedDate = theFileProperties.dateModified;
- theFile.size = theFileProperties.size;
- win(theFile);
- }else{
- fail(FileError.NOT_FOUND_ERR);
- }
- }
-};
-
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/FileReader.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/FileReader.js b/lib/blackberry/plugin/air/FileReader.js
deleted file mode 100644
index e6a66ef..0000000
--- a/lib/blackberry/plugin/air/FileReader.js
+++ /dev/null
@@ -1,262 +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'),
- ProgressEvent = require('cordova/plugin/ProgressEvent');
-
-/**
- * This class reads the mobile device file system.
- *
- * For Android:
- * The root directory is the root of the file system.
- * To read from the SD card, the file name is "sdcard/my_file.txt"
- * @constructor
- */
-var FileReader = function() {
- this.fileName = "";
-
- this.readyState = 0; // FileReader.EMPTY
-
- // File data
- this.result = null;
-
- // Error
- this.error = null;
-
- // Event handlers
- this.onloadstart = null; // When the read starts.
- this.onprogress = null; // While reading (and decoding) file or fileBlob data, and reporting partial file data (progress.loaded/progress.total)
- this.onload = null; // When the read has successfully completed.
- this.onerror = null; // When the read has failed (see errors).
- this.onloadend = null; // When the request has completed (either in success or failure).
- this.onabort = null; // When the read has been aborted. For instance, by invoking the abort() method.
-};
-
-// States
-FileReader.EMPTY = 0;
-FileReader.LOADING = 1;
-FileReader.DONE = 2;
-
-/**
- * Abort reading file.
- */
-FileReader.prototype.abort = function() {
- this.result = null;
-
- if (this.readyState == FileReader.DONE || this.readyState == FileReader.EMPTY) {
- return;
- }
-
- this.readyState = FileReader.DONE;
-
- // If abort callback
- if (typeof this.onabort === 'function') {
- this.onabort(new ProgressEvent('abort', {target:this}));
- }
- // If load end callback
- if (typeof this.onloadend === 'function') {
- this.onloadend(new ProgressEvent('loadend', {target:this}));
- }
-};
-
-/**
- * Read text file.
- *
- * @param file {File} File object containing file properties
- * @param encoding [Optional] (see http://www.iana.org/assignments/character-sets)
- */
-FileReader.prototype.readAsText = function(file, encoding) {
- // Figure out pathing
- this.fileName = '';
- if (typeof file.fullPath === 'undefined') {
- this.fileName = file;
- } else {
- this.fileName = file.fullPath;
- }
-
- // Already loading something
- if (this.readyState == FileReader.LOADING) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- // LOADING state
- this.readyState = FileReader.LOADING;
-
- // If loadstart callback
- if (typeof this.onloadstart === "function") {
- this.onloadstart(new ProgressEvent("loadstart", {target:this}));
- }
-
- // Default encoding is UTF-8
- var enc = encoding ? encoding : "UTF-8";
-
- var me = this;
- // Read file
- if(blackberry.io.file.exists(this.fileName)){
- var theText = '';
- var getFileContents = function(path,blob){
- if(blob){
-
- theText = blackberry.utils.blobToString(blob, enc);
- me.result = theText;
-
- if (typeof me.onload === "function") {
- me.onload(new ProgressEvent("load", {target:me}));
- }
-
- me.readyState = FileReader.DONE;
-
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- }
- };
- // setting asynch to off
- blackberry.io.file.readFile(this.fileName, getFileContents, false);
-
- }else{
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileReader.DONE) {
- return;
- }
-
- // DONE state
- me.readyState = FileReader.DONE;
-
- me.result = null;
-
- // Save error
- me.error = new FileError(FileError.NOT_FOUND_ERR);
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror(new ProgressEvent("error", {target:me}));
- }
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- }
-};
-
-
-/**
- * Read file and return data as a base64 encoded data url.
- * A data url is of the form:
- * data:[<mediatype>][;base64],<data>
- *
- * @param file {File} File object containing file properties
- */
-FileReader.prototype.readAsDataURL = function(file) {
- this.fileName = "";
- if (typeof file.fullPath === "undefined") {
- this.fileName = file;
- } else {
- this.fileName = file.fullPath;
- }
-
- // Already loading something
- if (this.readyState == FileReader.LOADING) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- // LOADING state
- this.readyState = FileReader.LOADING;
-
- // If loadstart callback
- if (typeof this.onloadstart === "function") {
- this.onloadstart(new ProgressEvent("loadstart", {target:this}));
- }
-
- var enc = "BASE64";
-
- var me = this;
-
- // Read file
- if(blackberry.io.file.exists(this.fileName)){
- var theText = '';
- var getFileContents = function(path,blob){
- if(blob){
- theText = blackberry.utils.blobToString(blob, enc);
- me.result = "data:text/plain;base64," +theText;
-
- if (typeof me.onload === "function") {
- me.onload(new ProgressEvent("load", {target:me}));
- }
-
- me.readyState = FileReader.DONE;
-
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- }
- };
- // setting asynch to off
- blackberry.io.file.readFile(this.fileName, getFileContents, false);
-
- }else{
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileReader.DONE) {
- return;
- }
-
- // DONE state
- me.readyState = FileReader.DONE;
-
- me.result = null;
-
- // Save error
- me.error = new FileError(FileError.NOT_FOUND_ERR);
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror(new ProgressEvent("error", {target:me}));
- }
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- }
-};
-
-/**
- * Read file and return data as a binary data.
- *
- * @param file {File} File object containing file properties
- */
-FileReader.prototype.readAsBinaryString = function(file) {
- // TODO - Can't return binary data to browser.
- console.log('method "readAsBinaryString" is not supported at this time.');
-};
-
-/**
- * Read file and return data as a binary data.
- *
- * @param file {File} File object containing file properties
- */
-FileReader.prototype.readAsArrayBuffer = function(file) {
- // TODO - Can't return binary data to browser.
- console.log('This method is not supported at this time.');
-};
-
-module.exports = FileReader;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/FileTransfer.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/FileTransfer.js b/lib/blackberry/plugin/air/FileTransfer.js
deleted file mode 100644
index b0fe799..0000000
--- a/lib/blackberry/plugin/air/FileTransfer.js
+++ /dev/null
@@ -1,159 +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'),
-FileTransferError = require('cordova/plugin/FileTransferError'),
-FileUploadResult = require('cordova/plugin/FileUploadResult');
-
-var validURLProtocol = new RegExp('^(https?|ftp):\/\/');
-
-function getParentPath(filePath) {
- var pos = filePath.lastIndexOf('/');
- return filePath.substring(0, pos + 1);
-}
-
-function getFileName(filePath) {
- var pos = filePath.lastIndexOf('/');
- return filePath.substring(pos + 1);
-}
-
-module.exports = {
- upload: function (args, win, fail) {
- var filePath = args[0],
- server = args[1],
- fileKey = args[2],
- fileName = args[3],
- mimeType = args[4],
- params = args[5],
- trustAllHosts = args[6],
- chunkedMode = args[7],
- headers = args[8];
-
- if(!validURLProtocol.exec(server)){
- return { "status" : cordova.callbackStatus.ERROR, "message" : new FileTransferError(FileTransferError.INVALID_URL_ERR) };
- }
-
- window.resolveLocalFileSystemURI(filePath, fileWin, fail);
-
- function fileWin(entryObject){
- blackberry.io.file.readFile(filePath, readWin, false);
- }
-
- function readWin(filePath, blobFile){
- var fd = new FormData();
-
- fd.append(fileKey, blobFile, fileName);
- for (var prop in params) {
- if(params.hasOwnProperty(prop)) {
- fd.append(prop, params[prop]);
- }
- }
-
- var xhr = new XMLHttpRequest();
- xhr.open("POST", server);
- xhr.onload = function(evt) {
- if (xhr.status == 200) {
- var result = new FileUploadResult();
- result.bytesSent = xhr.response.length;
- result.responseCode = xhr.status;
- result.response = xhr.response;
- win(result);
- } else if (xhr.status == 404) {
- fail(new FileTransferError(FileTransferError.INVALID_URL_ERR, null, null, xhr.status));
- } else if (xhr.status == 403) {
- fail(new FileTransferError(FileTransferError.INVALID_URL_ERR, null, null, xhr.status));
- } else {
- fail(new FileTransferError(FileTransferError.CONNECTION_ERR, null, null, xhr.status));
- }
- };
- xhr.ontimeout = function(evt) {
- fail(new FileTransferError(FileTransferError.CONNECTION_ERR, null, null, xhr.status));
- };
-
- if(headers){
- for(var i in headers){
- xhr.setRequestHeader(i, headers[i]);
- }
- }
- xhr.send(fd);
- }
-
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- },
-
- download: function(args, win, fail){
- var url = args[0],
- filePath = args[1];
-
- if(!validURLProtocol.exec(url)){
- return { "status" : cordova.callbackStatus.ERROR, "message" : new FileTransferError(FileTransferError.INVALID_URL_ERR) };
- }
-
- var xhr = new XMLHttpRequest();
-
- function writeFile(fileEntry) {
- fileEntry.createWriter(function(writer) {
- writer.onwriteend = function(evt) {
- if (!evt.target.error) {
- win(new window.FileEntry(fileEntry.name, fileEntry.toURL()));
- } else {
- fail(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
- }
- };
-
- writer.onerror = function(evt) {
- fail(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
- };
-
- var blob = blackberry.utils.stringToBlob(xhr.response);
- writer.write(blob);
-
- },
- function(error) {
- fail(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
- });
- }
-
- xhr.onreadystatechange = function () {
- if (xhr.readyState == xhr.DONE) {
- if (xhr.status == 200 && xhr.response) {
- window.resolveLocalFileSystemURI(getParentPath(filePath), function(dir) {
- dir.getFile(getFileName(filePath), {create: true}, writeFile, function(error) {
- fail(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
- });
- }, function(error) {
- fail(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
- });
- } else if (xhr.status == 404) {
- fail(new FileTransferError(FileTransferError.INVALID_URL_ERR, null, null, xhr.status));
- } else {
- fail(new FileTransferError(FileTransferError.CONNECTION_ERR, null, null, xhr.status));
- }
- }
- };
-
- xhr.open("GET", url, true);
- xhr.responseType = "arraybuffer";
- xhr.send();
-
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/FileWriter.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/FileWriter.js b/lib/blackberry/plugin/air/FileWriter.js
deleted file mode 100644
index c4176fe..0000000
--- a/lib/blackberry/plugin/air/FileWriter.js
+++ /dev/null
@@ -1,269 +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'),
- ProgressEvent = require('cordova/plugin/ProgressEvent');
-
-/**
- * @constructor
- * @param file {File} File object containing file properties
- * @param append if true write to the end of the file, otherwise overwrite the file
- */
-var FileWriter = function(file) {
- this.fileName = "";
- this.length = 0;
- if (file) {
- this.fileName = file.fullPath || file;
- this.length = file.size || 0;
- }
- // default is to write at the beginning of the file
- this.position = 0;
-
- this.readyState = 0; // EMPTY
-
- this.result = null;
-
- // Error
- this.error = null;
-
- // Event handlers
- this.onwritestart = null; // When writing starts
- this.onprogress = null; // While writing the file, and reporting partial file data
- this.onwrite = null; // When the write has successfully completed.
- this.onwriteend = null; // When the request has completed (either in success or failure).
- this.onabort = null; // When the write has been aborted. For instance, by invoking the abort() method.
- this.onerror = null; // When the write has failed (see errors).
-};
-
-// States
-FileWriter.INIT = 0;
-FileWriter.WRITING = 1;
-FileWriter.DONE = 2;
-
-/**
- * Abort writing file.
- */
-FileWriter.prototype.abort = function() {
- // check for invalid state
- if (this.readyState === FileWriter.DONE || this.readyState === FileWriter.INIT) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- // set error
- this.error = new FileError(FileError.ABORT_ERR);
-
- this.readyState = FileWriter.DONE;
-
- // If abort callback
- if (typeof this.onabort === "function") {
- this.onabort(new ProgressEvent("abort", {"target":this}));
- }
-
- // If write end callback
- if (typeof this.onwriteend === "function") {
- this.onwriteend(new ProgressEvent("writeend", {"target":this}));
- }
-};
-
-/**
- * Writes data to the file
- *
- * @param text to be written
- */
-FileWriter.prototype.write = function(text) {
- // Throw an exception if we are already writing a file
- if (this.readyState === FileWriter.WRITING) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- // WRITING state
- this.readyState = FileWriter.WRITING;
-
- var me = this;
-
- // If onwritestart callback
- if (typeof me.onwritestart === "function") {
- me.onwritestart(new ProgressEvent("writestart", {"target":me}));
- }
-
- var textBlob = blackberry.utils.stringToBlob(text);
-
- if(blackberry.io.file.exists(this.fileName)){
-
- var oldText = '';
- var newText = text;
-
- var getFileContents = function(path,blob){
-
- if(blob){
- oldText = blackberry.utils.blobToString(blob);
- if(oldText.length>0){
- newText = oldText.substr(0,me.position) + text;
- }
- }
-
- var tempFile = me.fileName+'temp';
- if(blackberry.io.file.exists(tempFile)){
- blackberry.io.file.deleteFile(tempFile);
- }
-
- var newTextBlob = blackberry.utils.stringToBlob(newText);
-
- // crete a temp file, delete file we are 'overwriting', then rename temp file
- blackberry.io.file.saveFile(tempFile, newTextBlob);
- blackberry.io.file.deleteFile(me.fileName);
- blackberry.io.file.rename(tempFile, me.fileName.split('/').pop());
-
- me.position = newText.length;
- me.length = me.position;
-
- if (typeof me.onwrite === "function") {
- me.onwrite(new ProgressEvent("write", {"target":me}));
- }
- };
-
- // setting asynch to off
- blackberry.io.file.readFile(this.fileName, getFileContents, false);
-
- }else{
-
- // file is new so just save it
- blackberry.io.file.saveFile(this.fileName, textBlob);
- me.position = text.length;
- me.length = me.position;
- }
-
- me.readyState = FileWriter.DONE;
-
- if (typeof me.onwriteend === "function") {
- me.onwriteend(new ProgressEvent("writeend", {"target":me}));
- }
-};
-
-/**
- * Moves the file pointer to the location specified.
- *
- * If the offset is a negative number the position of the file
- * pointer is rewound. If the offset is greater than the file
- * size the position is set to the end of the file.
- *
- * @param offset is the location to move the file pointer to.
- */
-FileWriter.prototype.seek = function(offset) {
- // Throw an exception if we are already writing a file
- if (this.readyState === FileWriter.WRITING) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- if (!offset && offset !== 0) {
- return;
- }
-
- // See back from end of file.
- if (offset < 0) {
- this.position = Math.max(offset + this.length, 0);
- }
- // Offset is bigger than file size so set position
- // to the end of the file.
- else if (offset > this.length) {
- this.position = this.length;
- }
- // Offset is between 0 and file size so set the position
- // to start writing.
- else {
- this.position = offset;
- }
-};
-
-/**
- * Truncates the file to the size specified.
- *
- * @param size to chop the file at.
- */
-FileWriter.prototype.truncate = function(size) {
- // Throw an exception if we are already writing a file
- if (this.readyState === FileWriter.WRITING) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- // WRITING state
- this.readyState = FileWriter.WRITING;
-
- var me = this;
-
- // If onwritestart callback
- if (typeof me.onwritestart === "function") {
- me.onwritestart(new ProgressEvent("writestart", {"target":this}));
- }
-
- if(blackberry.io.file.exists(this.fileName)){
-
- var oldText = '';
- var newText = '';
-
- var getFileContents = function(path,blob){
-
- if(blob){
- oldText = blackberry.utils.blobToString(blob);
- if(oldText.length>0){
- newText = oldText.slice(0,size);
- }else{
- // TODO: throw error
- }
- }
-
- var tempFile = me.fileName+'temp';
- if(blackberry.io.file.exists(tempFile)){
- blackberry.io.file.deleteFile(tempFile);
- }
-
- var newTextBlob = blackberry.utils.stringToBlob(newText);
-
- // crete a temp file, delete file we are 'overwriting', then rename temp file
- blackberry.io.file.saveFile(tempFile, newTextBlob);
- blackberry.io.file.deleteFile(me.fileName);
- blackberry.io.file.rename(tempFile, me.fileName.split('/').pop());
-
- me.position = newText.length;
- me.length = me.position;
-
- if (typeof me.onwrite === "function") {
- me.onwrite(new ProgressEvent("write", {"target":me}));
- }
- };
-
- // setting asynch to off - worry about making this all callbacks later
- blackberry.io.file.readFile(this.fileName, getFileContents, false);
-
- }else{
-
- // TODO: file doesn't exist - throw error
-
- }
-
- me.readyState = FileWriter.DONE;
-
- if (typeof me.onwriteend === "function") {
- me.onwriteend(new ProgressEvent("writeend", {"target":me}));
- }
-};
-
-module.exports = FileWriter;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/battery.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/battery.js b/lib/blackberry/plugin/air/battery.js
deleted file mode 100644
index a922573..0000000
--- a/lib/blackberry/plugin/air/battery.js
+++ /dev/null
@@ -1,57 +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');
-
-module.exports = {
- start: function (args, win, fail) {
- // Register one listener to each of the level and state change
- // events using WebWorks API.
- blackberry.system.event.deviceBatteryStateChange(function(state) {
- var me = navigator.battery;
- // state is either CHARGING or UNPLUGGED
- if (state === 2 || state === 3) {
- var info = {
- "level" : me._level,
- "isPlugged" : state === 2
- };
-
- if (me._isPlugged !== info.isPlugged && typeof win === 'function') {
- win(info);
- }
- }
- });
- blackberry.system.event.deviceBatteryLevelChange(function(level) {
- var me = navigator.battery;
- if (level != me._level && typeof win === 'function') {
- win({'level' : level, 'isPlugged' : me._isPlugged});
- }
- });
-
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- },
- stop: function (args, win, fail) {
- // Unregister battery listeners.
- blackberry.system.event.deviceBatteryStateChange(null);
- blackberry.system.event.deviceBatteryLevelChange(null);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/camera.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/camera.js b/lib/blackberry/plugin/air/camera.js
deleted file mode 100644
index aef67f3..0000000
--- a/lib/blackberry/plugin/air/camera.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 cordova = require('cordova');
-
-module.exports = {
- takePicture: function (args, win, fail) {
- var onCaptured = blackberry.events.registerEventHandler("onCaptured", win),
- onCameraClosed = blackberry.events.registerEventHandler("onCameraClosed", function () {}),
- onError = blackberry.events.registerEventHandler("onError", fail),
- request = new blackberry.transport.RemoteFunctionCall('blackberry/media/camera/takePicture');
-
- request.addParam("onCaptured", onCaptured);
- request.addParam("onCameraClosed", onCameraClosed);
- request.addParam("onError", onError);
-
- //HACK: this is a sync call due to:
- //https://github.com/blackberry/WebWorks-TabletOS/issues/51
- request.makeSyncCall();
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/capture.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/capture.js b/lib/blackberry/plugin/air/capture.js
deleted file mode 100644
index 7809195..0000000
--- a/lib/blackberry/plugin/air/capture.js
+++ /dev/null
@@ -1,114 +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');
-
-function capture(action, win, fail) {
- var onCaptured = blackberry.events.registerEventHandler("onCaptured", function (path) {
- var file = blackberry.io.file.getFileProperties(path);
- win([{
- fullPath: path,
- lastModifiedDate: file.dateModified,
- name: path.replace(file.directory + "/", ""),
- size: file.size,
- type: file.fileExtension
- }]);
- }),
- onCameraClosed = blackberry.events.registerEventHandler("onCameraClosed", function () {}),
- onError = blackberry.events.registerEventHandler("onError", fail),
- request = new blackberry.transport.RemoteFunctionCall('blackberry/media/camera/' + action);
-
- request.addParam("onCaptured", onCaptured);
- request.addParam("onCameraClosed", onCameraClosed);
- request.addParam("onError", onError);
-
- //HACK: this is a sync call due to:
- //https://github.com/blackberry/WebWorks-TabletOS/issues/51
- request.makeSyncCall();
-}
-
-module.exports = {
- getSupportedAudioModes: function (args, win, fail) {
- return {"status": cordova.callbackStatus.OK, "message": []};
- },
- getSupportedImageModes: function (args, win, fail) {
- return {"status": cordova.callbackStatus.OK, "message": []};
- },
- getSupportedVideoModes: function (args, win, fail) {
- return {"status": cordova.callbackStatus.OK, "message": []};
- },
- captureImage: function (args, win, fail) {
- if (args[0].limit > 0) {
- capture("takePicture", win, fail);
- }
- else {
- win([]);
- }
-
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- },
- captureVideo: function (args, win, fail) {
- if (args[0].limit > 0) {
- capture("takeVideo", win, fail);
- }
- else {
- win([]);
- }
-
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- },
- captureAudio: function (args, win, fail) {
- var onCaptureAudioWin = function(filePath){
- // for some reason the filePath is coming back as a string between two double quotes
- filePath = filePath.slice(1, filePath.length-1);
- var file = blackberry.io.file.getFileProperties(filePath);
-
- win([{
- fullPath: filePath,
- lastModifiedDate: file.dateModified,
- name: filePath.replace(file.directory + "/", ""),
- size: file.size,
- type: file.fileExtension
- }]);
- };
-
- var onCaptureAudioFail = function(){
- fail([]);
- };
-
- if (args[0].limit > 0 && args[0].duration){
- // a sloppy way of creating a uuid since there's no built in date function to get milliseconds since epoch
- // might be better to instead check files within directory and then figure out the next file name should be
- // ie, img000 -> img001 though that would take awhile and would add a whole bunch of checks
- var id = new Date();
- id = (id.getDay()).toString() + (id.getHours()).toString() + (id.getSeconds()).toString() + (id.getMilliseconds()).toString() + (id.getYear()).toString();
-
- var fileName = blackberry.io.dir.appDirs.shared.music.path+'/audio'+id+'.wav';
- blackberry.media.microphone.record(fileName, onCaptureAudioWin, onCaptureAudioFail);
- // multiple duration by a 1000 since it comes in as seconds
- setTimeout(blackberry.media.microphone.stop,args[0].duration*1000);
- }
- else {
- win([]);
- }
- return {"status": cordova.callbackStatus.NO_RESULT, "message": "WebWorks Is On It"};
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/device.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/device.js b/lib/blackberry/plugin/air/device.js
deleted file mode 100644
index 9d0ecc0..0000000
--- a/lib/blackberry/plugin/air/device.js
+++ /dev/null
@@ -1,48 +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'),
- cordova = require('cordova');
-
-// Tell cordova channel to wait on the CordovaInfoReady event
-channel.waitForInitialization('onCordovaInfoReady');
-
-module.exports = {
- getDeviceInfo : function(args, win, fail){
- //Register an event handler for the networkChange event
- var callback = blackberry.events.registerEventHandler("deviceInfo", function (info) {
- win({
- platform: "BlackBerry",
- version: info.version,
- model: "PlayBook",
- name: "PlayBook", // deprecated: please use device.model
- uuid: info.uuid,
- cordova: CORDOVA_JS_BUILD_LABEL
- });
- }),
- request = new blackberry.transport.RemoteFunctionCall("org/apache/cordova/getDeviceInfo");
-
- request.addParam("id", callback);
- request.makeSyncCall();
-
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "" };
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/file/bbsymbols.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/file/bbsymbols.js b/lib/blackberry/plugin/air/file/bbsymbols.js
deleted file mode 100644
index 26697fe..0000000
--- a/lib/blackberry/plugin/air/file/bbsymbols.js
+++ /dev/null
@@ -1,33 +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/air/DirectoryReader', 'DirectoryReader');
-modulemapper.clobbers('cordova/plugin/air/File', 'File');
-modulemapper.clobbers('cordova/plugin/air/FileReader', 'FileReader');
-modulemapper.clobbers('cordova/plugin/air/FileWriter', 'FileWriter');
-modulemapper.clobbers('cordova/plugin/air/requestFileSystem', 'requestFileSystem');
-modulemapper.clobbers('cordova/plugin/air/resolveLocalFileSystemURI', 'resolveLocalFileSystemURI');
-modulemapper.merges('cordova/plugin/air/DirectoryEntry', 'DirectoryEntry');
-modulemapper.merges('cordova/plugin/air/Entry', 'Entry');
-modulemapper.merges('cordova/plugin/air/FileEntry', 'FileEntry');
-
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/manager.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/manager.js b/lib/blackberry/plugin/air/manager.js
deleted file mode 100644
index f652b4d..0000000
--- a/lib/blackberry/plugin/air/manager.js
+++ /dev/null
@@ -1,57 +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'),
- plugins = {
- 'Device' : require('cordova/plugin/air/device'),
- 'Battery' : require('cordova/plugin/air/battery'),
- 'Camera' : require('cordova/plugin/air/camera'),
- 'Logger' : require('cordova/plugin/webworks/logger'),
- 'Media' : require('cordova/plugin/webworks/media'),
- 'Capture' : require('cordova/plugin/air/capture'),
- 'Accelerometer' : require('cordova/plugin/webworks/accelerometer'),
- 'NetworkStatus' : require('cordova/plugin/air/network'),
- 'Notification' : require('cordova/plugin/webworks/notification'),
- 'FileTransfer' : require('cordova/plugin/air/FileTransfer')
- };
-
-module.exports = {
- addPlugin: function (key, module) {
- plugins[key] = require(module);
- },
- exec: function (win, fail, clazz, action, args) {
- var result = {"status" : cordova.callbackStatus.CLASS_NOT_FOUND_EXCEPTION, "message" : "Class " + clazz + " cannot be found"};
-
- if (plugins[clazz]) {
- if (plugins[clazz][action]) {
- result = plugins[clazz][action](args, win, fail);
- }
- else {
- result = { "status" : cordova.callbackStatus.INVALID_ACTION, "message" : "Action not found: " + action };
- }
- }
-
- return result;
- },
- resume: function () {},
- pause: function () {},
- destroy: function () {}
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/network.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/network.js b/lib/blackberry/plugin/air/network.js
deleted file mode 100644
index 85e671e..0000000
--- a/lib/blackberry/plugin/air/network.js
+++ /dev/null
@@ -1,54 +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'),
- connection = require('cordova/plugin/Connection');
-
-module.exports = {
- getConnectionInfo: function (args, win, fail) {
- var connectionType = connection.NONE,
- eventType = "offline",
- callbackID,
- request;
-
- /**
- * For PlayBooks, we currently only have WiFi connections, so
- * return WiFi if there is any access at all.
- * TODO: update if/when PlayBook gets other connection types...
- */
- if (blackberry.system.hasDataCoverage()) {
- connectionType = connection.WIFI;
- eventType = "online";
- }
-
- //Register an event handler for the networkChange event
- callbackID = blackberry.events.registerEventHandler("networkChange", function (status) {
- win(status.type);
- });
-
- //pass our callback id down to our network extension
- request = new blackberry.transport.RemoteFunctionCall("org/apache/cordova/getConnectionInfo");
- request.addParam("networkStatusChangedID", callbackID);
- request.makeSyncCall();
-
- return { "status": cordova.callbackStatus.OK, "message": connectionType};
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/platform.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/platform.js b/lib/blackberry/plugin/air/platform.js
deleted file mode 100644
index 6ee2403..0000000
--- a/lib/blackberry/plugin/air/platform.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.
- *
-*/
-
-module.exports = {
- id: "playbook",
- initialize:function() {}
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/requestFileSystem.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/requestFileSystem.js b/lib/blackberry/plugin/air/requestFileSystem.js
deleted file mode 100644
index b1079cc..0000000
--- a/lib/blackberry/plugin/air/requestFileSystem.js
+++ /dev/null
@@ -1,80 +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'),
-FileError = require('cordova/plugin/FileError'),
-FileSystem = require('cordova/plugin/FileSystem'),
-LocalFileSystem = require('cordova/plugin/LocalFileSystem');
-
-/**
- * Request a file system in which to store application data.
- * @param type local file system type
- * @param size indicates how much storage space, in bytes, the application expects to need
- * @param successCallback invoked with a FileSystem object
- * @param errorCallback invoked if error occurs retrieving file system
- */
-var requestFileSystem = function(type, size, successCallback, errorCallback) {
- var fail = function(code) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(code));
- }
- };
-
- if (type < 0 || type > 3) {
- fail(FileError.SYNTAX_ERR);
- } else {
- // if successful, return a FileSystem object
- var success = function(file_system) {
- if (file_system) {
- if (typeof successCallback === 'function') {
- successCallback(file_system);
- }
- }
- else {
- // no FileSystem object returned
- fail(FileError.NOT_FOUND_ERR);
- }
- };
-
- // guessing the max file size is 2GB - 1 bytes?
- // https://bdsc.webapps.blackberry.com/native/documentation/com.qnx.doc.neutrino.user_guide/topic/limits_filesystems.html
-
- if(size>=2147483648){
- fail(FileError.QUOTA_EXCEEDED_ERR);
- return;
- }
-
-
- var theFileSystem;
- try{
- // is there a way to get space for the app that doesn't point to the appDirs folder?
- if(type==LocalFileSystem.TEMPORARY){
- theFileSystem = new FileSystem('temporary', new DirectoryEntry('root', blackberry.io.dir.appDirs.app.storage.path));
- }else if(type==LocalFileSystem.PERSISTENT){
- theFileSystem = new FileSystem('persistent', new DirectoryEntry('root', blackberry.io.dir.appDirs.app.storage.path));
- }
- success(theFileSystem);
- }catch(e){
- fail(FileError.SYNTAX_ERR);
- }
- }
-};
-module.exports = requestFileSystem;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/air/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/resolveLocalFileSystemURI.js b/lib/blackberry/plugin/air/resolveLocalFileSystemURI.js
deleted file mode 100644
index f179fed..0000000
--- a/lib/blackberry/plugin/air/resolveLocalFileSystemURI.js
+++ /dev/null
@@ -1,102 +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'),
- FileEntry = require('cordova/plugin/FileEntry'),
- FileError = require('cordova/plugin/FileError');
-
-/**
- * Look up file system Entry referred to by local URI.
- * @param {DOMString} uri URI referring to a local file or directory
- * @param successCallback invoked with Entry object corresponding to URI
- * @param errorCallback invoked if error occurs retrieving file system entry
- */
-module.exports = function(uri, successCallback, errorCallback) {
- // error callback
- var fail = function(error) {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(error));
- }
- };
- // if successful, return either a file or directory entry
- var success = function(entry) {
- var result;
-
- if (entry) {
- if (typeof successCallback === 'function') {
- // create appropriate Entry object
- 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);
- return;
- }
- };
-
- if(!uri || uri === ""){
- fail(FileError.NOT_FOUND_ERR);
- return;
- }
-
- // decode uri if % char found
- if(uri.indexOf('%')>=0){
- uri = decodeURI(uri);
- }
-
- // pop the parameters if any
- if(uri.indexOf('?')>=0){
- uri = uri.split('?')[0];
- }
-
- // check for leading /
- if(uri.indexOf('/')===0){
- fail(FileError.ENCODING_ERR);
- return;
- }
-
- // Entry object is borked - unable to instantiate a new Entry object so just create one
- var theEntry = {};
- if(blackberry.io.dir.exists(uri)){
- theEntry.isDirectory = true;
- theEntry.name = uri.split('/').pop();
- theEntry.fullPath = uri;
-
- success(theEntry);
- }else if(blackberry.io.file.exists(uri)){
- theEntry.isDirectory = false;
- theEntry.name = uri.split('/').pop();
- theEntry.fullPath = uri;
- success(theEntry);
- return;
- }else{
- fail(FileError.NOT_FOUND_ERR);
- return;
- }
-
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/Contact.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/Contact.js b/lib/blackberry/plugin/java/Contact.js
deleted file mode 100644
index 52d82cf..0000000
--- a/lib/blackberry/plugin/java/Contact.js
+++ /dev/null
@@ -1,406 +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 ContactError = require('cordova/plugin/ContactError'),
- ContactUtils = require('cordova/plugin/java/ContactUtils'),
- utils = require('cordova/utils'),
- ContactAddress = require('cordova/plugin/ContactAddress'),
- exec = require('cordova/exec');
-
-// ------------------
-// Utility functions
-// ------------------
-
-/**
- * Retrieves a BlackBerry contact from the device by unique id.
- *
- * @param uid
- * Unique id of the contact on the device
- * @return {blackberry.pim.Contact} BlackBerry contact or null if contact with
- * specified id is not found
- */
-var findByUniqueId = function(uid) {
- if (!uid) {
- return null;
- }
- var bbContacts = blackberry.pim.Contact.find(new blackberry.find.FilterExpression("uid", "==", uid));
- return bbContacts[0] || null;
-};
-
-/**
- * Creates a BlackBerry contact object from the W3C Contact object and persists
- * it to device storage.
- *
- * @param {Contact}
- * contact The contact to save
- * @return a new contact object with all properties set
- */
-var saveToDevice = function(contact) {
-
- if (!contact) {
- return;
- }
-
- var bbContact = null;
- var update = false;
-
- // if the underlying BlackBerry contact already exists, retrieve it for
- // update
- if (contact.id) {
- // we must attempt to retrieve the BlackBerry contact from the device
- // because this may be an update operation
- bbContact = findByUniqueId(contact.id);
- }
-
- // contact not found on device, create a new one
- if (!bbContact) {
- bbContact = new blackberry.pim.Contact();
- }
- // update the existing contact
- else {
- update = true;
- }
-
- // NOTE: The user may be working with a partial Contact object, because only
- // user-specified Contact fields are returned from a find operation (blame
- // the W3C spec). If this is an update to an existing Contact, we don't
- // want to clear an attribute from the contact database simply because the
- // Contact object that the user passed in contains a null value for that
- // attribute. So we only copy the non-null Contact attributes to the
- // BlackBerry contact object before saving.
- //
- // This means that a user must explicitly set a Contact attribute to a
- // non-null value in order to update it in the contact database.
- //
- // name
- if (contact.name !== null) {
- if (contact.name.givenName) {
- bbContact.firstName = contact.name.givenName;
- }
- if (contact.name.familyName) {
- bbContact.lastName = contact.name.familyName;
- }
- if (contact.name.honorificPrefix) {
- bbContact.title = contact.name.honorificPrefix;
- }
- }
-
- // display name
- if (contact.displayName !== null) {
- bbContact.user1 = contact.displayName;
- }
-
- // note
- if (contact.note !== null) {
- bbContact.note = contact.note;
- }
-
- // birthday
- //
- // user may pass in Date object or a string representation of a date
- // if it is a string, we don't know the date format, so try to create a
- // new Date with what we're given
- //
- // NOTE: BlackBerry's Date.parse() does not work well, so use new Date()
- //
- if (contact.birthday !== null) {
- if (utils.isDate(contact.birthday)) {
- bbContact.birthday = contact.birthday;
- } else {
- var bday = contact.birthday.toString();
- bbContact.birthday = (bday.length > 0) ? new Date(bday) : "";
- }
- }
-
- // BlackBerry supports three email addresses
- if (contact.emails && utils.isArray(contact.emails)) {
-
- // if this is an update, re-initialize email addresses
- if (update) {
- bbContact.email1 = "";
- bbContact.email2 = "";
- bbContact.email3 = "";
- }
-
- // copy the first three email addresses found
- var email = null;
- for ( var i = 0; i < contact.emails.length; i += 1) {
- email = contact.emails[i];
- if (!email || !email.value) {
- continue;
- }
- if (bbContact.email1 === "") {
- bbContact.email1 = email.value;
- } else if (bbContact.email2 === "") {
- bbContact.email2 = email.value;
- } else if (bbContact.email3 === "") {
- bbContact.email3 = email.value;
- }
- }
- }
-
- // BlackBerry supports a finite number of phone numbers
- // copy into appropriate fields based on type
- if (contact.phoneNumbers && utils.isArray(contact.phoneNumbers)) {
-
- // if this is an update, re-initialize phone numbers
- if (update) {
- bbContact.homePhone = "";
- bbContact.homePhone2 = "";
- bbContact.workPhone = "";
- bbContact.workPhone2 = "";
- bbContact.mobilePhone = "";
- bbContact.faxPhone = "";
- bbContact.pagerPhone = "";
- bbContact.otherPhone = "";
- }
-
- var type = null;
- var number = null;
- for ( var j = 0; j < contact.phoneNumbers.length; j += 1) {
- if (!contact.phoneNumbers[j] || !contact.phoneNumbers[j].value) {
- continue;
- }
- type = contact.phoneNumbers[j].type;
- number = contact.phoneNumbers[j].value;
- if (type === 'home') {
- if (bbContact.homePhone === "") {
- bbContact.homePhone = number;
- } else if (bbContact.homePhone2 === "") {
- bbContact.homePhone2 = number;
- }
- } else if (type === 'work') {
- if (bbContact.workPhone === "") {
- bbContact.workPhone = number;
- } else if (bbContact.workPhone2 === "") {
- bbContact.workPhone2 = number;
- }
- } else if (type === 'mobile' && bbContact.mobilePhone === "") {
- bbContact.mobilePhone = number;
- } else if (type === 'fax' && bbContact.faxPhone === "") {
- bbContact.faxPhone = number;
- } else if (type === 'pager' && bbContact.pagerPhone === "") {
- bbContact.pagerPhone = number;
- } else if (bbContact.otherPhone === "") {
- bbContact.otherPhone = number;
- }
- }
- }
-
- // BlackBerry supports two addresses: home and work
- // copy the first two addresses found from Contact
- if (contact.addresses && utils.isArray(contact.addresses)) {
-
- // if this is an update, re-initialize addresses
- if (update) {
- bbContact.homeAddress = null;
- bbContact.workAddress = null;
- }
-
- var address = null;
- var bbHomeAddress = null;
- var bbWorkAddress = null;
- for ( var k = 0; k < contact.addresses.length; k += 1) {
- address = contact.addresses[k];
- if (!address || address.id === undefined || address.pref === undefined || address.type === undefined || address.formatted === undefined) {
- continue;
- }
-
- if (bbHomeAddress === null && (!address.type || address.type === "home")) {
- bbHomeAddress = createBlackBerryAddress(address);
- bbContact.homeAddress = bbHomeAddress;
- } else if (bbWorkAddress === null && (!address.type || address.type === "work")) {
- bbWorkAddress = createBlackBerryAddress(address);
- bbContact.workAddress = bbWorkAddress;
- }
- }
- }
-
- // copy first url found to BlackBerry 'webpage' field
- if (contact.urls && utils.isArray(contact.urls)) {
-
- // if this is an update, re-initialize web page
- if (update) {
- bbContact.webpage = "";
- }
-
- var url = null;
- for ( var m = 0; m < contact.urls.length; m += 1) {
- url = contact.urls[m];
- if (!url || !url.value) {
- continue;
- }
- if (bbContact.webpage === "") {
- bbContact.webpage = url.value;
- break;
- }
- }
- }
-
- // copy fields from first organization to the
- // BlackBerry 'company' and 'jobTitle' fields
- if (contact.organizations && utils.isArray(contact.organizations)) {
-
- // if this is an update, re-initialize org attributes
- if (update) {
- bbContact.company = "";
- }
-
- var org = null;
- for ( var n = 0; n < contact.organizations.length; n += 1) {
- org = contact.organizations[n];
- if (!org) {
- continue;
- }
- if (bbContact.company === "") {
- bbContact.company = org.name || "";
- bbContact.jobTitle = org.title || "";
- break;
- }
- }
- }
-
- // categories
- if (contact.categories && utils.isArray(contact.categories)) {
- bbContact.categories = [];
- var category = null;
- for ( var o = 0; o < contact.categories.length; o += 1) {
- category = contact.categories[o];
- if (typeof category == "string") {
- bbContact.categories.push(category);
- }
- }
- }
-
- // save to device
- bbContact.save();
-
- // invoke native side to save photo
- // fail gracefully if photo URL is no good, but log the error
- if (contact.photos && utils.isArray(contact.photos)) {
- var photo = null;
- for ( var p = 0; p < contact.photos.length; p += 1) {
- photo = contact.photos[p];
- if (!photo || !photo.value) {
- continue;
- }
- exec(
- // success
- function() {
- },
- // fail
- function(e) {
- console.log('Contact.setPicture failed:' + e);
- }, "Contacts", "setPicture", [ bbContact.uid, photo.type,
- photo.value ]);
- break;
- }
- }
-
- // Use the fully populated BlackBerry contact object to create a
- // corresponding W3C contact object.
- return ContactUtils.createContact(bbContact, [ "*" ]);
-};
-
-/**
- * Creates a BlackBerry Address object from a W3C ContactAddress.
- *
- * @return {blackberry.pim.Address} a BlackBerry address object
- */
-var createBlackBerryAddress = function(address) {
- var bbAddress = new blackberry.pim.Address();
-
- if (!address) {
- return bbAddress;
- }
-
- bbAddress.address1 = address.streetAddress || "";
- bbAddress.city = address.locality || "";
- bbAddress.stateProvince = address.region || "";
- bbAddress.zipPostal = address.postalCode || "";
- bbAddress.country = address.country || "";
-
- return bbAddress;
-};
-
-module.exports = {
- /**
- * Persists contact to device storage.
- */
- save : function(success, fail) {
- try {
- // save the contact and store it's unique id
- var fullContact = saveToDevice(this);
- this.id = fullContact.id;
-
- // This contact object may only have a subset of properties
- // if the save was an update of an existing contact. This is
- // because the existing contact was likely retrieved using a
- // subset of properties, so only those properties were set in the
- // object. For this reason, invoke success with the contact object
- // returned by saveToDevice since it is fully populated.
- if (typeof success === 'function') {
- success(fullContact);
- }
- } catch (e) {
- console.log('Error saving contact: ' + e);
- if (typeof fail === 'function') {
- fail(new ContactError(ContactError.UNKNOWN_ERROR));
- }
- }
- },
-
- /**
- * Removes contact from device storage.
- *
- * @param success
- * success callback
- * @param fail
- * error callback
- */
- remove : function(success, fail) {
- try {
- // retrieve contact from device by id
- var bbContact = null;
- if (this.id) {
- bbContact = findByUniqueId(this.id);
- }
-
- // if contact was found, remove it
- if (bbContact) {
- console.log('removing contact: ' + bbContact.uid);
- bbContact.remove();
- if (typeof success === 'function') {
- success(this);
- }
- }
- // attempting to remove a contact that hasn't been saved
- else if (typeof fail === 'function') {
- fail(new ContactError(ContactError.UNKNOWN_ERROR));
- }
- } catch (e) {
- console.log('Error removing contact ' + this.id + ": " + e);
- if (typeof fail === 'function') {
- fail(new ContactError(ContactError.UNKNOWN_ERROR));
- }
- }
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/blackberry/plugin/java/ContactUtils.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/ContactUtils.js b/lib/blackberry/plugin/java/ContactUtils.js
deleted file mode 100644
index 2b7f030..0000000
--- a/lib/blackberry/plugin/java/ContactUtils.js
+++ /dev/null
@@ -1,382 +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 ContactAddress = require('cordova/plugin/ContactAddress'),
- ContactName = require('cordova/plugin/ContactName'),
- ContactField = require('cordova/plugin/ContactField'),
- ContactOrganization = require('cordova/plugin/ContactOrganization'),
- utils = require('cordova/utils'),
- Contact = require('cordova/plugin/Contact');
-
-/**
- * Mappings for each Contact field that may be used in a find operation. Maps
- * W3C Contact fields to one or more fields in a BlackBerry contact object.
- *
- * Example: user searches with a filter on the Contact 'name' field:
- *
- * <code>Contacts.find(['name'], onSuccess, onFail, {filter:'Bob'});</code>
- *
- * The 'name' field does not exist in a BlackBerry contact. Instead, a filter
- * expression will be built to search the BlackBerry contacts using the
- * BlackBerry 'title', 'firstName' and 'lastName' fields.
- */
-var fieldMappings = {
- "id" : "uid",
- "displayName" : "user1",
- "name" : [ "title", "firstName", "lastName" ],
- "name.formatted" : [ "title", "firstName", "lastName" ],
- "name.givenName" : "firstName",
- "name.familyName" : "lastName",
- "name.honorificPrefix" : "title",
- "phoneNumbers" : [ "faxPhone", "homePhone", "homePhone2", "mobilePhone",
- "pagerPhone", "otherPhone", "workPhone", "workPhone2" ],
- "phoneNumbers.value" : [ "faxPhone", "homePhone", "homePhone2",
- "mobilePhone", "pagerPhone", "otherPhone", "workPhone",
- "workPhone2" ],
- "emails" : [ "email1", "email2", "email3" ],
- "addresses" : [ "homeAddress.address1", "homeAddress.address2",
- "homeAddress.city", "homeAddress.stateProvince",
- "homeAddress.zipPostal", "homeAddress.country",
- "workAddress.address1", "workAddress.address2", "workAddress.city",
- "workAddress.stateProvince", "workAddress.zipPostal",
- "workAddress.country" ],
- "addresses.formatted" : [ "homeAddress.address1", "homeAddress.address2",
- "homeAddress.city", "homeAddress.stateProvince",
- "homeAddress.zipPostal", "homeAddress.country",
- "workAddress.address1", "workAddress.address2", "workAddress.city",
- "workAddress.stateProvince", "workAddress.zipPostal",
- "workAddress.country" ],
- "addresses.streetAddress" : [ "homeAddress.address1",
- "homeAddress.address2", "workAddress.address1",
- "workAddress.address2" ],
- "addresses.locality" : [ "homeAddress.city", "workAddress.city" ],
- "addresses.region" : [ "homeAddress.stateProvince",
- "workAddress.stateProvince" ],
- "addresses.country" : [ "homeAddress.country", "workAddress.country" ],
- "organizations" : [ "company", "jobTitle" ],
- "organizations.name" : "company",
- "organizations.title" : "jobTitle",
- "birthday" : "birthday",
- "note" : "note",
- "categories" : "categories",
- "urls" : "webpage",
- "urls.value" : "webpage"
-};
-
-/*
- * Build an array of all of the valid W3C Contact fields. This is used to
- * substitute all the fields when ["*"] is specified.
- */
-var allFields = [];
-for ( var key in fieldMappings) {
- if (fieldMappings.hasOwnProperty(key)) {
- allFields.push(key);
- }
-}
-
-/**
- * Create a W3C ContactAddress object from a BlackBerry Address object.
- *
- * @param {String}
- * type the type of address (e.g. work, home)
- * @param {blackberry.pim.Address}
- * bbAddress a BlackBerry Address object
- * @return {ContactAddress} a contact address object or null if the specified
- * address is null
- */
-var createContactAddress = function(type, bbAddress) {
-
- if (!bbAddress) {
- return null;
- }
-
- var address1 = bbAddress.address1 || "";
- var address2 = bbAddress.address2 || "";
- var streetAddress = address1 + ", " + address2;
- var locality = bbAddress.city || "";
- var region = bbAddress.stateProvince || "";
- var postalCode = bbAddress.zipPostal || "";
- var country = bbAddress.country || "";
- var formatted = streetAddress + ", " + locality + ", " + region + ", " + postalCode + ", " + country;
-
- return new ContactAddress(null, type, formatted, streetAddress, locality,
- region, postalCode, country);
-};
-
-module.exports = {
- /**
- * Builds a BlackBerry filter expression for contact search using the
- * contact fields and search filter provided.
- *
- * @param {String[]}
- * fields Array of Contact fields to search
- * @param {String}
- * filter Filter, or search string
- * @return filter expression or null if fields is empty or filter is null or
- * empty
- */
- buildFilterExpression : function(fields, filter) {
-
- // ensure filter exists
- if (!filter || filter === "") {
- return null;
- }
-
- if (fields.length == 1 && fields[0] === "*") {
- // Cordova enhancement to allow fields value of ["*"] to indicate
- // all supported fields.
- fields = allFields;
- }
-
- // BlackBerry API uses specific operators to build filter expressions
- // for
- // querying Contact lists. The operators are
- // ["!=","==","<",">","<=",">="].
- // Use of regex is also an option, and the only one we can use to
- // simulate
- // an SQL '%LIKE%' clause.
- //
- // Note: The BlackBerry regex implementation doesn't seem to support
- // conventional regex switches that would enable a case insensitive
- // search.
- // It does not honor the (?i) switch (which causes Contact.find() to
- // fail).
- // We need case INsensitivity to match the W3C Contacts API spec.
- // So the guys at RIM proposed this method:
- //
- // original filter = "norm"
- // case insensitive filter = "[nN][oO][rR][mM]"
- //
- var ciFilter = "";
- for ( var i = 0; i < filter.length; i++) {
- ciFilter = ciFilter + "[" + filter[i].toLowerCase() + filter[i].toUpperCase() + "]";
- }
-
- // match anything that contains our filter string
- filter = ".*" + ciFilter + ".*";
-
- // build a filter expression using all Contact fields provided
- var filterExpression = null;
- if (fields && utils.isArray(fields)) {
- var fe = null;
- for (var f = 0; f < fields.length; f++) {
- if (!fields[f]) {
- continue;
- }
-
- // retrieve the BlackBerry contact fields that map to the one
- // specified
- var bbFields = fieldMappings[fields[f]];
-
- // BlackBerry doesn't support the field specified
- if (!bbFields) {
- continue;
- }
-
- if (!utils.isArray(bbFields)) {
- bbFields = [bbFields];
- }
-
- // construct the filter expression using the BlackBerry fields
- for (var j = 0; j < bbFields.length; j++) {
- fe = new blackberry.find.FilterExpression(bbFields[j],
- "REGEX", filter);
- if (filterExpression === null) {
- filterExpression = fe;
- } else {
- // combine the filters
- filterExpression = new blackberry.find.FilterExpression(
- filterExpression, "OR", fe);
- }
- }
- }
- }
-
- return filterExpression;
- },
-
- /**
- * Creates a Contact object from a BlackBerry Contact object, copying only
- * the fields specified.
- *
- * This is intended as a privately used function but it is made globally
- * available so that a Contact.save can convert a BlackBerry contact object
- * into its W3C equivalent.
- *
- * @param {blackberry.pim.Contact}
- * bbContact BlackBerry Contact object
- * @param {String[]}
- * fields array of contact fields that should be copied
- * @return {Contact} a contact object containing the specified fields or
- * null if the specified contact is null
- */
- createContact : function(bbContact, fields) {
-
- if (!bbContact) {
- return null;
- }
-
- // construct a new contact object
- // always copy the contact id and displayName fields
- var contact = new Contact(bbContact.uid, bbContact.user1);
-
- // nothing to do
- if (!fields || !(utils.isArray(fields)) || fields.length === 0) {
- return contact;
- } else if (fields.length == 1 && fields[0] === "*") {
- // Cordova enhancement to allow fields value of ["*"] to indicate
- // all supported fields.
- fields = allFields;
- }
-
- // add the fields specified
- for (var i = 0; i < fields.length; i++) {
- var field = fields[i];
-
- if (!field) {
- continue;
- }
-
- // name
- if (field.indexOf('name') === 0) {
- var formattedName = bbContact.title + ' ' + bbContact.firstName + ' ' + bbContact.lastName;
- contact.name = new ContactName(formattedName,
- bbContact.lastName, bbContact.firstName, null,
- bbContact.title, null);
- }
- // phone numbers
- else if (field.indexOf('phoneNumbers') === 0) {
- var phoneNumbers = [];
- if (bbContact.homePhone) {
- phoneNumbers.push(new ContactField('home',
- bbContact.homePhone));
- }
- if (bbContact.homePhone2) {
- phoneNumbers.push(new ContactField('home',
- bbContact.homePhone2));
- }
- if (bbContact.workPhone) {
- phoneNumbers.push(new ContactField('work',
- bbContact.workPhone));
- }
- if (bbContact.workPhone2) {
- phoneNumbers.push(new ContactField('work',
- bbContact.workPhone2));
- }
- if (bbContact.mobilePhone) {
- phoneNumbers.push(new ContactField('mobile',
- bbContact.mobilePhone));
- }
- if (bbContact.faxPhone) {
- phoneNumbers.push(new ContactField('fax',
- bbContact.faxPhone));
- }
- if (bbContact.pagerPhone) {
- phoneNumbers.push(new ContactField('pager',
- bbContact.pagerPhone));
- }
- if (bbContact.otherPhone) {
- phoneNumbers.push(new ContactField('other',
- bbContact.otherPhone));
- }
- contact.phoneNumbers = phoneNumbers.length > 0 ? phoneNumbers
- : null;
- }
- // emails
- else if (field.indexOf('emails') === 0) {
- var emails = [];
- if (bbContact.email1) {
- emails.push(new ContactField(null, bbContact.email1, null));
- }
- if (bbContact.email2) {
- emails.push(new ContactField(null, bbContact.email2, null));
- }
- if (bbContact.email3) {
- emails.push(new ContactField(null, bbContact.email3, null));
- }
- contact.emails = emails.length > 0 ? emails : null;
- }
- // addresses
- else if (field.indexOf('addresses') === 0) {
- var addresses = [];
- if (bbContact.homeAddress) {
- addresses.push(createContactAddress("home",
- bbContact.homeAddress));
- }
- if (bbContact.workAddress) {
- addresses.push(createContactAddress("work",
- bbContact.workAddress));
- }
- contact.addresses = addresses.length > 0 ? addresses : null;
- }
- // birthday
- else if (field.indexOf('birthday') === 0) {
- if (bbContact.birthday) {
- contact.birthday = bbContact.birthday;
- }
- }
- // note
- else if (field.indexOf('note') === 0) {
- if (bbContact.note) {
- contact.note = bbContact.note;
- }
- }
- // organizations
- else if (field.indexOf('organizations') === 0) {
- var organizations = [];
- if (bbContact.company || bbContact.jobTitle) {
- organizations.push(new ContactOrganization(null, null,
- bbContact.company, null, bbContact.jobTitle));
- }
- contact.organizations = organizations.length > 0 ? organizations
- : null;
- }
- // categories
- else if (field.indexOf('categories') === 0) {
- if (bbContact.categories && bbContact.categories.length > 0) {
- contact.categories = bbContact.categories;
- } else {
- contact.categories = null;
- }
- }
- // urls
- else if (field.indexOf('urls') === 0) {
- var urls = [];
- if (bbContact.webpage) {
- urls.push(new ContactField(null, bbContact.webpage));
- }
- contact.urls = urls.length > 0 ? urls : null;
- }
- // photos
- else if (field.indexOf('photos') === 0) {
- var photos = [];
- // The BlackBerry Contact object will have a picture attribute
- // with Base64 encoded image
- if (bbContact.picture) {
- photos.push(new ContactField('base64', bbContact.picture));
- }
- contact.photos = photos.length > 0 ? photos : null;
- }
- }
-
- return contact;
- }
-};
[2/6] [CB-4419] Remove non-CLI platforms from cordova-js.
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/Globalization.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Globalization.js b/lib/tizen/plugin/tizen/Globalization.js
deleted file mode 100644
index 8196d17..0000000
--- a/lib/tizen/plugin/tizen/Globalization.js
+++ /dev/null
@@ -1,495 +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.
- *
-*/
-
-
-/*global tizen:false */
-
-var argscheck = require('cordova/argscheck'),
- exec = require('cordova/exec'),
- GlobalizationError = require('cordova/plugin/GlobalizationError');
-
-var globalization = {
-
- /**
- * Returns the string identifier for the client's current language.
- * It returns the language identifier string to the successCB callback with a
- * properties object as a parameter. If there is an error getting the language,
- * then the errorCB callback is invoked.
- *
- * @param {Function} successCB
- * @param {Function} errorCB
- *
- * @return Object.value {String}: The language identifier
- *
- * @error GlobalizationError.UNKNOWN_ERROR
- *
- * Example
- * globalization.getPreferredLanguage(function (language) {alert('language:' + language.value + '\n');},
- * function () {});
- */
- getPreferredLanguage:function(successCB, failureCB) {
- console.log('exec(successCB, failureCB, "Globalization","getPreferredLanguage", []);');
-
- tizen.systeminfo.getPropertyValue (
- "LOCALE",
- function (localeInfo) {
- console.log("Cordova, getLocaleName, language is " + localeInfo.language);
- successCB( {"value": localeInfo.language});
- },
- function(error) {
- console.log("Cordova, getLocaleName, An error occurred " + error.message);
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "cannot retrieve language name"));
- }
- );
- },
-
- /**
- * Returns the string identifier for the client's current locale setting.
- * It returns the locale identifier string to the successCB callback with a
- * properties object as a parameter. If there is an error getting the locale,
- * then the errorCB callback is invoked.
- *
- * @param {Function} successCB
- * @param {Function} errorCB
- *
- * @return Object.value {String}: The locale identifier
- *
- * @error GlobalizationError.UNKNOWN_ERROR
- *
- * Example
- * globalization.getLocaleName(function (locale) {alert('locale:' + locale.value + '\n');},
- * function () {});
- */
- getLocaleName:function(successCB, failureCB) {
- tizen.systeminfo.getPropertyValue (
- "LOCALE",
- function (localeInfo) {
- console.log("Cordova, getLocaleName, locale name (country) is " + localeInfo.country);
- successCB( {"value":localeInfo.language});
- },
- function(error) {
- console.log("Cordova, getLocaleName, An error occurred " + error.message);
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "cannot retrieve locale name"));
- }
- );
- },
-
-
- /**
- * Returns a date formatted as a string according to the client's user preferences and
- * calendar using the time zone of the client. It returns the formatted date string to the
- * successCB callback with a properties object as a parameter. If there is an error
- * formatting the date, then the errorCB callback is invoked.
- *
- * The defaults are: formatLenght="short" and selector="date and time"
- *
- * @param {Date} date
- * @param {Function} successCB
- * @param {Function} errorCB
- * @param {Object} options {optional}
- * formatLength {String}: 'short', 'medium', 'long', or 'full'
- * selector {String}: 'date', 'time', or 'date and time'
- *
- * @return Object.value {String}: The localized date string
- *
- * @error GlobalizationError.FORMATTING_ERROR
- *
- * Example
- * globalization.dateToString(new Date(),
- * function (date) {alert('date:' + date.value + '\n');},
- * function (errorCode) {alert(errorCode);},
- * {formatLength:'short'});
- */
- dateToString:function(date, successCB, failureCB, options) {
- var dateValue = date.valueOf();
- console.log('exec(successCB, failureCB, "Globalization", "dateToString", [{"date": dateValue, "options": options}]);');
-
- var tzdate = null;
- var format = null;
-
- tzdate = new tizen.TZDate(date);
-
- if (tzdate) {
- if (options && (options.formatLength == 'short') ){
- format = tzdate.toLocaleDateString();
- }
- else{
- format = tzdate.toLocaleString();
- }
- console.log('Cordova, globalization, dateToString ' +format);
- }
-
- if (format)
- {
- successCB ({"value": format});
- }
- else {
- failureCB(new GlobalizationError(GlobalizationError.FORMATTING_ERROR , "cannot format date string"));
- }
- },
-
-
- /**
- * Parses a date formatted as a string according to the client's user
- * preferences and calendar using the time zone of the client and returns
- * the corresponding date object. It returns the date to the successCB
- * callback with a properties object as a parameter. If there is an error
- * parsing the date string, then the errorCB callback is invoked.
- *
- * The defaults are: formatLength="short" and selector="date and time"
- *
- * @param {String} dateString
- * @param {Function} successCB
- * @param {Function} errorCB
- * @param {Object} options {optional}
- * formatLength {String}: 'short', 'medium', 'long', or 'full'
- * selector {String}: 'date', 'time', or 'date and time'
- *
- * @return Object.year {Number}: The four digit year
- * Object.month {Number}: The month from (0 - 11)
- * Object.day {Number}: The day from (1 - 31)
- * Object.hour {Number}: The hour from (0 - 23)
- * Object.minute {Number}: The minute from (0 - 59)
- * Object.second {Number}: The second from (0 - 59)
- * Object.millisecond {Number}: The milliseconds (from 0 - 999),
- * not available on all platforms
- *
- * @error GlobalizationError.PARSING_ERROR
- *
- * Example
- * globalization.stringToDate('4/11/2011',
- * function (date) { alert('Month:' + date.month + '\n' +
- * 'Day:' + date.day + '\n' +
- * 'Year:' + date.year + '\n');},
- * function (errorCode) {alert(errorCode);},
- * {selector:'date'});
- */
- stringToDate:function(dateString, successCB, failureCB, options) {
- argscheck.checkArgs('sfFO', 'Globalization.stringToDate', arguments);
- console.log('exec(successCB, failureCB, "Globalization", "stringToDate", [{"dateString": dateString, "options": options}]);');
-
- //not supported
- failureCB(new GlobalizationError(GlobalizationError.PARSING_ERROR , "unsupported"));
- },
-
-
- /**
- * Returns a pattern string for formatting and parsing dates according to the client's
- * user preferences. It returns the pattern to the successCB callback with a
- * properties object as a parameter. If there is an error obtaining the pattern,
- * then the errorCB callback is invoked.
- *
- * The defaults are: formatLength="short" and selector="date and time"
- *
- * @param {Function} successCB
- * @param {Function} errorCB
- * @param {Object} options {optional}
- * formatLength {String}: 'short', 'medium', 'long', or 'full'
- * selector {String}: 'date', 'time', or 'date and time'
- *
- * @return Object.pattern {String}: The date and time pattern for formatting and parsing dates.
- * The patterns follow Unicode Technical Standard #35
- * http://unicode.org/reports/tr35/tr35-4.html
- * Object.timezone {String}: The abbreviated name of the time zone on the client
- * Object.utc_offset {Number}: The current difference in seconds between the client's
- * time zone and coordinated universal time.
- * Object.dst_offset {Number}: The current daylight saving time offset in seconds
- * between the client's non-daylight saving's time zone
- * and the client's daylight saving's time zone.
- *
- * @error GlobalizationError.PATTERN_ERROR
- *
- * Example
- * globalization.getDatePattern(
- * function (date) {alert('pattern:' + date.pattern + '\n');},
- * function () {},
- * {formatLength:'short'});
- */
- getDatePattern:function(successCB, failureCB, options) {
- console.log(' exec(successCB, failureCB, "Globalization", "getDatePattern", [{"options": options}]);');
-
- var shortFormat = (options) ? ( options.formatLength === 'short') : true;
-
- var formatString = tizen.time.getDateFormat ( shortFormat);
-
-
- var current_datetime = tizen.time.getCurrentDateTime();
-
- // probably will require some control of operation...
- if (formatString)
- {
- successCB(
- {
- "pattern": formatString,
- "timezone": current_datetime.getTimezoneAbbreviation(),
- "utc_offset": current_datetime.difference(current_datetime.toUTC()).length,
- "dst_offset": current_datetime.isDST()
- }
- );
- }
- else {
- failureCB(new GlobalizationError(GlobalizationError.PATTERN_ERROR , "cannot get pattern"));
- }
- },
-
-
- /**
- * Returns an array of either the names of the months or days of the week
- * according to the client's user preferences and calendar. It returns the array of names to the
- * successCB callback with a properties object as a parameter. If there is an error obtaining the
- * names, then the errorCB callback is invoked.
- *
- * The defaults are: type="wide" and item="months"
- *
- * @param {Function} successCB
- * @param {Function} errorCB
- * @param {Object} options {optional}
- * type {String}: 'narrow' or 'wide'
- * item {String}: 'months', or 'days'
- *
- * @return Object.value {Array{String}}: The array of names starting from either
- * the first month in the year or the
- * first day of the week.
- * @error GlobalizationError.UNKNOWN_ERROR
- *
- * Example
- * globalization.getDateNames(function (names) {
- * for(var i = 0; i < names.value.length; i++) {
- * alert('Month:' + names.value[i] + '\n');}},
- * function () {});
- */
- getDateNames:function(successCB, failureCB, options) {
- argscheck.checkArgs('fFO', 'Globalization.getDateNames', arguments);
- console.log('exec(successCB, failureCB, "Globalization", "getDateNames", [{"options": options}]);');
-
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
- },
-
- /**
- * Returns whether daylight savings time is in effect for a given date using the client's
- * time zone and calendar. It returns whether or not daylight savings time is in effect
- * to the successCB callback with a properties object as a parameter. If there is an error
- * reading the date, then the errorCB callback is invoked.
- *
- * @param {Date} date
- * @param {Function} successCB
- * @param {Function} errorCB
- *
- * @return Object.dst {Boolean}: The value "true" indicates that daylight savings time is
- * in effect for the given date and "false" indicate that it is not.
- *
- * @error GlobalizationError.UNKNOWN_ERROR
- *
- * Example
- * globalization.isDayLightSavingsTime(new Date(),
- * function (date) {alert('dst:' + date.dst + '\n');}
- * function () {});
- */
- isDayLightSavingsTime:function(date, successCB, failureCB) {
-
- var tzdate = null,
- isDLS = false;
-
- console.log('exec(successCB, failureCB, "Globalization", "isDayLightSavingsTime", [{"date": dateValue}]);');
- console.log("date " + date + " value " + date.valueOf()) ;
-
- tzdate = new tizen.TZDate(date);
- if (tzdate) {
- isDLS = false | (tzdate && tzdate.isDST());
-
- console.log ("Cordova, globalization, isDayLightSavingsTime, " + isDLS);
-
- successCB({"dst":isDLS});
- }
- else {
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "cannot get information"));
- }
- },
-
- /**
- * Returns the first day of the week according to the client's user preferences and calendar.
- * The days of the week are numbered starting from 1 where 1 is considered to be Sunday.
- * It returns the day to the successCB callback with a properties object as a parameter.
- * If there is an error obtaining the pattern, then the errorCB callback is invoked.
- *
- * @param {Function} successCB
- * @param {Function} errorCB
- *
- * @return Object.value {Number}: The number of the first day of the week.
- *
- * @error GlobalizationError.UNKNOWN_ERROR
- *
- * Example
- * globalization.getFirstDayOfWeek(function (day)
- * { alert('Day:' + day.value + '\n');},
- * function () {});
- */
- getFirstDayOfWeek:function(successCB, failureCB) {
- argscheck.checkArgs('fF', 'Globalization.getFirstDayOfWeek', arguments);
- console.log('exec(successCB, failureCB, "Globalization", "getFirstDayOfWeek", []);');
-
- // there is no API to get the fist day of the week in Tizen Dvice API
- successCB({value:1});
-
- // first day of week is a settings in the date book app
- // what about : getting the settings directly or asking the date book ?
- },
-
-
- /**
- * Returns a number formatted as a string according to the client's user preferences.
- * It returns the formatted number string to the successCB callback with a properties object as a
- * parameter. If there is an error formatting the number, then the errorCB callback is invoked.
- *
- * The defaults are: type="decimal"
- *
- * @param {Number} number
- * @param {Function} successCB
- * @param {Function} errorCB
- * @param {Object} options {optional}
- * type {String}: 'decimal', "percent", or 'currency'
- *
- * @return Object.value {String}: The formatted number string.
- *
- * @error GlobalizationError.FORMATTING_ERROR
- *
- * Example
- * globalization.numberToString(3.25,
- * function (number) {alert('number:' + number.value + '\n');},
- * function () {},
- * {type:'decimal'});
- */
- numberToString:function(number, successCB, failureCB, options) {
- argscheck.checkArgs('nfFO', 'Globalization.numberToString', arguments);
- console.log('exec(successCB, failureCB, "Globalization", "numberToString", [{"number": number, "options": options}]);');
- //not supported
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
- },
-
- /**
- * Parses a number formatted as a string according to the client's user preferences and
- * returns the corresponding number. It returns the number to the successCB callback with a
- * properties object as a parameter. If there is an error parsing the number string, then
- * the errorCB callback is invoked.
- *
- * The defaults are: type="decimal"
- *
- * @param {String} numberString
- * @param {Function} successCB
- * @param {Function} errorCB
- * @param {Object} options {optional}
- * type {String}: 'decimal', "percent", or 'currency'
- *
- * @return Object.value {Number}: The parsed number.
- *
- * @error GlobalizationError.PARSING_ERROR
- *
- * Example
- * globalization.stringToNumber('1234.56',
- * function (number) {alert('Number:' + number.value + '\n');},
- * function () { alert('Error parsing number');});
- */
- stringToNumber:function(numberString, successCB, failureCB, options) {
- argscheck.checkArgs('sfFO', 'Globalization.stringToNumber', arguments);
- console.log('exec(successCB, failureCB, "Globalization", "stringToNumber", [{"numberString": numberString, "options": options}]);');
-
- //not supported
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
- },
-
- /**
- * Returns a pattern string for formatting and parsing numbers according to the client's user
- * preferences. It returns the pattern to the successCB callback with a properties object as a
- * parameter. If there is an error obtaining the pattern, then the errorCB callback is invoked.
- *
- * The defaults are: type="decimal"
- *
- * @param {Function} successCB
- * @param {Function} errorCB
- * @param {Object} options {optional}
- * type {String}: 'decimal', "percent", or 'currency'
- *
- * @return Object.pattern {String}: The number pattern for formatting and parsing numbers.
- * The patterns follow Unicode Technical Standard #35.
- * http://unicode.org/reports/tr35/tr35-4.html
- * Object.symbol {String}: The symbol to be used when formatting and parsing
- * e.g., percent or currency symbol.
- * Object.fraction {Number}: The number of fractional digits to use when parsing and
- * formatting numbers.
- * Object.rounding {Number}: The rounding increment to use when parsing and formatting.
- * Object.positive {String}: The symbol to use for positive numbers when parsing and formatting.
- * Object.negative: {String}: The symbol to use for negative numbers when parsing and formatting.
- * Object.decimal: {String}: The decimal symbol to use for parsing and formatting.
- * Object.grouping: {String}: The grouping symbol to use for parsing and formatting.
- *
- * @error GlobalizationError.PATTERN_ERROR
- *
- * Example
- * globalization.getNumberPattern(
- * function (pattern) {alert('Pattern:' + pattern.pattern + '\n');},
- * function () {});
- */
- getNumberPattern:function(successCB, failureCB, options) {
- argscheck.checkArgs('fFO', 'Globalization.getNumberPattern', arguments);
- console.log('exec(successCB, failureCB, "Globalization", "getNumberPattern", [{"options": options}]);');
-
- //not supported
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
- },
-
- /**
- * Returns a pattern string for formatting and parsing currency values according to the client's
- * user preferences and ISO 4217 currency code. It returns the pattern to the successCB callback with a
- * properties object as a parameter. If there is an error obtaining the pattern, then the errorCB
- * callback is invoked.
- *
- * @param {String} currencyCode
- * @param {Function} successCB
- * @param {Function} errorCB
- *
- * @return Object.pattern {String}: The currency pattern for formatting and parsing currency values.
- * The patterns follow Unicode Technical Standard #35
- * http://unicode.org/reports/tr35/tr35-4.html
- * Object.code {String}: The ISO 4217 currency code for the pattern.
- * Object.fraction {Number}: The number of fractional digits to use when parsing and
- * formatting currency.
- * Object.rounding {Number}: The rounding increment to use when parsing and formatting.
- * Object.decimal: {String}: The decimal symbol to use for parsing and formatting.
- * Object.grouping: {String}: The grouping symbol to use for parsing and formatting.
- *
- * @error GlobalizationError.FORMATTING_ERROR
- *
- * Example
- * globalization.getCurrencyPattern('EUR',
- * function (currency) {alert('Pattern:' + currency.pattern + '\n');}
- * function () {});
- */
- getCurrencyPattern:function(currencyCode, successCB, failureCB) {
- argscheck.checkArgs('sfF', 'Globalization.getCurrencyPattern', arguments);
- console.log('exec(successCB, failureCB, "Globalization", "getCurrencyPattern", [{"currencyCode": currencyCode}]);');
-
- //not supported
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
- }
-
-};
-
-module.exports = globalization;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/Media.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Media.js b/lib/tizen/plugin/tizen/Media.js
deleted file mode 100644
index 546df40..0000000
--- a/lib/tizen/plugin/tizen/Media.js
+++ /dev/null
@@ -1,217 +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.
- *
-*/
-
-/*global Media:false, webkitURL:false */
-var MediaError = require('cordova/plugin/MediaError'),
- audioObjects = {};
-
-//console.log("TIZEN MEDIA START");
-
-module.exports = {
-
-
- create: function (successCallback, errorCallback, args) {
- var id = args[0], src = args[1];
-
- console.log("media::create() - id =" + id + ", src =" + src);
-
- audioObjects[id] = new Audio(src);
-
- audioObjects[id].onStalledCB = function () {
- console.log("media::onStalled()");
-
- audioObjects[id].timer = window.setTimeout(
- function () {
- audioObjects[id].pause();
-
- if (audioObjects[id].currentTime !== 0)
- audioObjects[id].currentTime = 0;
-
- console.log("media::onStalled() - MEDIA_ERROR -> " + MediaError.MEDIA_ERR_ABORTED);
-
- var err = new MediaError(MediaError.MEDIA_ERR_ABORTED, "Stalled");
-
- Media.onStatus(id, Media.MEDIA_ERROR, err);
- },
- 2000);
- };
-
- audioObjects[id].onEndedCB = function () {
- console.log("media::onEndedCB() - MEDIA_STATE -> MEDIA_STOPPED");
-
- Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
- };
-
- audioObjects[id].onErrorCB = function () {
- console.log("media::onErrorCB() - MEDIA_ERROR -> " + event.srcElement.error);
-
- Media.onStatus(id, Media.MEDIA_ERROR, event.srcElement.error);
- };
-
- audioObjects[id].onPlayCB = function () {
- console.log("media::onPlayCB() - MEDIA_STATE -> MEDIA_STARTING");
-
- Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STARTING);
- };
-
- audioObjects[id].onPlayingCB = function () {
- console.log("media::onPlayingCB() - MEDIA_STATE -> MEDIA_RUNNING");
-
- Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_RUNNING);
- };
-
- audioObjects[id].onDurationChangeCB = function () {
- console.log("media::onDurationChangeCB() - MEDIA_DURATION -> " + audioObjects[id].duration);
-
- Media.onStatus(id, Media.MEDIA_DURATION, audioObjects[id].duration);
- };
-
- audioObjects[id].onTimeUpdateCB = function () {
- console.log("media::onTimeUpdateCB() - MEDIA_POSITION -> " + audioObjects[id].currentTime);
-
- Media.onStatus(id, Media.MEDIA_POSITION, audioObjects[id].currentTime);
- };
-
- audioObjects[id].onCanPlayCB = function () {
- console.log("media::onCanPlayCB()");
-
- window.clearTimeout(audioObjects[id].timer);
-
- audioObjects[id].play();
- };
- },
-
- startPlayingAudio: function (successCallback, errorCallback, args) {
- var id = args[0], src = args[1], options = args[2];
-
- console.log("media::startPlayingAudio() - id =" + id + ", src =" + src + ", options =" + options);
-
- audioObjects[id].addEventListener('canplay', audioObjects[id].onCanPlayCB);
- audioObjects[id].addEventListener('ended', audioObjects[id].onEndedCB);
- audioObjects[id].addEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
- audioObjects[id].addEventListener('durationchange', audioObjects[id].onDurationChangeCB);
- audioObjects[id].addEventListener('playing', audioObjects[id].onPlayingCB);
- audioObjects[id].addEventListener('play', audioObjects[id].onPlayCB);
- audioObjects[id].addEventListener('error', audioObjects[id].onErrorCB);
- audioObjects[id].addEventListener('stalled', audioObjects[id].onStalledCB);
-
- audioObjects[id].play();
- },
-
- stopPlayingAudio: function (successCallback, errorCallback, args) {
- var id = args[0];
-
- window.clearTimeout(audioObjects[id].timer);
-
- audioObjects[id].pause();
-
- if (audioObjects[id].currentTime !== 0)
- audioObjects[id].currentTime = 0;
-
- console.log("media::stopPlayingAudio() - MEDIA_STATE -> MEDIA_STOPPED");
-
- Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
-
- audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
- audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
- audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
- audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
- audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
- audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
- audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
- audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
- },
-
- seekToAudio: function (successCallback, errorCallback, args) {
-
- var id = args[0], milliseconds = args[1];
-
- console.log("media::seekToAudio()");
-
- audioObjects[id].currentTime = milliseconds;
- successCallback( audioObjects[id].currentTime);
- },
-
- pausePlayingAudio: function (successCallback, errorCallback, args) {
- var id = args[0];
-
- console.log("media::pausePlayingAudio() - MEDIA_STATE -> MEDIA_PAUSED");
-
- audioObjects[id].pause();
-
- Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_PAUSED);
- },
-
- getCurrentPositionAudio: function (successCallback, errorCallback, args) {
- var id = args[0];
- console.log("media::getCurrentPositionAudio()");
- successCallback(audioObjects[id].currentTime);
- },
-
- release: function (successCallback, errorCallback, args) {
- var id = args[0];
- window.clearTimeout(audioObjects[id].timer);
- console.log("media::release()");
- },
-
- setVolume: function (successCallback, errorCallback, args) {
- var id = args[0], volume = args[1];
-
- console.log("media::setVolume()");
-
- audioObjects[id].volume = volume;
- },
-
- startRecordingAudio: function (successCallback, errorCallback, args) {
- var id = args[0], src = args[1];
-
- console.log("media::startRecordingAudio() - id =" + id + ", src =" + src);
-
- function gotStreamCB(stream) {
- audioObjects[id].src = webkitURL.createObjectURL(stream);
- console.log("media::startRecordingAudio() - stream CB");
- }
-
- function gotStreamFailedCB(error) {
- console.log("media::startRecordingAudio() - error CB:" + error.toString());
- }
-
- if (navigator.webkitGetUserMedia) {
- audioObjects[id] = new Audio();
- navigator.webkitGetUserMedia('audio', gotStreamCB, gotStreamFailedCB);
- } else {
- console.log("webkitGetUserMedia not supported");
- }
- successCallback();
- },
-
- stopRecordingAudio: function (successCallback, errorCallback, args) {
- var id = args[0];
-
- console.log("media::stopRecordingAudio() - id =" + id);
-
- audioObjects[id].pause();
- successCallback();
- }
-};
-
-//console.log("TIZEN MEDIA END");
-
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/MediaError.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/MediaError.js b/lib/tizen/plugin/tizen/MediaError.js
deleted file mode 100644
index 534aab7..0000000
--- a/lib/tizen/plugin/tizen/MediaError.js
+++ /dev/null
@@ -1,29 +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.
- *
-*/
-
-
-// The MediaError object already exists on Tizen. This prevents the Cordova
-// version from being defined. This object is used to merge in differences
-// between Tizen and Cordova MediaError objects.
-module.exports = {
- MEDIA_ERR_NONE_ACTIVE : 0,
- MEDIA_ERR_NONE_SUPPORTED : 4
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/NetworkStatus.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/NetworkStatus.js b/lib/tizen/plugin/tizen/NetworkStatus.js
deleted file mode 100644
index 5130061..0000000
--- a/lib/tizen/plugin/tizen/NetworkStatus.js
+++ /dev/null
@@ -1,97 +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.
- *
-*/
-
-/*global tizen:false */
-var Connection = require('cordova/plugin/Connection');
-
-//console.log("TIZEN CONNECTION AKA NETWORK STATUS START");
-
-module.exports = {
- getConnectionInfo: function (successCallback, errorCallback) {
-
- var cncType = Connection.NONE;
- var infoCount = 0;
- var deviceCapabilities = null;
- var timerId = 0;
- var timeout = 300;
-
-
- function connectionCB() {
-
- if (timerId !== null) {
- clearTimeout(timerId);
- timerId = null;
- }
-
- infoCount++;
-
- if (infoCount > 1) {
- if (successCallback) {
- successCallback(cncType);
- }
- }
- }
-
- function errorCB(error) {
- console.log("Error: " + error.code + "," + error.name + "," + error.message);
-
- if (errorCallback) {
- errorCallback();
- }
- }
-
- function wifiSuccessCB(wifi) {
- if ((wifi.status === "ON") && (wifi.ipAddress.length !== 0)) {
- cncType = Connection.WIFI;
- }
- connectionCB();
- }
-
- function cellularSuccessCB(cell) {
- if ((cncType === Connection.NONE) && (cell.status === "ON") && (cell.ipAddress.length !== 0)) {
- cncType = Connection.CELL_2G;
- }
- connectionCB();
- }
-
-
- deviceCapabilities = tizen.systeminfo.getCapabilities();
-
-
- timerId = setTimeout( function(){
- timerId = null;
- infoCount = 1;
- connectionCB();
- }, timeout);
-
-
- if (deviceCapabilities.wifi) {
- tizen.systeminfo.getPropertyValue("WIFI_NETWORK", wifiSuccessCB, errorCB);
- }
-
- if (deviceCapabilities.telephony) {
- tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", cellularSuccessCB, errorCB);
- }
-
- }
-};
-
-//console.log("TIZEN CONNECTION AKA NETWORK STATUS END");
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/Notification.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Notification.js b/lib/tizen/plugin/tizen/Notification.js
deleted file mode 100644
index 2010b0e..0000000
--- a/lib/tizen/plugin/tizen/Notification.js
+++ /dev/null
@@ -1,168 +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 SoundBeat = require('cordova/plugin/tizen/SoundBeat');
-
-/* TODO: get resource path from app environment? */
-var soundBeat = new SoundBeat(["./sounds/beep.wav"]);
-
-
-//console.log("TIZEN NOTIFICATION START");
-
-
-module.exports = {
-
- alert: function(message, alertCallback, title, buttonName) {
- return this.confirm(message, alertCallback, title, buttonName);
- },
-
- confirm: function(message, confirmCallback, title, buttonLabels) {
- var index = null,
- overlayElement = null,
- popup = null,
- element = null,
- titleString = null,
- messageString = null,
- buttonString = null,
- buttonsArray = null;
-
-
- console.log ("message" , message);
- console.log ("confirmCallback" , confirmCallback);
- console.log ("title" , title);
- console.log ("buttonLabels" , buttonLabels);
-
- titleString = '<div class="popup-title"><p>' + title + '</p></div>';
- messageString = '<div class="popup-text"><p>' + message + '</p></div>';
- buttonString = '<div class="popup-button-bg"><ul>';
-
- switch(typeof(buttonLabels))
- {
- case "string":
- buttonsArray = buttonLabels.split(",");
-
- if (buttonsArray === null) {
- buttonsArray = buttonLabels;
- }
-
- for (index in buttonsArray) {
- buttonString += '<li><input id="popup-button-' + buttonsArray[index]+
- '" type="button" value="' + buttonsArray[index] + '" /></li>';
- console.log ("index: ", index,"");
- console.log ("buttonsArray[index]: ", buttonsArray[index]);
- console.log ("buttonString: ", buttonString);
- }
- break;
-
- case "array":
- if (buttonsArray === null) {
- buttonsArray = buttonLabels;
- }
-
- for (index in buttonsArray) {
- buttonString += '<li><input id="popup-button-' + buttonsArray[index]+
- '" type="button" value="' + buttonsArray[index] + '" /></li>';
- console.log ("index: ", index,"");
- console.log ("buttonsArray[index]: ", buttonsArray[index]);
- console.log ("buttonString: ", buttonString);
- }
- break;
- default:
- console.log ("cordova/plugin/tizen/Notification, default, buttonLabels: ", buttonLabels);
- break;
- }
-
- buttonString += '</ul></div>';
-
- overlayElement = document.createElement("div");
- overlayElement.className = 'ui-popupwindow-screen';
-
- overlayElement.style.zIndex = 1001;
- overlayElement.style.width = "100%";
- overlayElement.style.height = "100%";
- overlayElement.style.top = 0;
- overlayElement.style.left = 0;
- overlayElement.style.margin = 0;
- overlayElement.style.padding = 0;
- overlayElement.style.position = "absolute";
-
- popup = document.createElement("div");
- popup.className = "ui-popupwindow";
- popup.style.position = "fixed";
- popup.style.zIndex = 1002;
- popup.innerHTML = titleString + messageString + buttonString;
-
- document.body.appendChild(overlayElement);
- document.body.appendChild(popup);
-
- function createListener(button) {
- return function() {
- document.body.removeChild(overlayElement);
- document.body.removeChild(popup);
- confirmCallback(button.value);
- };
- }
-
- for (index in buttonsArray) {
- console.log ("index: ", index);
-
- element = document.getElementById("popup-button-" + buttonsArray[index]);
- element.addEventListener("click", createListener(element), false);
- }
- },
-
- prompt: function (message, promptCallback, title, buttonLabels) {
- console.log ("message" , message);
- console.log ("promptCallback" , promptCallback);
- console.log ("title" , title);
- console.log ("buttonLabels" , buttonLabels);
-
- //a temporary implementation using window.prompt()
- // note taht buttons are cancel ok (in that order)
- // gonna to return based on having OK / Cancel
- // ok is 1, cancel is 2
-
- var result = prompt(message);
-
- if (promptCallback && (typeof promptCallback == "function")) {
- promptCallback((result === null) ? 2 : 1, result);
- }
- },
-
- vibrate: function(milliseconds) {
- console.log ("milliseconds" , milliseconds);
-
- if (navigator.vibrate) {
- navigator.vibrate(milliseconds);
- }
- else {
- console.log ("cordova/plugin/tizen/Notification, vibrate API does not exist");
- }
- },
-
- beep: function(count) {
- console.log ("count" , count);
- soundBeat.play(count);
- }
-};
-
-//console.log("TIZEN NOTIFICATION END");
-
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/SoundBeat.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/SoundBeat.js b/lib/tizen/plugin/tizen/SoundBeat.js
deleted file mode 100644
index 4600400..0000000
--- a/lib/tizen/plugin/tizen/SoundBeat.js
+++ /dev/null
@@ -1,94 +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.
- *
-*/
-
-/*global webkitAudioContext:false */
-/*
- * SoundBeat
- * used by Notification Manager beep method
- *
- * This class provides sounds play
- *
- * uses W3C Web Audio API
- * uses BufferLoader object
- *
- * NOTE: the W3C Web Audio doc tells we do not need to recreate the audio
- * context to play a sound but only the audiosourcenode (createBufferSource)
- * in the WebKit implementation we have to.
- *
- */
-
-var BufferLoader = require('cordova/plugin/tizen/BufferLoader');
-
-function SoundBeat(urlList) {
- this.context = null;
- this.urlList = urlList || null;
- this.buffers = null;
-}
-
-/*
- * This method play a loaded sounds on the Device
- * @param {Number} times Number of times to play loaded sounds.
- *
- */
-SoundBeat.prototype.play = function(times) {
-
- var i = 0, sources = [], that = this;
-
- function finishedLoading (bufferList) {
- that.buffers = bufferList;
-
- for (i = 0; i < that.buffers.length ; i +=1) {
- if (that.context) {
- sources[i] = that.context.createBufferSource();
-
- sources[i].buffer = that.buffers[i];
- sources[i].connect (that.context.destination);
-
- sources[i].loop = true;
- sources[i].noteOn (0);
- sources[i].noteOff(sources[i].buffer.duration * times);
- }
- }
- }
-
- if (webkitAudioContext !== null) {
- this.context = new webkitAudioContext();
- }
- else {
- console.log ("SoundBeat.prototype.play, w3c web audio api not supported");
- this.context = null;
- }
-
- if (this.context === null) {
- console.log ("SoundBeat.prototype.play, cannot create audio context object");
- return;
- }
-
- this.bufferLoader = new BufferLoader (this.context, this.urlList, finishedLoading);
- if (this.bufferLoader === null) {
- console.log ("SoundBeat.prototype.play, cannot create buffer loader object");
- return;
- }
-
- this.bufferLoader.load();
-};
-
-module.exports = SoundBeat;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/SplashScreen.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/SplashScreen.js b/lib/tizen/plugin/tizen/SplashScreen.js
deleted file mode 100644
index 1187c45..0000000
--- a/lib/tizen/plugin/tizen/SplashScreen.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 exec = require('cordova/exec');
-
-var splashscreen = {
-
- window: null,
-
-
- show:function() {
- console.log ("tizen splashscreen show()");
-
- // open a windows in splashscreen.window
- // add DOM with an Image
-
- },
- hide:function() {
- console.log ("tizen splashscreen hide()");
- //delete the window splashscreen.window
- //set to null
- }
-};
-
-module.exports = splashscreen;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/contacts.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/contacts.js b/lib/tizen/plugin/tizen/contacts.js
deleted file mode 100644
index 95ae2a1..0000000
--- a/lib/tizen/plugin/tizen/contacts.js
+++ /dev/null
@@ -1,85 +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.
- *
-*/
-
-/*global tizen:false */
-var ContactError = require('cordova/plugin/ContactError'),
- utils = require('cordova/utils'),
- ContactUtils = require('cordova/plugin/tizen/ContactUtils');
-
-module.exports = {
- /**
- * Returns an array of Contacts matching the search criteria.
- *
- * @return array of Contacts matching search criteria
- */
- find : function(fields, successCB, failCB, options) {
-
- // Success callback is required. Throw exception if not specified.
- if (typeof successCB !== 'function') {
- throw new TypeError("You must specify a success callback for the find command.");
- }
-
- // Search qualifier is required and cannot be empty.
- if (!fields || !(utils.isArray(fields)) || fields.length === 0) {
- if (typeof failCB === 'function') {
- failCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR));
- }
- return;
- }
-
- // options are optional
- var filter ="",
- multiple = false,
- contacts = [],
- tizenFilter = null;
-
- if (options) {
- filter = options.filter || "";
- multiple = options.multiple || false;
- }
-
- if (filter){
- tizenFilter = ContactUtils.buildFilterExpression(fields, filter);
- }
-
- tizen.contact.getDefaultAddressBook().find(
- function(tizenContacts) {
- if (multiple) {
- for (var index in tizenContacts) {
- contacts.push(ContactUtils.createContact(tizenContacts[index], fields));
- }
- }
- else {
- contacts.push(ContactUtils.createContact(tizenContacts[0], fields));
- }
-
- // return results
- successCB(contacts);
- },
- function(error) {
- if (typeof failCB === 'function') {
- failCB(ContactError.UNKNOWN_ERROR);
- }
- },
- tizenFilter,
- null);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/contacts/symbols.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/contacts/symbols.js b/lib/tizen/plugin/tizen/contacts/symbols.js
deleted file mode 100644
index bf62092..0000000
--- a/lib/tizen/plugin/tizen/contacts/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.
- *
-*/
-
-require('cordova/plugin/contacts/symbols');
-
-var modulemapper = require('cordova/modulemapper');
-
-modulemapper.merges('cordova/plugin/tizen/contacts', 'navigator.contacts');
-modulemapper.merges('cordova/plugin/tizen/Contact', 'Contact');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/tizen/plugin/tizen/manager.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/manager.js b/lib/tizen/plugin/tizen/manager.js
deleted file mode 100644
index 4c23a8d..0000000
--- a/lib/tizen/plugin/tizen/manager.js
+++ /dev/null
@@ -1,38 +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');
-
-module.exports = {
- exec: function (successCallback, errorCallback, clazz, action, args) {
- var plugin = require('cordova/plugin/tizen/' + clazz);
-
- if (plugin && typeof plugin[action] === 'function') {
- var result = plugin[action](successCallback, errorCallback, args);
- return result || {status: cordova.callbackStatus.NO_RESULT};
- }
-
- return {"status" : cordova.callbackStatus.CLASS_NOT_FOUND_EXCEPTION, "message" : "Function " + clazz + "::" + action + " cannot be found"};
- },
- resume: function () {},
- pause: function () {},
- destroy: function () {}
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/exec.js
----------------------------------------------------------------------
diff --git a/lib/webos/exec.js b/lib/webos/exec.js
deleted file mode 100644
index c069e76..0000000
--- a/lib/webos/exec.js
+++ /dev/null
@@ -1,58 +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.
- *
-*/
-
-/**
- * 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
- * Asynchrounous: 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
- */
-
-var plugins = {
- "Device": require('cordova/plugin/webos/device'),
- "NetworkStatus": require('cordova/plugin/webos/network'),
- "Compass": require('cordova/plugin/webos/compass'),
- "Camera": require('cordova/plugin/webos/camera'),
- "Accelerometer" : require('cordova/plugin/webos/accelerometer'),
- "Notification" : require('cordova/plugin/webos/notification'),
- "Geolocation": require('cordova/plugin/webos/geolocation')
-};
-
-module.exports = function(success, fail, service, action, args) {
- try {
- console.error("exec:call plugin:"+service+":"+action);
- plugins[service][action](success, fail, args);
- }
- catch(e) {
- console.error("missing exec: " + service + "." + action);
- console.error(args);
- console.error(e);
- console.error(e.stack);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/platform.js
----------------------------------------------------------------------
diff --git a/lib/webos/platform.js b/lib/webos/platform.js
deleted file mode 100644
index f59ab5b..0000000
--- a/lib/webos/platform.js
+++ /dev/null
@@ -1,112 +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.
- *
-*/
-
-/*global Mojo:false */
-
-var service=require('cordova/plugin/webos/service'),
- cordova = require('cordova');
-
-module.exports = {
- id: "webos",
- initialize: function() {
- var modulemapper = require('cordova/modulemapper');
-
- modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
-
- modulemapper.merges('cordova/plugin/webos/service', 'navigator.service');
- modulemapper.merges('cordova/plugin/webos/application', 'navigator.application');
- modulemapper.merges('cordova/plugin/webos/window', 'navigator.window');
- modulemapper.merges('cordova/plugin/webos/orientation', 'navigator.orientation');
- modulemapper.merges('cordova/plugin/webos/keyboard', 'navigator.keyboard');
-
- modulemapper.mapModules(window);
-
- if (window.PalmSystem) {
- window.PalmSystem.stageReady();
- }
-
- // create global Mojo object if it does not exist
- Mojo = window.Mojo || {};
-
- // wait for deviceready before listening and firing document events
- document.addEventListener("deviceready", function () {
-
- // LunaSysMgr calls this when the windows is maximized or opened.
- window.Mojo.stageActivated = function() {
- console.log("stageActivated");
- cordova.fireDocumentEvent("resume");
- };
- // LunaSysMgr calls this when the windows is minimized or closed.
- window.Mojo.stageDeactivated = function() {
- console.log("stageDeactivated");
- cordova.fireDocumentEvent("pause");
- };
- // LunaSysMgr calls this when a KeepAlive app's window is hidden
- window.Mojo.hide = function() {
- console.log("hide");
- };
- // LunaSysMgr calls this when a KeepAlive app's window is shown
- window.Mojo.show = function() {
- console.log("show");
- };
-
- // LunaSysMgr calls this whenever an app is "launched;"
- window.Mojo.relaunch = function() {
- // need to return true to tell sysmgr the relaunch succeeded.
- // otherwise, it'll try to focus the app, which will focus the first
- // opened window of an app with multiple windows.
-
- var lp=JSON.parse(PalmSystem.launchParams) || {};
-
- if (lp['palm-command'] && lp['palm-command'] == 'open-app-menu') {
- console.log("event:ToggleAppMenu");
- cordova.fireDocumentEvent("menubutton");
- }
-
- console.log("relaunch");
- return true;
- };
-
- // start to listen for network connection changes
- service.Request('palm://com.palm.connectionmanager', {
- method: 'getstatus',
- parameters: { subscribe: true },
- onSuccess: function (result) {
- console.log("subscribe:result:"+JSON.stringify(result));
-
- if (!result.isInternetConnectionAvailable) {
- if (navigator.onLine) {
- console.log("Firing event:offline");
- cordova.fireDocumentEvent("offline");
- }
- } else {
- console.log("Firing event:online");
- cordova.fireDocumentEvent("online");
- }
- },
- onFailure: function(e) {
- console.error("subscribe:error");
- }
- });
-
- });
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/file/symbols.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/file/symbols.js b/lib/webos/plugin/file/symbols.js
deleted file mode 100644
index 50d7036..0000000
--- a/lib/webos/plugin/file/symbols.js
+++ /dev/null
@@ -1,27 +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'),
- symbolshelper = require('cordova/plugin/file/symbolshelper');
-
-symbolshelper(modulemapper.defaults);
-modulemapper.clobbers('cordova/plugin/webos/requestfilesystem', 'requestFileSystem');
-modulemapper.clobbers('cordova/plugin/webos/filereader', 'FileReader');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/notification/symbols.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/notification/symbols.js b/lib/webos/plugin/notification/symbols.js
deleted file mode 100644
index dc5114e..0000000
--- a/lib/webos/plugin/notification/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/notification', 'navigator.notification');
-modulemapper.merges('cordova/plugin/webos/notification', 'navigator.notification');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/accelerometer.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/accelerometer.js b/lib/webos/plugin/webos/accelerometer.js
deleted file mode 100644
index c285d13..0000000
--- a/lib/webos/plugin/webos/accelerometer.js
+++ /dev/null
@@ -1,52 +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 callback;
-module.exports = {
- /*
- * Tells WebOS to put higher priority on accelerometer resolution. Also relaxes the internal garbage collection events.
- * @param {Boolean} state
- * Dependencies: Mojo.windowProperties
- * Example:
- * navigator.accelerometer.setFastAccelerometer(true)
- */
- setFastAccelerometer: function(state) {
- navigator.windowProperties.fastAccelerometer = state;
- navigator.window.setWindowProperties();
- },
-
- /*
- * Starts the native acceleration listener.
- */
- start: function(win,fail,args) {
- console.error("webos plugin accelerometer start");
- window.removeEventListener("acceleration", callback);
- callback = function(event) {
- var accel = new Acceleration(event.accelX*-9.81, event.accelY*-9.81, event.accelZ*-9.81);
- win(accel);
- };
- document.addEventListener("acceleration", callback);
- },
- stop: function (win,fail,args) {
- console.error("webos plugin accelerometer stop");
- window.removeEventListener("acceleration", callback);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/application.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/application.js b/lib/webos/plugin/webos/application.js
deleted file mode 100644
index 837e739..0000000
--- a/lib/webos/plugin/webos/application.js
+++ /dev/null
@@ -1,70 +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 = {
- isActivated: function(inWindow) {
- inWindow = inWindow || window;
- if(inWindow.PalmSystem) {
- return inWindow.PalmSystem.isActivated;
- }
- return false;
- },
-
- /*
- * Tell webOS to activate the current page of your app, bringing it into focus.
- * Example:
- * navigator.application.activate();
- */
- activate: function(inWindow) {
- inWindow = inWindow || window;
- if(inWindow.PalmSystem) {
- inWindow.PalmSystem.activate();
- }
- },
-
- /*
- * Tell webOS to deactivate your app.
- * Example:
- * navigator.application.deactivate();
- */
- deactivate: function(inWindow) {
- inWindow = inWindow || window;
- if(inWindow.PalmSystem) {
- inWindow.PalmSystem.deactivate();
- }
- },
-
- /*
- * Returns the identifier of the current running application (e.g. com.yourdomain.yourapp).
- * Example:
- * navigator.application.getIdentifier();
- */
- getIdentifier: function() {
- return PalmSystem.identifier;
- },
-
- fetchAppId: function() {
- if (window.PalmSystem) {
- // PalmSystem.identifier: <appid> <processid>
- return PalmSystem.identifier.split(" ")[0];
- }
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/camera.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/camera.js b/lib/webos/plugin/webos/camera.js
deleted file mode 100644
index a8e993a..0000000
--- a/lib/webos/plugin/webos/camera.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 service = require('cordova/plugin/webos/service');
-
-module.exports = {
- takePicture: function(successCallback, errorCallback, options) {
- var filename = (options || {}).filename | "";
-
- service.Request('palm://com.palm.applicationManager', {
- method: 'launch',
- parameters: {
- id: 'com.palm.app.camera',
- params: {
- appId: 'com.palm.app.camera',
- name: 'capture',
- sublaunch: true,
- filename: filename
- }
- },
- onSuccess: successCallback,
- onFailure: errorCallback
- });
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/compass.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/compass.js b/lib/webos/plugin/webos/compass.js
deleted file mode 100644
index c6f392d..0000000
--- a/lib/webos/plugin/webos/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'),
- CompassError = require('cordova/plugin/CompassError');
-
-module.exports = {
- getHeading: function (win, lose) {
- // only TouchPad and Pre3 have a Compass/Gyro
- if (window.device.name !== "TouchPad" && window.device.name !== "Prē3") {
- lose({code: CompassError.COMPASS_NOT_SUPPORTED});
- } else {
- console.error("webos plugin compass getheading");
- var onReadingChanged = function (e) {
- var heading = new CompassHeading(e.magHeading, e.trueHeading);
- document.removeEventListener("compass", onReadingChanged);
- win(heading);
- };
- document.addEventListener("compass", onReadingChanged);
- }
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/device.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/device.js b/lib/webos/plugin/webos/device.js
deleted file mode 100644
index 21188b4..0000000
--- a/lib/webos/plugin/webos/device.js
+++ /dev/null
@@ -1,44 +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 service = require('cordova/plugin/webos/service');
-
-module.exports = {
- getDeviceInfo: function(success, fail, args) {
- console.log("webOS Plugin: Device - getDeviceInfo");
-
- service.Request('palm://com.palm.preferences/systemProperties', {
- method:"Get",
- parameters:{"key": "com.palm.properties.nduid" },
- onSuccess: function (result) {
- var parsedData = JSON.parse(PalmSystem.deviceInfo);
-
- success({
- cordova: "2.2.0",
- platform: "HP webOS",
- name: parsedData.modelName,
- version: parsedData.platformVersion,
- uuid: result["com.palm.properties.nduid"]
- });
- }
- });
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/file.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/file.js b/lib/webos/plugin/webos/file.js
deleted file mode 100644
index 7a3ff3e..0000000
--- a/lib/webos/plugin/webos/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;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/filereader.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/filereader.js b/lib/webos/plugin/webos/filereader.js
deleted file mode 100644
index f5e89e6..0000000
--- a/lib/webos/plugin/webos/filereader.js
+++ /dev/null
@@ -1,119 +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'),
- ProgressEvent = require('cordova/plugin/ProgressEvent');
-
-var FileReader = function() {
- this.fileName = "";
-
- this.readyState = 0; // FileReader.EMPTY
-
- // File data
- this.result = null;
-
- // Error
- this.error = null;
-
- // Event handlers
- this.onloadstart = null; // When the read starts.
- this.onprogress = null; // While reading (and decoding) file or fileBlob data, and reporting partial file data (progess.loaded/progress.total)
- this.onload = null; // When the read has successfully completed.
- this.onerror = null; // When the read has failed (see errors).
- this.onloadend = null; // When the request has completed (either in success or failure).
- this.onabort = null; // When the read has been aborted. For instance, by invoking the abort() method.
-};
-
-FileReader.prototype.readAsText = function(file, encoding) {
- console.error("webos plugin filereader readastext:" + file);
- //Mojo has no file i/o yet, so we use an xhr. very limited
-
- // Already loading something
- if (this.readyState == FileReader.LOADING) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- // LOADING state
- this.readyState = FileReader.LOADING;
-
- // If loadstart callback
- if (typeof this.onloadstart === "function") {
- this.onloadstart(new ProgressEvent("loadstart", {target:this}));
- }
-
- // Default encoding is UTF-8
- var enc = encoding ? encoding : "UTF-8";
-
- var me = this;
-
- var xhr = new XMLHttpRequest();
- xhr.onreadystatechange = function() {
- console.error("onreadystatechange:"+xhr.readyState+" "+xhr.status);
- if (xhr.readyState == 4) {
- if (xhr.status == 200 && xhr.responseText) {
- console.error("file read completed");
- // Save result
- me.result = xhr.responseText;
-
- // If onload callback
- if (typeof me.onload === "function") {
- me.onload(new ProgressEvent("load", {target:me}));
- }
-
- // DONE state
- me.readyState = FileReader.DONE;
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
-
- } else {
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileReader.DONE) {
- return;
- }
-
- // DONE state
- me.readyState = FileReader.DONE;
-
- me.result = null;
-
- // Save error
- me.error = new FileError(FileError.NOT_FOUND_ERR);
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror(new ProgressEvent("error", {target:me}));
- }
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- }
- }
- };
- xhr.open("GET", file, true);
- xhr.send();
-};
-
-module.exports = FileReader;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/geolocation.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/geolocation.js b/lib/webos/plugin/webos/geolocation.js
deleted file mode 100644
index 79039dd..0000000
--- a/lib/webos/plugin/webos/geolocation.js
+++ /dev/null
@@ -1,51 +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 service = require('cordova/plugin/webos/service');
-
-module.exports = {
- getLocation: function(successCallback, errorCallback, options) {
- console.error("webos plugin geolocation getlocation");
- var request = service.Request('palm://com.palm.location', {
- method: "getCurrentPosition",
- onSuccess: function(event) {
- var alias={};
- alias.lastPosition = {
- coords: {
- latitude: event.latitude,
- longitude: event.longitude,
- altitude: (event.altitude >= 0 ? event.altitude: null),
- speed: (event.velocity >= 0 ? event.velocity: null),
- heading: (event.heading >= 0 ? event.heading: null),
- accuracy: (event.horizAccuracy >= 0 ? event.horizAccuracy: null),
- altitudeAccuracy: (event.vertAccuracy >= 0 ? event.vertAccuracy: null)
- },
- timestamp: new Date().getTime()
- };
-
- successCallback(alias.lastPosition);
- },
- onFailure: function() {
- errorCallback();
- }
- });
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/keyboard.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/keyboard.js b/lib/webos/plugin/webos/keyboard.js
deleted file mode 100644
index cd71331..0000000
--- a/lib/webos/plugin/webos/keyboard.js
+++ /dev/null
@@ -1,65 +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 _isShowing = null,
- _manual = null;
-
-module.exports = {
- types: {
- text: 0,
- password: 1,
- search: 2,
- range: 3,
- email: 4,
- number: 5,
- phone: 6,
- url: 7,
- color: 8
- },
- isShowing: function() {
- return !!_isShowing;
- },
- show: function(type){
- if(this.isManualMode()) {
- PalmSystem.keyboardShow(type || 0);
- }
- },
- hide: function(){
- if(this.isManualMode()) {
- PalmSystem.keyboardHide();
- }
- },
- setManualMode: function(mode){
- _manual = mode;
- PalmSystem.setManualKeyboardEnabled(mode);
- },
- isManualMode: function(){
- return _manual || false;
- },
- forceShow: function(inType){
- this.setManualMode(true);
- PalmSystem.keyboardShow(inType || 0);
- },
- forceHide: function(){
- this.setManualMode(true);
- PalmSystem.keyboardHide();
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/network.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/network.js b/lib/webos/plugin/webos/network.js
deleted file mode 100644
index 504841f..0000000
--- a/lib/webos/plugin/webos/network.js
+++ /dev/null
@@ -1,52 +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 service=require('cordova/plugin/webos/service'),
- Connection = require('cordova/plugin/Connection');
-
-module.exports = {
- /**
- * Get connection info
- *
- * @param {Function} successCallback The function to call when the Connection data is available
- * @param {Function} errorCallback The function to call when there is an error getting the Connection data. (OPTIONAL)
- */
- getConnectionInfo: function (successCallback, errorCallback) {
- // Get info
- console.log("webos Plugin: NetworkStatus - getConnectionInfo");
-
- service.Request('palm://com.palm.connectionmanager', {
- method: 'getstatus',
- parameters: {},
- onSuccess: function (result) {
- console.log("result:"+JSON.stringify(result));
-
- var info={};
- if (!result.isInternetConnectionAvailable) { info.type=Connection.NONE; }
- if (result.wifi && result.wifi.onInternet) { info.type=Connection.WIFI; }
- if (result.wan && result.wan.state==="connected") { info.type=Connection.CELL_2G; }
-
- successCallback(info.type);
- },
- onFailure: errorCallback
- });
- }
-};