Skip to content

Commit

Permalink
Fix crashing of vtx and preset tab
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Jun 10, 2024
1 parent 66708ad commit a5ae22e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 43 deletions.
12 changes: 1 addition & 11 deletions src/js/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,7 @@ class GuiControl {
this.operating_system = GUI_checkOperatingSystem();

// Check the method of execution
this.nwGui = null;
try {
this.nwGui = require('nw.gui');
this.Mode = GUI_MODES.NWJS;
} catch (ex) {
if (typeof cordovaApp !== 'undefined') {
this.Mode = GUI_MODES.Cordova;
} else {
this.Mode = GUI_MODES.Other;
}
}
this.nwGui = GUI_MODES.Other;
}
// Timer managing methods
// name = string
Expand Down
31 changes: 0 additions & 31 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { isExpertModeEnabled } from './utils/isExportModeEnabled.js';
import { updateTabList } from './utils/updateTabList.js';
import { checkForConfiguratorUpdates } from './utils/checkForConfiguratorUpdates.js';
import * as THREE from 'three';
import * as d3 from 'd3';

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

if (GUI.isNWJS()) {
const nwWindow = GUI.nwGui.Window.get();
nwWindow.on('new-win-policy', function(frame, url, policy) {
// do not open the window
policy.ignore();
// and open it in external browser
GUI.nwGui.Shell.openExternal(url);
});
nwWindow.on('close', closeHandler);
const config = getConfig('showDevToolsOnStartup');
if (CONFIGURATOR.isDevVersion() && !!config.showDevToolsOnStartup) {
nwWindow.showDevTools();
}
} else if (GUI.isCordova()) {
window.addEventListener('beforeunload', closeHandler);
document.addEventListener('backbutton', function(e) {
e.preventDefault();
navigator.notification.confirm(
i18n.getMessage('cordovaExitAppMessage'),
function(stat) {
if (stat === 1) {
navigator.app.exitApp();
}
},
i18n.getMessage('cordovaExitAppTitle'),
[i18n.getMessage('yes'),i18n.getMessage('no')],
);
});
}

$('.connect_b a.connect').removeClass('disabled');
// with Vue reactive system we don't need to call these,
// our view is reactive to model changes
Expand Down
3 changes: 2 additions & 1 deletion src/js/utils/checkForConfiguratorUpdates.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import CONFIGURATOR from "../data_storage";
import { i18n } from "../localization";
import { gui_log } from "../gui_log";
import $ from 'jquery';
import semver from "semver-min";

function notifyOutdatedVersion(data) {

Expand All @@ -12,7 +13,7 @@ function notifyOutdatedVersion(data) {
return false;
}

if (data.isCurrent === false && data.updatedVersion !== undefined) {
if (data.isCurrent === false && data.updatedVersion !== undefined && semver.gt(data.updatedVersion.version, CONFIGURATOR.version)) {

CONFIGURATOR.latestVersion = data.updatedVersion.version;
CONFIGURATOR.latestVersionReleaseUrl = data.updatedVersion.url;
Expand Down

0 comments on commit a5ae22e

Please sign in to comment.