diff options
author | Sebastian <sebasjm@gmail.com> | 2022-03-23 10:50:12 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-03-23 10:58:57 -0300 |
commit | 32f6409ac312f31821f791c3a376168289f0e4f4 (patch) | |
tree | c77c660bb85cf359faf74b5cddbe95eb0a915c5e /packages/taler-wallet-webextension/src/walletEntryPoint.tsx | |
parent | c539d1803c1376cba0831be64866b6d2c1652403 (diff) | |
download | wallet-core-32f6409ac312f31821f791c3a376168289f0e4f4.tar.xz |
all the browser related code move into one place, making it easy for specific platform code or mocking for testing
Diffstat (limited to 'packages/taler-wallet-webextension/src/walletEntryPoint.tsx')
-rw-r--r-- | packages/taler-wallet-webextension/src/walletEntryPoint.tsx | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/packages/taler-wallet-webextension/src/walletEntryPoint.tsx b/packages/taler-wallet-webextension/src/walletEntryPoint.tsx index 2f53917e4..e7cb1f5e6 100644 --- a/packages/taler-wallet-webextension/src/walletEntryPoint.tsx +++ b/packages/taler-wallet-webextension/src/walletEntryPoint.tsx @@ -17,7 +17,7 @@ /** * Main entry point for extension pages. * - * @author sebasjm <dold@taler.net> + * @author sebasjm */ import { setupI18n } from "@gnu-taler/taler-util"; @@ -28,12 +28,7 @@ import Match from "preact-router/match"; import { useEffect, useState } from "preact/hooks"; import { LogoHeader } from "./components/LogoHeader"; import PendingTransactions from "./components/PendingTransactions"; -import { - NavigationHeader, - NavigationHeaderHolder, - SuccessBox, - WalletBox, -} from "./components/styled"; +import { SuccessBox, WalletBox } from "./components/styled"; import { DevContextProvider } from "./context/devContext"; import { IoCProviderForRuntime } from "./context/iocContext"; import { @@ -46,6 +41,9 @@ import { TipPage } from "./cta/Tip"; import { WithdrawPage } from "./cta/Withdraw"; import { strings } from "./i18n/strings"; import { Pages, WalletNavBar } from "./NavigationBar"; +import { setupPlatform } from "./platform/api"; +import chromeAPI from "./platform/chrome"; +import firefoxAPI from "./platform/firefox"; import { DeveloperPage } from "./popup/DeveloperPage"; import { BackupPage } from "./wallet/BackupPage"; import { DepositPage } from "./wallet/DepositPage"; @@ -75,6 +73,17 @@ function main(): void { setupI18n("en", strings); +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); +} + if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", main); } else { |