From a05ef6a8643a8df41c1156dd634c9b7cb573a9e3 Mon Sep 17 00:00:00 2001 From: Jon Gabilondo Date: Tue, 17 Jul 2018 08:57:22 +0300 Subject: [PATCH] Fixes on require imports and error handling. --- index.html | 1 + src/organismo/ORG3DDeviceModelLoader.js | 2 +- src/organismo/ORGActionsCenter.js | 9 ++++++-- src/organismo/ORGDeviceConnectionControls.js | 3 +-- src/organismo/ORGDeviceWDAController.js | 1 + src/organismo/ORGTestApp.js | 22 +++++++++++--------- 6 files changed, 23 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index 6b8e715..48fa379 100755 --- a/index.html +++ b/index.html @@ -257,6 +257,7 @@

Explore UI

+ \ No newline at end of file diff --git a/src/organismo/ORG3DDeviceModelLoader.js b/src/organismo/ORG3DDeviceModelLoader.js index c6c6888..24b71b1 100644 --- a/src/organismo/ORG3DDeviceModelLoader.js +++ b/src/organismo/ORG3DDeviceModelLoader.js @@ -14,7 +14,7 @@ class ORG3DDeviceModelLoader { * When load is finished it will call to the organismo scene to add the model to the three.js scene. * @param scene the ORG.scene to add the 3D model to. */ - static loadDevice3DModel(device, scene, yPosition) { + static loadDevice3DModel(device, scene) { return new Promise((resolve, reject) => { if (device.productName.startsWith('iPhone 5')) { this._load_iPhone_5(scene,device).then( diff --git a/src/organismo/ORGActionsCenter.js b/src/organismo/ORGActionsCenter.js index c3239d5..90a7bcd 100644 --- a/src/organismo/ORGActionsCenter.js +++ b/src/organismo/ORGActionsCenter.js @@ -90,7 +90,7 @@ class ORGActionsCenter { // 5. Get device 3D model let model = null; if (ORG.scene.flagShowDevice3DModel) { - model = await ORG3DDeviceModelLoader.loadDevice3DModel(ORG.device, ORG.scene, kORGDevicePositionY); + model = await ORG3DDeviceModelLoader.loadDevice3DModel(ORG.device, ORG.scene); } // 6. Add device with screenshot to scene @@ -222,7 +222,7 @@ class ORGActionsCenter { static async showDevice3DModel() { try { - let model = await ORG3DDeviceModelLoader.loadDevice3DModel(ORG.device, ORG.scene, kORGDevicePositionY); + let model = await ORG3DDeviceModelLoader.loadDevice3DModel(ORG.device, ORG.scene); if (model) { ORG.scene.addDevice3DModel(model); ORG.scene.setDeviceOrientation(ORG.device.orientation); @@ -322,6 +322,11 @@ class ORGActionsCenter { title: err.name, message: err.message }); + } else if (err instanceof ReferenceError || err instanceof TypeError) { + bootbox.alert({ + title: err.name, + message: err.message + ".\nFile:" + err.fileName + "\nLine:" + err.lineNumber + }); } else if (typeof err === "string") { const safeErrorText = (err.length < 2000 ? ((err.length === 0) ? "Unknown error" : err) : err.substring(0, 2000)); bootbox.alert({ diff --git a/src/organismo/ORGDeviceConnectionControls.js b/src/organismo/ORGDeviceConnectionControls.js index 1ed5252..7820d2a 100644 --- a/src/organismo/ORGDeviceConnectionControls.js +++ b/src/organismo/ORGDeviceConnectionControls.js @@ -2,8 +2,7 @@ * Created by jongabilondo on 20/09/2016. */ -const ORGActionsCenter = require('./ORGActionsCenter') - +//const ORGActionsCenter = require('./ORGActionsCenter') ORG.UI.connectButton = $('#connect-button'); //ORG.UI.connectDriversMenu = $('#connect-drivers-menu'); diff --git a/src/organismo/ORGDeviceWDAController.js b/src/organismo/ORGDeviceWDAController.js index 45aac00..583fb51 100644 --- a/src/organismo/ORGDeviceWDAController.js +++ b/src/organismo/ORGDeviceWDAController.js @@ -6,6 +6,7 @@ const { ORGError, ORGERR } = require('./ORGError') const ORGDeviceBaseController = require('./ORGDeviceBaseController') const { ORGDevice, ORGDeviceORIENTATION } = require('./ORGDevice') const { ORGDeviceMetrics, ORGDevicesData } = require('./ORG.DeviceMetrics') +const ORGTestApp = require('./ORGTestApp') module.exports = diff --git a/src/organismo/ORGTestApp.js b/src/organismo/ORGTestApp.js index 4cb6d72..701101e 100644 --- a/src/organismo/ORGTestApp.js +++ b/src/organismo/ORGTestApp.js @@ -2,18 +2,20 @@ * Created by jongabilondo on 13/12/2016. */ +module.exports = -function ORGTestApp( appInfo ) { +class ORGTestApp { - this.version = null; - this.bundleIdentifier = null; - this.name = null; + constructor( appInfo ) { + this.version = null; + this.bundleIdentifier = null; + this.name = null; - if ( appInfo ) { - this.name = appInfo.name; - this.version = appInfo.version; - this.bundleIdentifier = appInfo.bundleIdentifier; + if ( appInfo ) { + this.name = appInfo.name; + this.version = appInfo.version; + this.bundleIdentifier = appInfo.bundleIdentifier; + } } -} -ORG.testApp = null; +}