Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crashing of presets and vtx tab #4018

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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