From 2e4f4ee13c274bc285291f04c05d7ee023f4c93d Mon Sep 17 00:00:00 2001 From: Andrey Sorokin Date: Wed, 11 Oct 2023 01:04:57 +0600 Subject: [PATCH 1/8] fix(mobile): update balances on transaction event (#596) --- .../Send/steps/ConfirmStep/ConfirmStep.tsx | 14 ++++++-- .../mobile/src/hooks/useBalanceUpdater.ts | 35 +++++++++++++++++++ .../MainStack/TabStack/TabStack.tsx | 2 ++ packages/mobile/src/store/wallet/index.ts | 2 +- packages/mobile/src/store/wallet/sagas.ts | 3 +- 5 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 packages/mobile/src/hooks/useBalanceUpdater.ts diff --git a/packages/mobile/src/core/Send/steps/ConfirmStep/ConfirmStep.tsx b/packages/mobile/src/core/Send/steps/ConfirmStep/ConfirmStep.tsx index cc2580eaf..709896fba 100644 --- a/packages/mobile/src/core/Send/steps/ConfirmStep/ConfirmStep.tsx +++ b/packages/mobile/src/core/Send/steps/ConfirmStep/ConfirmStep.tsx @@ -4,7 +4,7 @@ import { BottomButtonWrapHelper, StepScrollView } from '$shared/components'; import { CryptoCurrencies, CryptoCurrency, Decimals } from '$shared/constants'; import { getTokenConfig } from '$shared/dynamicConfig'; import { Highlight, Icon, Separator, Spacer, StakedTonIcon, Text } from '$uikit'; -import { isIOS, parseLocaleNumber } from '$utils'; +import { parseLocaleNumber } from '$utils'; import React, { FC, memo, useCallback, useEffect, useMemo } from 'react'; import { ConfirmStepProps } from './ConfirmStep.interface'; import * as S from './ConfirmStep.style'; @@ -20,11 +20,11 @@ import { Alert } from 'react-native'; import { walletBalancesSelector, walletWalletSelector } from '$store/wallet'; import { useSelector } from 'react-redux'; import { SkeletonLine } from '$uikit/Skeleton/SkeletonLine'; -import { useStakingStore } from '$store'; import { t } from '@tonkeeper/shared/i18n'; import { openInactiveInfo } from '$core/ModalContainer/InfoAboutInactive/InfoAboutInactive'; import { Address } from '@tonkeeper/core'; -import { getImplementationIcon } from '$utils/staking'; +import { useNavigation } from '@tonkeeper/router'; +import { TabsStackRouteNames } from '$navigation'; const ConfirmStepComponent: FC = (props) => { const { @@ -50,6 +50,8 @@ const ConfirmStepComponent: FC = (props) => { const copyText = useCopyText(); + const nav = useNavigation(); + const balances = useSelector(walletBalancesSelector); const wallet = useSelector(walletWalletSelector); @@ -129,6 +131,11 @@ const ConfirmStepComponent: FC = (props) => { sendTx, ]); + const handleCloseModal = useCallback(() => { + nav.goBack(); + nav.navigate(TabsStackRouteNames.Activity); + }, [nav]); + const feeCurrency = useMemo(() => { const tokenConfig = getTokenConfig(currency as CryptoCurrency); if (currency === 'usdt') { @@ -350,6 +357,7 @@ const ConfirmStepComponent: FC = (props) => { withCloseButton={false} confirmTitle={t('confirm_sending_submit')} onPressConfirm={handleConfirm} + onCloseModal={handleCloseModal} ref={footerRef} /> diff --git a/packages/mobile/src/hooks/useBalanceUpdater.ts b/packages/mobile/src/hooks/useBalanceUpdater.ts new file mode 100644 index 000000000..358bf0714 --- /dev/null +++ b/packages/mobile/src/hooks/useBalanceUpdater.ts @@ -0,0 +1,35 @@ +import { walletActions, walletWalletSelector } from '$store/wallet'; +import { State } from '@tonkeeper/core'; +import { useExternalState } from '@tonkeeper/shared/hooks/useExternalState'; +import { tk } from '@tonkeeper/shared/tonkeeper'; +import { useEffect } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; + +// temporary fix +// TODO: Remove this hook during the "balances" refactoring. +export const useBalanceUpdater = () => { + const wallet = useSelector(walletWalletSelector); + const dispatch = useDispatch(); + + const isActivityReloading = useExternalState( + tk.wallet?.activityList.state ?? + new State({ + isReloading: false, + isLoading: false, + hasMore: true, + sections: [], + error: null, + }), + (s) => s.isReloading, + ); + + useEffect(() => { + if (!wallet) { + return; + } + + if (isActivityReloading) { + dispatch(walletActions.refreshBalancesPage(false)); + } + }, [dispatch, isActivityReloading, wallet]); +}; diff --git a/packages/mobile/src/navigation/MainStack/TabStack/TabStack.tsx b/packages/mobile/src/navigation/MainStack/TabStack/TabStack.tsx index 06883b5a6..9bb1be5fd 100644 --- a/packages/mobile/src/navigation/MainStack/TabStack/TabStack.tsx +++ b/packages/mobile/src/navigation/MainStack/TabStack/TabStack.tsx @@ -25,6 +25,7 @@ import { NotificationsIndicator } from '$navigation/MainStack/TabStack/Notificat import { useFetchMethodsToBuy } from '$store/zustand/methodsToBuy/useMethodsToBuyStore'; import { trackEvent } from '$utils/stats'; import { useRemoteBridge } from '$tonconnect'; +import { useBalanceUpdater } from '$hooks/useBalanceUpdater'; const Tab = createBottomTabNavigator(); @@ -41,6 +42,7 @@ export const TabStack: FC = () => { useNotificationsSubscribe(); usePreloadChart(); useCheckForUpdates(); + useBalanceUpdater(); const tabBarStyle = { height: ns(64) + (safeArea.bottom > 0 ? ns(20) : 0) }; const containerTabStyle = useMemo( diff --git a/packages/mobile/src/store/wallet/index.ts b/packages/mobile/src/store/wallet/index.ts index 7f793a297..265aaa128 100644 --- a/packages/mobile/src/store/wallet/index.ts +++ b/packages/mobile/src/store/wallet/index.ts @@ -56,7 +56,7 @@ export const { actions, reducer } = createSlice({ }, loadBalances() {}, refreshBalancesPage(state, action: RefreshBalancesPageAction) { - state.isRefreshing = true; + state.isRefreshing = action.payload ?? true; }, endRefreshBalancesPage(state) { state.isRefreshing = false; diff --git a/packages/mobile/src/store/wallet/sagas.ts b/packages/mobile/src/store/wallet/sagas.ts index d1bce6d12..bd7cc94e9 100644 --- a/packages/mobile/src/store/wallet/sagas.ts +++ b/packages/mobile/src/store/wallet/sagas.ts @@ -312,6 +312,7 @@ function* switchVersionWorker() { } function* refreshBalancesPageWorker(action: RefreshBalancesPageAction) { + const isRefreshing = action.payload ?? true; try { yield put(walletActions.loadBalances()); yield put(nftsActions.loadNFTs({ isReplace: true })); @@ -319,7 +320,7 @@ function* refreshBalancesPageWorker(action: RefreshBalancesPageAction) { yield put(jettonsActions.loadJettons()); yield fork(loadRatesAfterJettons); yield put(mainActions.loadNotifications()); - yield call(useStakingStore.getState().actions.fetchPools); + yield call(useStakingStore.getState().actions.fetchPools, !isRefreshing); yield call(setLastRefreshedAt, Date.now()); yield put(subscriptionsActions.loadSubscriptions()); } catch (e) { From 24fe6c8770cb5461bdc799b98ddaab90a22d6e53 Mon Sep 17 00:00:00 2001 From: Andrey Sorokin Date: Wed, 11 Oct 2023 01:14:39 +0600 Subject: [PATCH 2/8] bump(mobile): 3.4.3 (388) --- packages/mobile/android/app/build.gradle | 4 ++-- packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/mobile/android/app/build.gradle b/packages/mobile/android/app/build.gradle index c736c3865..93be2dfd1 100644 --- a/packages/mobile/android/app/build.gradle +++ b/packages/mobile/android/app/build.gradle @@ -123,8 +123,8 @@ android { applicationId "com.ton_keeper" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 387 - versionName "3.4.2" + versionCode 388 + versionName "3.4.3" missingDimensionStrategy 'react-native-camera', 'general' } diff --git a/packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj b/packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj index 67674ea4d..f52ccf764 100644 --- a/packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj +++ b/packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj @@ -1234,7 +1234,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = ton_keeper/ton_keeper.entitlements; - CURRENT_PROJECT_VERSION = 387; + CURRENT_PROJECT_VERSION = 388; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = CT523DK2KC; ENABLE_BITCODE = NO; @@ -1244,7 +1244,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 3.4.2; + MARKETING_VERSION = 3.4.3; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -1269,7 +1269,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = ton_keeper/ton_keeper.entitlements; - CURRENT_PROJECT_VERSION = 387; + CURRENT_PROJECT_VERSION = 388; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = CT523DK2KC; INFOPLIST_FILE = ton_keeper/SupportingFiles/Info.plist; @@ -1278,7 +1278,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 3.4.2; + MARKETING_VERSION = 3.4.3; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", From e92553f841a86b645803427c8e476cec62e6c68e Mon Sep 17 00:00:00 2001 From: Andrey Sorokin Date: Thu, 12 Oct 2023 00:36:37 +0600 Subject: [PATCH 3/8] fix(mobile): redirect to activity from confirmation (#598) --- .../src/core/DAppBrowser/DAppBrowser.tsx | 3 +- .../ModalContainer/LinkingDomainModal.tsx | 8 +--- .../Modals/NFTChangeOwnerModal.tsx | 18 ++++++-- .../Modals/NFTCollectionDeployModal.tsx | 11 ++++- .../Modals/NFTItemDeployModal.tsx | 16 +++++-- .../Modals/NFTSaleCancelModal.tsx | 22 ++++++--- .../Modals/NFTSalePlaceGetgemsModal.tsx | 11 ++++- .../Modals/NFTSalePlaceModal.tsx | 16 +++++-- .../Modals/NFTSingleDeployModal.tsx | 42 ++++++++--------- .../NFTOperations/Modals/NFTTransferModal.tsx | 6 ++- .../NFTOperations/Modals/SignRawModal.tsx | 19 +++++++- .../NFTOperations/NFTOperationFooter.tsx | 26 +++++------ .../NewConfirmSending/NewConfirmSending.tsx | 6 ++- .../Send/steps/ConfirmStep/ConfirmStep.tsx | 10 ---- packages/mobile/src/core/Swap/Swap.tsx | 2 + .../hooks/useDeeplinkingResolvers.ts | 46 +++++++++++++------ packages/mobile/src/tonconnect/TonConnect.ts | 4 +- 17 files changed, 172 insertions(+), 94 deletions(-) diff --git a/packages/mobile/src/core/DAppBrowser/DAppBrowser.tsx b/packages/mobile/src/core/DAppBrowser/DAppBrowser.tsx index eaaa62b02..4047db72d 100644 --- a/packages/mobile/src/core/DAppBrowser/DAppBrowser.tsx +++ b/packages/mobile/src/core/DAppBrowser/DAppBrowser.tsx @@ -98,6 +98,7 @@ const DAppBrowserComponent: FC = (props) => { const resolver = deeplinking.getResolver(req.url, { params: { openUrl, + redirectToActivity: false, }, }); @@ -136,8 +137,6 @@ const DAppBrowserComponent: FC = (props) => { openDAppsSearch(initialQuery, openUrl); }, [currentUrl, initialUrl, openUrl]); - const handleUnsubscribeFromNotifications = useCallback(() => {}, []); - return ( = ({ fee: initialFee, onDone, }) => { - const nav = useNavigation(); const [walletAddress, setWalletAddress] = React.useState(defaultWalletAddress); const [fee] = React.useState(initialFee); const copyText = useCopyText(); @@ -187,7 +186,7 @@ export const LinkingDomainModal: React.FC = ({ {t('nft_fee')} - {!!fee ? ( + {fee ? ( ≈ {fee} TON ) : ( @@ -214,9 +213,6 @@ export const LinkingDomainModal: React.FC = ({ }, } as any } - onCloseModal={() => { - nav.goBack() - }} /> diff --git a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTChangeOwnerModal.tsx b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTChangeOwnerModal.tsx index 72b05fcb7..8d8876ba0 100644 --- a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTChangeOwnerModal.tsx +++ b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTChangeOwnerModal.tsx @@ -15,9 +15,15 @@ import { t } from '@tonkeeper/shared/i18n'; import { Modal } from '@tonkeeper/uikit'; import { Address } from '@tonkeeper/core'; -type NFTChangeOwnerModalProps = TxRequestBody; +type NFTChangeOwnerModalProps = TxRequestBody & { + redirectToActivity?: boolean; +}; -export const NFTChangeOwnerModal = ({ params, ...options }: NFTChangeOwnerModalProps) => { +export const NFTChangeOwnerModal = ({ + params, + redirectToActivity, + ...options +}: NFTChangeOwnerModalProps) => { const meta = useDownloadCollectionMeta(params.nftCollectionAddress); const { footerRef, onConfirm } = useNFTOperationState(options); const [isShownDetails, setIsShownDetails] = React.useState(false); @@ -81,7 +87,7 @@ export const NFTChangeOwnerModal = ({ params, ...options }: NFTChangeOwnerModalP {t('nft_fee')} - {!!fee ? ( + {fee ? ( {toLocaleNumber(fee)} TON ) : ( @@ -112,7 +118,11 @@ export const NFTChangeOwnerModal = ({ params, ...options }: NFTChangeOwnerModalP - + ); diff --git a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTCollectionDeployModal.tsx b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTCollectionDeployModal.tsx index a7983a97f..c260e39e9 100644 --- a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTCollectionDeployModal.tsx +++ b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTCollectionDeployModal.tsx @@ -16,10 +16,13 @@ import { t } from '@tonkeeper/shared/i18n'; import { Modal } from '@tonkeeper/uikit'; import { Address } from '@tonkeeper/core'; -type NFTCollectionDeployModalProps = TxRequestBody; +type NFTCollectionDeployModalProps = TxRequestBody & { + redirectToActivity?: boolean; +}; export const NFTCollectionDeployModal = ({ params, + redirectToActivity, ...options }: NFTCollectionDeployModalProps) => { const meta = useDownloadMetaFromUri(params.collectionContentUri); @@ -149,7 +152,11 @@ export const NFTCollectionDeployModal = ({ - + ); diff --git a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTItemDeployModal.tsx b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTItemDeployModal.tsx index 077880897..4e83c35c6 100644 --- a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTItemDeployModal.tsx +++ b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTItemDeployModal.tsx @@ -17,9 +17,15 @@ import { t } from '@tonkeeper/shared/i18n'; import { Modal } from '@tonkeeper/uikit'; import { Address } from '@tonkeeper/core'; -type NFTItemDeployModalProps = TxRequestBody; +type NFTItemDeployModalProps = TxRequestBody & { + redirectToActivity?: boolean; +}; -export const NFTItemDeployModal = ({ params, ...options }: NFTItemDeployModalProps) => { +export const NFTItemDeployModal = ({ + params, + redirectToActivity, + ...options +}: NFTItemDeployModalProps) => { const itemMeta = useDownloadMetaFromUri( params.nftItemContentBaseUri + params.itemContentUri, ); @@ -130,7 +136,11 @@ export const NFTItemDeployModal = ({ params, ...options }: NFTItemDeployModalPro - + ); diff --git a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSaleCancelModal.tsx b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSaleCancelModal.tsx index 29d5be9aa..4fcbdebf2 100644 --- a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSaleCancelModal.tsx +++ b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSaleCancelModal.tsx @@ -1,9 +1,9 @@ import React from 'react'; import { useCopyText } from '$hooks/useCopyText'; import { useInstance } from '$hooks/useInstance'; -import { useWallet} from '$hooks/useWallet'; -import {Highlight, Icon, Skeleton, Text} from '$uikit'; -import { toLocaleNumber} from '$utils'; +import { useWallet } from '$hooks/useWallet'; +import { Highlight, Icon, Skeleton, Text } from '$uikit'; +import { toLocaleNumber } from '$utils'; import { debugLog } from '$utils/debugLog'; import { NFTOperationFooter, useNFTOperationState } from '../NFTOperationFooter'; import { NftSaleCancelParams, TxRequestBody } from '../TXRequest.types'; @@ -14,9 +14,15 @@ import * as S from '../NFTOperations.styles'; import { t } from '@tonkeeper/shared/i18n'; import { Modal } from '@tonkeeper/uikit'; -type NFTSaleCancelModalProps = TxRequestBody; +type NFTSaleCancelModalProps = TxRequestBody & { + redirectToActivity?: boolean; +}; -export const NFTSaleCancelModal = ({ params, ...options }: NFTSaleCancelModalProps) => { +export const NFTSaleCancelModal = ({ + params, + redirectToActivity, + ...options +}: NFTSaleCancelModalProps) => { const item = useDownloadNFT(params.nftItemAddress); const { footerRef, onConfirm } = useNFTOperationState(options); const [fee, setFee] = React.useState(''); @@ -101,7 +107,11 @@ export const NFTSaleCancelModal = ({ params, ...options }: NFTSaleCancelModalPro - + ); diff --git a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSalePlaceGetgemsModal.tsx b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSalePlaceGetgemsModal.tsx index c58ac51c3..fb02d77a5 100644 --- a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSalePlaceGetgemsModal.tsx +++ b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSalePlaceGetgemsModal.tsx @@ -17,10 +17,13 @@ import { Ton } from '$libs/Ton'; import { Modal } from '@tonkeeper/uikit'; import { Address } from '@tonkeeper/core'; -type NFTSalePlaceModalProps = TxRequestBody; +type NFTSalePlaceModalProps = TxRequestBody & { + redirectToActivity?: boolean; +}; export const NFTSalePlaceGetgemsModal = ({ params, + redirectToActivity, ...options }: NFTSalePlaceModalProps) => { const item = useDownloadNFT(params.nftItemAddress); @@ -279,7 +282,11 @@ export const NFTSalePlaceGetgemsModal = ({ - + ); diff --git a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSalePlaceModal.tsx b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSalePlaceModal.tsx index 93879883a..b12559033 100644 --- a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSalePlaceModal.tsx +++ b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSalePlaceModal.tsx @@ -17,9 +17,15 @@ import { Ton } from '$libs/Ton'; import { Modal } from '@tonkeeper/uikit'; import { Address } from '@tonkeeper/core'; -type NFTSalePlaceModalProps = TxRequestBody; +type NFTSalePlaceModalProps = TxRequestBody & { + redirectToActivity?: boolean; +}; -export const NFTSalePlaceModal = ({ params, ...options }: NFTSalePlaceModalProps) => { +export const NFTSalePlaceModal = ({ + params, + redirectToActivity, + ...options +}: NFTSalePlaceModalProps) => { const item = useDownloadNFT(params.nftItemAddress); const { footerRef, onConfirm } = useNFTOperationState(options); const [isShownDetails, setIsShownDetails] = React.useState(false); @@ -249,7 +255,11 @@ export const NFTSalePlaceModal = ({ params, ...options }: NFTSalePlaceModalProps - + ); diff --git a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSingleDeployModal.tsx b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSingleDeployModal.tsx index 572445290..621a11f29 100644 --- a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSingleDeployModal.tsx +++ b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTSingleDeployModal.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { useCopyText } from '$hooks/useCopyText'; import { useInstance } from '$hooks/useInstance'; -import { useWallet} from '$hooks/useWallet'; +import { useWallet } from '$hooks/useWallet'; import { Highlight, Separator, Skeleton, Text } from '$uikit'; import { NFTOperationFooter, useNFTOperationState } from '../NFTOperationFooter'; import { NftSingleDeployParams, TxRequestBody } from '../TXRequest.types'; @@ -10,14 +10,20 @@ import { NFTItemMeta } from '../useDownloadNFT'; import { useUnlockVault } from '../useUnlockVault'; import { NFTOperations } from '../NFTOperations'; import * as S from '../NFTOperations.styles'; -import { toLocaleNumber} from '$utils'; +import { toLocaleNumber } from '$utils'; import { debugLog } from '$utils/debugLog'; import { t } from '@tonkeeper/shared/i18n'; import { Modal } from '@tonkeeper/uikit'; -type NFTSingleDeployModal = TxRequestBody; +type NFTSingleDeployModal = TxRequestBody & { + redirectToActivity?: boolean; +}; -export const NFTSingleDeployModal = ({ params, ...options }: NFTSingleDeployModal) => { +export const NFTSingleDeployModal = ({ + params, + redirectToActivity, + ...options +}: NFTSingleDeployModal) => { const itemMeta = useDownloadMetaFromUri(params.itemContentUri); const { footerRef, onConfirm } = useNFTOperationState(options); const [fee, setFee] = React.useState(''); @@ -34,7 +40,7 @@ export const NFTSingleDeployModal = ({ params, ...options }: NFTSingleDeployModa .deploy({ stateInitHex: params.stateInitHex, address: params.contractAddress, - amount: params.amount + amount: params.amount, }) .then((operation) => operation.estimateFee()) .then((fee) => setFee(fee)) @@ -46,14 +52,14 @@ export const NFTSingleDeployModal = ({ params, ...options }: NFTSingleDeployModa const handleConfirm = onConfirm(async ({ startLoading }) => { const vault = await unlockVault(); - + startLoading(); const privateKey = await vault.getTonPrivateKey(); - const operation = await operations.deploy({ + const operation = await operations.deploy({ stateInitHex: params.stateInitHex, address: params.contractAddress, - amount: params.amount + amount: params.amount, }); await operation.send(privateKey); @@ -67,10 +73,7 @@ export const NFTSingleDeployModal = ({ params, ...options }: NFTSingleDeployModa {itemMeta.data?.image && ( - + )} {t('nft_item_deploy_title')} @@ -81,9 +84,7 @@ export const NFTSingleDeployModal = ({ params, ...options }: NFTSingleDeployModa {t('nft_item_name')} {itemMeta.data?.name ? ( - - {itemMeta.data.name} - + {itemMeta.data.name} ) : ( )} @@ -95,10 +96,8 @@ export const NFTSingleDeployModal = ({ params, ...options }: NFTSingleDeployModa {t('nft_fee')} - {!!fee ? ( - - {toLocaleNumber(fee)} TON - + {fee ? ( + {toLocaleNumber(fee)} TON ) : ( )} @@ -111,9 +110,10 @@ export const NFTSingleDeployModal = ({ params, ...options }: NFTSingleDeployModa ); -} +}; diff --git a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTTransferModal.tsx b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTTransferModal.tsx index 1ccbf20ce..cbcdf3c06 100644 --- a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTTransferModal.tsx +++ b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTTransferModal.tsx @@ -29,11 +29,14 @@ import { } from '$core/ModalContainer/InsufficientFunds/InsufficientFunds'; import { Address } from '@tonkeeper/core'; -type NFTTransferModalProps = TxRequestBody; +type NFTTransferModalProps = TxRequestBody & { + redirectToActivity?: boolean; +}; export const NFTTransferModal = ({ params, fee: precalculatedFee, + redirectToActivity, ...options }: NFTTransferModalProps) => { const { footerRef, onConfirm } = useNFTOperationState(options); @@ -188,6 +191,7 @@ export const NFTTransferModal = ({ onPressConfirm={handleConfirm} responseOptions={options?.response_options} ref={footerRef} + redirectToActivity={redirectToActivity} /> diff --git a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/SignRawModal.tsx b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/SignRawModal.tsx index 479e3a971..fb9772d50 100644 --- a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/SignRawModal.tsx +++ b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/SignRawModal.tsx @@ -43,10 +43,19 @@ interface SignRawModalProps { params: SignRawParams; onSuccess?: (boc: string) => void; onDismiss?: () => void; + redirectToActivity?: boolean; } export const SignRawModal = memo((props) => { - const { options, params, action, onSuccess, onDismiss, consequences } = props; + const { + options, + params, + action, + onSuccess, + onDismiss, + consequences, + redirectToActivity, + } = props; const { footerRef, onConfirm } = useNFTOperationState(options); const unlockVault = useUnlockVault(); @@ -186,7 +195,11 @@ export const SignRawModal = memo((props) => { - + ); @@ -198,6 +211,7 @@ export const openSignRawModal = async ( onSuccess?: (boc: string) => void, onDismiss?: () => void, isTonConnect?: boolean, + redirectToActivity = true, ) => { const wallet = store.getState().wallet.wallet; if (!wallet) { @@ -259,6 +273,7 @@ export const openSignRawModal = async ( action, onSuccess, onDismiss, + redirectToActivity, }, path: 'SignRaw', }); diff --git a/packages/mobile/src/core/ModalContainer/NFTOperations/NFTOperationFooter.tsx b/packages/mobile/src/core/ModalContainer/NFTOperations/NFTOperationFooter.tsx index 31a14e8d5..81a98d163 100644 --- a/packages/mobile/src/core/ModalContainer/NFTOperations/NFTOperationFooter.tsx +++ b/packages/mobile/src/core/ModalContainer/NFTOperations/NFTOperationFooter.tsx @@ -1,28 +1,23 @@ import React from 'react'; -import { Alert, Linking, View } from 'react-native'; +import { Linking, View } from 'react-native'; import { Icon, Loader, Spacer, Text, TransitionOpacity } from '$uikit'; -import { - delay, - triggerNotificationError, - triggerNotificationSuccess, -} from '$utils'; +import { delay, triggerNotificationError, triggerNotificationSuccess } from '$utils'; import { debugLog } from '$utils/debugLog'; import { NFTOperationError } from './NFTOperationError'; import { getTimeSec } from '$utils/getTimeSec'; import { TxBodyOptions, TxResponseOptions } from './TXRequest.types'; import { UnlockVaultError } from '$store/wallet/sagas'; -import { useDispatch, useSelector } from 'react-redux'; import { t } from '@tonkeeper/shared/i18n'; import * as S from './NFTOperations.styles'; import { useNavigation } from '@tonkeeper/router'; import axios from 'axios'; -import { isTimeSyncedSelector } from '$store/main'; import { Toast } from '$store'; import { CanceledActionError, DismissedActionError, } from '$core/Send/steps/ConfirmStep/ActionErrors'; import { tk } from '@tonkeeper/shared/tonkeeper'; +import { TabsStackRouteNames } from '$navigation'; enum States { INITIAL, @@ -38,8 +33,6 @@ type ConfirmFn = (options: { startLoading: () => void }) => Promise; // TODO: Rename NFTOperation -> Action export const useNFTOperationState = (txBody?: TxBodyOptions) => { const { footerRef, onConfirm: invokeConfirm } = useActionFooter(); - const dispatch = useDispatch(); - const isTimeSynced = useSelector(isTimeSyncedSelector); const onConfirm = (confirm: ConfirmFn) => async () => { try { @@ -138,6 +131,7 @@ interface ActionFooterProps { onPressConfirm: () => Promise; onCloseModal?: () => void; disabled?: boolean; + redirectToActivity?: boolean; } export const ActionFooter = React.forwardRef( @@ -145,17 +139,19 @@ export const ActionFooter = React.forwardRef const [errorText, setErrorText] = React.useState(t('error_occurred')); const [state, setState] = React.useState(States.INITIAL); const nav = useNavigation(); - const dispatch = useDispatch(); - const { withCloseButton = true } = props; + const { onCloseModal, withCloseButton = true, redirectToActivity = true } = props; const closeModal = React.useCallback(() => { - if (props.onCloseModal) { - props.onCloseModal(); + if (onCloseModal) { + onCloseModal(); } else { nav.goBack(); + if (redirectToActivity) { + nav.navigate(TabsStackRouteNames.Activity); + } } - }, [props.onCloseModal, nav.goBack]); + }, [onCloseModal, nav, redirectToActivity]); React.useImperativeHandle(ref, () => ({ async setState(state) { diff --git a/packages/mobile/src/core/ModalContainer/NewConfirmSending/NewConfirmSending.tsx b/packages/mobile/src/core/ModalContainer/NewConfirmSending/NewConfirmSending.tsx index 504e8271e..e89ce37cf 100644 --- a/packages/mobile/src/core/ModalContainer/NewConfirmSending/NewConfirmSending.tsx +++ b/packages/mobile/src/core/ModalContainer/NewConfirmSending/NewConfirmSending.tsx @@ -148,7 +148,11 @@ export const NewConfirmSending: FC = (props) => { - + ); diff --git a/packages/mobile/src/core/Send/steps/ConfirmStep/ConfirmStep.tsx b/packages/mobile/src/core/Send/steps/ConfirmStep/ConfirmStep.tsx index 709896fba..ecbecdacb 100644 --- a/packages/mobile/src/core/Send/steps/ConfirmStep/ConfirmStep.tsx +++ b/packages/mobile/src/core/Send/steps/ConfirmStep/ConfirmStep.tsx @@ -23,8 +23,6 @@ import { SkeletonLine } from '$uikit/Skeleton/SkeletonLine'; import { t } from '@tonkeeper/shared/i18n'; import { openInactiveInfo } from '$core/ModalContainer/InfoAboutInactive/InfoAboutInactive'; import { Address } from '@tonkeeper/core'; -import { useNavigation } from '@tonkeeper/router'; -import { TabsStackRouteNames } from '$navigation'; const ConfirmStepComponent: FC = (props) => { const { @@ -50,8 +48,6 @@ const ConfirmStepComponent: FC = (props) => { const copyText = useCopyText(); - const nav = useNavigation(); - const balances = useSelector(walletBalancesSelector); const wallet = useSelector(walletWalletSelector); @@ -131,11 +127,6 @@ const ConfirmStepComponent: FC = (props) => { sendTx, ]); - const handleCloseModal = useCallback(() => { - nav.goBack(); - nav.navigate(TabsStackRouteNames.Activity); - }, [nav]); - const feeCurrency = useMemo(() => { const tokenConfig = getTokenConfig(currency as CryptoCurrency); if (currency === 'usdt') { @@ -357,7 +348,6 @@ const ConfirmStepComponent: FC = (props) => { withCloseButton={false} confirmTitle={t('confirm_sending_submit')} onPressConfirm={handleConfirm} - onCloseModal={handleCloseModal} ref={footerRef} /> diff --git a/packages/mobile/src/core/Swap/Swap.tsx b/packages/mobile/src/core/Swap/Swap.tsx index d242b810c..c2c4de137 100644 --- a/packages/mobile/src/core/Swap/Swap.tsx +++ b/packages/mobile/src/core/Swap/Swap.tsx @@ -71,6 +71,8 @@ export const Swap: FC = (props) => { }, resolve, reject, + false, + false, ); }), }), diff --git a/packages/mobile/src/navigation/hooks/useDeeplinkingResolvers.ts b/packages/mobile/src/navigation/hooks/useDeeplinkingResolvers.ts index 1835fa166..4292ff1a9 100644 --- a/packages/mobile/src/navigation/hooks/useDeeplinkingResolvers.ts +++ b/packages/mobile/src/navigation/hooks/useDeeplinkingResolvers.ts @@ -236,6 +236,10 @@ export function useDeeplinkingResolvers() { broadcast: false, }, }, + undefined, + undefined, + false, + resolveParams.redirectToActivity, ); } else if (query.jetton) { if (!Address.isValid(query.jetton)) { @@ -351,7 +355,10 @@ export function useDeeplinkingResolvers() { } }); - const resolveTxType = async (txRequest: TxRequest) => { + const resolveTxType = async ( + txRequest: TxRequest, + resolveParams: Record, + ) => { const wallet = getWallet(); if (txRequest?.version !== '0') { throw new Error('Wrong txrequest protocol'); @@ -378,45 +385,54 @@ export function useDeeplinkingResolvers() { ) { Toast.hide(); return openAddressMismatchModal( - () => resolveTxType(txRequest), + () => resolveTxType(txRequest, resolveParams), txBody.params.source, ); } + const props = { ...txBody, ...resolveParams }; + switch (txRequest.body.type) { case 'nft-collection-deploy': - nav.openModal('NFTCollectionDeploy', txBody); + nav.openModal('NFTCollectionDeploy', props); break; case 'nft-item-deploy': - nav.openModal('NFTItemDeploy', txBody); + nav.openModal('NFTItemDeploy', props); break; case 'nft-single-deploy': - nav.openModal('NFTSingleDeploy', txBody); + nav.openModal('NFTSingleDeploy', props); break; case 'nft-change-owner': - nav.openModal('NFTChangeOwner', txBody); + nav.openModal('NFTChangeOwner', props); break; case 'nft-transfer': - nav.openModal('NFTTransfer', txBody); + nav.openModal('NFTTransfer', props); break; case 'nft-sale-place': - nav.openModal('NFTSalePlace', txBody); + nav.openModal('NFTSalePlace', props); break; case 'nft-sale-place-getgems': - nav.openModal('NFTSalePlaceGetgems', txBody); + nav.openModal('NFTSalePlaceGetgems', props); break; case 'nft-sale-cancel': - nav.openModal('NFTSaleCancel', txBody); + nav.openModal('NFTSaleCancel', props); break; case 'sign-raw-payload': const { params, ...options } = txBody; - await openSignRawModal(params, options); + await openSignRawModal( + params, + options, + undefined, + undefined, + false, + props.redirectToActivity, + ); break; } }; const prevTxRequestPath = useRef(''); - deeplinking.add('/v1/txrequest-url/*', async ({ params }) => { + deeplinking.add('/v1/txrequest-url/*', async ({ params, resolveParams }) => { try { if (params.path === prevTxRequestPath.current) { return; @@ -434,7 +450,7 @@ export function useDeeplinkingResolvers() { Toast.hide(); } - await resolveTxType(data); + await resolveTxType(data, resolveParams); } catch (err) { let message = err?.message; if (axios.isAxiosError(err)) { @@ -451,14 +467,14 @@ export function useDeeplinkingResolvers() { } }); - deeplinking.add('/v1/txrequest-inline/*', async ({ params }) => { + deeplinking.add('/v1/txrequest-inline/*', async ({ params, resolveParams }) => { try { const txRequest = Base64.decodeToObj(params.path); if (!txRequest) { throw new Error('Error JSON txrequest-inline parsing'); } - await resolveTxType(txRequest); + await resolveTxType(txRequest, resolveParams); } catch (err) { debugLog('[txrequest-url]', err); Toast.fail(err?.message); diff --git a/packages/mobile/src/tonconnect/TonConnect.ts b/packages/mobile/src/tonconnect/TonConnect.ts index 7878d4004..7ed7fcd55 100644 --- a/packages/mobile/src/tonconnect/TonConnect.ts +++ b/packages/mobile/src/tonconnect/TonConnect.ts @@ -274,6 +274,7 @@ class TonConnectService { async sendTransaction( request: AppRequest<'sendTransaction'>, + connection: IConnectedAppConnection, ): Promise> { try { const params = JSON.parse(request.params[0]) as SignRawParams; @@ -338,6 +339,7 @@ class TonConnectService { ), ), true, + connection.type === TonConnectBridgeType.Remote, ); if (!openModalResult) { @@ -386,7 +388,7 @@ class TonConnectService { } if (request.method === 'sendTransaction') { - return this.sendTransaction(request); + return this.sendTransaction(request, connection); } if (request.method === 'disconnect') { From ebf2160087fbe41770935068d85bd73fb4bd99e4 Mon Sep 17 00:00:00 2001 From: Andrey Sorokin Date: Thu, 12 Oct 2023 00:47:35 +0600 Subject: [PATCH 4/8] fix(mobile): whales & tf staking fee (#599) --- packages/mobile/src/core/StakingSend/StakingSend.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/mobile/src/core/StakingSend/StakingSend.tsx b/packages/mobile/src/core/StakingSend/StakingSend.tsx index 65f8bf807..a49f503bb 100644 --- a/packages/mobile/src/core/StakingSend/StakingSend.tsx +++ b/packages/mobile/src/core/StakingSend/StakingSend.tsx @@ -250,8 +250,16 @@ export const StakingSend: FC = (props) => { return undefined; } + if ( + [PoolImplementationType.Whales, PoolImplementationType.Tf].includes( + pool.implementation, + ) + ) { + return fee.plus(Ton.fromNano(getWithdrawalFee(pool))).toString(); + } + return fee.toString(); - }, [consequences]); + }, [consequences?.event.extra, pool]); const sendTx = useCallback(async () => { if (!actionRef.current) { From 22b98f971b76d906c566355419df1dd478cd822f Mon Sep 17 00:00:00 2001 From: Andrey Sorokin Date: Thu, 12 Oct 2023 01:25:23 +0600 Subject: [PATCH 5/8] bump(mobile): 3.4.3 (389) --- packages/mobile/android/app/build.gradle | 2 +- packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/mobile/android/app/build.gradle b/packages/mobile/android/app/build.gradle index 93be2dfd1..ca76482bc 100644 --- a/packages/mobile/android/app/build.gradle +++ b/packages/mobile/android/app/build.gradle @@ -123,7 +123,7 @@ android { applicationId "com.ton_keeper" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 388 + versionCode 389 versionName "3.4.3" missingDimensionStrategy 'react-native-camera', 'general' } diff --git a/packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj b/packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj index f52ccf764..99c1bb4a1 100644 --- a/packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj +++ b/packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj @@ -1234,7 +1234,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = ton_keeper/ton_keeper.entitlements; - CURRENT_PROJECT_VERSION = 388; + CURRENT_PROJECT_VERSION = 389; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = CT523DK2KC; ENABLE_BITCODE = NO; @@ -1269,7 +1269,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = ton_keeper/ton_keeper.entitlements; - CURRENT_PROJECT_VERSION = 388; + CURRENT_PROJECT_VERSION = 389; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = CT523DK2KC; INFOPLIST_FILE = ton_keeper/SupportingFiles/Info.plist; From 2864865e959f7cd310affc5d4e51c471db31773c Mon Sep 17 00:00:00 2001 From: Max Voloshinskii Date: Thu, 12 Oct 2023 17:52:58 +0900 Subject: [PATCH 6/8] fix(mobile): Spread pure props in ActionListItem --- packages/@core-js/src/utils/common.ts | 8 ++++ .../NFTOperations/Modals/SignRawModal.tsx | 4 +- .../ActivityList/ActionListItemByType.tsx | 40 ++++++++++--------- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/packages/@core-js/src/utils/common.ts b/packages/@core-js/src/utils/common.ts index 666320929..3cc300cc5 100644 --- a/packages/@core-js/src/utils/common.ts +++ b/packages/@core-js/src/utils/common.ts @@ -27,3 +27,11 @@ export function throttle( return throttled; } + +export function excludeUndefinedValues(obj: T): T { + return Object.keys(obj).reduce((acc, key) => { + const _acc = acc; + if (obj[key] !== undefined) _acc[key] = obj[key]; + return _acc; + }, {} as T); +} diff --git a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/SignRawModal.tsx b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/SignRawModal.tsx index fb9772d50..3a1588883 100644 --- a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/SignRawModal.tsx +++ b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/SignRawModal.tsx @@ -160,7 +160,7 @@ export const SignRawModal = memo((props) => { } } - return null; + return undefined; }; return ( @@ -173,9 +173,9 @@ export const SignRawModal = memo((props) => { ((props) => { const { action } = props; const { type, payload } = action; + const pureProps = excludeUndefinedValues(props); switch (type) { case ActionType.TonTransfer: return ( - + {!!payload.comment && } ); case ActionType.JettonTransfer: return ( - + {!!payload.comment && } ); case ActionType.NftItemTransfer: return ( - + {!!payload.comment && } ); case ActionType.NftPurchase: return ( - + ); @@ -47,7 +49,7 @@ export const ActionListItemByType = memo((props) => { subtitle={Address.parse(payload.contract.address).toShort()} title={t('transactions.smartcontract_exec')} iconName="ic-gear-28" - {...props} + {...pureProps} /> ); case ActionType.Unknown: @@ -56,7 +58,7 @@ export const ActionListItemByType = memo((props) => { title={t('transactions.unknown')} subtitle={t('transactions.unknown_description')} subtitleNumberOfLines={2} - {...props} + {...pureProps} /> ); case ActionType.AuctionBid: @@ -65,7 +67,7 @@ export const ActionListItemByType = memo((props) => { subtitle={modifyNftName(payload.nft?.metadata?.name)} title={t('transactions.bid')} iconName="ic-tray-arrow-up-28" - {...props} + {...pureProps} /> ); case ActionType.ContractDeploy: @@ -74,7 +76,7 @@ export const ActionListItemByType = memo((props) => { subtitle={Address.parse(payload.address).toShort()} title={t('transactions.wallet_initialized')} iconName="ic-donemark-28" - {...props} + {...pureProps} /> ); case ActionType.ReceiveTRC20: @@ -84,7 +86,7 @@ export const ActionListItemByType = memo((props) => { title={t('transaction_type_receive')} iconName="ic-tray-arrow-down-28" greenValue - {...props} + {...pureProps} /> ); case ActionType.SendTRC20: @@ -93,7 +95,7 @@ export const ActionListItemByType = memo((props) => { subtitle={Address.toShort(payload.recipient)} title={t('transaction_type_sent')} iconName="ic-tray-arrow-up-28" - {...props} + {...pureProps} /> ); case ActionType.JettonBurn: @@ -102,7 +104,7 @@ export const ActionListItemByType = memo((props) => { subtitle={payload.jetton.name} title={t('transactions.burned')} iconName="ic-fire-28" - {...props} + {...pureProps} /> ); case ActionType.JettonMint: @@ -110,7 +112,7 @@ export const ActionListItemByType = memo((props) => { ); case ActionType.DepositStake: @@ -119,7 +121,7 @@ export const ActionListItemByType = memo((props) => { pictureSource={getImplementationIcon(action.payload.implementation)} title={t('transactions.deposit')} subtitle={payload.pool.name} - {...props} + {...pureProps} /> ); case ActionType.WithdrawStake: @@ -129,7 +131,7 @@ export const ActionListItemByType = memo((props) => { title={t('transactions.withdraw')} subtitle={payload.pool.name} iconName="ic-donemark-28" - {...props} + {...pureProps} /> ); case ActionType.WithdrawStakeRequest: @@ -139,17 +141,17 @@ export const ActionListItemByType = memo((props) => { title={t('transactions.withdrawal_request')} subtitle={payload.pool.name} iconName="ic-donemark-28" - {...props} + {...pureProps} /> ); case ActionType.JettonSwap: - return ; + return ; case ActionType.Subscribe: - return ; + return ; case ActionType.UnSubscribe: - return ; + return ; default: - return ; + return ; } }); From 22f46326efbe6add6aecab460434ec476500ea36 Mon Sep 17 00:00:00 2001 From: Andrey Sorokin Date: Thu, 12 Oct 2023 22:37:26 +0600 Subject: [PATCH 7/8] fix(mobile): prevent redirect to activity on cancel tx (#603) --- .../NFTOperations/Modals/NFTTransferModal.tsx | 4 +-- .../NFTOperations/NFTOperationFooter.tsx | 25 +++++++++++-------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTTransferModal.tsx b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTTransferModal.tsx index cbcdf3c06..8491b3bff 100644 --- a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTTransferModal.tsx +++ b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/NFTTransferModal.tsx @@ -261,9 +261,7 @@ export async function checkFundsAndOpenNFTTransfer( type: 'nft-transfer', // expires in 100 minutes expires_sec: Date.now() / 1000 + 6000, - response_options: { - onDone: () => setTimeout(goBack, 850), - } as any, + response_options: {} as any, params: transferParams, fee, }); diff --git a/packages/mobile/src/core/ModalContainer/NFTOperations/NFTOperationFooter.tsx b/packages/mobile/src/core/ModalContainer/NFTOperations/NFTOperationFooter.tsx index 81a98d163..0256971a5 100644 --- a/packages/mobile/src/core/ModalContainer/NFTOperations/NFTOperationFooter.tsx +++ b/packages/mobile/src/core/ModalContainer/NFTOperations/NFTOperationFooter.tsx @@ -142,16 +142,19 @@ export const ActionFooter = React.forwardRef const { onCloseModal, withCloseButton = true, redirectToActivity = true } = props; - const closeModal = React.useCallback(() => { - if (onCloseModal) { - onCloseModal(); - } else { - nav.goBack(); - if (redirectToActivity) { - nav.navigate(TabsStackRouteNames.Activity); + const closeModal = React.useCallback( + (success: boolean) => { + if (onCloseModal) { + onCloseModal(); + } else { + nav.goBack(); + if (redirectToActivity && success) { + nav.navigate(TabsStackRouteNames.Activity); + } } - } - }, [onCloseModal, nav, redirectToActivity]); + }, + [onCloseModal, nav, redirectToActivity], + ); React.useImperativeHandle(ref, () => ({ async setState(state) { @@ -162,7 +165,7 @@ export const ActionFooter = React.forwardRef await delay(1750); tk.wallet.activityList.reload(); - closeModal(); + closeModal(true); props.responseOptions?.onDone?.(); } else if (state === States.ERROR) { @@ -190,7 +193,7 @@ export const ActionFooter = React.forwardRef {withCloseButton ? ( <> - + closeModal(false)}> {t('cancel')} From 70be509d63912023ec09a9b2ea866a9871825546 Mon Sep 17 00:00:00 2001 From: Andrey Sorokin Date: Thu, 12 Oct 2023 22:40:01 +0600 Subject: [PATCH 8/8] bump(mobile): 3.4.3 (390) --- packages/mobile/android/app/build.gradle | 2 +- packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/mobile/android/app/build.gradle b/packages/mobile/android/app/build.gradle index ca76482bc..93f84ff06 100644 --- a/packages/mobile/android/app/build.gradle +++ b/packages/mobile/android/app/build.gradle @@ -123,7 +123,7 @@ android { applicationId "com.ton_keeper" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 389 + versionCode 390 versionName "3.4.3" missingDimensionStrategy 'react-native-camera', 'general' } diff --git a/packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj b/packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj index 99c1bb4a1..cbf2a38e4 100644 --- a/packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj +++ b/packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj @@ -1234,7 +1234,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = ton_keeper/ton_keeper.entitlements; - CURRENT_PROJECT_VERSION = 389; + CURRENT_PROJECT_VERSION = 390; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = CT523DK2KC; ENABLE_BITCODE = NO; @@ -1269,7 +1269,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = ton_keeper/ton_keeper.entitlements; - CURRENT_PROJECT_VERSION = 389; + CURRENT_PROJECT_VERSION = 390; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = CT523DK2KC; INFOPLIST_FILE = ton_keeper/SupportingFiles/Info.plist;