提交 ed517abe 编写于 作者: S Sandeep Somavarapu

fix updating auth token status

上级 ef210f22
......@@ -33,7 +33,7 @@ import { isWeb } from 'vs/base/common/platform';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { UserDataAutoSync } from 'vs/platform/userDataSync/common/userDataSyncService';
const CONTEXT_AUTH_TOKEN_STATE = new RawContextKey<string>('authTokenStatus', AuthTokenStatus.SignedOut);
const CONTEXT_AUTH_TOKEN_STATE = new RawContextKey<string>('authTokenStatus', AuthTokenStatus.Initializing);
const SYNC_PUSH_LIGHT_ICON_URI = URI.parse(registerAndGetAmdImageURL(`vs/workbench/contrib/userDataSync/browser/media/check-light.svg`));
const SYNC_PUSH_DARK_ICON_URI = URI.parse(registerAndGetAmdImageURL(`vs/workbench/contrib/userDataSync/browser/media/check-dark.svg`));
......
......@@ -31,10 +31,8 @@ export class AuthTokenService extends Disposable implements IAuthTokenService {
) {
super();
this.channel = sharedProcessService.getChannel('authToken');
this.channel.call<AuthTokenStatus>('_getInitialStatus').then(status => {
this.updateStatus(status);
this._register(this.channel.listen<AuthTokenStatus>('onDidChangeStatus')(status => this.updateStatus(status)));
});
this._register(this.channel.listen<AuthTokenStatus>('onDidChangeStatus')(status => this.updateStatus(status)));
this.channel.call<AuthTokenStatus>('_getInitialStatus').then(status => this.updateStatus(status));
this.urlService.registerHandler(this);
}
......@@ -66,8 +64,10 @@ export class AuthTokenService extends Disposable implements IAuthTokenService {
}
private async updateStatus(status: AuthTokenStatus): Promise<void> {
this._status = status;
this._onDidChangeStatus.fire(status);
if (status !== AuthTokenStatus.Initializing) {
this._status = status;
this._onDidChangeStatus.fire(status);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册