From 6e060da237af35796b1b34dce108f05eef44ceb3 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Fri, 14 Apr 2023 14:16:08 -0300
Subject: some changes

using transaction context from web utils
alertContext.safely api change (easier to integrate)
using lang and localstorage from web utils
removing auto permission, from UI
adding settings
---
 .../src/wallet/Welcome.tsx                         | 28 +++++++++++++++-------
 1 file changed, 19 insertions(+), 9 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/wallet/Welcome.tsx')

diff --git a/packages/taler-wallet-webextension/src/wallet/Welcome.tsx b/packages/taler-wallet-webextension/src/wallet/Welcome.tsx
index b243eaa1c..1893c4161 100644
--- a/packages/taler-wallet-webextension/src/wallet/Welcome.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Welcome.tsx
@@ -24,18 +24,27 @@ import { WalletDiagnostics } from "@gnu-taler/taler-util";
 import { Fragment, h, VNode } from "preact";
 import { Checkbox } from "../components/Checkbox.js";
 import { SubTitle, Title } from "../components/styled/index.js";
-import { useTranslationContext } from "../context/translation.js";
+import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser";
 import { useDiagnostics } from "../hooks/useDiagnostics.js";
-import { useAutoOpenPermissions } from "../hooks/useAutoOpenPermissions.js";
+import { useSettings } from "../hooks/useSettings.js";
 import { ToggleHandler } from "../mui/handlers.js";
 import { platform } from "../platform/foreground.js";
+import { useAlertContext } from "../context/alert.js";
 
 export function WelcomePage(): VNode {
-  const permissionToggle = useAutoOpenPermissions();
+  const [settings, updateSettings] = useSettings();
+  const { safely } = useAlertContext();
   const [diagnostics, timedOut] = useDiagnostics();
   return (
     <View
-      permissionToggle={permissionToggle}
+      permissionToggle={{
+        value: settings.injectTalerSupport,
+        button: {
+          onClick: safely("update support injection", async () =>
+            updateSettings("injectTalerSupport", !settings.injectTalerSupport),
+          ),
+        },
+      }}
       diagnostics={diagnostics}
       timedOut={timedOut}
     />
@@ -88,15 +97,16 @@ export function View({
           </Fragment>
         )}
         <SubTitle>
-          <i18n.Translate>Permissions</i18n.Translate>
+          <i18n.Translate>Navigator</i18n.Translate>
         </SubTitle>
         <Checkbox
-          label={i18n.str`Automatically open wallet based on page content`}
-          name="perm"
+          label={i18n.str`Automatically inject Taler API in all pages`}
+          name="inject"
           description={
             <i18n.Translate>
-              (Enabling this option below will make using the wallet faster, but
-              requires more permissions from your browser.)
+              Disabling this option will make some web application not able to
+              trigger the wallet when clicking links but you will be able to
+              open the wallet using the keyboard shortcut
             </i18n.Translate>
           }
           enabled={permissionToggle.value!}
-- 
cgit v1.2.3

