From f1967ab0baf825cdfa767d36bb7cce78521e4e4b Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 30 Oct 2023 18:42:39 -0300 Subject: testing auto open feature --- .../demobank-ui/src/pages/OperationState/views.tsx | 56 +-- packages/demobank-ui/src/pages/QrCodeSection.tsx | 6 +- .../taler-wallet-webextension/manifest-v3.json | 22 +- .../src/hooks/useSettings.ts | 2 +- .../taler-wallet-webextension/src/platform/api.ts | 18 +- .../src/platform/chrome.ts | 473 +++++++++++---------- .../taler-wallet-webextension/src/platform/dev.ts | 7 +- .../src/platform/firefox.ts | 12 +- .../src/taler-wallet-interaction-loader.ts | 120 ++++-- .../src/taler-wallet-interaction-support.ts | 7 +- .../src/wallet/Settings.tsx | 32 +- packages/taler-wallet-webextension/src/wxApi.ts | 16 +- .../taler-wallet-webextension/src/wxBackend.ts | 114 ++--- 13 files changed, 483 insertions(+), 402 deletions(-) (limited to 'packages') diff --git a/packages/demobank-ui/src/pages/OperationState/views.tsx b/packages/demobank-ui/src/pages/OperationState/views.tsx index b7d7e5520..4001fd093 100644 --- a/packages/demobank-ui/src/pages/OperationState/views.tsx +++ b/packages/demobank-ui/src/pages/OperationState/views.tsx @@ -105,30 +105,30 @@ export function NeedConfirmationView({ error, onAbort: doAbort, onConfirm: doCon return } switch (hasError.case) { - case "previously-aborted": return notify({ - type: "error", - title: i18n.str`The withdrawal has been aborted previously and can't be confirmed`, - description: hasError.detail.hint as TranslatedString, - debug: hasError.detail, - }) - case "no-exchange-or-reserve-selected": return notify({ - type: "error", - title: i18n.str`The withdraw operation cannot be confirmed because no exchange and reserve public key selection happened before`, - description: hasError.detail.hint as TranslatedString, - debug: hasError.detail, - }) - case "invalid-id": return notify({ - type: "error", - title: i18n.str`The operation id is invalid.`, - description: hasError.detail.hint as TranslatedString, - debug: hasError.detail, - }); - case "not-found": return notify({ - type: "error", - title: i18n.str`The operation was not found.`, - description: hasError.detail.hint as TranslatedString, - debug: hasError.detail, - }); + case "previously-aborted": return notify({ + type: "error", + title: i18n.str`The withdrawal has been aborted previously and can't be confirmed`, + description: hasError.detail.hint as TranslatedString, + debug: hasError.detail, + }) + case "no-exchange-or-reserve-selected": return notify({ + type: "error", + title: i18n.str`The withdraw operation cannot be confirmed because no exchange and reserve public key selection happened before`, + description: hasError.detail.hint as TranslatedString, + debug: hasError.detail, + }) + case "invalid-id": return notify({ + type: "error", + title: i18n.str`The operation id is invalid.`, + description: hasError.detail.hint as TranslatedString, + debug: hasError.detail, + }); + case "not-found": return notify({ + type: "error", + title: i18n.str`The operation was not found.`, + description: hasError.detail.hint as TranslatedString, + debug: hasError.detail, + }); default: assertUnreachable(hasError) } }) @@ -408,6 +408,7 @@ export function ReadyView({ uri, onClose: doClose }: State.Ready): VNode<{}> { const { i18n } = useTranslationContext(); const [notification, notify, errorHandler] = useLocalNotification() + const talerWithdrawUri = stringifyWithdrawUri(uri); useEffect(() => { //Taler Wallet WebExtension is listening to headers response and tab updates. //In the SPA there is no header response with the Taler URI so @@ -415,8 +416,11 @@ export function ReadyView({ uri, onClose: doClose }: State.Ready): VNode<{}> { // WebExtension will be using // https://developer.chrome.com/docs/extensions/reference/tabs/#event-onUpdated document.title = `${document.title} ${uri.withdrawalOperationId}`; + const meta = document.createElement("meta") + meta.setAttribute("name", "taler-uri") + meta.setAttribute("content", talerWithdrawUri) + document.head.insertBefore(meta, document.head.children.length ? document.head.children[0] : null) }, []); - const talerWithdrawUri = stringifyWithdrawUri(uri); async function onClose() { errorHandler(async () => { @@ -447,7 +451,7 @@ export function ReadyView({ uri, onClose: doClose }: State.Ready): VNode<{}> { } return - +