mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
Polish onDidChangePassword changes
This commit is contained in:
@@ -84,12 +84,6 @@ export class Keychain {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
onDidChangePassword(listener: () => void) {
|
||||
vscode.authentication.onDidChangePassword(_ => {
|
||||
listener();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const keychain = new Keychain();
|
||||
|
||||
@@ -16,7 +16,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
context.subscriptions.push(vscode.window.registerUriHandler(uriHandler));
|
||||
const loginService = new GitHubAuthenticationProvider();
|
||||
|
||||
await loginService.initialize();
|
||||
await loginService.initialize(context);
|
||||
|
||||
context.subscriptions.push(vscode.commands.registerCommand('github.provide-token', () => {
|
||||
return loginService.manuallyProvideToken();
|
||||
|
||||
@@ -26,14 +26,14 @@ export class GitHubAuthenticationProvider {
|
||||
private _sessions: vscode.AuthenticationSession[] = [];
|
||||
private _githubServer = new GitHubServer();
|
||||
|
||||
public async initialize(): Promise<void> {
|
||||
public async initialize(context: vscode.ExtensionContext): Promise<void> {
|
||||
try {
|
||||
this._sessions = await this.readSessions();
|
||||
} catch (e) {
|
||||
// Ignore, network request failed
|
||||
}
|
||||
|
||||
keychain.onDidChangePassword(() => this.checkForUpdates());
|
||||
context.subscriptions.push(vscode.authentication.onDidChangePassword(() => this.checkForUpdates()));
|
||||
}
|
||||
|
||||
private async checkForUpdates() {
|
||||
|
||||
Reference in New Issue
Block a user