Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mobile): Copy/paste mnemonic #817

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
a20e133
Merge pull request #339 from tonkeeper/develop
voloshinskii Apr 25, 2023
0570617
add tonApiV2Key (#340)
sorokin0andrey Apr 25, 2023
df6f87b
Bump(mobile): 3.1 (313)
sorokin0andrey Apr 25, 2023
6bc1802
hotfix: bounce pool address (#361)
sorokin0andrey May 17, 2023
93a92b6
fix(android): crash
bogoslavskiy May 17, 2023
a31c4c9
Merge branch 'develop'
bogoslavskiy Jun 14, 2023
93c2865
Merge branch 'release/3.3'
bogoslavskiy Jul 15, 2023
82acbd8
fix: build google play release without sensitive module
bogoslavskiy Aug 12, 2023
33bf927
bump(mobile): 3.3.1 351
bogoslavskiy Aug 12, 2023
f2a18c6
fix: script
bogoslavskiy Aug 12, 2023
c516ecd
feat(mobile): renew all domains
bogoslavskiy Aug 28, 2023
eb9d991
bump(mobile): 3.3.2 361
bogoslavskiy Aug 28, 2023
4e8e09f
fix(mobile): renew all domains
bogoslavskiy Aug 28, 2023
e6b29a5
bump(mobile): 3.3.2 362
bogoslavskiy Aug 28, 2023
70ee20e
chore(mobile): remove console.log
bogoslavskiy Aug 28, 2023
a863f81
fix(mobile): add delay
bogoslavskiy Aug 28, 2023
4bcfd67
bump(mobile): 3.3.2 363
bogoslavskiy Aug 28, 2023
8a070ab
fix(mobile): send pack messages
bogoslavskiy Aug 29, 2023
cc14bbd
fix(mobile): some fixes for renew all domains
bogoslavskiy Aug 30, 2023
df196df
bump(mobile): 3.3.2 364
bogoslavskiy Aug 30, 2023
fe98ec9
fix(mobile): translactions
bogoslavskiy Aug 30, 2023
dec5512
fix(mobile): add renew alert for collectibles tab
bogoslavskiy Aug 30, 2023
202f660
fix(mobile): some fixes
bogoslavskiy Aug 30, 2023
7cf38f1
bump(mobile): 3.3.2 365
bogoslavskiy Aug 30, 2023
29b2d08
fix(mobile): some fixes
bogoslavskiy Aug 31, 2023
dd53a8f
bump(mobile): 3.3.2 366
bogoslavskiy Aug 31, 2023
868a24f
fix(mobile): translations
bogoslavskiy Aug 31, 2023
b15e384
fix(mobile): translations
bogoslavskiy Sep 1, 2023
e50ae7f
bump(mobile): 3.3.2 367
bogoslavskiy Sep 1, 2023
a17700f
Merge pull request #477 from tonkeeper/release/3.3.2
bogoslavskiy Sep 5, 2023
71387de
fix(mobile): disable refresh browser when catch error
bogoslavskiy Sep 13, 2023
0e04193
bump(mobile): 3.3.3 369
bogoslavskiy Sep 13, 2023
c399472
Merge pull request #484 from tonkeeper/release/3.3.3
bogoslavskiy Sep 14, 2023
8da49a1
Merge branch 'main' into release/3.4
bogoslavskiy Sep 28, 2023
11b2dbc
fix(mobile): fixes after merge
bogoslavskiy Sep 28, 2023
7bab6bb
Merge pull request #559 from tonkeeper/release/3.4
bogoslavskiy Sep 28, 2023
d634064
Merge branch 'main' into release/3.4.1
sorokin0andrey Oct 5, 2023
f3a2e26
Merge branch 'main' into release/3.4.1
sorokin0andrey Oct 5, 2023
b9b1899
merge fixes
sorokin0andrey Oct 5, 2023
af37c5e
Merge pull request #593 from tonkeeper/release/3.4.1
sorokin0andrey Oct 9, 2023
5de10c5
Merge pull request #594 from tonkeeper/release/3.4.2
sorokin0andrey Oct 9, 2023
36b5423
Merge pull request #611 from tonkeeper/release/3.4.3
sorokin0andrey Oct 26, 2023
020addd
Merge pull request #622 from tonkeeper/release/3.4.4
sorokin0andrey Nov 1, 2023
b5d43af
Merge branch 'main' into release/3.6
sorokin0andrey Jan 31, 2024
8ab4535
Merge pull request #692 from tonkeeper/release/3.6
sorokin0andrey Jan 31, 2024
fab7c6e
Merge pull request #759 from tonkeeper/develop
sorokin0andrey Mar 11, 2024
e5a889c
fix(mobile): fix migration using biometry (#762)
voloshinskii Mar 12, 2024
f18d810
hotfix(mobile): race condition fix (#764)
voloshinskii Mar 18, 2024
0bbfc9c
Merge branch 'main' into release/4.1.0
voloshinskii Mar 26, 2024
354f581
fix(mobile): Restake banner hotfix for non-whitelisted pools
voloshinskii Mar 26, 2024
26603d1
fix(mobile): account delete feature resets only current wallet
voloshinskii Mar 26, 2024
172d1e2
bump(mobile): 4.1.1
voloshinskii Mar 26, 2024
19e93fc
fix(mobile): bypass unstake step if it's cooldown now too
voloshinskii Mar 26, 2024
f76e175
fix(mobile): Untake all for TF pool
voloshinskii Mar 26, 2024
0dcc6f7
fix(mobile): ➕ add 😧 scary 🥰🥰🥰 emojis
voloshinskii Mar 26, 2024
f361056
fix(mobile): fix interactions while closing modal (#778)
sorokin0andrey Mar 26, 2024
9206f74
fix line separator on Android, emojis on other locales
voloshinskii Mar 26, 2024
5efee9c
Fix android alert
voloshinskii Mar 27, 2024
46aaa33
fix(mobile): bunch of fixes for fake logout
voloshinskii Apr 5, 2024
f66f9c0
bump(mobile): 4.1.2
voloshinskii Apr 6, 2024
ee2d466
Merge pull request #779 from tonkeeper/release/4.1.0
sorokin0andrey Apr 8, 2024
723dbd1
Merge pull request #786 from tonkeeper/hotfix/4.1.2
sorokin0andrey Apr 8, 2024
e32fb15
Release 4.2.0 (#795)
voloshinskii Apr 12, 2024
eb7d0f9
Merge branch 'main' into release/4.3.0
sorokin0andrey Apr 25, 2024
a65aa45
Merge pull request #804 from tonkeeper/release/4.3.0
sorokin0andrey Apr 25, 2024
2dbb3d2
fix(mobile): Copy/paste mnemonic improvements
voloshinskii Apr 29, 2024
20388ad
bump(mobile): 4.4.0
voloshinskii Apr 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 433
versionName "4.3.0"
versionName "4.4.0"
missingDimensionStrategy 'react-native-camera', 'general'
missingDimensionStrategy 'store', 'play'
}
Expand Down
4 changes: 2 additions & 2 deletions packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.3.0;
MARKETING_VERSION = 4.4.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -1332,7 +1332,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.3.0;
MARKETING_VERSION = 4.4.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
import React, { FC, useCallback, useMemo, useRef, useState } from 'react';
import Animated, {
useAnimatedScrollHandler,
useAnimatedStyle,
useSharedValue,
withTiming,
} from 'react-native-reanimated';
import { TapGestureHandler } from 'react-native-gesture-handler';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { useDispatch } from 'react-redux';

import { deviceHeight, isAndroid, ns, parseLockupConfig } from '$utils';
import { InputItem } from './InputItem';
import { Button, Input, NavBarHelper, Text } from '$uikit';
import { Input, NavBarHelper, Text, Button } from '$uikit';
import * as S from './ImportWalletForm.style';
import { useReanimatedKeyboardHeight } from '$hooks/useKeyboardHeight';
import { ImportWalletFormProps } from './ImportWalletForm.interface';
import { useInputsRegistry } from './useInputRegistry';
import { WordHintsPopup, WordHintsPopupRef } from './WordHintsPopup';
import { Keyboard } from 'react-native';
import { Keyboard, KeyboardAvoidingView } from 'react-native';
import { wordlist } from '$libs/Ton/mnemonic/wordlist';
import { Toast } from '$store';
import { t } from '@tonkeeper/shared/i18n';
import { Steezy, Button as ButtonNew } from '@tonkeeper/uikit';
import Clipboard from '@react-native-community/clipboard';

export const ImportWalletForm: FC<ImportWalletFormProps> = (props) => {
const { onWordsFilled } = props;


const { bottom: bottomInset } = useSafeAreaInsets();
const dispatch = useDispatch();
const inputsRegistry = useInputsRegistry();
Expand All @@ -36,6 +39,7 @@ export const ImportWalletForm: FC<ImportWalletFormProps> = (props) => {
const [isConfigInputShown, setConfigInputShown] = useState(false);
const [config, setConfig] = useState('');
const [isRestoring, setRestoring] = useState(false);
const hasTouchedInputs = useSharedValue(false);

const deferredScrollToInput = useRef<((offset: number) => void) | null>(null);
const { keyboardHeight } = useReanimatedKeyboardHeight({
Expand All @@ -57,8 +61,17 @@ export const ImportWalletForm: FC<ImportWalletFormProps> = (props) => {
setConfig(text);
}, []);

const pasteButtonStyle = useAnimatedStyle(
() => ({
opacity: withTiming(hasTouchedInputs.value ? 0 : 1, { duration: 200 }),
}),
[],
);

const handleMultipleWords = useCallback((index: number, text: string) => {
hasTouchedInputs.value = true;
const words = text
.replace(/\r\n|\r|\n/g, ' ')
.split(' ')
.map((word) => word.trim())
.filter((word) => word.length > 0);
Expand All @@ -77,6 +90,16 @@ export const ImportWalletForm: FC<ImportWalletFormProps> = (props) => {
}
}, []);

const handlePasteButton = useCallback(async () => {
if (hasTouchedInputs.value) {
return;
}
const maybePhrase = await Clipboard.getString();
if (maybePhrase.replace(/\r\n|\r|\n/g, ' ').split(' ').length === 24) {
handleMultipleWords(0, maybePhrase);
}
}, [handleMultipleWords]);

const handleSpace = useCallback((index: number) => {
if (index === 24) {
return;
Expand Down Expand Up @@ -185,6 +208,7 @@ export const ImportWalletForm: FC<ImportWalletFormProps> = (props) => {

const handleChangeText = useCallback(
(index: number) => (text: string) => {
hasTouchedInputs.value = true;
const overlap = 10;
const offsetTop = inputsRegistry.getPosition(index) + S.INPUT_HEIGHT - overlap;
const contentWidth = isAndroid ? 0 : inputsRegistry.getContentWidth(index);
Expand Down Expand Up @@ -269,6 +293,31 @@ export const ImportWalletForm: FC<ImportWalletFormProps> = (props) => {
</Button>
</S.ButtonWrap>
</Animated.ScrollView>
<KeyboardAvoidingView>
<Animated.View
style={[
styles.pasteButtonContainer.static,
{ bottom: bottomInset + 16 },
pasteButtonStyle,
]}
>
<ButtonNew
onPress={handlePasteButton}
color="tertiary"
size="medium"
title={t('paste')}
/>
</Animated.View>
</KeyboardAvoidingView>
</>
);
};

const styles = Steezy.create({
pasteButtonContainer: {
position: 'absolute',
left: 0,
right: 0,
alignItems: 'center',
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export const InputItem = forwardRef<InputItemRef, InputItemProps>((props, ref) =
const handleChangeText = useCallback(
(text) => {
let newText = text.trim();
newText = newText.replace(/\r\n|\r|\n/g, ' ');

if (newText.split(' ').length > 1) {
onMultipleWords(index, newText);
} else if (text.slice(-1) === ' ') {
Expand Down
Loading