diff --git a/.changeset/orange-drinks-explode.md b/.changeset/orange-drinks-explode.md
new file mode 100644
index 000000000000..431d693f1c2b
--- /dev/null
+++ b/.changeset/orange-drinks-explode.md
@@ -0,0 +1,5 @@
+---
+"live-mobile": minor
+---
+
+Fixes Add Custom Manifest screen
diff --git a/apps/ledger-live-mobile/src/locales/en/common.json b/apps/ledger-live-mobile/src/locales/en/common.json
index 6bb72d661d09..5550cf1cb8cb 100644
--- a/apps/ledger-live-mobile/src/locales/en/common.json
+++ b/apps/ledger-live-mobile/src/locales/en/common.json
@@ -3122,7 +3122,7 @@
"title": "Developer",
"desc": "Try out the Developer features and let us know what you think.",
"customManifest": {
- "title": "Load Custom Platform Manifest"
+ "title": "Load Manifest"
},
"exchangeDeveloperMode": {
"title": "Exchange Dev Mode",
@@ -7225,4 +7225,4 @@
"detectedAccounts_plural": "{{count}} accounts (detected)"
}
}
-}
+}
\ No newline at end of file
diff --git a/apps/ledger-live-mobile/src/screens/Settings/Developer/CustomManifest.tsx b/apps/ledger-live-mobile/src/screens/Settings/Developer/CustomManifest.tsx
index a0ddb431bfa5..bedf4eb9c5c6 100644
--- a/apps/ledger-live-mobile/src/screens/Settings/Developer/CustomManifest.tsx
+++ b/apps/ledger-live-mobile/src/screens/Settings/Developer/CustomManifest.tsx
@@ -1,9 +1,14 @@
import React, { useState, useCallback, useLayoutEffect } from "react";
-import { TextInput, StyleSheet, TouchableOpacity, TouchableOpacityProps } from "react-native";
+import {
+ TextInput,
+ StyleSheet,
+ TouchableOpacity,
+ TouchableOpacityProps,
+ Alert,
+} from "react-native";
import { useTheme, CompositeScreenProps } from "@react-navigation/native";
import { useLocalLiveAppContext } from "@ledgerhq/live-common/wallet-api/LocalLiveAppProvider/index";
-import { Box, Text } from "@ledgerhq/native-ui";
-import NavigationScrollView from "~/components/NavigationScrollView";
+import { Box, Icons, Text } from "@ledgerhq/native-ui";
import { ScreenName } from "~/const";
import KeyboardView from "~/components/KeyboardView";
import ImportIcon from "~/icons/Import";
@@ -11,9 +16,7 @@ import type { SettingsNavigatorStackParamList } from "~/components/RootNavigator
import type { BaseNavigatorStackParamList } from "~/components/RootNavigator/types/BaseNavigator";
import type { StackNavigatorProps } from "~/components/RootNavigator/types/helpers";
import AppCard from "~/screens/Platform/Catalog/AppCard";
-import Plus from "~/icons/Plus";
import Trash from "~/icons/Trash";
-import { DEFAULT_MANIFEST } from "./manifests/metamask";
import { LAGADO_MANIFEST, LAGADO_MANIFEST_BUST, LAGADO_MANIFEST_NOCACHE } from "./manifests/lagado";
import {
ONEINCH_MANIFEST,
@@ -26,6 +29,8 @@ import {
HEADERS_MANIFEST_BUST,
HEADERS_MANIFEST_NOCACHE,
} from "./manifests/headerSniffer";
+import { ScrollView } from "react-native-gesture-handler";
+import Clipboard from "@react-native-clipboard/clipboard";
const DebuggerButton: React.ComponentType<{
onPress: TouchableOpacityProps["onPress"];
@@ -33,7 +38,7 @@ const DebuggerButton: React.ComponentType<{
}> = ({ onPress, text }) => {
const { colors } = useTheme();
return (
- <>
+
{text && (
{text}
@@ -42,7 +47,7 @@ const DebuggerButton: React.ComponentType<{
- >
+
);
};
@@ -53,7 +58,30 @@ const AddButton: React.ComponentType<{
const { colors } = useTheme();
return (
-
+
+
+ );
+};
+
+const DeleteTextButton: React.ComponentType<{
+ onPress: TouchableOpacityProps["onPress"];
+ disabled: boolean;
+}> = ({ onPress, disabled }) => {
+ const { colors } = useTheme();
+ return (
+
+
+
+ );
+};
+
+const PasteButton: React.ComponentType<{
+ onPress: TouchableOpacityProps["onPress"];
+}> = ({ onPress }) => {
+ const { colors } = useTheme();
+ return (
+
+
);
};
@@ -92,15 +120,31 @@ export default function CustomManifest({ navigation }: Props) {
useLayoutEffect(() => {
navigation.setOptions({
headerRight: () => (
-
- onChange(JSON.stringify(JSON.parse(DEFAULT_MANIFEST)))} />
-
+ {
+ const text = await Clipboard.getString();
+
+ setManifest(text);
+ }}
+ />
+ {
- manifest !== null && addLocalManifest(JSON.parse(manifest));
setManifest(null);
}}
/>
+ {
+ try {
+ manifest !== null && addLocalManifest(JSON.parse(manifest));
+ setManifest(null);
+ } catch (e) {
+ Alert.alert("Invalid JSON");
+ }
+ }}
+ />
),
});
@@ -108,30 +152,30 @@ export default function CustomManifest({ navigation }: Props) {
return (
-
+
<>
- {
- manifest !== null && addLocalManifest(JSON.parse(manifest));
- setManifest(null);
- }}
- />
-
+
+ {"Example Manifests"}
+
+ >
+ <>
+
onChange(JSON.stringify(JSON.parse(LAGADO_MANIFEST)))}
text="Lagado"
@@ -140,16 +184,19 @@ export default function CustomManifest({ navigation }: Props) {
onPress={() => onChange(JSON.stringify(JSON.parse(LAGADO_MANIFEST_BUST)))}
text="Lagado cachebust"
/>
+
+
onChange(JSON.stringify(JSON.parse(LAGADO_MANIFEST_NOCACHE)))}
text="Lagado nocache"
/>
-
-
+
onChange(JSON.stringify(JSON.parse(ONEINCH_MANIFEST)))}
text="1inch"
/>
+
+
onChange(JSON.stringify(JSON.parse(ONEINCH_MANIFEST_V3)))}
text="1inch v3"
@@ -158,16 +205,19 @@ export default function CustomManifest({ navigation }: Props) {
onPress={() => onChange(JSON.stringify(JSON.parse(ONEINCH_MANIFEST_BUST)))}
text="1inch cachebust"
/>
+
+
onChange(JSON.stringify(JSON.parse(ONEINCH_MANIFEST_NOCACHE)))}
text="1inch nocache"
/>
-
-
+
onChange(JSON.stringify(JSON.parse(HEADERS_MANIFEST)))}
text="Headers Sniffer"
/>
+
+
onChange(JSON.stringify(JSON.parse(HEADERS_MANIFEST_BUST)))}
text="Headers Sniffer cachebust"
@@ -180,6 +230,11 @@ export default function CustomManifest({ navigation }: Props) {
>
<>
+ {list.length > 0 && (
+
+ {"Loaded Manifests"}
+
+ )}
{list.map(m => {
return (
@@ -208,7 +263,7 @@ export default function CustomManifest({ navigation }: Props) {
);
})}
>
-
+
);
}
@@ -231,9 +286,12 @@ const styles = StyleSheet.create({
flex: 1,
borderWidth: 1,
marginBottom: 16,
+ height: 60,
+ marginHorizontal: 10,
+ padding: 5,
},
buttons: {
- paddingVertical: 8,
- paddingHorizontal: 8,
+ paddingVertical: 12,
+ paddingHorizontal: 12,
},
});
diff --git a/apps/ledger-live-mobile/src/screens/Settings/Developer/manifests/metamask.ts b/apps/ledger-live-mobile/src/screens/Settings/Developer/manifests/metamask.ts
deleted file mode 100644
index 8f6b5ffa4121..000000000000
--- a/apps/ledger-live-mobile/src/screens/Settings/Developer/manifests/metamask.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-export const DEFAULT_MANIFEST = `{
- "id": "metamask-test-dapsp",
- "name": "Metamask Test Dapp",
- "private": false,
- "url": "https://metamask.github.io/test-dapp/",
- "dapp": {
- "networks": [
- {
- "currency": "ethereum",
- "chainID": 1,
- "nodeURL": "https://eth-dapps.api.live.ledger.com"
- },
- {
- "currency": "bsc",
- "chainID": 56,
- "nodeURL": "https://bsc-dataseed.binance.org/"
- },
- {
- "currency": "polygon",
- "chainID": 137,
- "nodeURL": "https://polygon-mainnet.g.alchemy.com/v2/oPIxZM7kXsPVVY1Sk0kOQwkoIOpSu8PE"
- },
- {
- "currency": "arbitrum",
- "chainID": 42161,
- "nodeURL": "https://arb1.arbitrum.io/rpc"
- },
- {
- "currency": "optimism",
- "chainID": 10,
- "nodeURL": "https://mainnet.optimism.io"
- }
- ]
- },
- "homepageUrl": "https://metamask.github.io/test-dapp/",
- "icon": "https://cdn.live.ledger.com/icons/platform/1inch.png",
- "platforms": ["android", "ios", "desktop"],
- "apiVersion": "^2.0.0",
- "manifestVersion": "1",
- "branch": "stable",
- "categories": ["tools"],
- "currencies": ["ethereum", "bsc", "polygon", "arbitrum", "optimism"],
- "content": {
- "shortDescription": {
- "en": "Metamask Test Dapp"
- },
- "description": {
- "en": "Metamask Test Dapp"
- }
- },
- "permissions": [],
- "domains": ["http://", "https://"],
- "visibility": "complete"
-}`;