From 124195164797ed4426c07458a354a729918007c2 Mon Sep 17 00:00:00 2001 From: Brice Zele Date: Sun, 15 Nov 2020 18:22:59 +0100 Subject: [PATCH] Wallet history refresh OK --- screens/wallet/WalletDetail.js | 32 +++++++++++++++++++ screens/wallet/WalletDetailUser.js | 23 +++++++------ .../wallet/user/EnvoieWalletToWalletUser.js | 5 +-- utils/UtilsFunction.js | 22 +++++++++---- utils/i18n/en.json | 2 ++ utils/i18n/fr.json | 2 ++ 6 files changed, 68 insertions(+), 18 deletions(-) diff --git a/screens/wallet/WalletDetail.js b/screens/wallet/WalletDetail.js index 1aca5464..18aba996 100644 --- a/screens/wallet/WalletDetail.js +++ b/screens/wallet/WalletDetail.js @@ -93,6 +93,38 @@ class WalletDetail extends Component { else this.props.getWalletTransactionHistory(this.props.navigation.state.params.wallet.id, false); } + + this.willFocus = this.props.navigation.addListener( + 'willFocus', + payload => { + const { result } = this.props; + console.log("will focus"); + if (result !== null) { + if (typeof result.response !== 'undefined') { + const wallet = result.response[0]; + readUser().then((user) => { + if (user !== null && user !== undefined) { + if (user.category !== undefined) { + switch (user.category) { + case "super": + this.props.getHyperSuperTransactionHistoryAction(result.response.id, false); + break; + case "hyper": + this.props.getHyperSuperTransactionHistoryAction(user.network_id, true); + break; + } + this.setState({}); + } + } + }); + this.setState({ + wallet: wallet, + isTriggerRefresh: false + }) + } + } + }); + } /* static options(passProps) { diff --git a/screens/wallet/WalletDetailUser.js b/screens/wallet/WalletDetailUser.js index a0a6bd8f..1377d53a 100644 --- a/screens/wallet/WalletDetailUser.js +++ b/screens/wallet/WalletDetailUser.js @@ -106,15 +106,20 @@ class WalletDetailUser extends Component { this.props.getWalletDetailActivated(this.props.navigation.state.params.userId, null); this.props.getUserIdentificationResetAction(); - readUser().then((user) => { - if (user) { - if (user !== undefined) { - this.setState({user}); - this.props.getUserIdentificationAction(user.phone); - this.props.getWalletTransactionHistoryUser(user.id); - } - } - }); + this.willFocus = this.props.navigation.addListener( + 'willFocus', + payload => { + readUser().then((user) => { + if (user) { + if (user !== undefined) { + this.setState({user}); + this.props.getUserIdentificationAction(user.phone); + this.props.getWalletTransactionHistoryUser(user.id); + } + } + }); + }); + } static navigatorStyle = { diff --git a/screens/wallet/user/EnvoieWalletToWalletUser.js b/screens/wallet/user/EnvoieWalletToWalletUser.js index 7d41a075..99027b92 100644 --- a/screens/wallet/user/EnvoieWalletToWalletUser.js +++ b/screens/wallet/user/EnvoieWalletToWalletUser.js @@ -442,6 +442,7 @@ class EnvoieWalletToWalletUser extends Component { this.props.getCommissionUserWalletToWalletAction({ type: 1, + network_destinataire: (this.state.walletActifs.filter(element => element.name === this.state.walletActifSelect))[0].id, id_wallet_user: this.state.wallet.id, final_country: (this.state.paysDestination.filter(element => element.name === this.state.paysDestinationSelect))[0].id, id_destinataire: this.state.numeroTelephoneOrWalletCode, @@ -564,8 +565,8 @@ class EnvoieWalletToWalletUser extends Component { onChangeText={(value, index, data) => { this.setState({ typeIdDestinataireSelect: value }); }} - valueExtractor={(value) => { return value.name }} - labelExtractor={(value) => { return value.name }} + valueExtractor={(value) => { return I18n.t(value.name) }} + labelExtractor={(value) => { return I18n.t(value.name) }} /> diff --git a/utils/UtilsFunction.js b/utils/UtilsFunction.js index a7c83d91..7132c601 100644 --- a/utils/UtilsFunction.js +++ b/utils/UtilsFunction.js @@ -369,6 +369,14 @@ export const optionRetraitUserScreen = { screen: route.retraitCarteVersWalletUser, icon: 'credit-card', title: 'WITHDRAWAL_CARD_TO_WALLET', + }, { + screen: '', + icon: 'credit-card', + title: 'WITHDRAWAL_BANK_TO_WALLET', + }, { + screen: '', + icon: 'credit-card', + title: 'WITHDRAWAL_BANK_TO_CASH', }, ] } @@ -393,13 +401,13 @@ export const optionDepotUserScreen = { icon: 'credit-card', title: 'DEPOSIT_TO_CARD', }, - { - type: 'WALLET_TO_BANK', - screen: route.operateurOptionSelect, - icon: 'bank-transfer-in', - title: 'DEPOSIT_TO_BANK', - subScreenOption: optionWalletToBank - }, + { + type: 'WALLET_TO_BANK', + screen: route.operateurOptionSelect, + icon: 'bank-transfer-in', + title: 'DEPOSIT_TO_BANK', + subScreenOption: optionWalletToBank + }, ] } diff --git a/utils/i18n/en.json b/utils/i18n/en.json index de37ff5d..58de9c28 100644 --- a/utils/i18n/en.json +++ b/utils/i18n/en.json @@ -93,6 +93,8 @@ "WITHDRAWAL_CARD_TO_WALLET": "Withdrawal card to wallet", "WITHDRAWAL_CARD_TO_WALLET_DESCRIPTION": "Withdrawal money from your card to your wallet", "WITHDRAWAL_CARD_TO_CASH": "Withdrawal card to cash", + "WITHDRAWAL_BANK_TO_WALLET": "Withdrawal bank to wallet", + "WITHDRAWAL_BANK_TO_CASH": "Withdrawal bank to cash", "WITHDRAWAL_CARD_TO_CASH_AGENT": "Withdrawal card to cash", "WITHDRAWAL_CARD_TO_CASH_DESCRIPTION": "Withdrawal money from card to cash", "WITHDRAWAL_CARD_TO_CASH_DESCRIPTION_AGENT": "Withdrawal money from card to cash", diff --git a/utils/i18n/fr.json b/utils/i18n/fr.json index 1741724e..b06af03f 100644 --- a/utils/i18n/fr.json +++ b/utils/i18n/fr.json @@ -97,6 +97,8 @@ "WITHDRAWAL_WALLET_TO_CASH": "Retrait de votre wallet vers cash", "WITHDRAWAL_WALLET_TO_CASH_DESCRIPTION": "Retirer de l'argent de votre Wallet vers cash", "WITHDRAWAL_CARD_TO_WALLET": "Retrait de votre carte vers wallet", + "WITHDRAWAL_BANK_TO_WALLET": "Retrait de votre banque vers wallet", + "WITHDRAWAL_BANK_TO_CASH": "Retrait de votre banque vers cash", "WITHDRAWAL_CARD_TO_WALLET_DESCRIPTION": "Retrait d'argent de votre carte vers wallet", "WITHDRAWAL_CARD_TO_CASH": "Retrait de votre carte vers cash", "WITHDRAWAL_CARD_TO_CASH_AGENT": "Retrait carte vers cash",