Rename login/logout to createSession/removeSession

This commit is contained in:
Rachel Macfarlane
2021-02-11 16:44:35 -08:00
parent ea865096f1
commit eceff53351
12 changed files with 52 additions and 52 deletions

View File

@@ -26,14 +26,14 @@ export async function activate(context: vscode.ExtensionContext) {
onDidChangeSessions: onDidChangeSessions.event,
getAllSessions: () => Promise.resolve(loginService.sessions),
getSessions: (scopes: string[]) => loginService.getSessions(scopes),
login: async (scopeList: string[]) => {
createSession: async (scopeList: string[]) => {
try {
/* __GDPR__
"login" : { }
*/
telemetryReporter.sendTelemetryEvent('login');
const session = await loginService.login(scopeList.sort().join(' '));
const session = await loginService.createSession(scopeList.sort().join(' '));
Logger.info('Login success!');
onDidChangeSessions.fire({ added: [session], removed: [], changed: [] });
return session;
@@ -57,14 +57,14 @@ export async function activate(context: vscode.ExtensionContext) {
throw e;
}
},
logout: async (id: string) => {
removeSession: async (id: string) => {
try {
/* __GDPR__
"logout" : { }
*/
telemetryReporter.sendTelemetryEvent('logout');
const session = await loginService.logout(id);
const session = await loginService.removeSession(id);
if (session) {
onDidChangeSessions.fire({ added: [], removed: [session], changed: [] });
}

View File

@@ -158,7 +158,7 @@ export class GitHubAuthenticationProvider {
return this._sessions;
}
public async login(scopes: string): Promise<vscode.AuthenticationSession> {
public async createSession(scopes: string): Promise<vscode.AuthenticationSession> {
const token = await this._githubServer.login(scopes);
const session = await this.tokenToSession(token, scopes.split(' '));
await this.setToken(session);
@@ -190,7 +190,7 @@ export class GitHubAuthenticationProvider {
await this.storeSessions();
}
public async logout(id: string): Promise<vscode.AuthenticationSession | undefined> {
public async removeSession(id: string): Promise<vscode.AuthenticationSession | undefined> {
Logger.info(`Logging out of ${id}`);
const sessionIndex = this._sessions.findIndex(session => session.id === id);
let session: vscode.AuthenticationSession | undefined;