Skip to content
Permalink
Browse files
  • Loading branch information
ldeluca committed Jun 11, 2014
2 parents 855acb6 + 64751b4 commit ebbd212ce0cf060b18dd35c564caf190dadf7352
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 7 deletions.
@@ -1,3 +1,24 @@
<!--
#
# 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.
#
-->

# Contributing to Apache Cordova

Anyone can contribute to Cordova. And we need your contributions.
@@ -61,3 +61,11 @@
* CB-6422: [windows8] use cordova/exec/proxy
* CB-6460: Update license headers
* Add NOTICE file

### 0.2.10 (Jun 05, 2014)
* CB-6127 Spanish and French Translations added. Github close #12
* Changing 1.5 to 2.0
* added firefoxos version - conversion
* added firefoxos version
* CB-6800 Add license
* CB-6491 add CONTRIBUTING.md
@@ -22,7 +22,7 @@
xmlns:rim="http://www.blackberry.com/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
id="org.apache.cordova.device"
version="0.2.10-dev">
version="0.2.11-dev">
<name>Device</name>
<description>Cordova Device Plugin</description>
<license>Apache 2.0</license>
@@ -17,23 +17,64 @@
* specific language governing permissions and limitations
* under the License.
*
*/

*/
//example UA String for Firefox OS
//Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0
var firefoxos = require('cordova/platform');
var cordova = require('cordova');

//UA parsing not recommended but currently this is the only way to get the Firefox OS version
//https://developer.mozilla.org/en-US/docs/Gecko_user_agent_string_reference

//Should be replaced when better conversion to Firefox OS Version is available
function convertVersionNumber(ver) {
var hashVersion = {
'18.0': '1.0.1',
'18.1': '1.1',
'26.0': '1.2',
'28.0': '1.3',
'30.0': '1.4',
'32.0': '2.0'
};
var rver = ver;
var sStr = ver.substring(0, 4);
if (hashVersion[sStr]) {
rver = hashVersion[sStr];
}
return (rver);

}
function getVersion() {
if (navigator.userAgent.match(/(mobile|tablet)/i)) {
var ffVersionArray = (navigator.userAgent.match(/Firefox\/([\d]+\.[\w]?\.?[\w]+)/));
if (ffVersionArray.length === 2) {
return (convertVersionNumber(ffVersionArray[1]));
}
}
return (null);
}

function getModel() {
var uaArray = navigator.userAgent.split(/\s*[;)(]\s*/);
if (navigator.userAgent.match(/(mobile|tablet)/i)) {
if (uaArray.length === 5) {
return (uaArray[2]);
}
}
return (null);
}
module.exports = {
getDeviceInfo: function(success, error) {
getDeviceInfo: function (success, error) {
setTimeout(function () {
success({
cordova: firefoxos.cordovaVersion,
platform: 'firefoxos',
model: null,
version: null,
model: getModel(),
version: getVersion(),
uuid: null
});
}, 0);
}
};

require("cordova/firefoxos/commandProxy").add("Device", module.exports);
require("cordova/firefoxos/commandProxy").add("Device", module.exports);

0 comments on commit ebbd212

Please sign in to comment.