Show sign out notification for all auth providers, fixes #94634

This commit is contained in:
Rachel Macfarlane
2020-04-09 13:54:47 -07:00
parent 2e62ea405e
commit 95bc288b23
2 changed files with 9 additions and 6 deletions

View File

@@ -15,6 +15,7 @@ import Severity from 'vs/base/common/severity';
import { MenuRegistry, MenuId, IMenuItem } from 'vs/platform/actions/common/actions';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { INotificationService } from 'vs/platform/notification/common/notification';
interface AuthDependent {
providerId: string;
@@ -59,7 +60,8 @@ export class MainThreadAuthenticationProvider extends Disposable {
private readonly _proxy: ExtHostAuthenticationShape,
public readonly id: string,
public readonly displayName: string,
public readonly dependents: AuthDependent[]
public readonly dependents: AuthDependent[],
private readonly notificationService: INotificationService
) {
super();
@@ -236,8 +238,9 @@ export class MainThreadAuthenticationProvider extends Disposable {
});
}
logout(sessionId: string): Promise<void> {
return this._proxy.$logout(this.id, sessionId);
async logout(sessionId: string): Promise<void> {
await this._proxy.$logout(this.id, sessionId);
this.notificationService.info(nls.localize('signedOut', "Successfully signed out."));
}
dispose(): void {
@@ -255,7 +258,8 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
extHostContext: IExtHostContext,
@IAuthenticationService private readonly authenticationService: IAuthenticationService,
@IDialogService private readonly dialogService: IDialogService,
@IStorageService private readonly storageService: IStorageService
@IStorageService private readonly storageService: IStorageService,
@INotificationService private readonly notificationService: INotificationService
) {
super();
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostAuthentication);
@@ -264,7 +268,7 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
async $registerAuthenticationProvider(id: string, displayName: string): Promise<void> {
const dependentBuiltIns = BUILT_IN_AUTH_DEPENDENTS.filter(dependency => dependency.providerId === id);
const provider = new MainThreadAuthenticationProvider(this._proxy, id, displayName, dependentBuiltIns);
const provider = new MainThreadAuthenticationProvider(this._proxy, id, displayName, dependentBuiltIns, this.notificationService);
this.authenticationService.registerAuthenticationProvider(id, provider);
}