Quellcode durchsuchen

Adds early adopter renewal discount notification

main
Eric Amodio vor 1 Jahr
committed von Keith Daulton
Ursprung
Commit
b32088d4e0
3 geänderte Dateien mit 28 neuen und 1 gelöschten Zeilen
  1. +1
    -1
      src/messages.ts
  2. +26
    -0
      src/plus/subscription/subscriptionService.ts
  3. +1
    -0
      src/storage.ts

+ 1
- 1
src/messages.ts Datei anzeigen

@ -197,7 +197,7 @@ export async function showWhatsNewMessage(version: string) {
}
}
async function showMessage(
export async function showMessage(
type: 'info' | 'warn' | 'error',
message: string,
suppressionKey?: SuppressedMessages,

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

@ -30,6 +30,7 @@ import { AccountValidationError } from '../../errors';
import type { RepositoriesChangeEvent } from '../../git/gitProviderService';
import { Logger } from '../../logger';
import { getLogScope } from '../../logScope';
import { showMessage } from '../../messages';
import type { Subscription } from '../../subscription';
import {
computeSubscriptionState,
@ -898,6 +899,18 @@ export class SubscriptionService implements Disposable {
this._subscription = subscription;
this._etag = Date.now();
setTimeout(() => {
if (
subscription?.account != null &&
subscription.plan.actual.id === SubscriptionPlanId.Pro &&
!subscription.plan.actual.bundle &&
new Date(subscription.plan.actual.startedOn) >= new Date('2022-02-28T00:00:00.000Z') &&
new Date(subscription.plan.actual.startedOn) <= new Date('2022-04-31T00:00:00.000Z')
) {
showRenewalDiscountNotification(this.container);
}
}, 5000);
if (!silent) {
this.updateContext();
@ -1158,3 +1171,16 @@ function licenseStatusPriority(status: GKLicense['latestStatus']): number {
return 0;
}
}
function showRenewalDiscountNotification(container: Container): void {
if (container.storage.get('plus:renewalDiscountNotificationShown', false)) return;
void container.storage.store('plus:renewalDiscountNotificationShown', true);
void showMessage(
'info',
'60% off your GitLens Pro renewal — as a thank you for being an early adopter of GitLens+. So there will be no change to your price for an additional year!',
undefined,
undefined,
);
}

+ 1
- 0
src/storage.ts Datei anzeigen

@ -129,6 +129,7 @@ export type GlobalStorage = {
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;

Laden…
Abbrechen
Speichern