gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated (6d8125c4e -> c899298d5)


From: gnunet
Subject: [taler-wallet-core] branch master updated (6d8125c4e -> c899298d5)
Date: Mon, 12 Aug 2024 15:57:22 +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 6d8125c4e bump version to 0.12.11
     new be43e472f no select amount in withdrawal since there is an amount 
input now
     new 51f1c4e82 pkg mngr
     new c899298d5 fixing mem leak problem

The 3 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:
 package.json                                       |   3 +-
 .../src/NavigationBar.tsx                          |   6 +-
 .../src/cta/Withdraw/index.ts                      |  26 ++---
 .../src/cta/Withdraw/state.ts                      | 122 ++++++++++-----------
 .../src/cta/Withdraw/views.tsx                     |  41 -------
 .../src/taler-wallet-interaction-loader.ts         |   9 +-
 .../src/taler-wallet-interaction-support.ts        |   6 +-
 .../src/wallet/Application.tsx                     |  30 +++--
 .../taler-wallet-webextension/src/wxBackend.ts     |   2 +
 9 files changed, 115 insertions(+), 130 deletions(-)

diff --git a/package.json b/package.json
index f53cf87a5..0da09cb59 100644
--- a/package.json
+++ b/package.json
@@ -16,5 +16,6 @@
     "prettier": "^3.1.1",
     "typedoc": "^0.25.4",
     "typescript": "^5.3.3"
-  }
+  },
+  "packageManager": "pnpm@9.7.0"
 }
diff --git a/packages/taler-wallet-webextension/src/NavigationBar.tsx 
b/packages/taler-wallet-webextension/src/NavigationBar.tsx
index 7d469ed7e..8dfa87d9c 100644
--- a/packages/taler-wallet-webextension/src/NavigationBar.tsx
+++ b/packages/taler-wallet-webextension/src/NavigationBar.tsx
@@ -112,7 +112,7 @@ export const Pages = {
   balanceTransaction: pageDefinition<{ tid: string }>(
     "/balance/transaction/:tid",
   ),
-  bankManange: pageDefinition<{ scope: CrockEncodedString}>(
+  bankManange: pageDefinition<{ scope: CrockEncodedString }>(
     "/bank/manage/:scope",
   ),
   balanceDeposit: pageDefinition<{
@@ -148,13 +148,15 @@ export const Pages = {
   ),
 
   defaultCta: pageDefinition<{ uri: CrockEncodedString }>("/taler-uri/:uri"),
+  // FIXME: mem leak problems
+  defaultCtaSimple: pageDefinition<{ uri: CrockEncodedString 
}>("/taler-uri-simple/:uri"),
   cta: pageDefinition<{ action: CrockEncodedString }>("/cta/:action"),
   ctaPay: "/cta/pay",
   ctaPayTemplate: "/cta/pay/template",
   ctaRecovery: "/cta/recovery",
   ctaRefund: "/cta/refund",
   ctaWithdraw: "/cta/withdraw",
-  ctaDeposit:  pageDefinition<{
+  ctaDeposit: pageDefinition<{
     scope: CrockEncodedString;
     account: CrockEncodedString,
   }>("/cta/deposit/:scope/:account"),
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/index.ts 
b/packages/taler-wallet-webextension/src/cta/Withdraw/index.ts
index 418fef505..91bde9369 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw/index.ts
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw/index.ts
@@ -16,9 +16,9 @@
 
 import {
   AmountJson,
-  AmountString,
   CurrencySpecification,
   ExchangeListItem,
+  ScopeInfo
 } from "@gnu-taler/taler-util";
 import { Loading } from "../../components/Loading.js";
 import { State as SelectExchangeState } from 
"../../hooks/useSelectedExchange.js";
@@ -37,7 +37,7 @@ import { ErrorAlertView } from 
"../../components/CurrentAlerts.js";
 import { ErrorAlert } from "../../context/alert.js";
 import { ExchangeSelectionPage } from 
"../../wallet/ExchangeSelection/index.js";
 import { NoExchangesView } from "../../wallet/ExchangeSelection/views.js";
-import { FinalStateOperation, SelectAmountView, SuccessView } from 
"./views.js";
+import { FinalStateOperation, SuccessView } from "./views.js";
 
 export interface PropsFromURI {
   talerWithdrawUri: string | undefined;
@@ -47,10 +47,10 @@ export interface PropsFromURI {
 
 export interface PropsFromParams {
   talerExchangeWithdrawUri: string | undefined;
+  scope: ScopeInfo;
   amount: string | undefined;
   cancel: () => Promise<void>;
   onSuccess: (txid: string) => Promise<void>;
-  onAmountChanged: (amount: AmountString) => Promise<void>;
 }
 
 export type State =
@@ -58,7 +58,7 @@ export type State =
   | State.LoadingUriError
   | SelectExchangeState.NoExchangeFound
   | SelectExchangeState.Selecting
-  | State.SelectAmount
+  // | State.SelectAmount
   | State.AlreadyCompleted
   | State.Success;
 
@@ -72,14 +72,14 @@ export namespace State {
     error: ErrorAlert;
   }
 
-  export interface SelectAmount {
-    status: "select-amount";
-    error: undefined;
-    exchangeBaseUrl: string;
-    confirm: ButtonHandler;
-    amount: AmountFieldHandler;
-    currency: string;
-  }
+  // export interface SelectAmount {
+  //   status: "select-amount";
+  //   error: undefined;
+  //   exchangeBaseUrl: string;
+  //   confirm: ButtonHandler;
+  //   amount: AmountFieldHandler;
+  //   currency: string;
+  // }
   export interface AlreadyCompleted {
     status: "already-completed";
     operationState: "confirmed" | "aborted" | "selected";
@@ -126,7 +126,7 @@ export namespace State {
 const viewMapping: StateViewMap<State> = {
   loading: Loading,
   error: ErrorAlertView,
-  "select-amount": SelectAmountView,
+  // "select-amount": SelectAmountView,
   "no-exchange-found": NoExchangesView,
   "selecting-exchange": ExchangeSelectionPage,
   success: SuccessView,
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts 
b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts
index b1ee2f1be..8a862d200 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts
@@ -38,8 +38,8 @@ import { PropsFromParams, PropsFromURI, State } from 
"./index.js";
 export function useComponentStateFromParams({
   talerExchangeWithdrawUri: maybeTalerUri,
   amount,
+  scope,
   cancel,
-  onAmountChanged,
   onSuccess,
 }: PropsFromParams): RecursiveState<State> {
   const api = useBackendContext();
@@ -97,66 +97,66 @@ export function useComponentStateFromParams({
 
   const maybeAmount = uriInfoHook.response.amount ?? paramsAmount;
 
-  if (!maybeAmount) {
-    const exchangeBaseUrl =
-      uriInfoHook.response.exchange?.exchangeBaseUrl ??
-      (exchangeList.length > 0 ? exchangeList[0].exchangeBaseUrl : undefined);
-    const currency =
-      uriInfoHook.response.exchange?.currency ??
-      (exchangeList.length > 0 ? exchangeList[0].currency : undefined);
-
-    if (!exchangeBaseUrl) {
-      return {
-        status: "error",
-        error: {
-          message: i18n.str`Can't withdraw from exchange`,
-          description: i18n.str`Missing base URL`,
-          cause: undefined,
-          context: {},
-          type: "error",
-        },
-      };
-    }
-    if (!currency) {
-      return {
-        status: "error",
-        error: {
-          message: i18n.str`Can't withdraw from exchange`,
-          description: i18n.str`Missing unknown currency`,
-          cause: undefined,
-          context: {},
-          type: "error",
-        },
-      };
-    }
-    return () => {
-      const { pushAlertOnError } = useAlertContext();
-      const [amount, setAmount] = useState<AmountJson>(
-        Amounts.zeroOfCurrency(currency),
-      );
-      const isValid = Amounts.isNonZero(amount);
-      return {
-        status: "select-amount",
-        currency,
-        exchangeBaseUrl,
-        error: undefined,
-        confirm: {
-          onClick: isValid
-            ? pushAlertOnError(async () => {
-                onAmountChanged(Amounts.stringify(amount));
-              })
-            : undefined,
-        },
-        amount: {
-          value: amount,
-          onInput: pushAlertOnError(async (e) => {
-            setAmount(e);
-          }),
-        },
-      };
-    };
-  }
-  const chosenAmount = maybeAmount;
+  // if (!maybeAmount) {
+  //   const exchangeBaseUrl =
+  //     uriInfoHook.response.exchange?.exchangeBaseUrl ??
+  //     (exchangeList.length > 0 ? exchangeList[0].exchangeBaseUrl : 
undefined);
+  //   const currency =
+  //     uriInfoHook.response.exchange?.currency ??
+  //     (exchangeList.length > 0 ? exchangeList[0].currency : undefined);
+
+  //   if (!exchangeBaseUrl) {
+  //     return {
+  //       status: "error",
+  //       error: {
+  //         message: i18n.str`Can't withdraw from exchange`,
+  //         description: i18n.str`Missing base URL`,
+  //         cause: undefined,
+  //         context: {},
+  //         type: "error",
+  //       },
+  //     };
+  //   }
+  //   if (!currency) {
+  //     return {
+  //       status: "error",
+  //       error: {
+  //         message: i18n.str`Can't withdraw from exchange`,
+  //         description: i18n.str`Missing unknown currency`,
+  //         cause: undefined,
+  //         context: {},
+  //         type: "error",
+  //       },
+  //     };
+  //   }
+  //   return () => {
+  //     const { pushAlertOnError } = useAlertContext();
+  //     const [amount, setAmount] = useState<AmountJson>(
+  //       Amounts.zeroOfCurrency(currency),
+  //     );
+  //     const isValid = Amounts.isNonZero(amount);
+  //     return {
+  //       status: "select-amount",
+  //       currency,
+  //       exchangeBaseUrl,
+  //       error: undefined,
+  //       confirm: {
+  //         onClick: isValid
+  //           ? pushAlertOnError(async () => {
+  //               onAmountChanged(Amounts.stringify(amount));
+  //             })
+  //           : undefined,
+  //       },
+  //       amount: {
+  //         value: amount,
+  //         onInput: pushAlertOnError(async (e) => {
+  //           setAmount(e);
+  //         }),
+  //       },
+  //     };
+  //   };
+  // }
+  const chosenAmount = maybeAmount ?? Amounts.zeroOfCurrency(scope.currency);
 
   async function doManualWithdraw(
     exchange: string,
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx 
b/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx
index 06a4be940..3283f998f 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx
@@ -280,44 +280,3 @@ function WithdrawWithMobile({
   );
 }
 
-export function SelectAmountView({
-  amount,
-  exchangeBaseUrl,
-  confirm,
-}: State.SelectAmount): VNode {
-  const { i18n } = useTranslationContext();
-  return (
-    <Fragment>
-      <section style={{ textAlign: "left" }}>
-        <Part
-          title={
-            <div
-              style={{
-                display: "flex",
-                alignItems: "center",
-              }}
-            >
-              <i18n.Translate>Exchange</i18n.Translate>
-            </div>
-          }
-          text={<ExchangeDetails exchange={exchangeBaseUrl} />}
-          kind="neutral"
-          big
-        />
-        <Grid container columns={2} justifyContent="space-between">
-          <AmountField label={i18n.str`Amount`} required handler={amount} />
-        </Grid>
-      </section>
-      <section>
-        <Button
-          variant="contained"
-          color="info"
-          disabled={!confirm.onClick}
-          onClick={confirm.onClick}
-        >
-          <i18n.Translate>See details</i18n.Translate>
-        </Button>
-      </section>
-    </Fragment>
-  );
-}
diff --git 
a/packages/taler-wallet-webextension/src/taler-wallet-interaction-loader.ts 
b/packages/taler-wallet-webextension/src/taler-wallet-interaction-loader.ts
index 1d0ac314a..37523c667 100644
--- a/packages/taler-wallet-webextension/src/taler-wallet-interaction-loader.ts
+++ b/packages/taler-wallet-webextension/src/taler-wallet-interaction-loader.ts
@@ -21,7 +21,8 @@ import {
 } from "@gnu-taler/taler-util";
 
 import type { MessageFromBackend } from "./platform/api.js";
-import { encodeCrockForURI } from "@gnu-taler/web-util/browser";
+// FIXME: mem leak problems
+// import { encodeCrockForURI } from "@gnu-taler/web-util/browser";
 
 
 /**
@@ -67,7 +68,9 @@ function validateTalerUri(uri: string): boolean {
 function convertURIToWebExtensionPath(uri: string) {
   const url = new URL(
     chrome.runtime.getURL(
-      `static/wallet.html#/taler-uri/${encodeCrockForURI(uri)}`,
+      // FIXME: mem leak problems
+      // `static/wallet.html#/taler-uri/${encodeCrockForURI(uri)}`,
+      `static/wallet.html#/taler-uri-simple/${encodeURIComponent(uri)}`,
     ),
   );
   return url.href;
@@ -82,7 +85,7 @@ const shouldNotInject =
   !rootElementIsHTML;
 
 const logger = {
-  debug: (...msg: any[]) => {},
+  debug: (...msg: any[]) => { },
   info: (...msg: any[]) =>
     console.log(`${new Date().toISOString()} TALER`, ...msg),
   error: (...msg: any[]) =>
diff --git 
a/packages/taler-wallet-webextension/src/taler-wallet-interaction-support.ts 
b/packages/taler-wallet-webextension/src/taler-wallet-interaction-support.ts
index 0c6074c42..c6d96ba01 100644
--- a/packages/taler-wallet-webextension/src/taler-wallet-interaction-support.ts
+++ b/packages/taler-wallet-webextension/src/taler-wallet-interaction-support.ts
@@ -24,7 +24,7 @@ import { encodeCrockForURI } from 
"@gnu-taler/web-util/browser";
  */
 (() => {
   const logger = {
-    debug: (..._msg: unknown[]) => {},
+    debug: (..._msg: unknown[]) => { },
     info: (...msg: unknown[]) =>
       console.log(`${new Date().toISOString()} TALER`, ...msg),
     error: (...msg: unknown[]) =>
@@ -78,7 +78,9 @@ import { encodeCrockForURI } from 
"@gnu-taler/web-util/browser";
         return undefined;
       }
       const host = `${config.protocol}//${config.hostname}`;
-      const path = `static/wallet.html#/taler-uri/${encodeCrockForURI(uri)}`;
+      // FIXME: mem leak problems
+      // const path = 
`static/wallet.html#/taler-uri/${encodeCrockForURI(uri)}`;
+      const path = 
`static/wallet.html#/taler-uri-simple/${encodeURIComponent(uri)}`;
       return `${host}/${path}`;
     }
 
diff --git a/packages/taler-wallet-webextension/src/wallet/Application.tsx 
b/packages/taler-wallet-webextension/src/wallet/Application.tsx
index b4044beca..90102dc09 100644
--- a/packages/taler-wallet-webextension/src/wallet/Application.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Application.tsx
@@ -502,6 +502,28 @@ export function Application(): VNode {
               return <Redirect to={path} />;
             }}
           />
+          {/* // FIXME: mem leak problems */}
+          <Route
+            path={Pages.defaultCtaSimple.pattern}
+            component={({ uri }: { uri: string }) => {
+              const path = getPathnameForTalerURI(decodeURIComponent(uri));
+              if (!path) {
+                return (
+                  <CallToActionTemplate title={i18n.str`Taler URI handler`}>
+                    <AlertView
+                      alert={{
+                        type: "warning",
+                        message: i18n.str`Could not found a handler for the 
Taler URI`,
+                        description: i18n.str`The uri read in the path 
parameter is not valid: "${uri}"`,
+                      }}
+                    />
+                  </CallToActionTemplate>
+                );
+              }
+              return <Redirect to={path} />;
+            }}
+          />
+
           <Route
             path={Pages.ctaPay}
             component={({ talerUri }: { talerUri: string }) => (
@@ -584,13 +606,7 @@ export function Application(): VNode {
               return (
                 <CallToActionTemplate title={i18n.str`Digital cash 
withdrawal`}>
                   <WithdrawPageFromParams
-                    onAmountChanged={async (newamount) => {
-                      const page = `${Pages.ctaWithdrawManual({
-                        scope: encodeCrockForURI(stringifyScopeInfoShort(s)),
-                        amount: newamount,
-                      })}?talerUri=${encodeCrockForURI(talerUri)}`;
-                      redirectTo(page);
-                    }}
+                    scope={s}
                     talerExchangeWithdrawUri={talerUri}
                     amount={amount}
                     cancel={() => redirectTo(Pages.balance)}
diff --git a/packages/taler-wallet-webextension/src/wxBackend.ts 
b/packages/taler-wallet-webextension/src/wxBackend.ts
index ab3c465c4..cdc9e6a15 100644
--- a/packages/taler-wallet-webextension/src/wxBackend.ts
+++ b/packages/taler-wallet-webextension/src/wxBackend.ts
@@ -483,6 +483,7 @@ async function reinitWallet(): Promise<void> {
     return;
   }
   wallet.addNotificationListener((message) => {
+    logger.trace("Wallet -> Webex", message)
     if (settings.showWalletActivity) {
       addNewWalletActivityNotification(activity, message);
     }
@@ -521,6 +522,7 @@ export async function wxMain(): Promise<void> {
   logger.trace("listen all channels");
   platform.listenToAllChannels(async (message, from) => {
     //wait until wallet is initialized
+    logger.trace("Webex -> Wallet", message)
     await afterWalletIsInitialized;
     const result = await dispatch(message, from);
     return result;

-- 
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]