Skip to content

Commit

Permalink
feat: show swap-live-app devtools based on flag (#6897)
Browse files Browse the repository at this point in the history
feat: show swap live app devtools based on flag

feat: add changeset
  • Loading branch information
liviuciulinaru authored May 23, 2024
1 parent ac2d6bf commit 7d97769
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-squids-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

display the swap-live-app devtools based on the "Enable platform dev tools" flag
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ import { initialWebviewState } from "~/renderer/components/Web3AppWebview/helper
import { WebviewAPI, WebviewProps, WebviewState } from "~/renderer/components/Web3AppWebview/types";
import { TopBar } from "~/renderer/components/WebPlatformPlayer/TopBar";
import useTheme from "~/renderer/hooks/useTheme";
import { counterValueCurrencySelector, languageSelector } from "~/renderer/reducers/settings";
import {
counterValueCurrencySelector,
enablePlatformDevToolsSelector,
languageSelector,
} from "~/renderer/reducers/settings";
import { useRedirectToSwapHistory } from "../utils/index";

import { SwapLiveError } from "@ledgerhq/live-common/exchange/swap/types";
Expand All @@ -25,8 +29,6 @@ import { LiveAppManifest } from "@ledgerhq/live-common/platform/types";
import { usePTXCustomHandlers } from "~/renderer/components/WebPTXPlayer/CustomHandlers";
import { captureException } from "~/sentry/internal";

const isDevelopment = process.env.NODE_ENV === "development";

export class UnableToLoadSwapLiveError extends Error {
constructor(message: string) {
const name = "UnableToLoadSwapLiveError";
Expand Down Expand Up @@ -99,6 +101,7 @@ const SwapWebView = ({ manifest, swapState, liveAppUnavailable }: SwapWebProps)
const fiatCurrency = useSelector(counterValueCurrencySelector);
const locale = useSelector(languageSelector);
const redirectToHistory = useRedirectToSwapHistory();
const enablePlatformDevTools = useSelector(enablePlatformDevToolsSelector);

const hasSwapState = !!swapState;
const customPTXHandlers = usePTXCustomHandlers(manifest);
Expand Down Expand Up @@ -252,7 +255,7 @@ const SwapWebView = ({ manifest, swapState, liveAppUnavailable }: SwapWebProps)

return (
<>
{isDevelopment && (
{enablePlatformDevTools && (
<TopBar
manifest={{ ...manifest, url: `${manifest.url}#${hashString}` }}
webviewAPIRef={webviewAPIRef}
Expand Down

0 comments on commit 7d97769

Please sign in to comment.