From 0dfe6fecd4d23b0873cbe0f2455f1474569a59fd Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Thu, 26 May 2016 15:21:18 +0200 Subject: [PATCH] show insider builds disclaimer fixes #6671 --- .../electron-browser/update.contribution.ts | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/parts/update/electron-browser/update.contribution.ts b/src/vs/workbench/parts/update/electron-browser/update.contribution.ts index 85ccc1594f8..e9bf8fce6bc 100644 --- a/src/vs/workbench/parts/update/electron-browser/update.contribution.ts +++ b/src/vs/workbench/parts/update/electron-browser/update.contribution.ts @@ -21,17 +21,15 @@ import * as semver from 'semver'; const CloseAction = new Action('close', nls.localize('close', "Close"), '', true, () => null); -const ShowLicenseAction = (licenseUrl: string) => new Action( - 'update.showLicense', - nls.localize('license', "Read License"), - null, - true, +const LinkAction = (id: string, message: string, licenseUrl: string) => new Action( + id, message, null, true, () => { shell.openExternal(licenseUrl); return TPromise.as(null); } ); export class UpdateContribution implements IWorkbenchContribution { private static KEY = 'releaseNotes/lastVersion'; + private static INSIDER_KEY = 'releaseNotes/shouldShowInsiderDisclaimer'; getId() { return 'vs.update'; } constructor( @@ -52,7 +50,6 @@ export class UpdateContribution implements IWorkbenchContribution { ShowReleaseNotesAction(env.releaseNotesUrl, true) ] }); - }, 0); } @@ -63,10 +60,32 @@ export class UpdateContribution implements IWorkbenchContribution { message: nls.localize('licenseChanged', "Our license terms have changed, please go through them.", env.appName, env.version), actions: [ CloseAction, - ShowLicenseAction(env.licenseUrl) + LinkAction('update.showLicense', nls.localize('license', "Read License"), env.licenseUrl) ] }); + }, 0); + } + const shouldShowInsiderDisclaimer = storageService.getBoolean(UpdateContribution.INSIDER_KEY, StorageScope.GLOBAL, true); + + // is this a build which releases often? + if (shouldShowInsiderDisclaimer && /-alpha$|-insider$/.test(env.version)) { + setTimeout(() => { + messageService.show(Severity.Info, { + message: nls.localize('insiderBuilds', "Insider builds are becoming daily builds!", env.appName, env.version), + actions: [ + CloseAction, + new Action('update.neverAgain', nls.localize('neverShowAgain', "Never Show Again"), '', true, () => { + storageService.store(UpdateContribution.INSIDER_KEY, false, StorageScope.GLOBAL); + return TPromise.as(null); + }), + new Action('update.insiderBuilds', nls.localize('readmore', "Read More"), '', true, () => { + shell.openExternal('http://go.microsoft.com/fwlink/?LinkID=798816'); + storageService.store(UpdateContribution.INSIDER_KEY, false, StorageScope.GLOBAL); + return TPromise.as(null); + }) + ] + }); }, 0); } -- GitLab