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 {
minSdkVersion 18
missingDimensionStrategy 'react-native-camera', 'general'
targetSdkVersion 28
versionCode 4302
versionName "4.3.2"
versionCode 4400
versionName "4.4.0"
ndk {
abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
}
......
......@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>4.3.2</string>
<string>4.4.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>4302</string>
<string>4400</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<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",
"version": "4.3.2-beta",
"version": "4.4.0-beta",
"private": true,
"license": "GPL-3.0",
"engines": {
......
......@@ -89,7 +89,9 @@ export default function AccountIcon(props: {
const styles = StyleSheet.create({
logo: {
alignItems: 'center',
height: 36,
justifyContent: 'center',
marginHorizontal: 2,
opacity: 0.7,
width: 36
......
......@@ -14,7 +14,7 @@
// 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, { ReactElement, useState } from 'react';
import React, { ReactElement, useMemo, useState } from 'react';
import { BackHandler, FlatList, FlatListProps } from 'react-native';
import { useFocusEffect } from '@react-navigation/native';
......@@ -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);
networkList.sort(sortNetworkKeys);
......
export const accountExistedError = 'account already existed';
export const accountExistedError = 'the path of the account already existed';
export const addressGenerateError =
'substrate address cannot be generated, please check suri and prefix';
export const identityUpdateError = 'current identity cannot be updated';
......
......@@ -172,14 +172,15 @@ export const getPathsWithSubstrateNetworkKey = (
networkKey: string
): string[] => {
const pathEntries = Array.from(identity.meta.entries());
const targetPathId = SUBSTRATE_NETWORK_LIST[networkKey]?.pathId;
const targetPathId =
SUBSTRATE_NETWORK_LIST[networkKey]?.pathId || unknownNetworkPathId;
const pathReducer = (
groupedPaths: string[],
[path, pathMeta]: [string, AccountMeta]
): string[] => {
let pathId;
if (!isSubstratePath(path)) return groupedPaths;
if (pathMeta.hasOwnProperty('networkPathId')) {
if (pathMeta.networkPathId !== undefined) {
pathId = pathMeta.networkPathId;
} else {
pathId = extractPathId(path);
......
......@@ -264,7 +264,7 @@ describe('IdentitiesUtils', () => {
it('group path under their network correctly, has no missing accounts', () => {
const mockIdentity = testIdentities[0];
const existedNetworks = getExistedNetworkKeys(mockIdentity);
const existedAccounts = mockIdentity.meta.size;
const existedAccountsSize = mockIdentity.meta.size;
const allListedAccounts = existedNetworks.reduce(
(acc: string[], networkKey: string) => {
......@@ -284,7 +284,7 @@ describe('IdentitiesUtils', () => {
},
[]
);
expect(existedAccounts).toEqual(allListedAccounts.length);
expect(existedAccountsSize).toEqual(allListedAccounts.length);
});
it('decides account is only with hard derivation', () => {
......
Markdown is supported
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