Skip to content

Commit 2f449b0

Browse files
committed
Fix crashing of vtx and preset tab
1 parent 66708ad commit 2f449b0

File tree

4 files changed

+7
-44
lines changed

4 files changed

+7
-44
lines changed

src/js/gui.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,7 @@ class GuiControl {
6969
this.operating_system = GUI_checkOperatingSystem();
7070

7171
// Check the method of execution
72-
this.nwGui = null;
73-
try {
74-
this.nwGui = require('nw.gui');
75-
this.Mode = GUI_MODES.NWJS;
76-
} catch (ex) {
77-
if (typeof cordovaApp !== 'undefined') {
78-
this.Mode = GUI_MODES.Cordova;
79-
} else {
80-
this.Mode = GUI_MODES.Other;
81-
}
82-
}
72+
this.nwGui = GUI_MODES.Other;
8373
}
8474
// Timer managing methods
8575
// name = string

src/js/main.js

-31
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { isExpertModeEnabled } from './utils/isExportModeEnabled.js';
2020
import { updateTabList } from './utils/updateTabList.js';
2121
import { checkForConfiguratorUpdates } from './utils/checkForConfiguratorUpdates.js';
2222
import * as THREE from 'three';
23-
import * as d3 from 'd3';
2423

2524
if (typeof String.prototype.replaceAll === "undefined") {
2625
String.prototype.replaceAll = function(match, replace) {
@@ -188,36 +187,6 @@ function startProcess() {
188187
gui_log(i18n.getMessage('infoVersionOs', { operatingSystem: GUI.operating_system }));
189188
gui_log(i18n.getMessage('infoVersionConfigurator', { configuratorVersion: CONFIGURATOR.getDisplayVersion() }));
190189

191-
if (GUI.isNWJS()) {
192-
const nwWindow = GUI.nwGui.Window.get();
193-
nwWindow.on('new-win-policy', function(frame, url, policy) {
194-
// do not open the window
195-
policy.ignore();
196-
// and open it in external browser
197-
GUI.nwGui.Shell.openExternal(url);
198-
});
199-
nwWindow.on('close', closeHandler);
200-
const config = getConfig('showDevToolsOnStartup');
201-
if (CONFIGURATOR.isDevVersion() && !!config.showDevToolsOnStartup) {
202-
nwWindow.showDevTools();
203-
}
204-
} else if (GUI.isCordova()) {
205-
window.addEventListener('beforeunload', closeHandler);
206-
document.addEventListener('backbutton', function(e) {
207-
e.preventDefault();
208-
navigator.notification.confirm(
209-
i18n.getMessage('cordovaExitAppMessage'),
210-
function(stat) {
211-
if (stat === 1) {
212-
navigator.app.exitApp();
213-
}
214-
},
215-
i18n.getMessage('cordovaExitAppTitle'),
216-
[i18n.getMessage('yes'),i18n.getMessage('no')],
217-
);
218-
});
219-
}
220-
221190
$('.connect_b a.connect').removeClass('disabled');
222191
// with Vue reactive system we don't need to call these,
223192
// our view is reactive to model changes

src/js/tabs/vtx.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const vtx = {
2424
VTXTABLE_POWERLEVEL_LIST: [],
2525
analyticsChanges: {},
2626
updating: true,
27-
env: new djv(),
2827
};
2928

3029
vtx.isVtxDeviceStatusReady = function() {
@@ -153,6 +152,10 @@ vtx.initialize = function (callback) {
153152
// Validates the vtxConfig object against a JSON Schema
154153
function validateVtxJson(vtxConfig, callback_valid, callback_error) {
155154

155+
if (this.env === undefined) {
156+
this.env = new djv();
157+
}
158+
156159
// At minimum the version must be defined
157160
if (!vtxConfig.version) {
158161
console.error("Validation against schema failed, version missing");

src/js/utils/checkForConfiguratorUpdates.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import CONFIGURATOR from "../data_storage";
44
import { i18n } from "../localization";
55
import { gui_log } from "../gui_log";
66
import $ from 'jquery';
7+
import semver from "semver-min";
78

89
function notifyOutdatedVersion(data) {
910

@@ -12,7 +13,7 @@ function notifyOutdatedVersion(data) {
1213
return false;
1314
}
1415

15-
if (data.isCurrent === false && data.updatedVersion !== undefined) {
16+
if (data.isCurrent === false && data.updatedVersion !== undefined && semver.gt(data.updatedVersion.version, CONFIGURATOR.version)) {
1617

1718
CONFIGURATOR.latestVersion = data.updatedVersion.version;
1819
CONFIGURATOR.latestVersionReleaseUrl = data.updatedVersion.url;

0 commit comments

Comments
 (0)