fix: add detection to see if we are logged in before starting the onboarding screen with the onInstalled trigger.
This commit is contained in:
parent
884db93478
commit
7f07621157
|
@ -1,17 +1,34 @@
|
|||
import { awaitBooted, getTimer } from "../vars.js";
|
||||
import { awaitBooted, events, getTimer } from "../vars.js";
|
||||
import browser from "webextension-polyfill";
|
||||
import { logLargeObjects } from "./background/util.js";
|
||||
import { queryKernel } from "./background/kernel.js";
|
||||
import { boot } from "./background/boot.js";
|
||||
import * as kernel from "@lumeweb/libkernel";
|
||||
import type { KernelAuthStatus } from "@lumeweb/libweb";
|
||||
import defer from "p-defer";
|
||||
|
||||
setTimeout(logLargeObjects, getTimer());
|
||||
|
||||
browser.runtime.onInstalled.addListener(() => {
|
||||
browser.tabs.create({
|
||||
url: browser.runtime.getURL("onboarding.html"),
|
||||
active: true,
|
||||
browser.runtime.onInstalled.addListener(async () => {
|
||||
let loggedIn = false;
|
||||
|
||||
events.on("authStatus", (update: KernelAuthStatus) => {
|
||||
if (update.loginComplete) {
|
||||
loggedIn = true;
|
||||
}
|
||||
});
|
||||
|
||||
const timerDefer = defer();
|
||||
setTimeout(timerDefer.resolve, 1000);
|
||||
|
||||
await timerDefer.promise;
|
||||
|
||||
if (!loggedIn) {
|
||||
browser.tabs.create({
|
||||
url: browser.runtime.getURL("onboarding.html"),
|
||||
active: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
browser.runtime.onMessage.addListener(async (request, sender) => {
|
||||
|
|
Reference in New Issue