All files / src/views gatekeeper-modal.ts

100% Statements 19/19
100% Branches 0/0
100% Functions 3/3
100% Lines 18/18

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37                3x 3x       3x 3x 3x   3x 3x   3x 3x 3x 3x   3x   3x 3x 3x   3x 3x 3x      
import { App, Modal } from "obsidian";
import { MESSAGES } from "../locales/en";
import { LILBEE_REPO_URL } from "../types";
import { bindEscapeToClose } from "../utils";
 
/** Explains how to allow the unsigned lilbee server after macOS Gatekeeper blocks it. */
export class GatekeeperModal extends Modal {
    constructor(app: App) {
        super(app);
        bindEscapeToClose(this);
    }
 
    onOpen(): void {
        const { contentEl } = this;
        contentEl.empty();
        contentEl.addClass("lilbee-gatekeeper-modal");
 
        contentEl.createEl("h3", { text: MESSAGES.GATEKEEPER_TITLE });
        contentEl.createEl("p", { text: MESSAGES.GATEKEEPER_INTRO });
 
        const steps = contentEl.createEl("ol");
        steps.createEl("li", { text: MESSAGES.GATEKEEPER_STEP_1 });
        steps.createEl("li", { text: MESSAGES.GATEKEEPER_STEP_2 });
        steps.createEl("li", { text: MESSAGES.GATEKEEPER_STEP_3 });
 
        contentEl.createEl("p", { text: MESSAGES.GATEKEEPER_RETRY });
 
        const source = contentEl.createEl("p", { text: `${MESSAGES.GATEKEEPER_SOURCE} ` });
        const repoLink = source.createEl("a", { text: MESSAGES.LINK_LILBEE_REPO });
        repoLink.setAttribute("href", LILBEE_REPO_URL);
 
        const actions = contentEl.createDiv({ cls: "lilbee-confirm-actions" });
        const gotItBtn = actions.createEl("button", { text: MESSAGES.BUTTON_GOT_IT, cls: "mod-cta" });
        gotItBtn.addEventListener("click", () => this.close());
    }
}