Skip to content

Commit

Permalink
further harden the subscription process
Browse files Browse the repository at this point in the history
  • Loading branch information
blackforestboi committed May 2, 2024
1 parent 1db699b commit 0dd8a30
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/util/subscriptions/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,27 +169,16 @@ export async function checkStatus(feature: PremiumPlans) {
currentStatusStorage[COUNTER_STORAGE_KEY] != null
? currentStatusStorage[COUNTER_STORAGE_KEY]
: DEFAULT_COUNTER_STORAGE_KEY
const currentDate = new Date(Date.now())
const currentMonth = currentDate.getMonth()

if ((await enforceTrialPeriod30Days()) === true) {
return true
}

// if (currentStatus.m !== currentMonth) {
// await browser.storage.local.set({
// [COUNTER_STORAGE_KEY]: {
// c: currentStatus.c,
// cQ: currentStatus.cQ,
// m: currentMonth,
// },
// })
// }

if (feature === 'bookmarksPowerUp') {
const hasBookmarkPowerUp =
(currentStatus.pU?.Unlimited ||
currentStatus.pU?.bookmarksPowerUp) ??
currentStatus.pU?.bookmarksPowerUp ||
currentStatus.pU?.lifetime) ??
false

if (hasBookmarkPowerUp) {
Expand All @@ -199,10 +188,12 @@ export async function checkStatus(feature: PremiumPlans) {
if (currentCounter < 25) {
return true
}
return false
}
}
if (feature === 'AIpowerup') {
const hasAIPowerUp = currentStatus.pU?.AIpowerup ?? false
const hasAIPowerUp =
(currentStatus.pU?.AIpowerup || currentStatus.pU?.lifetime) ?? false

if (hasAIPowerUp) {
return true
Expand All @@ -211,11 +202,14 @@ export async function checkStatus(feature: PremiumPlans) {
if (currentCounter < 25) {
return true
}
return false
}
}
if (feature === 'AIpowerupOwnKey') {
const hasAIPowerUp =
(currentStatus.pU.AIpowerupOwnKey || currentStatus.pU.AIpowerup) ??
(currentStatus.pU.AIpowerupOwnKey ||
currentStatus.pU.AIpowerup ||
currentStatus.pU?.lifetime) ??
false

if (hasAIPowerUp) {
Expand All @@ -225,9 +219,10 @@ export async function checkStatus(feature: PremiumPlans) {
if (currentCounter < 25) {
return true
}
return false
}
}
return false
return true
}

export async function pageActionAllowed(
Expand Down

0 comments on commit 0dd8a30

Please sign in to comment.