Skip to content

Commit

Permalink
Fixes on require imports and error handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Gabilondo committed Jul 17, 2018
1 parent e91b901 commit a05ef6a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 15 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ <h3 class="panel-title">Explore UI</h3>
<script type="text/javascript" src="src/organismo/ORGMain.js"></script>
<script type="text/javascript" src='src/third-party/patternfly-bootstrap-treeview/dist/bootstrap-treeview.min.js'></script>
<script type="text/javascript" src="src/organismo/ORGSettingsControls.js"></script>
<script type="text/javascript" src="src/organismo/ORGDeviceConnectionControls.js"></script>

</body>
</html>
2 changes: 1 addition & 1 deletion src/organismo/ORG3DDeviceModelLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
9 changes: 7 additions & 2 deletions src/organismo/ORGActionsCenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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({
Expand Down
3 changes: 1 addition & 2 deletions src/organismo/ORGDeviceConnectionControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions src/organismo/ORGDeviceWDAController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =

Expand Down
22 changes: 12 additions & 10 deletions src/organismo/ORGTestApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit a05ef6a

Please sign in to comment.