Port VS Code telemetry opt-in dialog (#1130)

This commit is contained in:
Karl Burtram
2018-04-11 15:47:34 -07:00
committed by GitHub
parent ed10f984b6
commit cd0210c88a
22 changed files with 240 additions and 107 deletions

View File

@@ -49,39 +49,3 @@ export class ShowCurrentReleaseNotesAction extends AbstractShowReleaseNotesActio
super(id, label, pkg.version, editorService, instantiationService);
}
}
export class ProductContribution implements IWorkbenchContribution {
private static KEY = 'releaseNotes/carbonLastVersion';
getId() { return 'carbon.product'; }
constructor(
@IStorageService storageService: IStorageService,
@IInstantiationService instantiationService: IInstantiationService,
@INotificationService notificationService: INotificationService,
@IWorkbenchEditorService editorService: IWorkbenchEditorService
) {
const lastVersion = storageService.get(ProductContribution.KEY, StorageScope.GLOBAL, '');
// was there an update? if so, open release notes
if (product.releaseNotesUrl && pkg.version !== lastVersion) {
instantiationService.invokeFunction(loadReleaseNotes, pkg.version).then(
text => editorService.openEditor(instantiationService.createInstance(ReleaseNotesInput, pkg.version, text), { pinned: true }),
() => {
const actions: INotificationActions = {
primary: [
instantiationService.createInstance(OpenGettingStartedInBrowserAction)
]
};
notificationService.notify({
severity: Severity.Info,
message: nls.localize('read the release notes', "Welcome to {0} April Public Preview! Would you like to view the Getting Started Guide?", product.nameLong, pkg.version),
actions
});
});
}
storageService.store(ProductContribution.KEY, pkg.version, StorageScope.GLOBAL);
}
}