From 02160500d819645043b0a4e7f1d4322f197b1525 Mon Sep 17 00:00:00 2001 From: cRui861 Date: Thu, 13 Feb 2020 15:30:31 -0800 Subject: [PATCH] Disable Auto-update (#2139) * autoDownload set to false * Set default for auto-update to be false * Autoupdate cmdline overwrite * Minor cleanup * * Reverted default of autoupdate from Disable to Enable * Changed naming for cmdline flag * Added persisting user config changes * * Reverted user settings changes due to a bug - will revisit * Minor fixes * Changed cmdline naming for autoupdate * Minor changes * Changed test for application start up * Changed batch account name + minor fixes Co-authored-by: Brandon Klein --- dev-app-update.yml | 1 + src/client/cli.ts | 4 ++++ src/client/startup.ts | 5 +++++ test/spectron/test-app-start.spec.ts | 2 +- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dev-app-update.yml b/dev-app-update.yml index b9b63ecee9..317abe7413 100644 --- a/dev-app-update.yml +++ b/dev-app-update.yml @@ -1,3 +1,4 @@ owner: Azure repo: BatchExplorer provider: github +updaterCacheDirName: BatchExplorer-cache diff --git a/src/client/cli.ts b/src/client/cli.ts index d42e534b32..a4e1ce2156 100644 --- a/src/client/cli.ts +++ b/src/client/cli.ts @@ -2,15 +2,19 @@ import * as commander from "commander"; import { app } from "electron"; export interface BatchExplorerArgs { + disableAutoupdate?: boolean; updated?: boolean; userDataDir?: string; ignoreCertificateErrors?: boolean; args: string[]; } +// add user config options (in Settings) to also let the status of the autoupdate to persist - whether that be on or off +// change naming to "set autoupdate on/off" or "autoupdate set to true/false" -> as Xing/Matt export function parseArguments(argv: string[]): BatchExplorerArgs { return commander .version(app.getVersion()) + .option("--disable-auto-update", "Disables autoupdate for one instance of opening up the application") .option("--updated", "If the application was just updated") .option("--user-data-dir ", "Change the user data directory. Used for tests") .option("--ignore-certificate-errors", "Ignore https certificate errors") diff --git a/src/client/startup.ts b/src/client/startup.ts index 58b54173f1..32ff594116 100644 --- a/src/client/startup.ts +++ b/src/client/startup.ts @@ -68,6 +68,11 @@ export async function startBatchExplorer(args: BatchExplorerArgs) { app.commandLine.appendSwitch("ignore-certificate-errors", "true"); } + if (args.disableAutoupdate) { + log.warn("Application will not autoupdate"); + autoUpdater.autoInstallOnAppQuit = false; + } + const module = await platformDynamicServer().bootstrapModule(BatchExplorerClientModule); const localeService = module.injector.get(LocaleService) as ClientLocaleService; await localeService.load(); diff --git a/test/spectron/test-app-start.spec.ts b/test/spectron/test-app-start.spec.ts index a82c5990f8..4f3c812862 100644 --- a/test/spectron/test-app-start.spec.ts +++ b/test/spectron/test-app-start.spec.ts @@ -65,7 +65,7 @@ describe("Bundled application is starting correctly", () => { await app.client.windowByIndex(MAIN_WINDOW_INDEX); expect(await app.browserWindow.isVisible()).toBe(true); expect(await app.browserWindow.getTitle()).toEqual("Batch Explorer"); - await app.client.waitUntilTextExists("bl-account-list .quick-list-row-title", "prodtest1", 60_000); + await app.client.waitUntilTextExists("bl-account-list .quick-list-row-title", "0prodtest", 60_000); });