Skip to content

Commit

Permalink
Merge pull request #562 from justinlampley/UnsupportedOSMessage
Browse files Browse the repository at this point in the history
Unsupported OS Message
  • Loading branch information
jurgelenas authored Oct 23, 2023
2 parents e804dee + 62018a6 commit 4e5f2e8
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 @@ -64,6 +64,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 @@ -427,19 +434,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 4e5f2e8

Please sign in to comment.