move sync enablement to auto sync service

This commit is contained in:
Sandeep Somavarapu
2020-06-16 23:36:09 +02:00
parent 9f11451eac
commit 5a986588b6
13 changed files with 128 additions and 100 deletions

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IUserDataSyncService, IUserDataSyncEnablementService, IAuthenticationProvider, getUserDataSyncStore, isAuthenticationProvider, IUserDataAutoSyncService } from 'vs/platform/userDataSync/common/userDataSync';
import { IUserDataSyncService, IAuthenticationProvider, getUserDataSyncStore, isAuthenticationProvider, IUserDataAutoSyncService } from 'vs/platform/userDataSync/common/userDataSync';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { IUserDataSyncWorkbenchService, IUserDataSyncAccount, AccountStatus, CONTEXT_SYNC_ENABLEMENT, CONTEXT_SYNC_STATE, CONTEXT_ACCOUNT_STATE, SHOW_SYNCED_DATA_COMMAND_ID } from 'vs/workbench/services/userDataSync/common/userDataSync';
@@ -82,7 +82,6 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
@IUserDataSyncAccountService private readonly userDataSyncAccountService: IUserDataSyncAccountService,
@IQuickInputService private readonly quickInputService: IQuickInputService,
@IStorageService private readonly storageService: IStorageService,
@IUserDataSyncEnablementService private readonly userDataSyncEnablementService: IUserDataSyncEnablementService,
@IUserDataAutoSyncService private readonly userDataAutoSyncService: IUserDataAutoSyncService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@ILogService private readonly logService: ILogService,
@@ -105,8 +104,8 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
this.syncStatusContext.set(this.userDataSyncService.status);
this._register(userDataSyncService.onDidChangeStatus(status => this.syncStatusContext.set(status)));
this.syncEnablementContext.set(userDataSyncEnablementService.isEnabled());
this._register(userDataSyncEnablementService.onDidChangeEnablement(enabled => this.syncEnablementContext.set(enabled)));
this.syncEnablementContext.set(userDataAutoSyncService.isEnabled());
this._register(userDataAutoSyncService.onDidChangeEnablement(enabled => this.syncEnablementContext.set(enabled)));
extensionService.whenInstalledExtensionsRegistered().then(() => {
if (this.authenticationProviders.every(({ id }) => authenticationService.isAuthenticationProviderRegistered(id))) {
@@ -378,7 +377,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
private async switch(sessionId: string, accountName: string, accountId: string): Promise<void> {
const currentAccount = this.current;
if (this.userDataSyncEnablementService.isEnabled() && (currentAccount && currentAccount.accountName !== accountName)) {
if (this.userDataAutoSyncService.isEnabled() && (currentAccount && currentAccount.accountName !== accountName)) {
// accounts are switched while sync is enabled.
}
this.currentSessionId = sessionId;