migrated all openPinCodeModal actions to pinCodeScreen navigation

This commit is contained in:
noumantahir 2022-08-30 18:26:17 +05:00
parent 75adb130c0
commit ef55092aa5
9 changed files with 46 additions and 49 deletions

View File

@ -6,14 +6,13 @@ import { injectIntl } from 'react-intl';
import get from 'lodash/get';
// Services and Actions
import { followUser, getRelationship, ignoreUser, pinCommunityPost, profileUpdate, reblog, unfollowUser } from '../../../providers/hive/dhive';
import { ignoreUser, pinCommunityPost, profileUpdate, reblog } from '../../../providers/hive/dhive';
import { addBookmark, addReport } from '../../../providers/ecency/ecency';
import { toastNotification, setRcOffer, showActionModal } from '../../../redux/actions/uiAction';
import { openPinCodeModal } from '../../../redux/actions/applicationActions';
// Constants
import OPTIONS from '../../../constants/options/post';
import { default as ROUTES } from '../../../constants/routeNames';
import ROUTES from '../../../constants/routeNames';
// Utilities
import { writeToClipboard } from '../../../utils/clipboard';
@ -429,7 +428,7 @@ class PostDropdownContainer extends PureComponent {
};
_redirectToPromote = (routeName, from, redeemType) => {
const { content, isLoggedIn, navigation, dispatch, isPinCodeOpen } = this.props as any;
const { content, isLoggedIn, navigation, isPinCodeOpen } = this.props as any;
const params = {
from,
permlink: `${get(content, 'author')}/${get(content, 'permlink')}`,
@ -437,12 +436,14 @@ class PostDropdownContainer extends PureComponent {
};
if (isPinCodeOpen) {
dispatch(
openPinCodeModal({
navigation.navigate({
routeName:ROUTES.SCREENS.PINCODE,
params:{
navigateTo: routeName,
navigateParams: params,
} as any)
);
}
})
} else if (isLoggedIn) {
navigation.navigate({
routeName,

View File

@ -5,8 +5,6 @@ import { connect } from 'react-redux';
// Constants
import ROUTES from '../../../constants/routeNames';
import { openPinCodeModal } from '../../../redux/actions/applicationActions';
// Component
import WalletDetailsView from '../view/walletDetailsView';
@ -48,12 +46,13 @@ class WalletContainer extends PureComponent {
}
if (isPinCodeOpen) {
dispatch(
openPinCodeModal({
navigation.navigate({
routeName: ROUTES.SCREENS.PINCODE,
params: {
navigateTo: ROUTES.SCREENS.TRANSFER,
navigateParams: { transferType, fundType, balance },
}),
);
},
});
} else {
navigation.navigate({
routeName: ROUTES.SCREENS.TRANSFER,

View File

@ -7,7 +7,6 @@ import { withNavigation } from '@react-navigation/compat';
// Services and Actions
import { getPointsSummary, claimPoints, getPointsHistory } from '../providers/ecency/ePoint';
import { openPinCodeModal } from '../redux/actions/applicationActions';
import { getAccount, boost } from '../providers/hive/dhive';
import { getUserDataWithUsername } from '../realm/realm';
import { toastNotification } from '../redux/actions/uiAction';
@ -100,12 +99,13 @@ const PointsContainer = ({
}
if (isPinCodeOpen) {
dispatch(
openPinCodeModal({
navigateTo,
navigateParams,
}),
);
navigation.navigate({
routeName: ROUTES.SCREENS.PINCODE,
params: {
routeName: navigateTo,
params: navigateParams,
},
});
} else {
navigation.navigate({
routeName: navigateTo,

View File

@ -8,9 +8,6 @@ import { toastNotification } from '../redux/actions/uiAction';
// dhive
import { getAccount, claimRewardBalance, getBtcAddress } from '../providers/hive/dhive';
// Actions
import { openPinCodeModal } from '../redux/actions/applicationActions';
// Utils
import { groomingWalletData, groomingTransactionData, transferTypes } from '../utils/wallet';
import parseToken from '../utils/parseToken';
@ -255,12 +252,13 @@ const WalletContainer = ({
}
if (isPinCodeOpen) {
dispatch(
openPinCodeModal({
navigate({
routeName: ROUTES.SCREENS.PINCODE,
params: {
navigateTo: ROUTES.SCREENS.TRANSFER,
navigateParams: { transferType, fundType, balance, tokenAddress },
}),
);
},
});
} else {
navigate({
routeName: ROUTES.SCREENS.TRANSFER,

View File

@ -61,7 +61,6 @@ import {
isDarkTheme,
login,
logoutDone,
openPinCodeModal,
setConnectivityStatus,
setAnalyticsStatus,
setPinCode as savePinCode,

View File

@ -8,7 +8,6 @@ import { useAppDispatch, useAppSelector } from '../../../hooks'
import { CoinActivitiesCollection, QuoteItem } from '../../../redux/reducers/walletReducer';
import { fetchCoinActivities } from '../../../utils/wallet';
import { fetchAndSetCoinsData, setCoinActivities } from '../../../redux/actions/walletActions';
import { openPinCodeModal } from '../../../redux/actions/applicationActions';
import { navigate } from '../../../navigation/service';
import ROUTES from '../../../constants/routeNames';
import { COIN_IDS } from '../../../constants/defaultCoins';
@ -130,12 +129,13 @@ const CoinDetailsScreen = ({ navigation, route }: CoinDetailsScreenProps) => {
}
if (isPinCodeOpen) {
dispatch(
openPinCodeModal({
navigate({
routeName: ROUTES.SCREENS.PINCODE,
params:{
navigateTo,
navigateParams,
}),
);
}
})
} else {
navigate({
routeName: navigateTo,

View File

@ -14,11 +14,7 @@ import {
addOtherAccount,
updateCurrentAccount,
} from '../../../redux/actions/accountAction';
import {
login as loginAction,
openPinCodeModal,
setPinCode,
} from '../../../redux/actions/applicationActions';
import { login as loginAction, setPinCode } from '../../../redux/actions/applicationActions';
import { setInitPosts, setFeedPosts } from '../../../redux/actions/postsAction';
import { setPushTokenSaved, setExistUser } from '../../../realm/realm';
import { setPushToken } from '../../../providers/ecency/ecency';
@ -79,7 +75,12 @@ class LoginContainer extends PureComponent {
dispatch(setPinCode(encryptedPin));
if (isPinCodeOpen) {
dispatch(openPinCodeModal({ navigateTo: ROUTES.DRAWER.MAIN }));
navigation.navigate({
name: ROUTES.SCREENS.PINCODE,
params: {
navigateTo: ROUTES.DRAWER.MAIN,
},
});
} else {
navigation.navigate({
name: ROUTES.DRAWER.MAIN,

View File

@ -1,13 +1,11 @@
import React, { useEffect, useRef } from 'react'
import { Alert, AppState, View } from 'react-native';
import { AppState } from 'react-native';
import { useAppDispatch, useAppSelector } from '../../../hooks'
import { getExistUser } from '../../../realm/realm';
import { openPinCodeModal } from '../../../redux/actions/applicationActions';
import { BasicHeader } from '../../../components';
import PinCodeContainer from '../container/pinCodeContainer';
import ROUTE from '../../../constants/routeNames';
import { navigate } from '../../../navigation/service';
import routeNames from '../../../constants/routeNames';

View File

@ -10,7 +10,7 @@ import { hsOptions } from '../../constants/hsOptions';
// Actions
import { addOtherAccount, updateCurrentAccount } from '../../redux/actions/accountAction';
import { login as loginAction, openPinCodeModal } from '../../redux/actions/applicationActions';
import { login as loginAction } from '../../redux/actions/applicationActions';
// Constants
import { default as ROUTES } from '../../constants/routeNames';
@ -51,12 +51,13 @@ class HiveSigner extends PureComponent {
dispatch(loginAction(true));
if (isPinCodeOpen) {
dispatch(
openPinCodeModal({
navigation.navigate({
routeName: ROUTES.SCREENS.PINCODE,
params: {
accessToken: result.accessToken,
navigateTo: ROUTES.DRAWER.MAIN,
}),
);
},
});
} else {
navigation.navigate({
routeName: ROUTES.DRAWER.MAIN,