You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by za...@apache.org on 2014/06/04 10:53:13 UTC

[1/4] git commit: added firefoxos version - conversion

Repository: cordova-plugin-device
Updated Branches:
  refs/heads/master 72bfd9c15 -> bcb4ba44a


added firefoxos version - conversion


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/fd160e09
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/fd160e09
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/fd160e09

Branch: refs/heads/master
Commit: fd160e0987435985285569f582305b4e46613a65
Parents: 357848b
Author: Jason Weathersby <jw...@mozilla.com>
Authored: Thu Apr 24 08:13:20 2014 -0700
Committer: Rodrigo Silveira <ro...@outlook.com>
Committed: Tue Jun 3 21:23:41 2014 -0700

----------------------------------------------------------------------
 src/firefoxos/DeviceProxy.js | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/fd160e09/src/firefoxos/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/DeviceProxy.js b/src/firefoxos/DeviceProxy.js
index 47bcdb0..9e63e17 100644
--- a/src/firefoxos/DeviceProxy.js
+++ b/src/firefoxos/DeviceProxy.js
@@ -1,4 +1,4 @@
-cordova.define("org.apache.cordova.device.DeviceProxy", function(require, exports, module) { /*
+/*
  *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -26,15 +26,34 @@ 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': '1.5'
+    }
+    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 (ffVersionArray[1]);
+            return (convertVersionNumber(ffVersionArray[1]));
         }
     }
     return (null);
 }
+
 function getModel() {
     var uaArray = navigator.userAgent.split(/\s*[;)(]\s*/);
     if (navigator.userAgent.match(/(mobile|tablet)/i)) {
@@ -58,5 +77,4 @@ module.exports = {
     }
 };
 
-require("cordova/firefoxos/commandProxy").add("Device", module.exports);
-});
+require("cordova/firefoxos/commandProxy").add("Device", module.exports);
\ No newline at end of file


[3/4] git commit: Changing 1.5 to 2.0

Posted by za...@apache.org.
Changing 1.5 to 2.0


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/3146b573
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/3146b573
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/3146b573

Branch: refs/heads/master
Commit: 3146b57323ac23ed39bbca52b45e0c4f818ff254
Parents: fd160e0
Author: Rodrigo Silveira <ro...@outlook.com>
Authored: Tue Jun 3 21:24:44 2014 -0700
Committer: Rodrigo Silveira <ro...@outlook.com>
Committed: Tue Jun 3 21:24:44 2014 -0700

----------------------------------------------------------------------
 src/firefoxos/DeviceProxy.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/3146b573/src/firefoxos/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/DeviceProxy.js b/src/firefoxos/DeviceProxy.js
index 9e63e17..0f67412 100644
--- a/src/firefoxos/DeviceProxy.js
+++ b/src/firefoxos/DeviceProxy.js
@@ -34,8 +34,8 @@ function convertVersionNumber(ver) {
         '26.0': '1.2',
         '28.0': '1.3',
         '30.0': '1.4',
-        '32.0': '1.5'
-    }
+        '32.0': '2.0'
+    };
     var rver = ver;
     var sStr = ver.substring(0, 4);
     if (hashVersion[sStr]) {


[4/4] git commit: Merge remote-tracking branch 'mozilla/fx-version'

Posted by za...@apache.org.
Merge remote-tracking branch 'mozilla/fx-version'


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/bcb4ba44
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/bcb4ba44
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/bcb4ba44

Branch: refs/heads/master
Commit: bcb4ba44ae10d130fab640890688ab297a2add6f
Parents: 72bfd9c 3146b57
Author: Piotr Zalewa <pi...@zalewa.info>
Authored: Wed Jun 4 10:52:49 2014 +0200
Committer: Piotr Zalewa <pi...@zalewa.info>
Committed: Wed Jun 4 10:52:49 2014 +0200

----------------------------------------------------------------------
 src/firefoxos/DeviceProxy.js | 53 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 47 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[2/4] git commit: added firefoxos version

Posted by za...@apache.org.
added firefoxos version


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/357848b2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/357848b2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/357848b2

Branch: refs/heads/master
Commit: 357848b242f9649553ce1bf78d891ca242fddc25
Parents: 72bfd9c
Author: Jason Weathersby <jw...@mozilla.com>
Authored: Wed Apr 23 14:19:06 2014 -0700
Committer: Rodrigo Silveira <ro...@outlook.com>
Committed: Tue Jun 3 21:23:41 2014 -0700

----------------------------------------------------------------------
 src/firefoxos/DeviceProxy.js | 35 +++++++++++++++++++++++++++++------
 1 file changed, 29 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/357848b2/src/firefoxos/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/DeviceProxy.js b/src/firefoxos/DeviceProxy.js
index f37e761..47bcdb0 100644
--- a/src/firefoxos/DeviceProxy.js
+++ b/src/firefoxos/DeviceProxy.js
@@ -1,4 +1,4 @@
-/*
+cordova.define("org.apache.cordova.device.DeviceProxy", function(require, exports, module) { /*
  *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,19 +17,41 @@
  * 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
+
+function getVersion() {
+    if (navigator.userAgent.match(/(mobile|tablet)/i)) {
+        var ffVersionArray = (navigator.userAgent.match(/Firefox\/([\d]+\.[\w]?\.?[\w]+)/));
+        if (ffVersionArray.length === 2) {
+            return (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);
@@ -37,3 +59,4 @@ module.exports = {
 };
 
 require("cordova/firefoxos/commandProxy").add("Device", module.exports);
+});