Skip to content

Commit

Permalink
feat: update web ptx Player to load correct manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
cksanders committed Aug 3, 2023
1 parent cc463f5 commit 0402fe9
Show file tree
Hide file tree
Showing 56 changed files with 306 additions and 3,231 deletions.
8 changes: 8 additions & 0 deletions .changeset/cold-walls-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"ledger-live-desktop": minor
"live-mobile": minor
"@ledgerhq/live-common": minor
---

- Update WebPTXPlayer to load correct manifest
- Remove unused LL BUY/SELL in favour of BUY/SELL Live App
2 changes: 1 addition & 1 deletion apps/ledger-live-desktop/src/renderer/Default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export default function Default() {
/>
<Route path="/platform/:appId?" component={LiveApp} />
<Route path="/earn" component={Earn} />
<Route path="/exchange" component={Exchange} />
<Route exact path="/exchange/:appId?" component={Exchange} />
<Route
exact
path="/account/:id/nft-collection"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,17 @@ export default function BalanceInfos({ totalBalance, valueChange, isAvailable, u
const { t } = useTranslation();
const history = useHistory();

// PTX smart routing feature flag - buy sell live app flag
const ptxSmartRouting = useFeature("ptxSmartRouting");
// Remove "SWAP" and "BUY" redundant buttons when portafolio exchange banner is available
const portfolioExchangeBanner = useFeature("portfolioExchangeBanner");
const onBuy = useCallback(() => {
setTrackingSource("Page Portfolio");
history.push({
pathname: "/exchange",
state: ptxSmartRouting?.enabled
? {
mode: "buy", // buy or sell
}
: undefined,
state: {
mode: "buy", // buy or sell
},
});
}, [history, ptxSmartRouting]);
}, [history]);
const onSwap = useCallback(() => {
setTrackingSource("Page Portfolio");
history.push({
Expand Down
24 changes: 9 additions & 15 deletions apps/ledger-live-desktop/src/renderer/components/BuyButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,28 @@ import { Account } from "@ledgerhq/types-live";
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
import { setTrackingSource } from "~/renderer/analytics/TrackPage";
import { isCurrencySupported } from "~/renderer/screens/exchange/config";
import { useFeature } from "@ledgerhq/live-common/featureFlags/index";

const BuyButton = ({ currency, account }: { currency: CryptoCurrency; account: Account }) => {
const history = useHistory();
const dispatch = useDispatch();

// PTX smart routing feature flag - buy sell live app flag
const ptxSmartRouting = useFeature("ptxSmartRouting");
const onClick = useCallback(() => {
dispatch(closeAllModal());
setTrackingSource("send flow");
history.push({
pathname: "/exchange",
state: ptxSmartRouting?.enabled
? {
currency: currency.id,
account: account.id,
mode: "buy", // buy or sell
}
: {
tab: 0,
defaultCurrency: currency,
defaultAccount: account,
},
state: {
currency: currency.id,
account: account.id,
mode: "buy", // buy or sell
},
});
}, [account, currency, dispatch, history, ptxSmartRouting]);
}, [account, currency, dispatch, history]);

if (!isCurrencySupported("BUY", currency)) {
return null;
}

return (
<Button mr={1} primary inverted onClick={onClick}>
<Trans
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { useRefreshAccountsOrdering } from "~/renderer/actions/general";
import { swapSelectableCurrenciesSelector } from "~/renderer/reducers/settings";
import { isCurrencySupported } from "~/renderer/screens/exchange/config";
import { setTrackingSource } from "~/renderer/analytics/TrackPage";
import { useFeature } from "@ledgerhq/live-common/featureFlags/index";
import { ContextMenuItemType } from "./ContextMenuWrapper";
import { IconsLegacy } from "@ledgerhq/react-ui";

Expand All @@ -39,8 +38,6 @@ export default function AccountContextMenu({
const refreshAccountsOrdering = useRefreshAccountsOrdering();
const swapSelectableCurrencies = useSelector(swapSelectableCurrenciesSelector);

// PTX smart routing feature flag - buy sell live app flag
const ptxSmartRouting = useFeature("ptxSmartRouting");
const menuItems = useMemo(() => {
const currency = getAccountCurrency(account);
const mainAccount = getMainAccount(account, parentAccount);
Expand Down Expand Up @@ -77,16 +74,11 @@ export default function AccountContextMenu({
setTrackingSource("account context menu");
history.push({
pathname: "/exchange",
state: ptxSmartRouting?.enabled
? {
currency: currency?.id,
account: mainAccount?.id,
mode: "buy", // buy or sell
}
: {
defaultCurrency: currency,
defaultAccount: mainAccount,
},
state: {
currency: currency?.id,
account: mainAccount?.id,
mode: "buy", // buy or sell
},
});
},
});
Expand All @@ -100,16 +92,11 @@ export default function AccountContextMenu({
setTrackingSource("account context menu");
history.push({
pathname: "/exchange",
state: ptxSmartRouting?.enabled
? {
currency: currency?.id,
account: mainAccount?.id,
mode: "sell", // buy or sell
}
: {
defaultCurrency: currency,
defaultAccount: mainAccount,
},
state: {
currency: currency?.id,
account: mainAccount?.id,
mode: "sell", // buy or sell
},
});
},
});
Expand Down Expand Up @@ -176,7 +163,6 @@ export default function AccountContextMenu({
swapSelectableCurrencies,
withStar,
dispatch,
ptxSmartRouting,
history,
refreshAccountsOrdering,
]);
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 0402fe9

Please sign in to comment.