Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8E520FE76 for ; Tue, 7 May 2013 15:13:52 +0000 (UTC) Received: (qmail 72908 invoked by uid 500); 7 May 2013 15:13:50 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 72799 invoked by uid 500); 7 May 2013 15:13:50 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 72581 invoked by uid 99); 7 May 2013 15:13:50 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 May 2013 15:13:50 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C3E7D8887BD; Tue, 7 May 2013 15:13:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lorinbeer@apache.org To: commits@cordova.apache.org Date: Tue, 07 May 2013 15:14:07 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [20/50] [abbrv] webworks commit: Modifying device to account for API not existing on older versions of the OS and for errors with missing properties. Modifying device to account for API not existing on older versions of the OS and for errors with missing properties. Reviewed by Bryan Higgins Tested by Tracy Li Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/0d591024 Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/0d591024 Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/0d591024 Branch: refs/heads/future Commit: 0d591024cab242cdfe4fb9797585dd68ac174465 Parents: 2fa00c4 Author: Jeffrey Heifetz Authored: Thu Apr 11 11:28:02 2013 -0400 Committer: Bryan Higgins Committed: Fri May 3 10:13:30 2013 -0400 ---------------------------------------------------------------------- .../bin/templates/project/plugins/Device/index.js | 36 +++++++++++++- 1 files changed, 33 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/0d591024/blackberry10/bin/templates/project/plugins/Device/index.js ---------------------------------------------------------------------- diff --git a/blackberry10/bin/templates/project/plugins/Device/index.js b/blackberry10/bin/templates/project/plugins/Device/index.js index 41b454c..f4849f5 100644 --- a/blackberry10/bin/templates/project/plugins/Device/index.js +++ b/blackberry10/bin/templates/project/plugins/Device/index.js @@ -14,15 +14,45 @@ * limitations under the License. */ +function getModelName () { + var modelName = window.qnx.webplatform.device.modelName; + //Pre 10.2 (meaning Z10 or Q10) + if (typeof modelName === "undefined") { + if (window.screen.height === 720 && window.screen.width === 720) { + modelName = "Q10"; + } else if ((window.screen.height === 1280 && window.screen.width === 768) || + (window.screen.height === 768 && window.screen.width === 1280)) { + modelName = "Z10"; + } else { + modelName = window.qnx.webplatform.deviceName; + } + } + + return modelName; +} + +function getUUID () { + var uuid = ""; + try { + //Must surround by try catch because this will throw if the app is missing permissions + uuid = window.qnx.webplatform.device.devicePin; + } catch (e) { + //DO Nothing + } + return uuid; +} + module.exports = { getDeviceInfo: function (success, fail, args, env) { var result = new PluginResult(args, env), + modelName = getModelName(), + uuid = getUUID(), info = { platform: "blackberry10", version: window.qnx.webplatform.device.scmBundle, - model: window.qnx.webplatform.device.modelName, - name: window.qnx.webplatform.device.modelName, // deprecated: please use device.model - uuid: window.qnx.webplatform.device.devicePin, + model: modelName, + name: modelName, // deprecated: please use device.model + uuid: uuid, cordova: "2.5.0" }; result.ok(info);