Allow overriding animatableness of welcome page via exp service

上级 f76d07f7
......@@ -25,6 +25,8 @@ import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editor
import { EditorResolution } from 'vs/platform/editor/common/editor';
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { ITASExperimentService } from 'vs/workbench/services/experiment/common/experimentService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export * as icons from 'vs/workbench/contrib/welcome/gettingStarted/browser/gettingStartedIcons';
......@@ -245,12 +247,51 @@ registerAction2(class extends Action2 {
}
});
const prefersReducedMotionConfig = {
...workbenchConfigurationNodeBase,
'properties': {
'workbench.welcomePage.preferReducedMotion': {
scope: ConfigurationScope.APPLICATION,
type: 'boolean',
default: true,
description: localize('workbench.welcomePage.preferReducedMotion', "When enabled, reduce motion in welcome page.")
}
}
} as const;
const prefersStandardMotionConfig = {
...workbenchConfigurationNodeBase,
'properties': {
'workbench.welcomePage.preferReducedMotion': {
scope: ConfigurationScope.APPLICATION,
type: 'boolean',
default: false,
description: localize('workbench.welcomePage.preferReducedMotion', "When enabled, reduce motion in welcome page.")
}
}
} as const;
class WorkbenchConfigurationContribution {
constructor(
@IInstantiationService _instantiationService: IInstantiationService,
@IGettingStartedService _gettingStartedService: IGettingStartedService,
@IConfigurationService _configurationService: IConfigurationService,
@ITASExperimentService _experimentSevice: ITASExperimentService,
) {
// Init the getting started service via DI.
this.registerConfigs(_experimentSevice);
}
private async registerConfigs(_experimentSevice: ITASExperimentService) {
const preferReduced = await _experimentSevice.getTreatment('welcomePage.preferReducedMotion').catch(e => false);
if (preferReduced) {
configurationRegistry.deregisterConfigurations([prefersStandardMotionConfig]);
configurationRegistry.registerConfiguration(prefersReducedMotionConfig);
}
else {
configurationRegistry.deregisterConfigurations([prefersReducedMotionConfig]);
configurationRegistry.registerConfiguration(prefersStandardMotionConfig);
}
}
}
......@@ -267,12 +308,6 @@ configurationRegistry.registerConfiguration({
type: 'boolean',
default: true,
description: localize('workbench.welcomePage.walkthroughs.openOnInstall', "When enabled, an extension's walkthrough will open upon install the extension.")
},
'workbench.welcomePage.preferReducedMotion': {
scope: ConfigurationScope.APPLICATION,
type: 'boolean',
default: false,
description: localize('workbench.welcomePage.preferReducedMotion', "When enabled, reduce motion in welcome page.")
}
}
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册