gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated (0d81c227 -> 9b85d139)


From: gnunet
Subject: [taler-wallet-core] branch master updated (0d81c227 -> 9b85d139)
Date: Tue, 26 Apr 2022 16:48:41 +0200

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a change to branch master
in repository wallet-core.

    from 0d81c227 fix WebEx Content-Type, after Sebastian suggestion
     new 1e6b2dd1 improve readme
     new 65e6a8ca useAsync new API
     new 41ab8557 remove old async hook
     new 4aa8adbd do not warn for every translation
     new 53c76456 custom protocol
     new 9b85d139 fix: shorcut for wallet #6592

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 README                                             | 62 +++++++++++++++-------
 contrib/custom-protocol/README                     | 33 ++++++++++++
 contrib/custom-protocol/taler-wallet-cli.desktop   | 12 +++++
 packages/taler-util/src/i18n.ts                    |  2 +-
 packages/taler-wallet-webextension/dev.mjs         |  8 +--
 .../taler-wallet-webextension/manifest-v2.json     |  9 +++-
 .../taler-wallet-webextension/manifest-v3.json     |  7 ++-
 packages/taler-wallet-webextension/package.json    |  1 +
 .../src/components/PendingTransactions.tsx         | 12 +++--
 packages/taler-wallet-webextension/src/cta/Pay.tsx | 11 ++--
 .../src/cta/Withdraw.test.ts                       |  5 +-
 .../taler-wallet-webextension/src/cta/Withdraw.tsx | 52 ++++++++----------
 .../src/hooks/useAsyncAsHook.ts                    | 44 ---------------
 .../src/platform/chrome.ts                         |  2 +-
 .../src/popup/BalancePage.tsx                      | 13 +++--
 packages/taler-wallet-webextension/src/stories.tsx | 15 ++++++
 .../src/wallet/DepositPage.tsx                     |  4 --
 .../src/wallet/DeveloperPage.tsx                   | 10 +++-
 .../src/wallet/History.tsx                         | 19 ++++---
 .../src/wallet/ManualWithdrawPage.tsx              | 11 ++--
 .../src/wallet/Settings.tsx                        |  6 +--
 .../src/wallet/Transaction.tsx                     | 33 +++++++-----
 .../src/wallet/Welcome.tsx                         | 28 +++++++++-
 23 files changed, 242 insertions(+), 157 deletions(-)
 create mode 100644 contrib/custom-protocol/README
 create mode 100755 contrib/custom-protocol/taler-wallet-cli.desktop

diff --git a/README b/README
index b48a5356..67c41d34 100644
--- a/README
+++ b/README
@@ -3,18 +3,16 @@
 This repository contains the implementation of a wallet for GNU Taler written
 in TypeScript.
 
-
 ## Dependencies
 
 The following dependencies are required to build the wallet:
 
-* python>=3.8
-* nodejs>=12
-* jq
-* npm
-* pnpm
-* zip
-
+- python>=3.8
+- nodejs>=12
+- jq
+- npm
+- pnpm
+- zip
 
 ## Installation
 
@@ -44,7 +42,7 @@ packages/taler-wallet-webextension/extension/
 ```
 
 We also provide a `Dockerfile` for a container that can build the
-WebExtension.  After you install docker, make sure the user is in group
+WebExtension. After you install docker, make sure the user is in group
 `docker` and (re-)start the docker daemon:
 
 ```shell
@@ -93,27 +91,51 @@ Then, you can proceed with these instructions:
 
 ### Reviewing WebExtension UI examples
 
-The WebExtension can be tested using Storybook. Using live server or building 
-static html files to deploy into nginx.
-
+The WebExtension can be tested using example stories.
 To run a live server use the 'dev-view' target
 
 ```shell
 make webextension-dev-view
 ```
 
-A server will start, usually at http://localhost:6006/.
-On the left it will have a navigation panel with examples organized in a tree 
view.
-
-Stories are defined with a *.stories.tsx file [1], you are free to create new 
or edit
+Stories are defined with a \*.stories.tsx file [1], you are free to create new 
or edit
 some and commit them in order to create a more complete set of examples.
 
-[1] look for them at packages/taler-wallet-webextension/src/**/*.stories.tsx
+[1] look for them at packages/taler-wallet-webextension/src/\*_/_.stories.tsx
+
+### WebExtension UI Components
+
+Every group of component have a directory and a README.
+Testing component is based in two main category:
+
+- UI testing
+- State transition testing
+
+For UI testing, every story example will be taken as a unit test.
+For State testing, every stateful component should have an `useStateComponent` 
function that will be tested in a \*.test.ts file.
+
+### Testing WebExtension
+
+After building the WebExtension look for the folder `extension`
+Inside you will find v2 and v3 version referring to the manifest version being 
used.
+
+Firefox users:
+
+- Go to about:addons
+- Then `debug addon` (or about:debugging#/runtime/this-firefox)
+- Then `Load temporary addon...`
+- Select the `taler-wallet-webextension-*.zip`
+
+Chrome users:
+
+- Settings -> More tools -> Extensions (or go to chrome://extensions/)
+- `Load unpacked` button in the upper left
+- Selected the `unpacked` folder in v2 or v3
 
 # Integration Tests
 
-This repository comes with integration tests for GNU Taler.  To run them,
-install the wallet first.  Then use the test runner from the
+This repository comes with integration tests for GNU Taler. To run them,
+install the wallet first. Then use the test runner from the
 taler-integrationtests package:
 
 ```shell
@@ -121,7 +143,7 @@ cd packages/taler-integrationtests/
 ./testrunner '*'
 ```
 
-The test runner accepts a bash glob pattern as parameter.  Individual tests can
+The test runner accepts a bash glob pattern as parameter. Individual tests can
 be run by specifying their name.
 
 To check coverage, use nyc from the root of the repository and make sure that 
the taler-wallet-cli
diff --git a/contrib/custom-protocol/README b/contrib/custom-protocol/README
new file mode 100644
index 00000000..0ebbeed4
--- /dev/null
+++ b/contrib/custom-protocol/README
@@ -0,0 +1,33 @@
+Custom protocol handler for taler:// URI
+
+In order to run the wallet when trying to open an html anchor to a ref 
starting with "taler://" you have to setup a custom protocol handler in your 
local setup.
+
+
+
+First add this content into file `.config/mimeapps.list` under section 
`[Default Applications]`
+
+```
+x-scheme-handler/taler=taler-wallet-cli.desktop
+x-scheme-handler/taler+http=taler-wallet-cli.desktop
+```
+
+then create a file named `taler-wallet-cli.desktop` in location 
`$HOME/.local/share/applications` with content
+
+```
+[Desktop Entry]
+Name=GNU Taler Wallet CLI URL Handler
+GenericName=Wallet
+Comment=Handle URL Scheme taler://
+Exec=bash -c "taler-wallet-cli handle-uri %u; read"
+Terminal=true
+Type=Application
+MimeType=x-scheme-handler/taler;x-scheme-handler/taler+http
+Name[en_US]=GNU Taler Wallet URL Handler
+```
+
+Done, you can test it using the next command:
+
+```
+$ xdg-open 
taler://withdraw/bank.demo.taler.net/api/793ee3e4-2915-47e8-9abe-bcc36c8e65cf
+```
+
diff --git a/contrib/custom-protocol/taler-wallet-cli.desktop 
b/contrib/custom-protocol/taler-wallet-cli.desktop
new file mode 100755
index 00000000..35c8e515
--- /dev/null
+++ b/contrib/custom-protocol/taler-wallet-cli.desktop
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Name=GNU Taler Wallet CLI URL Handler
+GenericName=Wallet
+Comment=Handle URL Scheme taler://
+Exec=bash -c "taler-wallet-cli handle-uri %u; read"
+Terminal=true
+Type=Application
+MimeType=x-scheme-handler/taler;x-scheme-handler/taler+http
+Icon=sublime-text-2
+Categories=TextEditor;Development;Utility;
+Name[en_US]=GNU Taler Wallet URL Handler
+
diff --git a/packages/taler-util/src/i18n.ts b/packages/taler-util/src/i18n.ts
index c8895521..7b3ec55d 100644
--- a/packages/taler-util/src/i18n.ts
+++ b/packages/taler-util/src/i18n.ts
@@ -15,7 +15,7 @@ export function setupI18n(lang: string, strings: { [s: 
string]: any }): any {
 
   if (!strings[lang]) {
     strings[lang] = {}
-    logger.warn(`language ${lang} not found, defaulting to source strings`);
+    // logger.warn(`language ${lang} not found, defaulting to source strings`);
   }
   jed = new jedLib.Jed(strings[lang]);
 }
diff --git a/packages/taler-wallet-webextension/dev.mjs 
b/packages/taler-wallet-webextension/dev.mjs
index 6c88f8a2..842424a9 100755
--- a/packages/taler-wallet-webextension/dev.mjs
+++ b/packages/taler-wallet-webextension/dev.mjs
@@ -24,9 +24,6 @@ function broadcast(file, event) {
     });
   }, devServerBroadcastDelay);
 }
-wss.addListener("connection", () => {
-  console.log("new client")
-})
 
 const watcher = chokidar
   .watch(toWatch, {
@@ -63,5 +60,8 @@ const server = await esbuild
     process.exit(1)
   });
 
-console.log("ready!", server.port);
+console.log(`Dev server is ready at http://localhost:${server.port}/.
+http://localhost:${server.port}/stories.html for the components stories.
+The server is running a using websocket at ${devServerPort} to notify code 
change and live reload.
+`);
 
diff --git a/packages/taler-wallet-webextension/manifest-v2.json 
b/packages/taler-wallet-webextension/manifest-v2.json
index 8f705d19..f98f70e6 100644
--- a/packages/taler-wallet-webextension/manifest-v2.json
+++ b/packages/taler-wallet-webextension/manifest-v2.json
@@ -7,7 +7,7 @@
   "version_name": "0.9.0-dev.9",
   "minimum_chrome_version": "51",
   "minimum_opera_version": "36",
-  "applications": {
+  "browser_specific_settings": {
     "gecko": {
       "id": "wallet@taler.net",
       "strict_min_version": "57.0"
@@ -17,6 +17,11 @@
     "32": "static/img/icon.png",
     "128": "static/img/logo.png"
   },
+  "commands": {
+    "_execute_browser_action": {
+      "suggested_key": "Alt+W"
+    }
+  },
   "permissions": [
     "unlimitedStorage",
     "activeTab"
@@ -30,7 +35,7 @@
     "default_icon": {
       "32": "static/img/icon.png"
     },
-    "default_title": "Taler",
+    "default_title": "GNU Taler Wallet",
     "default_popup": "static/popup.html"
   },
   "background": {
diff --git a/packages/taler-wallet-webextension/manifest-v3.json 
b/packages/taler-wallet-webextension/manifest-v3.json
index 576b263f..a8f043b3 100644
--- a/packages/taler-wallet-webextension/manifest-v3.json
+++ b/packages/taler-wallet-webextension/manifest-v3.json
@@ -16,6 +16,11 @@
     "scripting",
     "alarms"
   ],
+  "commands": {
+    "_execute_action": {
+      "suggested_key": "Alt+W"
+    }
+  },
   "optional_permissions": [
     "webRequest"
   ],
@@ -27,7 +32,7 @@
     "default_icon": {
       "32": "static/img/icon.png"
     },
-    "default_title": "Taler",
+    "default_title": "GNU Taler Wallet",
     "default_popup": "static/popup.html"
   },
   "background": {
diff --git a/packages/taler-wallet-webextension/package.json 
b/packages/taler-wallet-webextension/package.json
index bf586834..07495a27 100644
--- a/packages/taler-wallet-webextension/package.json
+++ b/packages/taler-wallet-webextension/package.json
@@ -12,6 +12,7 @@
     "test": "mocha --enable-source-maps 'dist/**/*.test.js'",
     "test:coverage": "nyc pnpm test",
     "compile": "tsc && ./build-fast-with-linaria.mjs",
+    "dev": "./dev.mjs",
     "compile:test": "rollup -c rollup.config.test.js -m",
     "prepare": "rollup -c -m",
     "pretty": "prettier --write src",
diff --git 
a/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx 
b/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx
index f37a212f..2fc2d2d3 100644
--- a/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx
+++ b/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx
@@ -5,6 +5,7 @@ import {
   Transaction,
 } from "@gnu-taler/taler-util";
 import { Fragment, h, JSX, VNode } from "preact";
+import { useEffect } from "preact/hooks";
 import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js";
 import { Avatar } from "../mui/Avatar.js";
 import { Typography } from "../mui/Typography.js";
@@ -17,9 +18,14 @@ interface Props extends JSX.HTMLAttributes {
 }
 
 export function PendingTransactions({ goToTransaction }: Props): VNode {
-  const state = useAsyncAsHook(wxApi.getTransactions, [
-    NotificationType.WithdrawGroupFinished,
-  ]);
+  const state = useAsyncAsHook(wxApi.getTransactions);
+
+  useEffect(() => {
+    wxApi.onUpdateNotification([NotificationType.WithdrawGroupFinished], () => 
{
+      state?.retry();
+    });
+  });
+
   const transactions =
     !state || state.hasError
       ? []
diff --git a/packages/taler-wallet-webextension/src/cta/Pay.tsx 
b/packages/taler-wallet-webextension/src/cta/Pay.tsx
index 832b4879..3e9e34fe 100644
--- a/packages/taler-wallet-webextension/src/cta/Pay.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Pay.tsx
@@ -29,7 +29,6 @@ import {
   AmountJson,
   Amounts,
   ConfirmPayResult,
-  ConfirmPayResultDone,
   ConfirmPayResultType,
   ContractTerms,
   NotificationType,
@@ -60,11 +59,7 @@ import {
   WarningBox,
 } from "../components/styled/index.js";
 import { useTranslationContext } from "../context/translation.js";
-import {
-  HookError,
-  useAsyncAsHook,
-  useAsyncAsHook2,
-} from "../hooks/useAsyncAsHook.js";
+import { HookError, useAsyncAsHook } from "../hooks/useAsyncAsHook.js";
 import { ButtonHandler } from "../mui/handlers.js";
 import * as wxApi from "../wxApi.js";
 
@@ -112,7 +107,7 @@ export function useComponentState(
   );
   const [payErrMsg, setPayErrMsg] = useState<TalerError | 
undefined>(undefined);
 
-  const hook = useAsyncAsHook2(async () => {
+  const hook = useAsyncAsHook(async () => {
     if (!talerPayUri) throw Error("ERROR_NO-URI-FOR-PAYMENT");
     const payStatus = await api.preparePay(talerPayUri);
     const balance = await api.getBalance();
@@ -181,7 +176,7 @@ export function useComponentState(
         if (typeof window !== "undefined") {
           document.location.href = fu;
         } else {
-          console.log(`should redirect to ${fu}`);
+          console.log(`should d to ${fu}`);
         }
       }
       setPayResult(res);
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw.test.ts 
b/packages/taler-wallet-webextension/src/cta/Withdraw.test.ts
index 0301e321..7f05870c 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw.test.ts
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw.test.ts
@@ -58,7 +58,10 @@ describe("Withdraw CTA states", () => {
       const { status, hook } = getLastResultOrThrow()
 
       expect(status).equals('loading-uri')
-      expect(hook).deep.equals({ "hasError": true, "operational": false, 
"message": "ERROR_NO-URI-FOR-WITHDRAWAL" });
+      if (!hook) expect.fail();
+      if (!hook.hasError) expect.fail();
+      if (hook.operational) expect.fail();
+      expect(hook.message).eq("ERROR_NO-URI-FOR-WITHDRAWAL");
     }
 
     await assertNoPendingUpdate()
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx 
b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
index 21f98ec9..3346512f 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
@@ -147,44 +147,36 @@ export function useComponentState(
   /**
    * For the exchange selected, bring the status of the terms of service
    */
-  const terms = useAsyncAsHook(
-    async () => {
-      if (!thisExchange) return false;
+  const terms = useAsyncAsHook(async () => {
+    if (!thisExchange) return false;
 
-      const exchangeTos = await api.getExchangeTos(thisExchange, ["text/xml"]);
+    const exchangeTos = await api.getExchangeTos(thisExchange, ["text/xml"]);
 
-      const state = buildTermsOfServiceState(exchangeTos);
+    const state = buildTermsOfServiceState(exchangeTos);
 
-      return { state };
-    },
-    [],
-    [thisExchange],
-  );
+    return { state };
+  }, [thisExchange]);
 
   /**
    * With the exchange and amount, ask the wallet the information
    * about the withdrawal
    */
-  const info = useAsyncAsHook(
-    async () => {
-      if (!thisExchange || !amount) return false;
-
-      const info = await api.getExchangeWithdrawalInfo({
-        exchangeBaseUrl: thisExchange,
-        amount,
-        tosAcceptedFormat: ["text/xml"],
-      });
-
-      const withdrawalFee = Amounts.sub(
-        Amounts.parseOrThrow(info.withdrawalAmountRaw),
-        Amounts.parseOrThrow(info.withdrawalAmountEffective),
-      ).amount;
-
-      return { info, withdrawalFee };
-    },
-    [],
-    [thisExchange, amount],
-  );
+  const info = useAsyncAsHook(async () => {
+    if (!thisExchange || !amount) return false;
+
+    const info = await api.getExchangeWithdrawalInfo({
+      exchangeBaseUrl: thisExchange,
+      amount,
+      tosAcceptedFormat: ["text/xml"],
+    });
+
+    const withdrawalFee = Amounts.sub(
+      Amounts.parseOrThrow(info.withdrawalAmountRaw),
+      Amounts.parseOrThrow(info.withdrawalAmountEffective),
+    ).amount;
+
+    return { info, withdrawalFee };
+  }, [thisExchange, amount]);
 
   const [reviewing, setReviewing] = useState<boolean>(false);
   const [reviewed, setReviewed] = useState<boolean>(false);
diff --git a/packages/taler-wallet-webextension/src/hooks/useAsyncAsHook.ts 
b/packages/taler-wallet-webextension/src/hooks/useAsyncAsHook.ts
index d03455ff..04a6dbb1 100644
--- a/packages/taler-wallet-webextension/src/hooks/useAsyncAsHook.ts
+++ b/packages/taler-wallet-webextension/src/hooks/useAsyncAsHook.ts
@@ -47,50 +47,6 @@ export type HookResponse<T> = HookOk<T> | HookError | 
undefined;
 export type HookResponseWithRetry<T> = ((HookOk<T> | HookError) & WithRetry) | 
undefined;
 
 export function useAsyncAsHook<T>(
-  fn: () => Promise<T | false>,
-  updateOnNotification?: Array<NotificationType>,
-  deps?: any[],
-): HookResponse<T> {
-
-  const args = useMemo(() => ({
-    fn, updateOnNotification
-    // eslint-disable-next-line react-hooks/exhaustive-deps
-  }), deps || [])
-  const [result, setHookResponse] = useState<HookResponse<T>>(undefined);
-
-  useEffect(() => {
-    async function doAsync(): Promise<void> {
-      try {
-        const response = await args.fn();
-        if (response === false) return;
-        setHookResponse({ hasError: false, response });
-      } catch (e) {
-        if (e instanceof TalerError) {
-          setHookResponse({
-            hasError: true,
-            operational: true,
-            details: e.errorDetail,
-          });
-        } else if (e instanceof Error) {
-          setHookResponse({
-            hasError: true,
-            operational: false,
-            message: e.message,
-          });
-        }
-      }
-    }
-    doAsync();
-    if (args.updateOnNotification && args.updateOnNotification.length > 0) {
-      return wxApi.onUpdateNotification(args.updateOnNotification, () => {
-        doAsync();
-      });
-    }
-  }, [args]);
-  return result;
-}
-
-export function useAsyncAsHook2<T>(
   fn: () => Promise<T | false>,
   deps?: any[],
 ): HookResponseWithRetry<T> {
diff --git a/packages/taler-wallet-webextension/src/platform/chrome.ts 
b/packages/taler-wallet-webextension/src/platform/chrome.ts
index 67779f08..d1f4585d 100644
--- a/packages/taler-wallet-webextension/src/platform/chrome.ts
+++ b/packages/taler-wallet-webextension/src/platform/chrome.ts
@@ -304,7 +304,7 @@ function registerOnInstalled(callback: () => void): void {
   // This needs to be outside of main, as Firefox won't fire the event if
   // the listener isn't created synchronously on loading the backend.
   chrome.runtime.onInstalled.addListener((details) => {
-    console.log("onInstalled with reason", details.reason);
+    console.log(`onInstalled with reason: "${details.reason}"`);
     if (details.reason === chrome.runtime.OnInstalledReason.INSTALL) {
       callback()
     }
diff --git a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx 
b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
index 37000bd3..966782bb 100644
--- a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
+++ b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
@@ -16,7 +16,7 @@
 
 import { Amounts, Balance, NotificationType } from "@gnu-taler/taler-util";
 import { Fragment, h, VNode } from "preact";
-import { useState } from "preact/hooks";
+import { useEffect, useState } from "preact/hooks";
 import { BalanceTable } from "../components/BalanceTable.js";
 import { JustInDevMode } from "../components/JustInDevMode.js";
 import { Loading } from "../components/Loading.js";
@@ -41,9 +41,14 @@ export function BalancePage({
 }: Props): VNode {
   const { i18n } = useTranslationContext();
   const [addingAction, setAddingAction] = useState(false);
-  const state = useAsyncAsHook(wxApi.getBalance, [
-    NotificationType.WithdrawGroupFinished,
-  ]);
+  const state = useAsyncAsHook(wxApi.getBalance);
+
+  useEffect(() => {
+    wxApi.onUpdateNotification([NotificationType.WithdrawGroupFinished], () => 
{
+      state?.retry();
+    });
+  });
+
   const balances = !state || state.hasError ? [] : state.response.balances;
 
   if (!state) {
diff --git a/packages/taler-wallet-webextension/src/stories.tsx 
b/packages/taler-wallet-webextension/src/stories.tsx
index 1ad91a13..9c0f69ec 100644
--- a/packages/taler-wallet-webextension/src/stories.tsx
+++ b/packages/taler-wallet-webextension/src/stories.tsx
@@ -38,6 +38,9 @@ import * as wallet from "./wallet/index.stories.js";
 import * as cta from "./cta/index.stories.js";
 import * as components from "./components/index.stories.js";
 import { strings } from "./i18n/strings.js";
+import { setupPlatform } from "./platform/api.js";
+import chromeAPI from "./platform/chrome.js";
+import firefoxAPI from "./platform/firefox.js";
 
 const url = new URL(window.location.href);
 const lang = url.searchParams.get("lang") || "en";
@@ -441,3 +444,15 @@ function setupLiveReload(port: number, onReload: () => 
void): void {
     console.error(error);
   };
 }
+
+const isFirefox = typeof (window as any)["InstallTrigger"] !== "undefined";
+
+//FIXME: create different entry point for any platform instead of
+//switching in runtime
+if (isFirefox) {
+  console.log("Wallet setup for Firefox API");
+  setupPlatform(firefoxAPI);
+} else {
+  console.log("Wallet setup for Chrome API");
+  setupPlatform(chromeAPI);
+}
diff --git a/packages/taler-wallet-webextension/src/wallet/DepositPage.tsx 
b/packages/taler-wallet-webextension/src/wallet/DepositPage.tsx
index 98328ae4..9b800817 100644
--- a/packages/taler-wallet-webextension/src/wallet/DepositPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/DepositPage.tsx
@@ -117,10 +117,6 @@ export function useComponentState(
 
   const [fee, setFee] = useState<DepositGroupFees | undefined>(undefined);
 
-  // const hookResponse = !hook || hook.hasError ? undefined : hook.response;
-
-  // useEffect(() => {}, [hookResponse]);
-
   if (!hook || hook.hasError) {
     return {
       status: "loading",
diff --git a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx 
b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
index a54c1675..e371775f 100644
--- a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
@@ -23,7 +23,7 @@ import {
 import { PendingTaskInfo } from "@gnu-taler/taler-wallet-core";
 import { format } from "date-fns";
 import { Fragment, h, VNode } from "preact";
-import { useRef, useState } from "preact/hooks";
+import { useEffect, useRef, useState } from "preact/hooks";
 import { Diagnostics } from "../components/Diagnostics.js";
 import { NotifyUpdateFadeOut } from "../components/styled/index.js";
 import { Time } from "../components/Time.js";
@@ -47,7 +47,13 @@ export function DeveloperPage(): VNode {
       coins: c.coins,
       exchanges: ex.exchanges,
     };
-  }, listenAllEvents);
+  });
+
+  useEffect(() => {
+    wxApi.onUpdateNotification(listenAllEvents, () => {
+      response?.retry();
+    });
+  });
 
   const nonResponse = { operations: [], coins: [], exchanges: [] };
   const { operations, coins, exchanges } =
diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx 
b/packages/taler-wallet-webextension/src/wallet/History.tsx
index 51ffcb31..4a435d0c 100644
--- a/packages/taler-wallet-webextension/src/wallet/History.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/History.tsx
@@ -21,7 +21,7 @@ import {
   Transaction,
 } from "@gnu-taler/taler-util";
 import { Fragment, h, VNode } from "preact";
-import { useState } from "preact/hooks";
+import { useEffect, useState } from "preact/hooks";
 import { Loading } from "../components/Loading.js";
 import { LoadingError } from "../components/LoadingError.js";
 import {
@@ -50,13 +50,16 @@ export function HistoryPage({
   goToWalletDeposit,
 }: Props): VNode {
   const { i18n } = useTranslationContext();
-  const state = useAsyncAsHook(
-    async () => ({
-      b: await wxApi.getBalance(),
-      tx: await wxApi.getTransactions(),
-    }),
-    [NotificationType.WithdrawGroupFinished],
-  );
+  const state = useAsyncAsHook(async () => ({
+    b: await wxApi.getBalance(),
+    tx: await wxApi.getTransactions(),
+  }));
+
+  useEffect(() => {
+    wxApi.onUpdateNotification([NotificationType.WithdrawGroupFinished], () => 
{
+      state?.retry();
+    });
+  });
 
   if (!state) {
     return <Loading />;
diff --git 
a/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx 
b/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx
index 8b8d375d..daa46086 100644
--- a/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx
@@ -23,7 +23,7 @@ import {
   PaytoUri,
 } from "@gnu-taler/taler-util";
 import { h, VNode } from "preact";
-import { useState } from "preact/hooks";
+import { useEffect, useState } from "preact/hooks";
 import { Loading } from "../components/Loading.js";
 import { LoadingError } from "../components/LoadingError.js";
 import { useTranslationContext } from "../context/translation.js";
@@ -50,9 +50,12 @@ export function ManualWithdrawPage({ currency, onCancel }: 
Props): VNode {
   >(undefined);
   const [error, setError] = useState<string | undefined>(undefined);
 
-  const state = useAsyncAsHook(wxApi.listExchanges, [
-    NotificationType.ExchangeAdded,
-  ]);
+  const state = useAsyncAsHook(wxApi.listExchanges);
+  useEffect(() => {
+    wxApi.onUpdateNotification([NotificationType.ExchangeAdded], () => {
+      state?.retry();
+    });
+  });
   const { i18n } = useTranslationContext();
 
   async function doCreate(
diff --git a/packages/taler-wallet-webextension/src/wallet/Settings.tsx 
b/packages/taler-wallet-webextension/src/wallet/Settings.tsx
index 9a41bcc2..5a9c776f 100644
--- a/packages/taler-wallet-webextension/src/wallet/Settings.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Settings.tsx
@@ -40,13 +40,11 @@ export function SettingsPage(): VNode {
   const [permissionsEnabled, togglePermissions] = useExtendedPermissions();
   const { devMode, toggleDevMode } = useDevContext();
   const { name, update } = useBackupDeviceName();
-  // const [lang, changeLang] = useLang();
+
   const exchangesHook = useAsyncAsHook(wxApi.listExchanges);
 
   return (
     <SettingsView
-      // lang={lang}
-      // changeLang={changeLang}
       knownExchanges={
         !exchangesHook || exchangesHook.hasError
           ? []
@@ -63,8 +61,6 @@ export function SettingsPage(): VNode {
 }
 
 export interface ViewProps {
-  // lang: string;
-  // changeLang: (s: string) => void;
   deviceName: string;
   setDeviceName: (s: string) => Promise<void>;
   permissionsEnabled: boolean;
diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx 
b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
index 4a6c218c..584fe427 100644
--- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
@@ -16,7 +16,6 @@
 
 import {
   AbsoluteTime,
-  AmountLike,
   Amounts,
   NotificationType,
   parsePaytoUri,
@@ -26,7 +25,7 @@ import {
 } from "@gnu-taler/taler-util";
 import { differenceInSeconds } from "date-fns";
 import { ComponentChildren, Fragment, h, VNode } from "preact";
-import { useState } from "preact/hooks";
+import { useEffect, useState } from "preact/hooks";
 import emptyImg from "../../static/img/empty.png";
 import { Amount } from "../components/Amount.js";
 import { BankDetailsByPaytoType } from 
"../components/BankDetailsByPaytoType.js";
@@ -56,21 +55,27 @@ interface Props {
   tid: string;
   goToWalletHistory: (currency?: string) => void;
 }
+
+async function getTransaction(tid: string): Promise<Transaction> {
+  const res = await wxApi.getTransactions();
+  const ts = res.transactions.filter((t) => t.transactionId === tid);
+  if (ts.length > 1) throw Error("more than one transaction with this id");
+  if (ts.length === 1) {
+    return ts[0];
+  }
+  throw Error("no transaction found");
+}
+
 export function TransactionPage({ tid, goToWalletHistory }: Props): VNode {
   const { i18n } = useTranslationContext();
-  async function getTransaction(): Promise<Transaction> {
-    const res = await wxApi.getTransactions();
-    const ts = res.transactions.filter((t) => t.transactionId === tid);
-    if (ts.length > 1) throw Error("more than one transaction with this id");
-    if (ts.length === 1) {
-      return ts[0];
-    }
-    throw Error("no transaction found");
-  }
 
-  const state = useAsyncAsHook(getTransaction, [
-    NotificationType.WithdrawGroupFinished,
-  ]);
+  const state = useAsyncAsHook(() => getTransaction(tid));
+
+  useEffect(() => {
+    wxApi.onUpdateNotification([NotificationType.WithdrawGroupFinished], () => 
{
+      state?.retry();
+    });
+  });
 
   if (!state) {
     return <Loading />;
diff --git a/packages/taler-wallet-webextension/src/wallet/Welcome.tsx 
b/packages/taler-wallet-webextension/src/wallet/Welcome.tsx
index 5aad3b78..58023a20 100644
--- a/packages/taler-wallet-webextension/src/wallet/Welcome.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Welcome.tsx
@@ -27,6 +27,7 @@ import { SubTitle, Title } from 
"../components/styled/index.js";
 import { useTranslationContext } from "../context/translation.js";
 import { useDiagnostics } from "../hooks/useDiagnostics.js";
 import { useExtendedPermissions } from "../hooks/useExtendedPermissions.js";
+import { platform } from "../platform/api.js";
 
 export function WelcomePage(): VNode {
   const [permissionsEnabled, togglePermissions] = useExtendedPermissions();
@@ -61,8 +62,33 @@ export function View({
       </Title>
       <div>
         <p>
-          <i18n.Translate>Thank you for installing the wallet.</i18n.Translate>
+          <i18n.Translate>
+            You can open the GNU Taler Wallet using the combination{" "}
+            <pre style="font-weight: bold; display: 
inline;">&lt;ALT+W&gt;</pre>
+            .
+          </i18n.Translate>
         </p>
+        {!platform.isFirefox() && (
+          <Fragment>
+            <p>
+              <i18n.Translate>
+                Also pinning the GNU Taler Wallet to your Chrome browser allows
+                you to quick access without keyboard:
+              </i18n.Translate>
+            </p>
+            <ol style={{ paddingLeft: 40 }}>
+              <li>
+                <i18n.Translate>Click the puzzle icon</i18n.Translate>
+              </li>
+              <li>
+                <i18n.Translate>Search for GNU Taler Wallet</i18n.Translate>
+              </li>
+              <li>
+                <i18n.Translate>Click the pin icon</i18n.Translate>
+              </li>
+            </ol>
+          </Fragment>
+        )}
         <SubTitle>
           <i18n.Translate>Permissions</i18n.Translate>
         </SubTitle>

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]