diff options
author | Sebastian <sebasjm@gmail.com> | 2022-03-23 10:50:12 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-03-23 10:58:57 -0300 |
commit | 32f6409ac312f31821f791c3a376168289f0e4f4 (patch) | |
tree | c77c660bb85cf359faf74b5cddbe95eb0a915c5e /packages/taler-wallet-webextension/src/wallet | |
parent | c539d1803c1376cba0831be64866b6d2c1652403 (diff) | |
download | wallet-core-32f6409ac312f31821f791c3a376168289f0e4f4.tar.xz |
all the browser related code move into one place, making it easy for specific platform code or mocking for testing
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet')
-rw-r--r-- | packages/taler-wallet-webextension/src/wallet/AddNewActionView.tsx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/AddNewActionView.tsx b/packages/taler-wallet-webextension/src/wallet/AddNewActionView.tsx index 3516bfbf1..bebf036c9 100644 --- a/packages/taler-wallet-webextension/src/wallet/AddNewActionView.tsx +++ b/packages/taler-wallet-webextension/src/wallet/AddNewActionView.tsx @@ -1,9 +1,9 @@ import { classifyTalerUri, TalerUriType } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { useState } from "preact/hooks"; +import { platform } from "../platform/api"; import { Button, ButtonSuccess, InputWithLabel } from "../components/styled"; import { useTranslationContext } from "../context/translation"; -import { actionForTalerUri } from "../utils/index"; export interface Props { onCancel: () => void; @@ -14,6 +14,10 @@ export function AddNewActionView({ onCancel }: Props): VNode { const uriType = classifyTalerUri(url); const { i18n } = useTranslationContext(); + function redirectToWallet() { + platform.openWalletURIFromPopup(uriType, url); + } + return ( <Fragment> <section> @@ -37,12 +41,7 @@ export function AddNewActionView({ onCancel }: Props): VNode { <i18n.Translate>Cancel</i18n.Translate> </Button> {uriType !== TalerUriType.Unknown && ( - <ButtonSuccess - onClick={() => { - // eslint-disable-next-line no-undef - chrome.tabs.create({ url: actionForTalerUri(uriType, url) }); - }} - > + <ButtonSuccess onClick={redirectToWallet}> {(() => { switch (uriType) { case TalerUriType.TalerNotifyReserve: |