[MM-18552] Autoupdater (#1714)
* wip * background download * various fixes * wip * wokring autoupgrade * fix menu * fix windows * cleanup * add publishername * fix messages and titles * Test updates * Moved module and added functionality to click icon to install (instead of just download) * Add auto update setting, update on close app if downloaded * Tests, changes for security fixes, update version number * Update E2E tests * Lint fix * Update to latest electron-updater * Revert to stable electron-builder (only needed to update electron-updater) * Fix package-lock * skip flaky test * Update package * Fix E2E test * Fixes for enabling/disabled autoupdater * Fixed GPO definitions * [MM-38300] Set localhost as the test server * blank * Switch to s3 bucket for testing * Update icons to match spec * Add menu items for download/update actions * Type and test fixes * Fix notification circle * Fix macOS app not restarting on Restart/Update * Update dialog box titles * Turn off file system check for Linux * Changes to support deployments * Testing autoupdater deployments to s3 * disable tests for now * asfrehwf * fine no windows WHATEVER * remove windows again * Try universal all in one * pffftttngggguhhhh * make sure it's working * Missed artifacts script * Modify destination as well * one more time! * Update yml files * Oops * add yq manually * oof * Fix the script to work properly * Fix release script * Fix script again so it runs in time * Build version 2 * Revert build specific changes * Lint override * Fix build apps for PR builds * One more change * Add file generation for .deb repo * Deb repo test * skip tests for now * Fix artifact push * Persist after repo creation * Put tests back * Fix unit tests * Enable mac generated builds temp * Temporarily disable tests * Fix issue where notification doesn't pop dialog box * Try version 2 again * Put the version back * Attempting to debug mac app path issue * Fix issue where Mac app will quarantine itself after first update * Lock versions of yq * Fix yq for mac * As usual, Mac is difficult :P * Add quotes to anti-quarantine command * Change to spawn to avoid command injection * Oops * Nightly deployment changes (#2005) * Test nightly deploy * I fixed a some things * aaaaaaaaa * Restore old bucket * Added progress indicator via tooltip * Ship nightly builds to main S3 bucket * PR feedback * Fix a couple security exploits * Fix opacity on light mode button * Use large app icon * Resize icon for Windows * Resize icon for Mac * Update to electron-updater final * Remove Mac support and deb repo * Typo * Remove deb script * Remove checksum function * Removed autoUpdateSettingsPath * Update URL Co-authored-by: = <=> Co-authored-by: Devin Binnie <devin.binnie@mattermost.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com>
This commit is contained in:
@@ -24,6 +24,7 @@ import {
|
||||
BROWSER_HISTORY_BUTTON,
|
||||
} from 'common/communication';
|
||||
import urlUtils from 'common/utils/url';
|
||||
import {SECOND} from 'common/utils/constants';
|
||||
import Config from 'common/config';
|
||||
import {getTabViewName, TAB_MESSAGING} from 'common/tabs/TabView';
|
||||
|
||||
@@ -43,12 +44,14 @@ export class WindowManager {
|
||||
assetsDir: string;
|
||||
|
||||
mainWindow?: BrowserWindow;
|
||||
mainWindowReady: boolean;
|
||||
settingsWindow?: BrowserWindow;
|
||||
viewManager?: ViewManager;
|
||||
teamDropdown?: TeamDropdownView;
|
||||
currentServerName?: string;
|
||||
|
||||
constructor() {
|
||||
this.mainWindowReady = false;
|
||||
this.assetsDir = path.resolve(app.getAppPath(), 'assets');
|
||||
|
||||
ipcMain.on(HISTORY, this.handleHistory);
|
||||
@@ -94,6 +97,7 @@ export class WindowManager {
|
||||
this.mainWindow.show();
|
||||
}
|
||||
} else {
|
||||
this.mainWindowReady = false;
|
||||
this.mainWindow = createMainWindow({
|
||||
linuxAppIcon: path.join(this.assetsDir, 'linux', 'app_icon.png'),
|
||||
});
|
||||
@@ -104,10 +108,15 @@ export class WindowManager {
|
||||
return;
|
||||
}
|
||||
|
||||
this.mainWindow.once('ready-to-show', () => {
|
||||
this.mainWindowReady = true;
|
||||
});
|
||||
|
||||
// window handlers
|
||||
this.mainWindow.on('closed', () => {
|
||||
log.warn('main window closed');
|
||||
delete this.mainWindow;
|
||||
this.mainWindowReady = false;
|
||||
});
|
||||
this.mainWindow.on('unresponsive', () => {
|
||||
CriticalErrorHandler.setMainWindow(this.mainWindow!);
|
||||
@@ -189,16 +198,34 @@ export class WindowManager {
|
||||
ipcMain.emit(RESIZE_MODAL, null, bounds);
|
||||
}
|
||||
|
||||
sendToRenderer = (channel: string, ...args: any[]) => {
|
||||
if (!this.mainWindow) {
|
||||
// max retries allows the message to get to the renderer even if it is sent while the app is starting up.
|
||||
sendToRendererWithRetry = (maxRetries: number, channel: string, ...args: any[]) => {
|
||||
if (!this.mainWindow || !this.mainWindowReady) {
|
||||
this.showMainWindow();
|
||||
if (maxRetries > 0) {
|
||||
log.info(`Can't send ${channel}, will retry`);
|
||||
setTimeout(() => {
|
||||
this.sendToRendererWithRetry(maxRetries - 1, channel, ...args);
|
||||
}, SECOND);
|
||||
} else {
|
||||
log.error(`Unable to send the message to the main window for message type ${channel}`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.mainWindow!.webContents.send(channel, ...args);
|
||||
if (this.settingsWindow && this.settingsWindow.isVisible()) {
|
||||
this.settingsWindow.webContents.send(channel, ...args);
|
||||
try {
|
||||
this.settingsWindow.webContents.send(channel, ...args);
|
||||
} catch (e) {
|
||||
log.error(`There was an error while trying to communicate with the renderer: ${e}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sendToRenderer = (channel: string, ...args: any[]) => {
|
||||
this.sendToRendererWithRetry(3, channel, ...args);
|
||||
}
|
||||
|
||||
sendToAll = (channel: string, ...args: any[]) => {
|
||||
this.sendToRenderer(channel, ...args);
|
||||
if (this.settingsWindow) {
|
||||
|
Reference in New Issue
Block a user