Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
Add experimental dev toggle for using learn staging URL
Browse files Browse the repository at this point in the history
  • Loading branch information
ofreyssinet-ledger committed Feb 24, 2022
1 parent ae0b932 commit 61db1cc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@ledgerhq/errors": "6.10.0",
"@ledgerhq/hw-transport": "6.24.1",
"@ledgerhq/hw-transport-http": "6.24.1",
"@ledgerhq/live-common": "^21.33.0",
"@ledgerhq/live-common": "https://github.com/LedgerHQ/ledger-live-common.git#c14a6b5c83cfffe0a7e1e3de50f64f96bfc7449a",
"@ledgerhq/logs": "6.10.0",
"@ledgerhq/native-ui": "^0.7.0",
"@ledgerhq/react-native-hid": "6.24.1",
Expand Down
6 changes: 6 additions & 0 deletions src/experimental.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ export const developerFeatures: Feature[] = [
title: "Allow experimental apps",
description: "Display and allow opening experimental tagged platform apps.",
},
{
type: "toggle",
name: "USE_LEARN_STAGING_URL",
title: "Learn staging URL",
description: "Use the staging URL for the Learn page.",
},
];

const storageKey = "experimentalFlags";
Expand Down
11 changes: 9 additions & 2 deletions src/screens/Learn/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import { SafeAreaView } from "react-native";
import WebView from "react-native-webview";
import styled, { useTheme } from "styled-components/native";
import { useTranslation } from "react-i18next";
import useEnv from "@ledgerhq/live-common/lib/hooks/useEnv";
import extraStatusBarPadding from "../../logic/extraStatusBarPadding";

const learnURL = "https://www.ledger.com/ledger-live-learn";
const learnProdURL = "https://www.ledger.com/ledger-live-learn";
const learnStagingURL =
"https://ecommerce-website.aws.stg.ldg-tech.com/ledger-live-learn";

const SafeContainer = styled(SafeAreaView)`
flex: 1;
Expand All @@ -23,7 +26,11 @@ export default function Learn() {
colors: { type: themeType },
} = useTheme();

const uri = `${learnURL}?theme=${themeType}&lang=${i18n.languages[0]}`;
const useStagingURL = useEnv("USE_LEARN_STAGING_URL");

const uri = `${
useStagingURL ? learnStagingURL : learnProdURL
}?theme=${themeType}&lang=${i18n.languages[0]}`;

return (
<SafeContainer>
Expand Down
5 changes: 2 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2479,10 +2479,9 @@
bignumber.js "^9.0.1"
json-rpc-2.0 "^0.2.16"

"@ledgerhq/live-common@^21.33.0":
"@ledgerhq/live-common@https://github.com/LedgerHQ/ledger-live-common.git#c14a6b5c83cfffe0a7e1e3de50f64f96bfc7449a":
version "21.33.0"
resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-21.33.0.tgz#4b709dcbccdcb5010fd19b6829effe2a18587cc3"
integrity sha512-CpMiASJjLOYCz59EqjGEe3p7JxoF062RpbVuaF2AIBje09kxu9kVeqBeOQpk2bx+jLH2t3yWvmqVh9E1sm9FyA==
resolved "https://github.com/LedgerHQ/ledger-live-common.git#c14a6b5c83cfffe0a7e1e3de50f64f96bfc7449a"
dependencies:
"@celo/contractkit" "^1.5.1"
"@celo/wallet-base" "^1.5.1"
Expand Down

0 comments on commit 61db1cc

Please sign in to comment.