Unverified Commit f29204bb authored by Hanwen Cheng's avatar Hanwen Cheng Committed by GitHub

feat: Network settings display (#668)

* update dependencies

* add network related screens and components

* finish network basic display screens

* fix android build for vector icons upgrade

* rename derivation network selector to prevent duplication

* fix network sorting and renaming

* make lint happy

* align to the left

* remove clickable header, and update the text in path secret

* Update NetworkContext.ts

* Update NetworkContext.ts
parent 98dc0259
Pipeline #103329 failed with stages
in 3 minutes and 4 seconds
......@@ -261,3 +261,7 @@ task copyDownloadableDepsToLibs(type: Copy) {
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
project.ext.vectoricons = [
iconFontNames: [ 'MaterialIcons.ttf', 'MaterialCommunityIcons.ttf', 'AntDesign.ttf', 'FontAwesome.ttf', 'Feather.ttf' ] // Name of the font files you want to copy
]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
......
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
......
......@@ -233,15 +233,15 @@ PODS:
- React-cxxreact (= 0.62.2)
- React-jsi (= 0.62.2)
- React-jsinspector (0.62.2)
- react-native-camera (3.21.0):
- react-native-camera (3.35.0):
- React
- react-native-camera/RCT (= 3.21.0)
- react-native-camera/RN (= 3.21.0)
- react-native-camera/RCT (3.21.0):
- react-native-camera/RCT (= 3.35.0)
- react-native-camera/RN (= 3.35.0)
- react-native-camera/RCT (3.35.0):
- React
- react-native-camera/RN (3.21.0):
- react-native-camera/RN (3.35.0):
- React
- react-native-netinfo (5.9.3):
- react-native-netinfo (5.9.5):
- React
- react-native-randombytes (3.5.3):
- React
......@@ -312,15 +312,15 @@ PODS:
- React
- RNCMaskedView (0.1.10):
- React
- RNGestureHandler (1.6.0):
- RNGestureHandler (1.7.0):
- React
- RNScreens (2.0.0-alpha.32):
- RNScreens (2.9.0):
- React
- RNSecureStorage (1.0.1):
- React
- RNSVG (12.1.0):
- React
- RNVectorIcons (6.6.0):
- RNVectorIcons (7.0.0):
- React
- Yoga (1.14.0)
- YogaKit (1.18.1):
......@@ -504,8 +504,8 @@ SPEC CHECKSUMS:
React-jsi: b6dc94a6a12ff98e8877287a0b7620d365201161
React-jsiexecutor: 1540d1c01bb493ae3124ed83351b1b6a155db7da
React-jsinspector: 512e560d0e985d0e8c479a54a4e5c147a9c83493
react-native-camera: 4e12e877b8fef60b0914a49c942a0f32479e5b50
react-native-netinfo: 1b8691be19549f020d0757b40aca4f355cafeeec
react-native-camera: d9e7b66e40420dcef111f3265a00f01eea54c52c
react-native-netinfo: a53b00d949b6456913aaf507d9dba90c4008c611
react-native-randombytes: 3638d24759d67c68f6ccba60c52a7a8a8faa6a23
react-native-safe-area-context: e200d4433aba6b7e60b52da5f37af11f7a0b0392
react-native-substrate-sign: 646f9915990e3930829d34dafaeb8d00825b02a2
......@@ -521,11 +521,11 @@ SPEC CHECKSUMS:
ReactCommon: ed4e11d27609d571e7eee8b65548efc191116eb3
RNCAsyncStorage: d059c3ee71738c39834a627476322a5a8cd5bf36
RNCMaskedView: 5a8ec07677aa885546a0d98da336457e2bea557f
RNGestureHandler: dde546180bf24af0b5f737c8ad04b6f3fa51609a
RNScreens: a55364dc1833101f836cee70975ce1fea615a12f
RNGestureHandler: b6b359bb800ae399a9c8b27032bdbf7c18f08a08
RNScreens: c526239bbe0e957b988dacc8d75ac94ec9cb19da
RNSecureStorage: af0099b5b9f3c41692848b7778fe98b4a6b0358d
RNSVG: ce9d996113475209013317e48b05c21ee988d42e
RNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4
RNVectorIcons: da6fe858f5a65d7bbc3379540a889b0b12aa5976
Yoga: 3ebccbdd559724312790e7742142d062476b698e
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
......
......@@ -27,7 +27,6 @@ import Separator from 'components/Separator';
import { NETWORK_LIST, NetworkProtocols } from 'constants/networkSpecs';
import fontStyles from 'styles/fontStyles';
import colors from 'styles/colors';
import { NetworkParams } from 'types/networkSpecsTypes';
import { ButtonListener } from 'types/props';
const CardSeparator = (): ReactElement => (
......@@ -41,18 +40,12 @@ const CardSeparator = (): ReactElement => (
/>
);
const NetworkFooter = ({
networkColor,
network
}: {
networkColor: string;
network: NetworkParams;
}): React.ReactElement => (
const NetworkFooter = ({ color }: { color: string }): React.ReactElement => (
<View
style={[
styles.footer,
{
backgroundColor: networkColor || network.color
backgroundColor: color
}
]}
/>
......@@ -69,7 +62,7 @@ export function NetworkCard({
isAdd?: boolean;
networkColor?: string;
networkKey?: string;
onPress: ButtonListener;
onPress?: ButtonListener;
testID?: string;
title: string;
}): ReactElement {
......@@ -77,9 +70,9 @@ export function NetworkCard({
networkKey !== undefined
? NETWORK_LIST[networkKey]
: NETWORK_LIST[NetworkProtocols.UNKNOWN];
const isDisabled = onPress === undefined;
return (
<TouchableItem testID={testID} disabled={false} onPress={onPress}>
<TouchableItem testID={testID} disabled={isDisabled} onPress={onPress}>
<CardSeparator />
<View style={styles.content}>
{isAdd ? (
......@@ -99,10 +92,7 @@ export function NetworkCard({
<View style={styles.desc}>
<AccountPrefixedTitle title={title} />
</View>
<NetworkFooter
network={network}
networkColor={networkColor ?? network.color}
/>
<NetworkFooter color={networkColor ?? network.color} />
</View>
</TouchableItem>
);
......@@ -161,7 +151,7 @@ export default function AccountCard({
<Address address={address} protocol={network.protocol} />
)}
</View>
<NetworkFooter network={network} networkColor={network.color} />
<NetworkFooter color={network.color} />
</View>
</TouchableItem>
);
......
......@@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
'use strict';
import React from 'react';
import {
Image,
......@@ -48,7 +46,7 @@ if (!__DEV__) {
excludedNetworks.push(SubstrateNetworkKeys.KUSAMA_DEV);
}
export function NetworkSelector({
export function DerivationNetworkSelector({
networkKey,
setVisible
}: {
......
......@@ -150,6 +150,10 @@ function IdentitiesSwitch({}: {}): React.ReactElement {
textStyle={fontStyles.t_big}
style={styles.indentedButton}
/>
<ButtonWithArrow
title="Network Settings"
onPress={(): void => closeModalAndNavigate('NetworkSettings')}
/>
<ButtonWithArrow
title="Terms and Conditions"
onPress={(): void => closeModalAndNavigate('TermsAndConditions')}
......
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
......@@ -22,6 +22,7 @@ import { Icon } from 'react-native-elements';
import ButtonIcon from './ButtonIcon';
import AccountIcon from './AccountIcon';
import TouchableItem from 'components/TouchableItem';
import testIDs from 'e2e/testIDs';
import { NETWORK_LIST } from 'constants/networkSpecs';
import fontStyles from 'styles/fontStyles';
......@@ -95,13 +96,15 @@ export function LeftScreenHeading({
subtitle,
hasSubtitleIcon,
headMenu,
networkKey
networkKey,
onPress
}: {
title: string;
subtitle?: string;
hasSubtitleIcon?: boolean;
headMenu?: React.ReactElement;
networkKey: string;
onPress?: () => any;
}): ReactElement {
const titleStyle: TextStyle = {
...fontStyles.h2,
......@@ -112,8 +115,13 @@ export function LeftScreenHeading({
...baseStyles.text,
...baseStyles.t_left
};
const isDisabled = onPress === undefined;
return (
<View style={baseStyles.bodyWithIcon}>
<TouchableItem
style={baseStyles.bodyWithIcon}
onPress={onPress}
disabled={isDisabled}
>
<View style={{ alignItems: 'center', flexDirection: 'row' }}>
<AccountIcon
address={''}
......@@ -128,7 +136,7 @@ export function LeftScreenHeading({
</View>
</View>
{headMenu}
</View>
</TouchableItem>
);
}
......
......@@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
'use strict';
import React from 'react';
import {
Modal,
......
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
export default {
ethClassic:
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB5CAYAAADyOOV3AAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAmUSURBVHgB7Z09cBNHFMef/IWxLRDQmI/i6CjtjlLuQgcd6ewyFXaVUGGqlMZdOpsqUOFUSSpERyqcLl2UGQwOMBNhAwMG7PyfuYMdcR97n/t2db8ZjWTrJNnae+9+u/v2jqimpqampqampqampqamZnAYpgHizJkzN44fP97Y2dnpUo1bTE9Pe2fPnv0Pt/s0QAxMBCNyV3B3ETdvamrq5atXrx7SANCgAeD06dOXh4aG7im/6r1+/fp8D5DjDNEAgMZd6ftVa3JycoUGAOcbmMUKd17IU/Pnzp1rk+M43cAsVo1GYzHq+YODA+ej2GnJUsQqiulms9nY3d3tkKM4K1khYhVF7+PHj7Pb29tdchBnU3SIWEXRSrGtdTjZwDFiFQqO05ddFS7nUjSL1fDw8CM8bFE6uugbz7rWN3YugtG4HL1pG5fxJiYmFskxnIpgjDPP426NsuOccLkWwTcoHy1kgDw7iDicaeC0YhVD2yXhciJF+2L1NxWHM8LlRAT7YlUkzgiX9RFcgFhFAuE6b7twuRDBRUfvZ1wQLqsbuECxiqLNY9pkMdam6BLEKgqrhcvaCC5BrKLwJicnq/qswrEygssUqxhmt7a2NskybI1gExFl5ZSidRUdLFY8vUfVY2W5rVUpukKxisK6clurUnSFYhVFyzbhsiaCDYlVKDhEzD1+/LhDFmBTBIuJnIODA2ui2ArJMihWUVgjXOJTdFFihajrDg0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K/sV9EDmxerMAkQYouK+xQk6y8DhgNh4UbWMnd5UhgiZYGTV4t6pQ2Ex/Cwc44YLQ8evCG8Dh8mLlBFZlGkHgkmNI7H6CGIhKp7rWeX33QwcG5CUEbeyD0FGYBnCGpaxemKDXAO03zthcw5oFTUrPAwcJgVKztKIEUKGYIYguYJ7DiN9KDmgLfnuSzC96FBn2d6jRcgQzARM6MzUYrQPuVpwdx6CVQ8OHQ8mRYawDMGeRLlBTmE0CVTyyIc88VEDx8KejfD3UQPhQLBDkJ9k7otQS9UzSh5gVINhSDZFhggZgr0HCoCBELKVki9i+tA7+CWPnJFv/xsMisaK8jKsl85a1CYtRMYHf5H0rhGXAsQhUpU1CNOLHpWXXNFA23xE6kNpEnm8UvgSx2bgMDTx+KXJLdtldOflO+kPe3IeOUVnczgWA4cD4fngb6XzlEADSjrrXuhXzC42xGA98Zo9TSMAQzS/DrARucyXl9wkccgVPENnFTGqZMfQpfq2ZwiZxCEMnCrjeT24ZYjX6989y3gh2AzRhJkGLpXx2LBbYe3quS+8yVRKL3qlaqsx08CojWKwvR/cMoRn7KyTJwYmQwxhNkUvsh9sL51VzxUYyQ+ncJQ6m8OxJjpagVhV90Z5rJ6a9OIhtxMncdsNbDNEXppuJ0+I0UqSO44hDu6BTTPqaxZm56iPRmdzuG0rOKazM3PUgHt6kYnbZOBFrioxs3PUALWMNwu3wcAYbLykzVNnF5lcxpuF27KC9c04s3V2K75ZNnfclTCpFQcv483CKRrYGlYp99N64WcYdSt3BH8BpeBSEQ3jqykAAAAASUVORK5CYII='
};
......@@ -25,26 +25,20 @@ import {
export const unknownNetworkPathId = '';
export const NetworkProtocols: {
[key: string]: NetworkProtocol;
} = Object.freeze({
export const NetworkProtocols: Record<string, NetworkProtocol> = Object.freeze({
ETHEREUM: 'ethereum',
SUBSTRATE: 'substrate',
UNKNOWN: 'unknown'
});
// accounts for which the network couldn't be found (failed migration, removed network)
export const UnknownNetworkKeys: {
[key: string]: string;
} = Object.freeze({
export const UnknownNetworkKeys: Record<string, string> = Object.freeze({
UNKNOWN: 'unknown'
});
// ethereumChainId is used as Network key for Ethereum networks
/* eslint-disable sort-keys */
export const EthereumNetworkKeys: {
[key: string]: string;
} = Object.freeze({
export const EthereumNetworkKeys: Record<string, string> = Object.freeze({
FRONTIER: '1',
ROPSTEN: '3',
RINKEBY: '4',
......@@ -56,9 +50,7 @@ export const EthereumNetworkKeys: {
/* eslint-enable sort-keys */
// genesisHash is used as Network key for Substrate networks
export const SubstrateNetworkKeys: {
[key: string]: string;
} = Object.freeze({
export const SubstrateNetworkKeys: Record<string, string> = Object.freeze({
CENTRIFUGE:
'0x67dddf2673b69e5f875f6f25277495834398eafd67f492e09f3f3345e003d1b5', // https://portal.chain.centrifuge.io/#/explorer/query/0
CENTRIFUGE_AMBER:
......@@ -78,7 +70,7 @@ export const SubstrateNetworkKeys: {
WESTEND: '0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e'
});
const unknownNetworkBase: { [key: string]: UnknownNetworkParams } = {
const unknownNetworkBase: Record<string, UnknownNetworkParams> = {
[UnknownNetworkKeys.UNKNOWN]: {
color: colors.signal.error,
order: 99,
......@@ -90,9 +82,7 @@ const unknownNetworkBase: { [key: string]: UnknownNetworkParams } = {
}
};
const substrateNetworkBase: {
[key: string]: Partial<SubstrateNetworkParams>;
} = {
const substrateNetworkBase: Record<string, Partial<SubstrateNetworkParams>> = {
[SubstrateNetworkKeys.CENTRIFUGE]: {
color: '#FCC367',
decimals: 18,
......@@ -202,7 +192,7 @@ const substrateNetworkBase: {
}
};
const ethereumNetworkBase: { [key: string]: Partial<EthereumNetworkParams> } = {
const ethereumNetworkBase: Record<string, Partial<EthereumNetworkParams>> = {
[EthereumNetworkKeys.FRONTIER]: {
color: '#8B94B3',
ethereumChainId: EthereumNetworkKeys.FRONTIER,
......@@ -264,15 +254,18 @@ function setDefault(
}, {});
}
export const ETHEREUM_NETWORK_LIST: {
[key: string]: EthereumNetworkParams;
} = Object.freeze(setDefault(ethereumNetworkBase, ethereumDefaultValues));
export const SUBSTRATE_NETWORK_LIST: {
[key: string]: SubstrateNetworkParams;
} = Object.freeze(setDefault(substrateNetworkBase, substrateDefaultValues));
export const UNKNOWN_NETWORK: {
[key: string]: UnknownNetworkParams;
} = Object.freeze(unknownNetworkBase);
export const ETHEREUM_NETWORK_LIST: Record<
string,
EthereumNetworkParams
> = Object.freeze(setDefault(ethereumNetworkBase, ethereumDefaultValues));
export const SUBSTRATE_NETWORK_LIST: Record<
string,
SubstrateNetworkParams
> = Object.freeze(setDefault(substrateNetworkBase, substrateDefaultValues));
export const UNKNOWN_NETWORK: Record<
string,
UnknownNetworkParams
> = Object.freeze(unknownNetworkBase);
const substrateNetworkMetas = Object.values({
...SUBSTRATE_NETWORK_LIST,
......@@ -282,7 +275,7 @@ export const PATH_IDS_LIST = substrateNetworkMetas.map(
(meta: UnknownNetworkParams | SubstrateNetworkParams) => meta.pathId
);
export const NETWORK_LIST: { [key: string]: NetworkParams } = Object.freeze(
export const NETWORK_LIST: Record<string, NetworkParams> = Object.freeze(
Object.assign(
{},
SUBSTRATE_NETWORK_LIST,
......
......@@ -18,14 +18,11 @@ import React, { ReactElement, useContext, useMemo, useState } from 'react';
import { BackHandler, FlatList, FlatListProps } from 'react-native';
import { useFocusEffect } from '@react-navigation/native';
import { NETWORK_LIST } from 'constants/networkSpecs';
import { filterSubstrateNetworks } from 'modules/network/utils';
import { NetworkCard } from 'components/AccountCard';
import { SafeAreaViewContainer } from 'components/SafeAreaContainer';
import ScreenHeading, { IdentityHeading } from 'components/ScreenHeading';
import {
NETWORK_LIST,
SubstrateNetworkKeys,
UnknownNetworkKeys
} from 'constants/networkSpecs';
import testIDs from 'e2e/testIDs';
import { AlertStateContext } from 'stores/alertContext';
import colors from 'styles/colors';
......@@ -48,15 +45,6 @@ import {
import { useSeedRef } from 'utils/seedRefHooks';
import QrScannerTab from 'components/QrScannerTab';
const excludedNetworks = [
UnknownNetworkKeys.UNKNOWN,
SubstrateNetworkKeys.KUSAMA_CC2
];
if (!__DEV__) {
excludedNetworks.push(SubstrateNetworkKeys.SUBSTRATE_DEV);
excludedNetworks.push(SubstrateNetworkKeys.KUSAMA_DEV);
}
function NetworkSelector({
accountsStore,
navigation,
......@@ -94,30 +82,6 @@ function NetworkSelector({
params: { parentPath: '' }
});
const sortNetworkKeys = (
[, params1]: [any, NetworkParams],
[, params2]: [any, NetworkParams]
): number => {
if (params1.order > params2.order) {
return 1;
} else if (params1.order < params2.order) {
return -1;
} else {
return 0;
}
};
const filterNetworkKeys = ([networkKey]: [string, any]): boolean => {
const shouldExclude = excludedNetworks.includes(networkKey);
if (isNew && !shouldExclude) return true;
if (shouldShowMoreNetworks) {
if (shouldExclude) return false;
return !availableNetworks.includes(networkKey);
}
return availableNetworks.includes(networkKey);
};
const deriveSubstrateNetworkRootPath = async (
networkKey: string,
networkParams: SubstrateNetworkParams
......@@ -216,8 +180,20 @@ function NetworkSelector({
() => getExistedNetworkKeys(currentIdentity),
[currentIdentity]
);
const networkList = Object.entries(NETWORK_LIST).filter(filterNetworkKeys);
networkList.sort(sortNetworkKeys);
const networkList = useMemo(
() =>
filterSubstrateNetworks(NETWORK_LIST, (networkKey, shouldExclude) => {
if (isNew && !shouldExclude) return true;
if (shouldShowMoreNetworks) {
if (shouldExclude) return false;
return !availableNetworks.includes(networkKey);
}
return availableNetworks.includes(networkKey);
}),
[availableNetworks, isNew, shouldShowMoreNetworks]
);
const renderNetwork = ({
item
......
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import colors from 'styles/colors';
import fontStyles from 'styles/fontStyles';
export default function NetworkInfoCard(props: {
text: string;
label: string;
small?: boolean;
}): React.ReactElement {
const { label, small, text } = props;
return (
<View style={styles.body}>
<View style={styles.label}>
<Text style={fontStyles.t_important}>{label}</Text>
</View>
<View style={styles.content}>
<Text style={small ? fontStyles.t_codeS : fontStyles.t_code}>
{text}
</Text>
</View>
</View>
);
}
const styles = StyleSheet.create({
body: {
backgroundColor: colors.background.app,
flexDirection: 'row'
},
content: {
alignItems: 'flex-start',
flex: 3,
justifyContent: 'center',
padding: 20
},
label: {
alignItems: 'flex-start',
flex: 1,
justifyContent: 'center',
padding: 20
}
});
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import React from 'react';
import { NetworkCard } from 'components/AccountCard';
import NetworkInfoCard from 'modules/network/components/NetworkInfoCard';
import { SafeAreaScrollViewContainer } from 'components/SafeAreaContainer';
import { SUBSTRATE_NETWORK_LIST } from 'constants/networkSpecs';
import { NavigationProps } from 'types/props';
import { getNetworkKeyByPathId } from 'utils/identitiesUtils';
export default function NetworkDetails({
route
}: NavigationProps<'NetworkDetails'>): React.ReactElement {
const networkPathId = route.params.pathId;
const networkKey = getNetworkKeyByPathId(networkPathId);
const networkParams = SUBSTRATE_NETWORK_LIST[networkKey];
return (
<SafeAreaScrollViewContainer>
<NetworkCard
networkKey={networkParams.genesisHash}
title={networkParams.title}