From 9b85d139bf7bdc360ea0894e09f6115cd9d472d8 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 26 Apr 2022 11:48:23 -0300 Subject: fix: shorcut for wallet #6592 --- .../src/platform/chrome.ts | 2 +- packages/taler-wallet-webextension/src/stories.tsx | 15 ++++++++++++ .../src/wallet/Welcome.tsx | 28 +++++++++++++++++++++- 3 files changed, 43 insertions(+), 2 deletions(-) (limited to 'packages/taler-wallet-webextension/src') diff --git a/packages/taler-wallet-webextension/src/platform/chrome.ts b/packages/taler-wallet-webextension/src/platform/chrome.ts index 67779f08c..d1f4585da 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/stories.tsx b/packages/taler-wallet-webextension/src/stories.tsx index 1ad91a13b..9c0f69ec4 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/Welcome.tsx b/packages/taler-wallet-webextension/src/wallet/Welcome.tsx index 5aad3b782..58023a203 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({

- Thank you for installing the wallet. + + You can open the GNU Taler Wallet using the combination{" "} +

<ALT+W>
+ . +

+ {!platform.isFirefox() && ( + +

+ + Also pinning the GNU Taler Wallet to your Chrome browser allows + you to quick access without keyboard: + +

+
    +
  1. + Click the puzzle icon +
  2. +
  3. + Search for GNU Taler Wallet +
  4. +
  5. + Click the pin icon +
  6. +
+
+ )} Permissions -- cgit v1.2.3