From 5d62b11a6d88f30a1340e4d82778b1c086ae4f46 Mon Sep 17 00:00:00 2001 From: Ajay Date: Mon, 10 Oct 2022 00:38:09 -0400 Subject: [PATCH] Enable chapters if not enabled after redeem successful --- src/upsell.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/upsell.ts b/src/upsell.ts index 7ea7f277..1396d705 100644 --- a/src/upsell.ts +++ b/src/upsell.ts @@ -3,11 +3,15 @@ import { checkLicenseKey } from "./utils/licenseKey"; import { localizeHtmlPage } from "./utils/pageUtils"; import * as countries from "../public/res/countries.json"; +import Utils from "./utils"; +import { Category, CategorySkipOption } from "./types"; // This is needed, if Config is not imported before Utils, things break. // Probably due to cyclic dependencies Config.config; +const utils = new Utils(); + window.addEventListener('DOMContentLoaded', init); async function init() { @@ -31,6 +35,13 @@ async function init() { Config.config.payments.licenseKey = licenseKey; Config.forceSyncUpdate("payments"); + if (!utils.getCategorySelection("chapter")) { + Config.config.categorySelections.push({ + name: "chapter" as Category, + option: CategorySkipOption.ShowOverlay + }); + } + alert(chrome.i18n.getMessage("redeemSuccess")); } else { alert(chrome.i18n.getMessage("redeemFailed"));