Skip to content

Commit 5d62b11

Browse files
committed
Enable chapters if not enabled after redeem successful
1 parent f4cac58 commit 5d62b11

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/upsell.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ import { checkLicenseKey } from "./utils/licenseKey";
33
import { localizeHtmlPage } from "./utils/pageUtils";
44

55
import * as countries from "../public/res/countries.json";
6+
import Utils from "./utils";
7+
import { Category, CategorySkipOption } from "./types";
68

79
// This is needed, if Config is not imported before Utils, things break.
810
// Probably due to cyclic dependencies
911
Config.config;
1012

13+
const utils = new Utils();
14+
1115
window.addEventListener('DOMContentLoaded', init);
1216

1317
async function init() {
@@ -31,6 +35,13 @@ async function init() {
3135
Config.config.payments.licenseKey = licenseKey;
3236
Config.forceSyncUpdate("payments");
3337

38+
if (!utils.getCategorySelection("chapter")) {
39+
Config.config.categorySelections.push({
40+
name: "chapter" as Category,
41+
option: CategorySkipOption.ShowOverlay
42+
});
43+
}
44+
3445
alert(chrome.i18n.getMessage("redeemSuccess"));
3546
} else {
3647
alert(chrome.i18n.getMessage("redeemFailed"));

0 commit comments

Comments
 (0)