Skip to content

Commit

Permalink
Unsupported OS Message
Browse files Browse the repository at this point in the history
  • Loading branch information
justinlampley committed Sep 8, 2023
1 parent 2667b58 commit 62018a6
Showing 1 changed file with 48 additions and 13 deletions.
61 changes: 48 additions & 13 deletions src/main.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ logger.log('path', {

const isWindows = process.platform.startsWith('win');
const isMacOS = process.platform.startsWith('darwin');
logger.log(`platform: ${process.platform}`);
logger.log(`os release: ${process.getSystemVersion()}`);

const isOSSupported = !(
isWindows && parseFloat(process.getSystemVersion()) < 6.2
);

let userDataDirectory = app.getPath('userData');

if (isWindows) {
Expand Down Expand Up @@ -426,19 +433,47 @@ app.on('window-all-closed', () => {
}
});

app
.whenReady()
.then(createWindow)
.catch((err: Error) => {
logger.error(`createWindow error ${err}`);
handleFatalError(err);
})
.then(() => {
return updater?.checkForUpdates();
})
.catch((err: Error) => {
logger.error(`Auto update error ${err}`);
});
if (!isOSSupported) {
app
.whenReady()
.then(() => {
// eslint-disable-next-line promise/no-nesting
dialog
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
.showMessageBox(undefined, {
type: 'error',
buttons: ['Okay'],
title: 'ExpressLRS Configurator',
detail: 'Unsupported OS Version Detected',
message: ``,
})
.then(() => {
process.exit(1);
})
.catch((dialogErr) => {
logger.error('failed to show error dialog', dialogErr.stack);
process.exit(1);
});
})
.catch((err: Error) => {
logger.error(`Unsupported OS dialog error ${err}`);
});
} else {
app
.whenReady()
.then(createWindow)
.catch((err: Error) => {
logger.error(`createWindow error ${err}`);
handleFatalError(err);
})
.then(() => {
return updater?.checkForUpdates();
})
.catch((err: Error) => {
logger.error(`Auto update error ${err}`);
});
}

app.on('activate', () => {
// On macOS, it's common to re-create a window in the app when the
Expand Down

0 comments on commit 62018a6

Please sign in to comment.