You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by gt...@apache.org on 2012/11/02 14:31:15 UTC
[5/5] Refactored BlackBerry into one javascript file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0919268c/lib/webworks/java/plugin/java/ContactUtils.js
----------------------------------------------------------------------
diff --git a/lib/webworks/java/plugin/java/ContactUtils.js b/lib/webworks/java/plugin/java/ContactUtils.js
deleted file mode 100644
index 2b7f030..0000000
--- a/lib/webworks/java/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;
- }
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0919268c/lib/webworks/java/plugin/java/DirectoryEntry.js
----------------------------------------------------------------------
diff --git a/lib/webworks/java/plugin/java/DirectoryEntry.js b/lib/webworks/java/plugin/java/DirectoryEntry.js
deleted file mode 100644
index d8315d2..0000000
--- a/lib/webworks/java/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/incubator-cordova-js/blob/0919268c/lib/webworks/java/plugin/java/Entry.js
----------------------------------------------------------------------
diff --git a/lib/webworks/java/plugin/java/Entry.js b/lib/webworks/java/plugin/java/Entry.js
deleted file mode 100644
index 5e2f313..0000000
--- a/lib/webworks/java/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/incubator-cordova-js/blob/0919268c/lib/webworks/java/plugin/java/MediaError.js
----------------------------------------------------------------------
diff --git a/lib/webworks/java/plugin/java/MediaError.js b/lib/webworks/java/plugin/java/MediaError.js
deleted file mode 100644
index 6702452..0000000
--- a/lib/webworks/java/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/incubator-cordova-js/blob/0919268c/lib/webworks/java/plugin/java/app.js
----------------------------------------------------------------------
diff --git a/lib/webworks/java/plugin/java/app.js b/lib/webworks/java/plugin/java/app.js
deleted file mode 100644
index 43b74c1..0000000
--- a/lib/webworks/java/plugin/java/app.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.
- *
-*/
-
-var exec = require('cordova/exec');
-var manager = require('cordova/plugin/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/incubator-cordova-js/blob/0919268c/lib/webworks/java/plugin/java/contacts.js
----------------------------------------------------------------------
diff --git a/lib/webworks/java/plugin/java/contacts.js b/lib/webworks/java/plugin/java/contacts.js
deleted file mode 100644
index 522ad7a..0000000
--- a/lib/webworks/java/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/incubator-cordova-js/blob/0919268c/lib/webworks/java/plugin/java/notification.js
----------------------------------------------------------------------
diff --git a/lib/webworks/java/plugin/java/notification.js b/lib/webworks/java/plugin/java/notification.js
deleted file mode 100644
index 8586393..0000000
--- a/lib/webworks/java/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/incubator-cordova-js/blob/0919268c/lib/webworks/java/plugin/manager.js
----------------------------------------------------------------------
diff --git a/lib/webworks/java/plugin/manager.js b/lib/webworks/java/plugin/manager.js
deleted file mode 100644
index aa93ef6..0000000
--- a/lib/webworks/java/plugin/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/incubator-cordova-js/blob/0919268c/lib/webworks/qnx/platform.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/platform.js b/lib/webworks/qnx/platform.js
deleted file mode 100644
index 3c7b4cc..0000000
--- a/lib/webworks/qnx/platform.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 = {
- id: "qnx",
- initialize: function () {
- document.addEventListener("deviceready", function () {
- blackberry.event.addEventListener("pause", function () {
- cordova.fireDocumentEvent("pause");
- });
- blackberry.event.addEventListener("resume", function () {
- cordova.fireDocumentEvent("resume");
- });
-
- window.addEventListener("online", function () {
- cordova.fireDocumentEvent("online");
- });
-
- window.addEventListener("offline", function () {
- cordova.fireDocumentEvent("offline");
- });
- });
- },
- objects: {
- requestFileSystem:{
- path: 'cordova/plugin/qnx/requestFileSystem'
- },
- resolveLocalFileSystemURI:{
- path: 'cordova/plugin/qnx/resolveLocalFileSystemURI'
- }
- }
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0919268c/lib/webworks/qnx/plugin/compass.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/compass.js b/lib/webworks/qnx/plugin/compass.js
deleted file mode 100644
index 061ceb5..0000000
--- a/lib/webworks/qnx/plugin/compass.js
+++ /dev/null
@@ -1,162 +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'),
- utils = require('cordova/utils'),
- CompassHeading = require('cordova/plugin/CompassHeading'),
- CompassError = require('cordova/plugin/CompassError'),
- timers = {},
- listeners = [],
- heading = null,
- running = false,
- start = function () {
- exec(function (result) {
- heading = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp);
- listeners.forEach(function (l) {
- l.win(heading);
- });
- }, function (e) {
- listeners.forEach(function (l) {
- l.fail(e);
- });
- },
- "Compass", "start", []);
- running = true;
- },
- stop = function () {
- exec(null, null, "Compass", "stop", []);
- running = false;
- },
- createCallbackPair = function (win, fail) {
- return {win:win, fail:fail};
- },
- removeListeners = function (l) {
- var idx = listeners.indexOf(l);
- if (idx > -1) {
- listeners.splice(idx, 1);
- if (listeners.length === 0) {
- stop();
- }
- }
- },
- compass = {
- /**
- * Asynchronously acquires the current heading.
- * @param {Function} successCallback The function to call when the heading
- * data is available
- * @param {Function} errorCallback The function to call when there is an error
- * getting the heading data.
- * @param {CompassOptions} options The options for getting the heading data (not used).
- */
- getCurrentHeading:function(successCallback, errorCallback, options) {
- if (typeof successCallback !== "function") {
- throw "getCurrentHeading must be called with at least a success callback function as first parameter.";
- }
-
- var p;
- var win = function(a) {
- removeListeners(p);
- successCallback(a);
- };
- var fail = function(e) {
- removeListeners(p);
- errorCallback(e);
- };
-
- p = createCallbackPair(win, fail);
- listeners.push(p);
-
- if (!running) {
- start();
- }
- },
-
- /**
- * Asynchronously acquires the heading repeatedly at a given interval.
- * @param {Function} successCallback The function to call each time the heading
- * data is available
- * @param {Function} errorCallback The function to call when there is an error
- * getting the heading data.
- * @param {HeadingOptions} options The options for getting the heading data
- * such as timeout and the frequency of the watch. For iOS, filter parameter
- * specifies to watch via a distance filter rather than time.
- */
- watchHeading:function(successCallback, errorCallback, options) {
- var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100;
- var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0;
-
- // successCallback required
- if (typeof successCallback !== "function") {
- console.log("Compass Error: successCallback is not a function");
- return;
- }
-
- // errorCallback optional
- if (errorCallback && (typeof errorCallback !== "function")) {
- console.log("Compass Error: errorCallback is not a function");
- return;
- }
- // Keep reference to watch id, and report heading readings as often as defined in frequency
- var id = utils.createUUID();
-
- var p = createCallbackPair(function(){}, function(e) {
- removeListeners(p);
- errorCallback(e);
- });
- listeners.push(p);
-
- timers[id] = {
- timer:window.setInterval(function() {
- if (heading) {
- successCallback(heading);
- }
- }, frequency),
- listeners:p
- };
-
- if (running) {
- // If we're already running then immediately invoke the success callback
- // but only if we have retrieved a value, sample code does not check for null ...
- if(heading) {
- successCallback(heading);
- }
- } else {
- start();
- }
-
- return id;
- },
-
- /**
- * Clears the specified heading watch.
- * @param {String} watchId The ID of the watch returned from #watchHeading.
- */
- clearWatch:function(id) {
- // Stop javascript timer & remove from timer list
- if (id && timers[id]) {
- window.clearInterval(timers[id].timer);
- removeListeners(timers[id].listeners);
- delete timers[id];
- }
- }
- };
-
-module.exports = compass;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0919268c/lib/webworks/qnx/plugin/manager.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/manager.js b/lib/webworks/qnx/plugin/manager.js
deleted file mode 100644
index 991dc74..0000000
--- a/lib/webworks/qnx/plugin/manager.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.
- *
-*/
-
-var cordova = require('cordova'),
- plugins = {
- 'NetworkStatus' : require('cordova/plugin/qnx/network'),
- 'Accelerometer' : require('cordova/plugin/webworks/accelerometer'),
- 'Device' : require('cordova/plugin/qnx/device'),
- 'Battery' : require('cordova/plugin/qnx/battery'),
- 'Compass' : require('cordova/plugin/qnx/compass'),
- 'Camera' : require('cordova/plugin/qnx/camera'),
- 'Capture' : require('cordova/plugin/qnx/capture'),
- 'Logger' : require('cordova/plugin/webworks/logger'),
- 'Notification' : require('cordova/plugin/webworks/notification'),
- 'Media': require('cordova/plugin/webworks/media'),
- 'FileTransfer': require('cordova/plugin/qnx/fileTransfer')
- };
-
-module.exports = {
- 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/incubator-cordova-js/blob/0919268c/lib/webworks/qnx/plugin/qnx/battery.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/qnx/battery.js b/lib/webworks/qnx/plugin/qnx/battery.js
deleted file mode 100644
index 1971a49..0000000
--- a/lib/webworks/qnx/plugin/qnx/battery.js
+++ /dev/null
@@ -1,36 +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'),
- handler;
-
-module.exports = {
- start: function (args, win, fail) {
- handler = win;
- blackberry.event.addEventListener("batterystatus", handler);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- },
-
- stop: function (args, win, fail) {
- blackberry.event.removeEventListener("batterystatus", handler);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- }
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0919268c/lib/webworks/qnx/plugin/qnx/camera.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/qnx/camera.js b/lib/webworks/qnx/plugin/qnx/camera.js
deleted file mode 100644
index c357437..0000000
--- a/lib/webworks/qnx/plugin/qnx/camera.js
+++ /dev/null
@@ -1,32 +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 noop = function () {};
- blackberry.invoke.card.invokeCamera("photo", function (path) {
- win("file://" + path);
- }, noop, noop);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- }
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0919268c/lib/webworks/qnx/plugin/qnx/capture.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/qnx/capture.js b/lib/webworks/qnx/plugin/qnx/capture.js
deleted file mode 100644
index 41c5de0..0000000
--- a/lib/webworks/qnx/plugin/qnx/capture.js
+++ /dev/null
@@ -1,76 +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 noop = function () {};
-
- blackberry.invoke.card.invokeCamera(action, function (path) {
- var sb = blackberry.io.sandbox;
- blackberry.io.sandbox = false;
- webkitRequestFileSystem(PERSISTENT, 1024, function (fs) {
- fs.root.getFile(path, {}, function (fe) {
- fe.file(function (file) {
- file.fullPath = fe.fullPath;
- win([file]);
- blackberry.io.sandbox = sb;
- }, fail);
- }, fail);
- }, fail);
- }, noop, noop);
-}
-
-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("photo", 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("video", win, fail);
- }
- else {
- win([]);
- }
-
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- },
- captureAudio: function (args, win, fail) {
- fail("Capturing Audio not supported");
- return {"status": cordova.callbackStatus.NO_RESULT, "message": "WebWorks Is On It"};
- }
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0919268c/lib/webworks/qnx/plugin/qnx/compass.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/qnx/compass.js b/lib/webworks/qnx/plugin/qnx/compass.js
deleted file mode 100644
index f636ac0..0000000
--- a/lib/webworks/qnx/plugin/qnx/compass.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.
- *
-*/
-
-var cordova = require('cordova'),
- callback;
-
-module.exports = {
- start: function (args, win, fail) {
- window.removeEventListener("deviceorientation", callback);
- callback = function (orientation) {
- var heading = 360 - orientation.alpha;
- win({
- magneticHeading: heading,
- trueHeading: heading,
- headingAccuracy: 0,
- timestamp: orientation.timeStamp
- });
- };
-
- window.addEventListener("deviceorientation", callback);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- },
- stop: function (args, win, fail) {
- window.removeEventListener("deviceorientation", callback);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- }
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0919268c/lib/webworks/qnx/plugin/qnx/device.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/qnx/device.js b/lib/webworks/qnx/plugin/qnx/device.js
deleted file mode 100644
index ca21d68..0000000
--- a/lib/webworks/qnx/plugin/qnx/device.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 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){
- win({
- platform: "BB10",
- version: blackberry.system.softwareVersion,
- name: "Dev Alpha",
- uuid: blackberry.identity.uuid,
- cordova: "2.2.0"
- });
-
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "Device info returned" };
- }
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0919268c/lib/webworks/qnx/plugin/qnx/fileTransfer.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/qnx/fileTransfer.js b/lib/webworks/qnx/plugin/qnx/fileTransfer.js
deleted file mode 100644
index 0433f0c..0000000
--- a/lib/webworks/qnx/plugin/qnx/fileTransfer.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.
- *
-*/
-
-var cordova = require('cordova');
-
-module.exports = {
- download: function (args, win, fail) {
- var source = args[0],
- target = args[1];
-
- blackberry.io.filetransfer.download(source, target, win, fail);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
- },
-
- upload: function (args, win, fail) {
- var path = args[0],
- server = args[1],
- options = {
- fileKey: args[2],
- fileName: args[3],
- mimeType: args[4],
- params: args[5],
- chunkedMode: args[6]
- };
-
- blackberry.io.filetransfer.upload(path, server, win, fail, options);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
- }
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0919268c/lib/webworks/qnx/plugin/qnx/network.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/qnx/network.js b/lib/webworks/qnx/plugin/qnx/network.js
deleted file mode 100644
index 4df3e38..0000000
--- a/lib/webworks/qnx/plugin/qnx/network.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.
- *
-*/
-
-var cordova = require('cordova'),
- connection = require('cordova/plugin/Connection');
-
-module.exports = {
- getConnectionInfo: function (args, win, fail) {
- return { "status": cordova.callbackStatus.OK, "message": blackberry.connection.type};
- }
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0919268c/lib/webworks/qnx/plugin/qnx/requestFileSystem.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/qnx/requestFileSystem.js b/lib/webworks/qnx/plugin/qnx/requestFileSystem.js
deleted file mode 100644
index 36524a0..0000000
--- a/lib/webworks/qnx/plugin/qnx/requestFileSystem.js
+++ /dev/null
@@ -1,22 +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 = window.webkitRequestFileSystem;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0919268c/lib/webworks/qnx/plugin/qnx/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/lib/webworks/qnx/plugin/qnx/resolveLocalFileSystemURI.js b/lib/webworks/qnx/plugin/qnx/resolveLocalFileSystemURI.js
deleted file mode 100644
index f0b29d2..0000000
--- a/lib/webworks/qnx/plugin/qnx/resolveLocalFileSystemURI.js
+++ /dev/null
@@ -1,22 +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 = window.webkitResolveLocalFileSystemURI;