From e0e33a88db7641775de16f5425bfc08e461a4f75 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 5 Sep 2022 10:04:56 -0300 Subject: adding informantion about the service worker version on the setting page --- .../src/wallet/Settings.tsx | 76 +++++++++++++++++----- 1 file changed, 60 insertions(+), 16 deletions(-) (limited to 'packages/taler-wallet-webextension/src/wallet/Settings.tsx') diff --git a/packages/taler-wallet-webextension/src/wallet/Settings.tsx b/packages/taler-wallet-webextension/src/wallet/Settings.tsx index 1b75ee6c9..4a520c3bb 100644 --- a/packages/taler-wallet-webextension/src/wallet/Settings.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Settings.tsx @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see */ -import { ExchangeListItem } from "@gnu-taler/taler-util"; +import { ExchangeListItem, WalletCoreVersion } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { Checkbox } from "../components/Checkbox.js"; import { ErrorTalerOperation } from "../components/ErrorTalerOperation.js"; @@ -38,26 +38,39 @@ import { ToggleHandler } from "../mui/handlers.js"; import { Pages } from "../NavigationBar.js"; import { buildTermsOfServiceStatus } from "../utils/index.js"; import * as wxApi from "../wxApi.js"; +import { platform } from "../platform/api.js"; + +const GIT_HASH = typeof __GIT_HASH__ !== "undefined" ? __GIT_HASH__ : undefined; export function SettingsPage(): VNode { const permissionToggle = useExtendedPermissions(); const { devMode, toggleDevMode } = useDevContext(); const { name, update } = useBackupDeviceName(); + const webex = platform.getWalletWebExVersion(); - const exchangesHook = useAsyncAsHook(wxApi.listExchanges); + const exchangesHook = useAsyncAsHook(async () => { + const list = await wxApi.listExchanges(); + const version = await wxApi.getVersion(); + return { exchanges: list.exchanges, version }; + }); + const { exchanges, version } = + !exchangesHook || exchangesHook.hasError + ? { exchanges: [], version: undefined } + : exchangesHook.response; return ( ); } @@ -69,14 +82,19 @@ export interface ViewProps { developerMode: boolean; toggleDeveloperMode: () => Promise; knownExchanges: Array; + coreVersion: WalletCoreVersion | undefined; + webexVersion: { + version: string; + hash: string | undefined; + }; } -const VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "dev"; -const GIT_HASH = typeof __GIT_HASH__ !== "undefined" ? __GIT_HASH__ : undefined; export function SettingsView({ knownExchanges, permissionToggle, developerMode, + coreVersion, + webexVersion, toggleDeveloperMode, }: ViewProps): VNode { const { i18n, lang, supportedLang, changeLanguage } = useTranslationContext(); @@ -216,16 +234,42 @@ export function SettingsView({ Version - Release} - text={{VERSION}} - /> - {GIT_HASH && ( + {coreVersion && ( Hash} - text={{GIT_HASH}} + title={Wallet Core} + text={ + + {coreVersion.version}{" "} + {coreVersion.hash} + + } /> )} + Web Extension} + text={ + + {webexVersion.version}{" "} + {webexVersion.hash} + + } + /> + {coreVersion && ( + + Exchange compatibility} + text={{coreVersion.exchange}} + /> + Merchant compatibility} + text={{coreVersion.merchant}} + /> + Bank compatibility} + text={{coreVersion.bank}} + /> + + )} ); -- cgit v1.2.3