Skip to content

Commit

Permalink
refactor: remove old manifest id for buy-sell "multibuy-v2" (#7660)
Browse files Browse the repository at this point in the history
* refactor: remove old manifest id for buy-sell "multibuy-v2"

* chore: add changeset

* refactor: format code

* refactor: removes old comment
  • Loading branch information
sergiubreban authored Aug 26, 2024
1 parent 6460687 commit 9c584a0
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 15 deletions.
6 changes: 6 additions & 0 deletions .changeset/real-pets-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"ledger-live-desktop": patch
"live-mobile": patch
---

removes old manifest id for buy-sell app
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { getParentAccount, isTokenAccount } from "@ledgerhq/live-common/account/
import { LiveAppManifest } from "@ledgerhq/live-common/platform/types";
import { accountToWalletAPIAccount } from "@ledgerhq/live-common/wallet-api/converters";
import {
DEFAULT_MULTIBUY_APP_ID,
BUY_SELL_UI_APP_ID,
INTERNAL_APP_IDS,
WALLET_API_VERSION,
} from "@ledgerhq/live-common/wallet-api/constants";
Expand Down Expand Up @@ -114,7 +114,7 @@ export type ExchangeComponentParams = {
const Exchange = ({ match }: RouteComponentProps<ExchangeComponentParams>) => {
const appId = match?.params?.appId;
const buySellUiFlag = useFeature("buySellUi");
const defaultPlatform = buySellUiFlag?.params?.manifestId || DEFAULT_MULTIBUY_APP_ID;
const defaultPlatform = buySellUiFlag?.params?.manifestId || BUY_SELL_UI_APP_ID;

return <LiveAppExchange appId={appId || defaultPlatform} />;
};
Expand Down
3 changes: 2 additions & 1 deletion apps/ledger-live-desktop/tests/specs/market/market.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { MarketPage } from "../../page/market.page";
import { Layout } from "../../component/layout.component";
import { MarketCoinPage } from "../../page/market.coin.page";
import { LiveAppWebview } from "../../models/LiveAppWebview";
import { BUY_SELL_UI_APP_ID } from "@ledgerhq/live-common/wallet-api/constants";

test.use({ userdata: "skip-onboarding" });

Expand All @@ -14,7 +15,7 @@ test.beforeAll(async () => {
// Check that dummy app in tests/dummy-ptx-app has been started successfully
testServerIsRunning = await LiveAppWebview.startLiveApp("dummy-ptx-app/public", {
name: "Buy App",
id: "multibuy-v2",
id: BUY_SELL_UI_APP_ID,
permissions: ["account.request"],
});

Expand Down
3 changes: 2 additions & 1 deletion apps/ledger-live-desktop/tests/specs/services/buy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { AccountPage } from "../../page/account.page";
import { SettingsPage } from "../../page/settings.page";
import { MarketPage } from "../../page/market.page";
import { LiveAppWebview } from "../../models/LiveAppWebview";
import { BUY_SELL_UI_APP_ID } from "@ledgerhq/live-common/wallet-api/constants";

test.use({
userdata: "1AccountBTC1AccountETH",
Expand All @@ -22,7 +23,7 @@ test.beforeAll(async () => {
// Check that dummy app in tests/dummy-ptx-app has been started successfully
testServerIsRunning = await LiveAppWebview.startLiveApp("dummy-ptx-app/public", {
name: "Buy App",
id: "multibuy-v2",
id: BUY_SELL_UI_APP_ID,
permissions: ["account.request"],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useMemo } from "react";
import { createStackNavigator } from "@react-navigation/stack";
import { useTheme } from "styled-components/native";
import { findCryptoCurrencyByKeyword } from "@ledgerhq/live-common/currencies/index";
import { DEFAULT_MULTIBUY_APP_ID } from "@ledgerhq/live-common/wallet-api/constants";
import { BUY_SELL_UI_APP_ID } from "@ledgerhq/live-common/wallet-api/constants";
import { useFeature } from "@ledgerhq/live-common/featureFlags/index";
import { ScreenName } from "~/const";
import { getStackNavigatorConfig } from "~/navigation/navigatorConfig";
Expand All @@ -18,7 +18,7 @@ const ExchangeBuy = (
_props: StackNavigatorProps<ExchangeLiveAppNavigatorParamList, ScreenName.ExchangeBuy>,
) => {
const buySellUiFlag = useFeature("buySellUi");
const defaultPlatform = buySellUiFlag?.params?.manifestId || DEFAULT_MULTIBUY_APP_ID;
const defaultPlatform = buySellUiFlag?.params?.manifestId || BUY_SELL_UI_APP_ID;
return (
<BuyAndSellScreen
{..._props}
Expand All @@ -44,7 +44,7 @@ const ExchangeSell = (
_props: StackNavigatorProps<ExchangeLiveAppNavigatorParamList, ScreenName.ExchangeSell>,
) => {
const buySellUiFlag = useFeature("buySellUi");
const defaultPlatform = buySellUiFlag?.params?.manifestId || DEFAULT_MULTIBUY_APP_ID;
const defaultPlatform = buySellUiFlag?.params?.manifestId || BUY_SELL_UI_APP_ID;
return (
<BuyAndSellScreen
{..._props}
Expand Down
9 changes: 3 additions & 6 deletions apps/ledger-live-mobile/src/navigation/DeeplinksProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ import Config from "react-native-config";
import { useFlipper } from "@react-navigation/devtools";
import { useRemoteLiveAppContext } from "@ledgerhq/live-common/platform/providers/RemoteLiveAppProvider/index";
import { useFeature } from "@ledgerhq/live-common/featureFlags/index";
import {
DEFAULT_MULTIBUY_APP_ID,
BUY_SELL_UI_APP_ID,
} from "@ledgerhq/live-common/wallet-api/constants";
import { BUY_SELL_UI_APP_ID } from "@ledgerhq/live-common/wallet-api/constants";

import Braze from "@braze/react-native-sdk";
import { LiveAppManifest } from "@ledgerhq/live-common/platform/types";
Expand Down Expand Up @@ -73,8 +70,8 @@ function getProxyURL(url: string, customBuySellUiAppId?: string) {
}

const buySellAppIds = customBuySellUiAppId
? [customBuySellUiAppId, DEFAULT_MULTIBUY_APP_ID, BUY_SELL_UI_APP_ID]
: [DEFAULT_MULTIBUY_APP_ID, BUY_SELL_UI_APP_ID];
? [customBuySellUiAppId, BUY_SELL_UI_APP_ID]
: [BUY_SELL_UI_APP_ID];

// This is to handle links set in the useFromAmountStatusMessage in LLC.
// Also handles a difference in paths between LLD on LLD /platform/:app_id
Expand Down
3 changes: 2 additions & 1 deletion libs/ledger-live-common/src/featureFlags/defaultFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from "@ledgerhq/types-live";
import reduce from "lodash/reduce";
import { formatToFirebaseFeatureId } from "./firebaseFeatureFlags";
import { BUY_SELL_UI_APP_ID } from "../wallet-api/constants";

/**
* Default disabled feature.
Expand Down Expand Up @@ -384,7 +385,7 @@ export const DEFAULT_FEATURES: Features = {
buySellUi: {
enabled: false,
params: {
manifestId: "multibuy-v2", // Update to "buy-sell-ui" after rollout
manifestId: BUY_SELL_UI_APP_ID,
},
},

Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/types-live/src/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ export type Feature_LlmRefreshMarketData = Feature<{
}>;

export type Feature_BuySellUiManifest = Feature<{
manifestId: string; // id of the app to use for the Buy/Sell UI, e.g. "multibuy-v2"
manifestId: string; // id of the app to use for the Buy/Sell UI, e.g. "buy-sell-ui"
}>;

export type Feature_LldWalletSync = Feature<{
Expand Down

0 comments on commit 9c584a0

Please sign in to comment.