提交 5b8f78a1 编写于 作者: J Jackson Kearl

Move sync-enabled trigger to gettingStartedService

上级 67c98800
......@@ -54,7 +54,6 @@ import { UserDataSyncDataViews } from 'vs/workbench/contrib/userDataSync/browser
import { IUserDataSyncWorkbenchService, getSyncAreaLabel, AccountStatus, CONTEXT_SYNC_STATE, CONTEXT_SYNC_ENABLEMENT, CONTEXT_ACCOUNT_STATE, CONFIGURE_SYNC_COMMAND_ID, SHOW_SYNC_LOG_COMMAND_ID, SYNC_VIEW_CONTAINER_ID, SYNC_TITLE, SYNC_VIEW_ICON } from 'vs/workbench/services/userDataSync/common/userDataSync';
import { Codicon } from 'vs/base/common/codicons';
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { IGettingStartedService } from 'vs/workbench/services/gettingStarted/common/gettingStartedService';
const CONTEXT_CONFLICTS_SOURCES = new RawContextKey<string>('conflictsSources', '');
......@@ -118,7 +117,6 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IProductService private readonly productService: IProductService,
@IStorageService private readonly storageService: IStorageService,
@IGettingStartedService private readonly gettingStartedService: IGettingStartedService,
@IOpenerService private readonly openerService: IOpenerService,
@IAuthenticationService private readonly authenticationService: IAuthenticationService,
@IUserDataSyncStoreManagementService private readonly userDataSyncStoreManagementService: IUserDataSyncStoreManagementService,
......@@ -155,10 +153,8 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
textModelResolverService.registerTextModelContentProvider(USER_DATA_SYNC_SCHEME, instantiationService.createInstance(UserDataRemoteContentProvider));
registerEditorContribution(AcceptChangesContribution.ID, AcceptChangesContribution);
this._register(Event.any(userDataSyncService.onDidChangeStatus, userDataAutoSyncEnablementService.onDidChangeEnablement)(() => {
if (userDataAutoSyncEnablementService.isEnabled()) { this.gettingStartedService.progressByEvent('sync-enabled'); }
this.turningOnSync = !userDataAutoSyncEnablementService.isEnabled() && userDataSyncService.status !== SyncStatus.Idle;
}));
this._register(Event.any(userDataSyncService.onDidChangeStatus, userDataAutoSyncEnablementService.onDidChangeEnablement)
(() => this.turningOnSync = !userDataAutoSyncEnablementService.isEnabled() && userDataSyncService.status !== SyncStatus.Idle));
}
}
......
......@@ -12,6 +12,8 @@ import { Memento } from 'vs/workbench/common/memento';
import { Action2, registerAction2 } from 'vs/platform/actions/common/actions';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { Disposable } from 'vs/base/common/lifecycle';
import { IUserDataAutoSyncEnablementService } from 'vs/platform/userDataSync/common/userDataSync';
export const IGettingStartedService = createDecorator<IGettingStartedService>('gettingStartedService');
......@@ -43,7 +45,7 @@ export interface IGettingStartedService {
progressByEvent(eventName: string): void;
}
export class GettingStartedService implements IGettingStartedService {
export class GettingStartedService extends Disposable implements IGettingStartedService {
declare readonly _serviceBrand: undefined;
private readonly _onDidAddTask = new Emitter<IGettingStartedTaskWithProgress>();
......@@ -65,7 +67,10 @@ export class GettingStartedService implements IGettingStartedService {
@IStorageService private readonly storageService: IStorageService,
@ICommandService private readonly commandService: ICommandService,
@IContextKeyService private readonly contextService: IContextKeyService,
@IUserDataAutoSyncEnablementService readonly userDataAutoSyncEnablementService: IUserDataAutoSyncEnablementService,
) {
super();
this.memento = new Memento('gettingStartedService', this.storageService);
this.taskProgress = this.memento.getMemento(StorageScope.GLOBAL, StorageTarget.USER);
......@@ -75,13 +80,17 @@ export class GettingStartedService implements IGettingStartedService {
}
});
this.registry.onDidAddCategory(category => this._onDidAddCategory.fire(this.getCategoryProgress(category)));
this.registry.onDidAddTask(task => {
this._register(this.registry.onDidAddCategory(category => this._onDidAddCategory.fire(this.getCategoryProgress(category))));
this._register(this.registry.onDidAddTask(task => {
this.registerDoneListeners(task);
this._onDidAddTask.fire(this.getTaskProgress(task));
});
}));
this._register(this.commandService.onDidExecuteCommand(command => this.progressByCommand(command.commandId)));
this.commandService.onDidExecuteCommand(command => this.progressByCommand(command.commandId));
this._register(userDataAutoSyncEnablementService.onDidChangeEnablement(() => {
if (userDataAutoSyncEnablementService.isEnabled()) { this.progressByEvent('sync-enabled'); }
}));
}
private registerDoneListeners(task: IGettingStartedTask) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册