From b3fca3b416cf70a79e7377eaebec676137f41922 Mon Sep 17 00:00:00 2001 From: SimonStnn Date: Mon, 17 Jun 2024 18:28:49 +0200 Subject: [PATCH] Use ask permission function from utils --- src/popup/components/forms/LocalSettings.tsx | 24 ++++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/popup/components/forms/LocalSettings.tsx b/src/popup/components/forms/LocalSettings.tsx index 5d993e67..b327143f 100644 --- a/src/popup/components/forms/LocalSettings.tsx +++ b/src/popup/components/forms/LocalSettings.tsx @@ -16,6 +16,7 @@ import InfoIcon from '@/components/InfoIcon'; import { Default as DefaultBalloon } from '@/balloons'; import storage from '@/managers/storage'; import log from '@/managers/log'; +import { askOriginPermissions } from '@/utils'; const MIN_POP_VOLUME = 0; const VOLUME_STEP = 20; @@ -77,14 +78,7 @@ export default () => { }; const onGrantOriginPermissionClick = async () => { - const host_permissions = - await browser.runtime.getManifest().host_permissions; - if (!host_permissions) return log.error('No host_permissions found'); - const permissions = await browser.permissions.request({ - origins: host_permissions, - }); - log.debug('Permissions granted for', permissions); - + await askOriginPermissions(); setPermissions(await browser.permissions.getAll()); }; @@ -113,10 +107,10 @@ export default () => { {popVolume} -

+

Pop Volume

-

+

The volume of the pop sound when a balloon is popped.

@@ -148,10 +142,10 @@ export default () => { x{spawnRate} -

+

Spawn Rate

-

+

The rate at which balloons spawn. A lower value means less balloons will spawn.

@@ -184,11 +178,11 @@ export default () => { Host Permission -

+

Host Permission{' '} - *recommended + *recommended

-

+

Pop-a-loon requires host permissions to function properly.