mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 01:25:38 -05:00
Port VS Code telemetry opt-in dialog (#1130)
This commit is contained in:
@@ -12,7 +12,7 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||
import { ShowCurrentReleaseNotesAction, ProductContribution } from 'sql/workbench/update/releaseNotes';
|
||||
import { ShowCurrentReleaseNotesAction } from 'sql/workbench/update/releaseNotes';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
|
||||
new Actions.BackupAction().registerTask();
|
||||
@@ -21,8 +21,5 @@ new Actions.NewQueryAction().registerTask();
|
||||
new Actions.ConfigureDashboardAction().registerTask();
|
||||
|
||||
// add product update and release notes contributions
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(ProductContribution, LifecyclePhase.Running);
|
||||
|
||||
Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions)
|
||||
.registerWorkbenchAction(new SyncActionDescriptor(ShowCurrentReleaseNotesAction, ShowCurrentReleaseNotesAction.ID, ShowCurrentReleaseNotesAction.LABEL), 'Show Getting Started');
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user