Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid use of native private variables #186756

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

/* eslint-disable local/code-no-native-private */

import { Disposable } from 'vs/base/common/lifecycle';
import { localize } from 'vs/nls';
import { Action2, MenuId, MenuRegistry, registerAction2 } from 'vs/platform/actions/common/actions';
Expand Down Expand Up @@ -40,7 +38,7 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
private serverConfiguration = this.productService['editSessions.store'];
private machineClient: IUserDataSyncMachinesService | undefined;

#authenticationInfo: { sessionId: string; token: string; providerId: string } | undefined;
private authenticationInfo: { sessionId: string; token: string; providerId: string } | undefined;
private static CACHED_SESSION_STORAGE_KEY = 'editSessionAccountPreference';

private initialized = false;
Expand Down Expand Up @@ -227,13 +225,13 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
}

// If we already have an existing auth session in memory, use that
if (this.#authenticationInfo !== undefined) {
if (this.authenticationInfo !== undefined) {
return true;
}

const authenticationSession = await this.getAuthenticationSession(silent);
if (authenticationSession !== undefined) {
this.#authenticationInfo = authenticationSession;
this.authenticationInfo = authenticationSession;
this.storeClient.setAuthToken(authenticationSession.token, authenticationSession.providerId);
}

Expand Down Expand Up @@ -436,25 +434,25 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
&& e.scope === StorageScope.APPLICATION
) {
const newSessionId = this.existingSessionId;
const previousSessionId = this.#authenticationInfo?.sessionId;
const previousSessionId = this.authenticationInfo?.sessionId;

if (previousSessionId !== newSessionId) {
this.logService.trace(`Resetting authentication state because authentication session ID preference changed from ${previousSessionId} to ${newSessionId}.`);
this.#authenticationInfo = undefined;
this.authenticationInfo = undefined;
this.initialized = false;
}
}
}

private clearAuthenticationPreference(): void {
this.#authenticationInfo = undefined;
this.authenticationInfo = undefined;
this.initialized = false;
this.existingSessionId = undefined;
this.signedInContext.set(false);
}

private onDidChangeSessions(e: AuthenticationSessionsChangeEvent): void {
if (this.#authenticationInfo?.sessionId && e.removed.find(session => session.id === this.#authenticationInfo?.sessionId)) {
if (this.authenticationInfo?.sessionId && e.removed.find(session => session.id === this.authenticationInfo?.sessionId)) {
this.clearAuthenticationPreference();
}
}
Expand Down