gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: remove diag, check tos


From: gnunet
Subject: [taler-wallet-core] branch master updated: remove diag, check tos
Date: Fri, 08 Sep 2023 16:15:24 +0200

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

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

The following commit(s) were added to refs/heads/master by this push:
     new 036f8a463 remove diag, check tos
036f8a463 is described below

commit 036f8a463fca11584fbca45ec1c4c9a918433f9d
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Fri Sep 8 11:15:13 2023 -0300

    remove diag, check tos
---
 .../paths/instance/accounts/create/CreatePage.tsx  |  6 +--
 .../src/components/TermsOfService/views.tsx        |  4 +-
 .../src/cta/TransferCreate/state.ts                |  8 +++-
 .../src/hooks/useDiagnostics.ts                    | 44 ----------------------
 .../src/wallet/DeveloperPage.tsx                   | 20 +++-------
 .../src/wallet/Welcome.stories.tsx                 |  8 ----
 .../src/wallet/Welcome.tsx                         |  8 ----
 packages/taler-wallet-webextension/src/wxApi.ts    |  4 --
 .../taler-wallet-webextension/src/wxBackend.ts     | 38 -------------------
 9 files changed, 15 insertions(+), 125 deletions(-)

diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/CreatePage.tsx
 
b/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/CreatePage.tsx
index 3ac510f63..6e4786a47 100644
--- 
a/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/CreatePage.tsx
+++ 
b/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/CreatePage.tsx
@@ -28,12 +28,10 @@ import {
   FormProvider,
 } from "../../../../components/form/FormProvider.js";
 import { Input } from "../../../../components/form/Input.js";
-import { useBackendContext } from "../../../../context/backend.js";
-import { MerchantBackend } from "../../../../declaration.js";
 import { InputPaytoForm } from "../../../../components/form/InputPaytoForm.js";
-import { parsePayUri, stringifyPaytoUri } from "@gnu-taler/taler-util";
-import { undefinedIfEmpty } from "../../../../utils/table.js";
 import { InputSelector } from "../../../../components/form/InputSelector.js";
+import { MerchantBackend } from "../../../../declaration.js";
+import { undefinedIfEmpty } from "../../../../utils/table.js";
 
 type Entity = MerchantBackend.BankAccounts.AccountAddDetails & { 
repeatPassword: string };
 
diff --git 
a/packages/taler-wallet-webextension/src/components/TermsOfService/views.tsx 
b/packages/taler-wallet-webextension/src/components/TermsOfService/views.tsx
index 214c4d792..f6c176550 100644
--- a/packages/taler-wallet-webextension/src/components/TermsOfService/views.tsx
+++ b/packages/taler-wallet-webextension/src/components/TermsOfService/views.tsx
@@ -99,7 +99,7 @@ export function ShowButtonsNonAcceptedTosView({
           </WarningText>
         </section>
       )} */}
-      {terms.status === ExchangeTosStatus.Pending && (
+      {terms.status === ExchangeTosStatus.Accepted && (
         <section style={{ justifyContent: "space-around", display: "flex" }}>
           <Button
             variant="contained"
@@ -181,7 +181,7 @@ export function ShowTosContentView({
           </LinkSuccess>
         </section>
       )}
-      {termsAccepted && terms.status !== ExchangeTosStatus.Proposed && (
+      {termsAccepted && terms.status !== ExchangeTosStatus.Accepted && (
         <section style={{ justifyContent: "space-around", display: "flex" }}>
           <CheckboxOutlined
             name="terms"
diff --git a/packages/taler-wallet-webextension/src/cta/TransferCreate/state.ts 
b/packages/taler-wallet-webextension/src/cta/TransferCreate/state.ts
index dcd41bcc1..77333e15c 100644
--- a/packages/taler-wallet-webextension/src/cta/TransferCreate/state.ts
+++ b/packages/taler-wallet-webextension/src/cta/TransferCreate/state.ts
@@ -118,8 +118,8 @@ export function useComponentState({
         subject === undefined
           ? undefined
           : !subject
-          ? "Can't be empty"
-          : undefined,
+            ? "Can't be empty"
+            : undefined,
       value: subject ?? "",
       onInput: pushAlertOnError(async (e) => setSubject(e)),
     },
@@ -172,6 +172,10 @@ async function checkPeerPushDebitAndCheckMax(
       //a good response that allow us to try again
       throw e;
     }
+    if (Amounts.cmp(newAmount, amount) === 1) {
+      //how can this happen?
+      throw e;
+    }
     return checkPeerPushDebitAndCheckMax(api, Amounts.stringify(newAmount));
   }
 }
diff --git a/packages/taler-wallet-webextension/src/hooks/useDiagnostics.ts 
b/packages/taler-wallet-webextension/src/hooks/useDiagnostics.ts
deleted file mode 100644
index fcd31b3c6..000000000
--- a/packages/taler-wallet-webextension/src/hooks/useDiagnostics.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2022 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
- */
-
-import { WalletDiagnostics } from "@gnu-taler/taler-util";
-import { useEffect, useState } from "preact/hooks";
-import { useBackendContext } from "../context/backend.js";
-
-export function useDiagnostics(): [WalletDiagnostics | undefined, boolean] {
-  const [timedOut, setTimedOut] = useState(false);
-  const api = useBackendContext();
-  const [diagnostics, setDiagnostics] = useState<WalletDiagnostics | 
undefined>(
-    undefined,
-  );
-
-  useEffect(() => {
-    let gotDiagnostics = false;
-    setTimeout(() => {
-      if (!gotDiagnostics) {
-        console.error("timed out");
-        setTimedOut(true);
-      }
-    }, 1000);
-    const doFetch = async (): Promise<void> => {
-      const d = await api.background.call("getDiagnostics", undefined);
-      gotDiagnostics = true;
-      setDiagnostics(d);
-    };
-    doFetch();
-  }, []);
-  return [diagnostics, timedOut];
-}
diff --git a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx 
b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
index c5e5c3c07..c972f0919 100644
--- a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
@@ -27,24 +27,21 @@ import {
   PendingTaskInfo,
   WalletApiOperation,
 } from "@gnu-taler/taler-wallet-core";
+import { useTranslationContext } from "@gnu-taler/web-util/browser";
 import { format } from "date-fns";
-import { Fragment, h, VNode } from "preact";
+import { Fragment, VNode, h } from "preact";
 import { useEffect, useRef, useState } from "preact/hooks";
-import { Diagnostics } from "../components/Diagnostics.js";
 import { SelectList } from "../components/SelectList.js";
-import { NotifyUpdateFadeOut } from "../components/styled/index.js";
 import { Time } from "../components/Time.js";
+import { NotifyUpdateFadeOut } from "../components/styled/index.js";
 import { useBackendContext } from "../context/backend.js";
-import { useTranslationContext } from "@gnu-taler/web-util/browser";
 import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js";
-import { useDiagnostics } from "../hooks/useDiagnostics.js";
 import { Button } from "../mui/Button.js";
 import { Grid } from "../mui/Grid.js";
 import { Paper } from "../mui/Paper.js";
 import { TextField } from "../mui/TextField.js";
 
 export function DeveloperPage(): VNode {
-  const [status, timedOut] = useDiagnostics();
 
   const listenAllEvents = Array.from<NotificationType>({ length: 1 });
 
@@ -73,13 +70,11 @@ export function DeveloperPage(): VNode {
     response === undefined
       ? nonResponse
       : response.hasError
-      ? nonResponse
-      : response.response;
+        ? nonResponse
+        : response.response;
 
   return (
     <View
-      status={status}
-      timedOut={timedOut}
       operations={operations}
       coins={coins}
       exchanges={exchanges}
@@ -108,8 +103,6 @@ type SplitedCoinInfo = {
 };
 
 export interface Props {
-  status: any;
-  timedOut: boolean;
   operations: PendingTaskInfo[];
   coins: CoinsInfo;
   exchanges: ExchangeListItem[];
@@ -121,8 +114,6 @@ function hashObjectId(o: any): string {
 }
 
 export function View({
-  status,
-  timedOut,
   operations,
   coins,
   onDownloadDatabase,
@@ -458,7 +449,6 @@ export function View({
         );
       })}
       <br />
-      <Diagnostics diagnostics={status} timedOut={timedOut} />
       {operations && operations.length > 0 && (
         <Fragment>
           <p>
diff --git a/packages/taler-wallet-webextension/src/wallet/Welcome.stories.tsx 
b/packages/taler-wallet-webextension/src/wallet/Welcome.stories.tsx
index 2cf28b611..dfce1c14b 100644
--- a/packages/taler-wallet-webextension/src/wallet/Welcome.stories.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Welcome.stories.tsx
@@ -29,17 +29,9 @@ export default {
 
 export const Normal = tests.createExample(TestedComponent, {
   permissionToggle: { value: true, button: {} },
-  diagnostics: {
-    errors: [],
-    walletManifestVersion: "1.0",
-    walletManifestDisplayVersion: "1.0",
-    firefoxIdbProblem: false,
-    dbOutdated: false,
-  },
 });
 
 export const TimedoutDiagnostics = tests.createExample(TestedComponent, {
-  timedOut: true,
   permissionToggle: { value: true, button: {} },
 });
 
diff --git a/packages/taler-wallet-webextension/src/wallet/Welcome.tsx 
b/packages/taler-wallet-webextension/src/wallet/Welcome.tsx
index 8d348ca9d..e19152be2 100644
--- a/packages/taler-wallet-webextension/src/wallet/Welcome.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Welcome.tsx
@@ -25,7 +25,6 @@ import { Fragment, h, VNode } from "preact";
 import { Checkbox } from "../components/Checkbox.js";
 import { SubTitle, Title } from "../components/styled/index.js";
 import { useTranslationContext } from "@gnu-taler/web-util/browser";
-import { useDiagnostics } from "../hooks/useDiagnostics.js";
 import { useSettings } from "../hooks/useSettings.js";
 import { ToggleHandler } from "../mui/handlers.js";
 import { platform } from "../platform/foreground.js";
@@ -34,7 +33,6 @@ import { useAlertContext } from "../context/alert.js";
 export function WelcomePage(): VNode {
   const [settings, updateSettings] = useSettings();
   const { safely } = useAlertContext();
-  const [diagnostics, timedOut] = useDiagnostics();
   return (
     <View
       permissionToggle={{
@@ -45,21 +43,15 @@ export function WelcomePage(): VNode {
           ),
         },
       }}
-      diagnostics={diagnostics}
-      timedOut={timedOut}
     />
   );
 }
 
 export interface ViewProps {
   permissionToggle: ToggleHandler;
-  diagnostics: WalletDiagnostics | undefined;
-  timedOut: boolean;
 }
 export function View({
   permissionToggle,
-  diagnostics,
-  timedOut,
 }: ViewProps): VNode {
   const { i18n } = useTranslationContext();
   return (
diff --git a/packages/taler-wallet-webextension/src/wxApi.ts 
b/packages/taler-wallet-webextension/src/wxApi.ts
index 46c9f1b2d..004faad5c 100644
--- a/packages/taler-wallet-webextension/src/wxApi.ts
+++ b/packages/taler-wallet-webextension/src/wxApi.ts
@@ -70,10 +70,6 @@ export interface BackgroundOperations {
     request: void;
     response: void;
   };
-  getDiagnostics: {
-    request: void;
-    response: WalletDiagnostics;
-  };
   runGarbageCollector: {
     request: void;
     response: void;
diff --git a/packages/taler-wallet-webextension/src/wxBackend.ts 
b/packages/taler-wallet-webextension/src/wxBackend.ts
index d5f6ca2cd..40b7077af 100644
--- a/packages/taler-wallet-webextension/src/wxBackend.ts
+++ b/packages/taler-wallet-webextension/src/wxBackend.ts
@@ -76,43 +76,6 @@ const walletInit: OpenedPromise<void> = openPromise<void>();
 
 const logger = new Logger("wxBackend.ts");
 
-async function getDiagnostics(): Promise<WalletDiagnostics> {
-  const manifestData = platform.getWalletWebExVersion();
-  const errors: string[] = [];
-  let firefoxIdbProblem = false;
-  let dbOutdated = false;
-  try {
-    await walletInit.promise;
-  } catch (e) {
-    errors.push("Error during wallet initialization: " + e);
-    if (
-      currentDatabase === undefined &&
-      outdatedDbVersion === undefined &&
-      platform.isFirefox()
-    ) {
-      firefoxIdbProblem = true;
-    }
-  }
-  if (!currentWallet) {
-    errors.push("Could not create wallet backend.");
-  }
-  if (!currentDatabase) {
-    errors.push("Could not open database");
-  }
-  if (outdatedDbVersion !== undefined) {
-    errors.push(`Outdated DB version: ${outdatedDbVersion}`);
-    dbOutdated = true;
-  }
-  const diagnostics: WalletDiagnostics = {
-    walletManifestDisplayVersion: manifestData.version_name || "(undefined)",
-    walletManifestVersion: manifestData.version,
-    errors,
-    firefoxIdbProblem,
-    dbOutdated,
-  };
-  return diagnostics;
-}
-
 type BackendHandlerType = {
   [Op in keyof BackgroundOperations]: (
     req: BackgroundOperations[Op]["request"],
@@ -172,7 +135,6 @@ async function isInjectionEnabled(): Promise<boolean> {
 const backendHandlers: BackendHandlerType = {
   freeze,
   sum,
-  getDiagnostics,
   resetDb,
   runGarbageCollector,
   setLoggingLevel,

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