Skip to content

Commit

Permalink
Merge branch 'fix/seed' into tmp/20241220
Browse files Browse the repository at this point in the history
  • Loading branch information
heisenberg-2077 committed Dec 18, 2024
2 parents 9fef7a7 + 25885f9 commit 0cbe1f3
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 24 deletions.
4 changes: 2 additions & 2 deletions apps/mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ android {
applicationId "com.debank.rabbymobile"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 100043
versionName "0.5.1"
versionCode 100044
versionName "0.5.2"
}
splits {
abi {
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/ios/RabbyMobile/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.5.1</string>
<string>0.5.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/ios/RabbyMobileTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.5.1</string>
<string>0.5.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rabby-mobile",
"version": "0.5.1",
"version": "0.5.2",
"private": true,
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions apps/mobile/src/changeLogs/0.5.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Features

- Added support to pin addresses on the homepage
- Added support to view token details, including price and price chart, when tapping a token
- Optimized the "Receive" feature
33 changes: 21 additions & 12 deletions apps/mobile/src/components/HDSetting/SettingHDKeyring.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ import { LedgerHDPathType } from '@rabby-wallet/eth-keyring-ledger/dist/utils';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { MainContainer, settingAtom } from './MainContainer';
import { requestKeyring } from '@/core/apis/keyring';
import { KEYRING_CLASS } from '@rabby-wallet/keyring-utils';
import { useAtom } from 'jotai';
import { apiMnemonic } from '@/core/apis';

export const SettingHDKeyring: React.FC<{
onDone: () => void;
mnemonics: string;
passphrase: string;
keyringId: number;
}> = ({ onDone, keyringId }) => {
}> = ({ onDone, mnemonics, passphrase }) => {
const { t } = useTranslation();
const [setting, setSetting] = useAtom(settingAtom);

Expand Down Expand Up @@ -45,19 +43,30 @@ export const SettingHDKeyring: React.FC<{
[t],
);

const mnemonicKeyringRef = React.useRef<
ReturnType<typeof apiMnemonic.getKeyringByMnemonic> | undefined
>(undefined);
const getMnemonicKeyring = React.useCallback(() => {
if (mnemonics) {
if (!mnemonicKeyringRef.current) {
mnemonicKeyringRef.current = apiMnemonic.getKeyringByMnemonic(
mnemonics!,
passphrase!,
);
}
return mnemonicKeyringRef.current;
}
return undefined;
}, [mnemonics, passphrase]);

const handleConfirm = React.useCallback(
async value => {
await requestKeyring(
KEYRING_CLASS.MNEMONIC,
'setHDPathType',
keyringId || null,
value.hdPath,
);

const keyring = await getMnemonicKeyring();
await keyring?.setHDPathType(value.hdPath);
setSetting(value);
onDone?.();
},
[keyringId, onDone, setSetting],
[getMnemonicKeyring, onDone, setSetting],
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ export const ImportMoreAddress: React.FC<Props> = ({ params, onCancel }) => {
async (index: number) => {
const res =
params.type === KEYRING_TYPE.HdKeyring
? await apiKeyring.requestKeyring(
KEYRING_TYPE.HdKeyring,
'getAddresses',
params?.keyringId ?? null,
? await getMnemonicKeyring()?.getAddresses(
index,
index + stepCountRef.current,
)
Expand Down Expand Up @@ -171,7 +168,7 @@ export const ImportMoreAddress: React.FC<Props> = ({ params, onCancel }) => {
});
}
},
[apiHD, params?.keyringId, params.type],
[apiHD, getMnemonicKeyring, params.type],
);

const handleLoadAddress = React.useCallback(async () => {
Expand Down Expand Up @@ -384,9 +381,22 @@ export const ImportMoreAddress: React.FC<Props> = ({ params, onCancel }) => {
onDone: () => {
removeGlobalBottomSheetModal2024(id);
},
...(params.type ? { keyringId: params.keyringId } : {}),
...(params.type
? {
keyringId: params.keyringId,
mnemonics: params.mnemonics,
passphrase: params.passphrase,
}
: {}),
});
}, [params.brand, params.keyringId, params.type, settingModalName]);
}, [
params.brand,
params.keyringId,
params.mnemonics,
params.passphrase,
params.type,
settingModalName,
]);

return (
<View style={styles.root}>
Expand Down

0 comments on commit 0cbe1f3

Please sign in to comment.