mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 11:38:51 +01:00
Fix #103246
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IUserDataSyncService, IAuthenticationProvider, getUserDataSyncStore, isAuthenticationProvider, IUserDataAutoSyncService, SyncResource, IResourcePreview, ISyncResourcePreview, Change, IManualSyncTask } from 'vs/platform/userDataSync/common/userDataSync';
|
||||
import { IUserDataSyncService, IAuthenticationProvider, isAuthenticationProvider, IUserDataAutoSyncService, SyncResource, IResourcePreview, ISyncResourcePreview, Change, IManualSyncTask, IUserDataSyncStoreManagementService, UserDataSyncStoreType } 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_SYNC_LOG_COMMAND_ID, getSyncAreaLabel, IUserDataSyncPreview, IUserDataSyncResource, CONTEXT_ENABLE_SYNC_MERGES_VIEW, SYNC_MERGES_VIEW_ID, CONTEXT_ENABLE_ACTIVITY_VIEWS, SYNC_VIEW_CONTAINER_ID, SYNC_TITLE } from 'vs/workbench/services/userDataSync/common/userDataSync';
|
||||
@@ -30,6 +30,8 @@ import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/
|
||||
import { isEqual } from 'vs/base/common/resources';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IViewsService, ViewContainerLocation, IViewDescriptorService } from 'vs/workbench/common/views';
|
||||
import { isNative } from 'vs/base/common/platform';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
|
||||
type UserAccountClassification = {
|
||||
id: { classification: 'EndUserPseudonymizedInformation', purpose: 'BusinessInsight' };
|
||||
@@ -97,7 +99,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
|
||||
@IUserDataAutoSyncService private readonly userDataAutoSyncService: IUserDataAutoSyncService,
|
||||
@ITelemetryService private readonly telemetryService: ITelemetryService,
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@IProductService productService: IProductService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IExtensionService private readonly extensionService: IExtensionService,
|
||||
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
|
||||
@@ -107,9 +109,11 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IViewsService private readonly viewsService: IViewsService,
|
||||
@IViewDescriptorService private readonly viewDescriptorService: IViewDescriptorService,
|
||||
@IUserDataSyncStoreManagementService private readonly userDataSyncStoreManagementService: IUserDataSyncStoreManagementService,
|
||||
@IHostService private readonly hostService: IHostService,
|
||||
) {
|
||||
super();
|
||||
this._authenticationProviders = getUserDataSyncStore(productService, configurationService)?.authenticationProviders || [];
|
||||
this._authenticationProviders = this.userDataSyncStoreManagementService.userDataSyncStore?.authenticationProviders || [];
|
||||
this.syncEnablementContext = CONTEXT_SYNC_ENABLEMENT.bindTo(contextKeyService);
|
||||
this.syncStatusContext = CONTEXT_SYNC_STATE.bindTo(contextKeyService);
|
||||
this.accountStatusContext = CONTEXT_ACCOUNT_STATE.bindTo(contextKeyService);
|
||||
@@ -383,6 +387,30 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
|
||||
await this.viewsService.openViewContainer(SYNC_VIEW_CONTAINER_ID);
|
||||
}
|
||||
|
||||
async switchSyncService(type: UserDataSyncStoreType): Promise<void> {
|
||||
if (!this.userDataSyncStoreManagementService.userDataSyncStore
|
||||
|| !this.userDataSyncStoreManagementService.userDataSyncStore.insidersUrl
|
||||
|| !this.userDataSyncStoreManagementService.userDataSyncStore.stableUrl) {
|
||||
return;
|
||||
}
|
||||
await this.userDataSyncStoreManagementService.switch(type);
|
||||
const res = await this.dialogService.confirm({
|
||||
type: 'info',
|
||||
message: isNative ?
|
||||
localize('relaunchMessage', "Switching settings sync service requires a restart to take effect.") :
|
||||
localize('relaunchMessageWeb', "Switching settings sync service requires a reload to take effect."),
|
||||
detail: isNative ?
|
||||
localize('relaunchDetail', "Press the restart button to restart {0} and switch.", this.productService.nameLong) :
|
||||
localize('relaunchDetailWeb', "Press the reload button to reload {0} and switch.", this.productService.nameLong),
|
||||
primaryButton: isNative ?
|
||||
localize('restart', "&&Restart") :
|
||||
localize('restartWeb', "&&Reload"),
|
||||
});
|
||||
if (res.confirmed) {
|
||||
this.hostService.restart();
|
||||
}
|
||||
}
|
||||
|
||||
private async waitForActiveSyncViews(): Promise<void> {
|
||||
const viewContainer = this.viewDescriptorService.getViewContainerById(SYNC_VIEW_CONTAINER_ID);
|
||||
if (viewContainer) {
|
||||
|
||||
Reference in New Issue
Block a user