Quellcode durchsuchen

Removes deprecated code

Deprecates storage settings
main
Eric Amodio vor 1 Jahr
Ursprung
Commit
31eabdf0e0
4 geänderte Dateien mit 19 neuen und 66 gelöschten Zeilen
  1. +18
    -11
      src/constants.ts
  2. +1
    -45
      src/plus/subscription/authenticationProvider.ts
  3. +0
    -5
      src/plus/subscription/subscriptionService.ts
  4. +0
    -5
      src/webviews/home/protocol.ts

+ 18
- 11
src/constants.ts Datei anzeigen

@ -3,7 +3,6 @@ import type { Environment } from './container';
import type { StoredSearchQuery } from './git/search';
import type { Subscription } from './subscription';
import type { TrackedUsage, TrackedUsageKeys } from './telemetry/usageTracker';
import type { CompletedActions } from './webviews/home/protocol';
export const extensionPrefix = 'gitlens';
export const quickPickTitleMaxChars = 80;
@ -588,9 +587,25 @@ export const enum SyncedStorageKeys {
export type DeprecatedGlobalStorage = {
/** @deprecated use `confirm:ai:send:openai` */
'confirm:sendToOpenAI': boolean;
/** @deprecated not longer valid */
/** @deprecated */
'home:actions:completed': ('dismissed:welcome' | 'opened:scm')[];
/** @deprecated */
'home:steps:completed': string[];
/** @deprecated */
'home:sections:dismissed': string[];
/** @deprecated */
'home:status:pinned': boolean;
/** @deprecated */
'home:banners:dismissed': string[];
/** @deprecated */
'plus:discountNotificationShown': boolean;
/** @deprecated */
'plus:migratedAuthentication': boolean;
/** @deprecated */
'plus:renewalDiscountNotificationShown': boolean;
/** @deprecated */
'views:layout': 'gitlens' | 'scm';
/** @deprecated not longer used */
/** @deprecated */
'views:commitDetails:dismissed': 'sidebar'[];
} & {
/** @deprecated */
@ -601,16 +616,8 @@ export type GlobalStorage = {
avatars: [string, StoredAvatar][];
repoVisibility: [string, StoredRepoVisibilityInfo][];
'deepLinks:pending': StoredDeepLinkContext;
'home:actions:completed': CompletedActions[];
'home:steps:completed': string[];
'home:sections:dismissed': string[];
'home:status:pinned': boolean;
'home:banners:dismissed': string[];
pendingWelcomeOnFocus: boolean;
pendingWhatsNewOnFocus: boolean;
'plus:migratedAuthentication': boolean;
'plus:discountNotificationShown': boolean;
'plus:renewalDiscountNotificationShown': boolean;
// Don't change this key name ('premium`) as its the stored subscription
'premium:subscription': Stored<Subscription>;
'synced:version': string;

+ 1
- 45
src/plus/subscription/authenticationProvider.ts Datei anzeigen

@ -3,7 +3,7 @@ import type {
AuthenticationProviderAuthenticationSessionsChangeEvent,
AuthenticationSession,
} from 'vscode';
import { authentication, Disposable, EventEmitter, extensions, window } from 'vscode';
import { authentication, Disposable, EventEmitter, window } from 'vscode';
import { uuid } from '@env/crypto';
import type { Container, Environment } from '../../container';
import { debug } from '../../system/decorators/log';
@ -168,50 +168,6 @@ export class SubscriptionAuthenticationProvider implements AuthenticationProvide
}
}
private _migrated: boolean | undefined;
async tryMigrateSession(): Promise<AuthenticationSession | undefined> {
if (this._migrated == null) {
this._migrated = this.container.storage.get('plus:migratedAuthentication', false);
}
if (this._migrated) return undefined;
let session: AuthenticationSession | undefined;
try {
if (extensions.getExtension('gitkraken.gitkraken-authentication') == null) return;
session = await authentication.getSession('gitkraken', ['gitlens'], {
createIfNone: false,
});
if (session == null) return;
session = {
id: uuid(),
accessToken: session.accessToken,
account: { ...session.account },
scopes: session.scopes,
};
const sessions = await this._sessionsPromise;
const scopesKey = getScopesKey(session.scopes);
const sessionIndex = sessions.findIndex(s => s.id === session!.id || getScopesKey(s.scopes) === scopesKey);
if (sessionIndex > -1) {
sessions.splice(sessionIndex, 1, session);
} else {
sessions.push(session);
}
await this.storeSessions(sessions);
this._onDidChangeSessions.fire({ added: [session], removed: [], changed: [] });
} catch (ex) {
Logger.error(ex, 'Unable to migrate authentication');
} finally {
this._migrated = true;
void this.container.storage.store('plus:migratedAuthentication', true);
}
return session;
}
private async checkForUpdates() {
const previousSessions = await this._sessionsPromise;
this._sessionsPromise = this.getSessionsFromStorage();

+ 0
- 5
src/plus/subscription/subscriptionService.ts Datei anzeigen

@ -760,11 +760,6 @@ export class SubscriptionService implements Disposable {
Logger.error(ex, scope);
}
// If we didn't find a session, check if we could migrate one from the GK auth provider
if (session === undefined) {
session = await this.container.subscriptionAuthentication.tryMigrateSession();
}
if (session == null) {
Logger.debug(scope, 'No valid session was found');
await this.logoutCore();

+ 0
- 5
src/webviews/home/protocol.ts Datei anzeigen

@ -1,10 +1,5 @@
import { IpcNotificationType } from '../protocol';
export const enum CompletedActions {
DismissedWelcome = 'dismissed:welcome',
OpenedSCM = 'opened:scm',
}
export interface State {
timestamp: number;

Laden…
Abbrechen
Speichern