diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/Settings.tsx')
-rw-r--r-- | packages/taler-wallet-webextension/src/wallet/Settings.tsx | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/Settings.tsx b/packages/taler-wallet-webextension/src/wallet/Settings.tsx index 3109e8947..eea1ffb49 100644 --- a/packages/taler-wallet-webextension/src/wallet/Settings.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Settings.tsx @@ -36,9 +36,9 @@ import { import { useAlertContext } from "../context/alert.js"; import { useBackendContext } from "../context/backend.js"; import { useDevContext } from "../context/devContext.js"; -import { useTranslationContext } from "../context/translation.js"; +import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js"; -import { useAutoOpenPermissions } from "../hooks/useAutoOpenPermissions.js"; +import { useSettings } from "../hooks/useSettings.js"; import { useBackupDeviceName } from "../hooks/useBackupDeviceName.js"; import { useClipboardPermissions } from "../hooks/useClipboardPermissions.js"; import { ToggleHandler } from "../mui/handlers.js"; @@ -48,9 +48,10 @@ import { platform } from "../platform/foreground.js"; const GIT_HASH = typeof __GIT_HASH__ !== "undefined" ? __GIT_HASH__ : undefined; export function SettingsPage(): VNode { - const autoOpenToggle = useAutoOpenPermissions(); + const [settings, updateSettings] = useSettings(); const clipboardToggle = useClipboardPermissions(); const { devMode, toggle } = useDevContext(); + const { safely } = useAlertContext(); const { name, update } = useBackupDeviceName(); const { pushAlertOnError } = useAlertContext(); const webex = platform.getWalletWebExVersion(); @@ -71,7 +72,15 @@ export function SettingsPage(): VNode { knownExchanges={exchanges} deviceName={name} setDeviceName={update} - autoOpenToggle={autoOpenToggle} + autoOpenToggle={{ + value: settings.injectTalerSupport, + button: { + onClick: safely("update support injection", async () => { + console.log("click", settings.injectTalerSupport); + updateSettings("injectTalerSupport", !settings.injectTalerSupport); + }), + }, + }} clipboardToggle={clipboardToggle} devModeToggle={{ value: devMode, @@ -115,21 +124,6 @@ export function SettingsView({ return ( <Fragment> <section> - {/* <Checkbox - label={ - i18n.str`Automatically check clipboard for Taler URI` - } - name="clipboard" - description={ - <i18n.Translate> - Enabling this option below will make using the wallet faster, but - requires more permissions from your browser. - </i18n.Translate> - } - enabled={clipboardToggle.value!} - onToggle={clipboardToggle.button.onClick!} - /> */} - <SubTitle> <i18n.Translate>Trust</i18n.Translate> </SubTitle> @@ -273,23 +267,22 @@ export function SettingsView({ enabled={devModeToggle.value!} onToggle={devModeToggle.button.onClick!} /> - <JustInDevMode> - <SubTitle> - <i18n.Translate>Navigator</i18n.Translate> - </SubTitle> - <Checkbox - label={i18n.str`Automatically open wallet based on page content`} - name="autoOpen" - description={ - <i18n.Translate> - Enabling this option below will make using the wallet faster, - but requires more permissions from your browser. - </i18n.Translate> - } - enabled={autoOpenToggle.value!} - onToggle={autoOpenToggle.button.onClick!} - /> - </JustInDevMode> + <SubTitle> + <i18n.Translate>Navigator</i18n.Translate> + </SubTitle> + <Checkbox + label={i18n.str`Automatically inject Taler API in all pages`} + name="inject" + description={ + <i18n.Translate> + 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={autoOpenToggle.value!} + onToggle={autoOpenToggle.button.onClick!} + /> </section> </Fragment> ); |