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

Disable Auto-update #2139

Merged
merged 13 commits into from
Feb 13, 2020
1 change: 1 addition & 0 deletions dev-app-update.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
owner: Azure
repo: BatchExplorer
provider: github
updaterCacheDirName: BatchExplorer-cache
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export interface BatchFlaskUserConfiguration {
};

fileAssociations?: Array<{extension: string, type: string}>;

updateOnQuit?: boolean;
}

export interface UserConfigurationStore<T> {
Expand Down
4 changes: 4 additions & 0 deletions src/client/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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-autoupdate", "Disables autoupdate for instance and changes settings to turn off autoupdate")
cRui861 marked this conversation as resolved.
Show resolved Hide resolved
.option("--updated", "If the application was just updated")
.option("--user-data-dir <path>", "Change the user data directory. Used for tests")
.option("--ignore-certificate-errors", "Ignore https certificate errors")
Expand Down
10 changes: 9 additions & 1 deletion src/client/startup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { platformDynamicServer } from "@angular/platform-server";
import { LocaleService, TranslationsLoaderService } from "@batch-flask/core";
import { LocaleService, TranslationsLoaderService, UserConfigurationService } from "@batch-flask/core";
import { log } from "@batch-flask/utils";
import { ClientTranslationsLoaderService } from "client/core/i18n";
import { MainApplicationMenu } from "client/menu";
Expand Down Expand Up @@ -75,6 +75,14 @@ export async function startBatchExplorer(args: BatchExplorerArgs) {
await translationLoader.load();
const batchExplorerApp = module.injector.get(BatchExplorerApplication);
const menu = module.injector.get(MainApplicationMenu);

if (args.disableAutoupdate) {
log.warn("Application will not autoupdate");
autoUpdater.autoInstallOnAppQuit = false;
const userConfigService = module.injector.get(UserConfigurationService);
userConfigService.set("updateOnQuit", false);
}

initializeServices(module.injector);

setupSingleInstance(batchExplorerApp);
Expand Down