From 32f6409ac312f31821f791c3a376168289f0e4f4 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 23 Mar 2022 10:50:12 -0300 Subject: all the browser related code move into one place, making it easy for specific platform code or mocking for testing --- .../src/wallet/AddNewActionView.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'packages/taler-wallet-webextension/src/wallet/AddNewActionView.tsx') 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 (
@@ -37,12 +41,7 @@ export function AddNewActionView({ onCancel }: Props): VNode { Cancel {uriType !== TalerUriType.Unknown && ( - { - // eslint-disable-next-line no-undef - chrome.tabs.create({ url: actionForTalerUri(uriType, url) }); - }} - > + {(() => { switch (uriType) { case TalerUriType.TalerNotifyReserve: -- cgit v1.2.3