This commit is contained in:
Sandeep Somavarapu 2024-10-31 11:23:54 +01:00 коммит произвёл GitHub
Родитель bea51cd8de
Коммит 54d1a4d6f3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 13 добавлений и 12 удалений

Просмотреть файл

@ -151,11 +151,11 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
}
private async waitAndInitialize(): Promise<void> {
/* wait */
await Promise.all([this.extensionService.whenInstalledExtensionsRegistered(), this.userDataInitializationService.whenInitializationFinished()]);
/* initialize */
try {
/* wait */
await Promise.all([this.extensionService.whenInstalledExtensionsRegistered(), this.userDataInitializationService.whenInitializationFinished()]);
/* initialize */
await this.initialize();
} catch (error) {
// Do not log if the current window is running extension tests
@ -181,7 +181,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
}
}
await this.update();
await this.update('initialize');
this._register(this.authenticationService.onDidChangeDeclaredProviders(() => this.updateAuthenticationProviders()));
@ -189,7 +189,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
Event.any(
this.authenticationService.onDidRegisterAuthenticationProvider,
this.authenticationService.onDidUnregisterAuthenticationProvider,
), info => this.isSupportedAuthenticationProviderId(info.id))(() => this.update()));
), info => this.isSupportedAuthenticationProviderId(info.id))(() => this.update('authentication provider change')));
this._register(Event.filter(this.userDataSyncAccountService.onTokenFailed, isSuccessive => !isSuccessive)(() => this.update('token failure')));
@ -213,11 +213,8 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
}));
}
private async update(reason?: string): Promise<void> {
if (reason) {
this.logService.info(`Settings Sync: Updating due to ${reason}`);
}
private async update(reason: string): Promise<void> {
this.logService.info(`Settings Sync: Updating due to ${reason}`);
this.updateAuthenticationProviders();
await this.updateCurrentAccount();
@ -548,6 +545,9 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
if (authenticationProvider) {
await this.doSignIn(authenticationProvider);
} else {
if (!this.authenticationProviders.length) {
throw new Error(localize('no authentication providers during signin', "Cannot sign in because there are no authentication providers available."));
}
await this.pick();
}
}
@ -688,7 +688,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
this.currentAuthenticationProviderId = accountOrAuthProvider.authenticationProviderId;
}
this.currentSessionId = sessionId;
await this.update();
await this.update('sign in');
}
private async onDidAuthFailure(): Promise<void> {

Просмотреть файл

@ -67,6 +67,7 @@ export function getSyncAreaLabel(source: SyncResource): string {
}
export const enum AccountStatus {
Uninitialized = 'uninitialized',
Unavailable = 'unavailable',
Available = 'available',
}