Unverified Commit 7284d150 authored by Hanwen Cheng's avatar Hanwen Cheng Committed by GitHub
Browse files

fix: unknown network accounts do not listed (#646)

* fix showing account with unknown network path id

* rephrase errors

* bump version to 4.4.0

* update ios bundle

* fix unit test
parent 5f650559
Pipeline #98232 failed with stages
in 2 minutes and 57 seconds
...@@ -136,8 +136,8 @@ android { ...@@ -136,8 +136,8 @@ android {
minSdkVersion 18 minSdkVersion 18
missingDimensionStrategy 'react-native-camera', 'general' missingDimensionStrategy 'react-native-camera', 'general'
targetSdkVersion 28 targetSdkVersion 28
versionCode 4302 versionCode 4400
versionName "4.3.2" versionName "4.4.0"
ndk { ndk {
abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64' abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
} }
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>4.3.2</string> <string>4.4.0</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>4302</string> <string>4400</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>
......
ios/assets/res/img/card_shadow.png

5.86 KB | W: | H:

ios/assets/res/img/card_shadow.png

5.83 KB | W: | H:

ios/assets/res/img/card_shadow.png
ios/assets/res/img/card_shadow.png
ios/assets/res/img/card_shadow.png
ios/assets/res/img/card_shadow.png
  • 2-up
  • Swipe
  • Onion skin
ios/assets/res/img/card_shadow@2x.png

3.51 KB | W: | H:

ios/assets/res/img/card_shadow@2x.png

19.7 KB | W: | H:

ios/assets/res/img/card_shadow@2x.png
ios/assets/res/img/card_shadow@2x.png
ios/assets/res/img/card_shadow@2x.png
ios/assets/res/img/card_shadow@2x.png
  • 2-up
  • Swipe
  • Onion skin
ios/assets/res/img/icon.png

34.1 KB | W: | H:

ios/assets/res/img/icon.png

30.9 KB | W: | H:

ios/assets/res/img/icon.png
ios/assets/res/img/icon.png
ios/assets/res/img/icon.png
ios/assets/res/img/icon.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
{ {
"name": "NativeSigner", "name": "NativeSigner",
"version": "4.3.2-beta", "version": "4.4.0-beta",
"private": true, "private": true,
"license": "GPL-3.0", "license": "GPL-3.0",
"engines": { "engines": {
......
...@@ -89,7 +89,9 @@ export default function AccountIcon(props: { ...@@ -89,7 +89,9 @@ export default function AccountIcon(props: {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
logo: { logo: {
alignItems: 'center',
height: 36, height: 36,
justifyContent: 'center',
marginHorizontal: 2, marginHorizontal: 2,
opacity: 0.7, opacity: 0.7,
width: 36 width: 36
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
import React, { ReactElement, useState } from 'react'; import React, { ReactElement, useMemo, useState } from 'react';
import { BackHandler, FlatList, FlatListProps } from 'react-native'; import { BackHandler, FlatList, FlatListProps } from 'react-native';
import { useFocusEffect } from '@react-navigation/native'; import { useFocusEffect } from '@react-navigation/native';
...@@ -231,7 +231,10 @@ export default function NetworkSelector({ ...@@ -231,7 +231,10 @@ export default function NetworkSelector({
} }
}; };
const availableNetworks = getExistedNetworkKeys(currentIdentity); const availableNetworks = useMemo(
() => getExistedNetworkKeys(currentIdentity),
[currentIdentity]
);
const networkList = Object.entries(NETWORK_LIST).filter(filterNetworkKeys); const networkList = Object.entries(NETWORK_LIST).filter(filterNetworkKeys);
networkList.sort(sortNetworkKeys); networkList.sort(sortNetworkKeys);
......
export const accountExistedError = 'account already existed'; export const accountExistedError = 'the path of the account already existed';
export const addressGenerateError = export const addressGenerateError =
'substrate address cannot be generated, please check suri and prefix'; 'substrate address cannot be generated, please check suri and prefix';
export const identityUpdateError = 'current identity cannot be updated'; export const identityUpdateError = 'current identity cannot be updated';
......
...@@ -172,14 +172,15 @@ export const getPathsWithSubstrateNetworkKey = ( ...@@ -172,14 +172,15 @@ export const getPathsWithSubstrateNetworkKey = (
networkKey: string networkKey: string
): string[] => { ): string[] => {
const pathEntries = Array.from(identity.meta.entries()); const pathEntries = Array.from(identity.meta.entries());
const targetPathId = SUBSTRATE_NETWORK_LIST[networkKey]?.pathId; const targetPathId =
SUBSTRATE_NETWORK_LIST[networkKey]?.pathId || unknownNetworkPathId;
const pathReducer = ( const pathReducer = (
groupedPaths: string[], groupedPaths: string[],
[path, pathMeta]: [string, AccountMeta] [path, pathMeta]: [string, AccountMeta]
): string[] => { ): string[] => {
let pathId; let pathId;
if (!isSubstratePath(path)) return groupedPaths; if (!isSubstratePath(path)) return groupedPaths;
if (pathMeta.hasOwnProperty('networkPathId')) { if (pathMeta.networkPathId !== undefined) {
pathId = pathMeta.networkPathId; pathId = pathMeta.networkPathId;
} else { } else {
pathId = extractPathId(path); pathId = extractPathId(path);
......
...@@ -264,7 +264,7 @@ describe('IdentitiesUtils', () => { ...@@ -264,7 +264,7 @@ describe('IdentitiesUtils', () => {
it('group path under their network correctly, has no missing accounts', () => { it('group path under their network correctly, has no missing accounts', () => {
const mockIdentity = testIdentities[0]; const mockIdentity = testIdentities[0];
const existedNetworks = getExistedNetworkKeys(mockIdentity); const existedNetworks = getExistedNetworkKeys(mockIdentity);
const existedAccounts = mockIdentity.meta.size; const existedAccountsSize = mockIdentity.meta.size;
const allListedAccounts = existedNetworks.reduce( const allListedAccounts = existedNetworks.reduce(
(acc: string[], networkKey: string) => { (acc: string[], networkKey: string) => {
...@@ -284,7 +284,7 @@ describe('IdentitiesUtils', () => { ...@@ -284,7 +284,7 @@ describe('IdentitiesUtils', () => {
}, },
[] []
); );
expect(existedAccounts).toEqual(allListedAccounts.length); expect(existedAccountsSize).toEqual(allListedAccounts.length);
}); });
it('decides account is only with hard derivation', () => { it('decides account is only with hard derivation', () => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment