Skip to content

Commit

Permalink
Allow instant free access
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayyy committed Aug 18, 2024
1 parent 2287dd9 commit d69bd6a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/help/PaymentComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface PaymentComponentChoices {
freeTrial?: boolean;
licenseKey?: string;
freeAccess?: boolean;
freeInstantAccess?: boolean;
freeAccessWaitingPeriod? : number;
}

Expand Down Expand Up @@ -64,10 +65,15 @@ export const PaymentComponent = () => {
}

if (choices.freeAccess) {
Config.config!.freeAccessRequestStart = Date.now();

if (choices.freeAccessWaitingPeriod) {
Config.config!.freeAccessWaitingPeriod = choices.freeAccessWaitingPeriod;
if (choices.freeInstantAccess) {
Config.config!.activated = true;
Config.config!.freeActivation = true;
} else {
Config.config!.freeAccessRequestStart = Date.now();

if (choices.freeAccessWaitingPeriod) {
Config.config!.freeAccessWaitingPeriod = choices.freeAccessWaitingPeriod;
}
}
}

Expand All @@ -85,7 +91,7 @@ export const PaymentComponent = () => {
window.scrollTo(0, 0);
}

if (validLicenseKey || choices.freeTrial) {
if (validLicenseKey || choices.freeTrial || Config.config!.activated) {
await askBackgroundToRegisterNeededContentScripts(true);
} else if (choices.freeAccess) {
setTimeout(() => void askBackgroundToSetupAlarms(), 2000);
Expand Down

0 comments on commit d69bd6a

Please sign in to comment.