mirror of
https://github.com/XFox111/TabsAsideExtension.git
synced 2026-04-22 07:58:01 +03:00
chore(deps): WXT 0.20.0 bump + lockfile regen (#199)
* chore(deps): wxt 0.20.0 bump #134 * chore: 3.2.1 manifest bump
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { Unwatch, WatchCallback, WxtStorageItem } from "wxt/storage";
|
||||
import { Unwatch, WatchCallback } from "wxt/utils/storage";
|
||||
import { analytics } from "./analytics";
|
||||
import { Permissions } from "wxt/browser";
|
||||
|
||||
const analyticsPermission: Pick<WxtStorageItem<boolean, Record<string, unknown>>, "getValue" | "watch" | "setValue"> =
|
||||
{
|
||||
@@ -9,7 +8,7 @@ const analyticsPermission: Pick<WxtStorageItem<boolean, Record<string, unknown>>
|
||||
const isGranted: boolean = import.meta.env.FIREFOX
|
||||
? await browser.permissions.contains({
|
||||
data_collection: ["technicalAndInteraction"]
|
||||
})
|
||||
} as Browser.permissions.Permissions)
|
||||
: await allowAnalytics.getValue();
|
||||
|
||||
analytics.setEnabled(isGranted);
|
||||
@@ -30,11 +29,11 @@ const analyticsPermission: Pick<WxtStorageItem<boolean, Record<string, unknown>>
|
||||
if (value)
|
||||
result = await browser.permissions.request({
|
||||
data_collection: ["technicalAndInteraction"]
|
||||
});
|
||||
} as Browser.permissions.Permissions);
|
||||
else
|
||||
result = await browser.permissions.remove({
|
||||
data_collection: ["technicalAndInteraction"]
|
||||
});
|
||||
} as Browser.permissions.Permissions);
|
||||
|
||||
if (!result)
|
||||
throw new Error("Permission request was denied");
|
||||
@@ -45,11 +44,14 @@ const analyticsPermission: Pick<WxtStorageItem<boolean, Record<string, unknown>>
|
||||
if (!import.meta.env.FIREFOX)
|
||||
return allowAnalytics.watch(cb);
|
||||
|
||||
const listener = async (permissions: Permissions.Permissions): Promise<void> =>
|
||||
const listener = async (permissions: Browser.permissions.Permissions): Promise<void> =>
|
||||
{
|
||||
// @ts-expect-error Firefox-only API
|
||||
if (permissions.data_collection?.includes("technicalAndInteraction"))
|
||||
{
|
||||
const isGranted: boolean = await browser.permissions.contains({ data_collection: ["technicalAndInteraction"] });
|
||||
const isGranted: boolean = await browser.permissions.contains({
|
||||
data_collection: ["technicalAndInteraction"]
|
||||
} as Browser.permissions.Permissions);
|
||||
cb(isGranted, !isGranted);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user