correction des bugs stabilisation android

This commit is contained in:
Brice Zele 2020-10-04 12:17:41 +01:00
parent b29b30ec6a
commit edafab7025
9 changed files with 127 additions and 16 deletions

4
App.js
View File

@ -242,7 +242,7 @@ const AppAgentStack = createDrawerNavigator({
activeColor: '#f0edf6', activeColor: '#f0edf6',
inactiveColor: '#3e2465', inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' }, barStyle: { backgroundColor: '#694fad' },
headerLeft: (<HeaderBackButton />), /* headerLeft: (<HeaderBackButton />), */
drawerLabel: I18n.t('CREDIT_MANAGE'), drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => ( drawerIcon: ({ tintColor }) => (
<Icon <Icon
@ -455,6 +455,8 @@ class App extends React.Component {
params: { routeName, params } params: { routeName, params }
}); });
} }
if (typeof this.refs.navigator !== 'undefined') {
}
}; };
handleDeepLink = (openResult) => { handleDeepLink = (openResult) => {

File diff suppressed because one or more lines are too long

View File

@ -49,7 +49,7 @@ import {
CASSER_EPARGNE_USER_PENDING, CASSER_EPARGNE_USER_PENDING,
CASSER_EPARGNE_USER_SUCCESS, CASSER_EPARGNE_USER_SUCCESS,
CASSER_EPARGNE_USER_ERROR, CASSER_EPARGNE_USER_ERROR,
CASSER_EPARGNE_USER_RESET, GET_NANO_CREDIT_ACCOUNT_USER_PENDING, GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS, GET_NANO_CREDIT_ACCOUNT_USER_ERROR, GET_NANO_CREDIT_ACCOUNT_USER_RESET CASSER_EPARGNE_USER_RESET, GET_NANO_CREDIT_ACCOUNT_USER_PENDING, GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS, GET_NANO_CREDIT_ACCOUNT_USER_ERROR, GET_NANO_CREDIT_ACCOUNT_USER_RESET, GET_NANO_CREDIT_HISTORY_USER_PENDING, GET_NANO_CREDIT_HISTORY_USER_SUCCESS, GET_NANO_CREDIT_HISTORY_USER_RESET, GET_NANO_CREDIT_HISTORY_USER_ERROR
} from "../types/NanoCreditType"; } from "../types/NanoCreditType";
export const fetchCreateGroupPending = () => ({ export const fetchCreateGroupPending = () => ({
@ -332,3 +332,22 @@ export const fetchGetNanoCreditUserAccountError = (error) => ({
export const fetchGetNanoCreditUserAccountReset = () => ({ export const fetchGetNanoCreditUserAccountReset = () => ({
type: GET_NANO_CREDIT_ACCOUNT_USER_RESET type: GET_NANO_CREDIT_ACCOUNT_USER_RESET
}); });
export const fetchGetNanoCreditUserHistoryPending = () => ({
type: GET_NANO_CREDIT_HISTORY_USER_PENDING
});
export const fetchGetNanoCreditUserHistorySuccess = (res) => ({
type: GET_NANO_CREDIT_HISTORY_USER_SUCCESS,
result: res,
});
export const fetchGetNanoCreditUserHistoryError = (error) => ({
type: GET_NANO_CREDIT_HISTORY_USER_ERROR,
result: error
});
export const fetchGetNanoCreditUserHistoryReset = () => ({
type: GET_NANO_CREDIT_HISTORY_USER_RESET
});

View File

@ -0,0 +1,33 @@
import { GET_NANO_CREDIT_HISTORY_USER_ERROR, GET_NANO_CREDIT_HISTORY_USER_PENDING, GET_NANO_CREDIT_HISTORY_USER_RESET, GET_NANO_CREDIT_HISTORY_USER_SUCCESS } from "../types/NanoCreditType";
const initialState = {
loading: false,
result: null,
error: null
};
export default (state = initialState, action) => {
switch (action.type) {
case GET_NANO_CREDIT_HISTORY_USER_PENDING: return {
...state,
loading: true
}
case GET_NANO_CREDIT_HISTORY_USER_SUCCESS: return {
...state,
loading: false,
result: action.result.data,
error: null
}
case GET_NANO_CREDIT_HISTORY_USER_ERROR: return {
...state,
loading: false,
result: null,
error: action.result
}
case GET_NANO_CREDIT_HISTORY_USER_RESET: return initialState;
default: {
return state;
}
}
};

View File

@ -72,3 +72,8 @@ export const GET_NANO_CREDIT_ACCOUNT_USER_PENDING = 'GET_NANO_CREDIT_ACCOUNT_USE
export const GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS = 'GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS'; export const GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS = 'GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS';
export const GET_NANO_CREDIT_ACCOUNT_USER_ERROR = 'GET_NANO_CREDIT_ACCOUNT_USER_ERROR'; export const GET_NANO_CREDIT_ACCOUNT_USER_ERROR = 'GET_NANO_CREDIT_ACCOUNT_USER_ERROR';
export const GET_NANO_CREDIT_ACCOUNT_USER_RESET = 'GET_NANO_CREDIT_ACCOUNT_USER_RESET'; export const GET_NANO_CREDIT_ACCOUNT_USER_RESET = 'GET_NANO_CREDIT_ACCOUNT_USER_RESET';
export const GET_NANO_CREDIT_HISTORY_USER_PENDING = 'GET_NANO_CREDIT_HISTORY_USER_PENDING';
export const GET_NANO_CREDIT_HISTORY_USER_SUCCESS = 'GET_NANO_CREDIT_HISTORY_USER_SUCCESS';
export const GET_NANO_CREDIT_HISTORY_USER_ERROR = 'GET_NANO_CREDIT_HISTORY_USER_ERROR';
export const GET_NANO_CREDIT_HISTORY_USER_RESET = 'GET_NANO_CREDIT_HISTORY_USER_RESET';

View File

@ -53,7 +53,7 @@ export default class SplashScreen extends Component {
}; };
workUserResult(result) { workUserResult(result) {
console.log("SPLASHSCREEN PROPS", this.props); console.log("SPLASHSCREEN PROPS", this.props);
if (this.props.navigation.state.params.hasOwnProperty('routeName')) { if (typeof this.props.navigation.state.params !== 'undefined') {
this.props.navigation.navigate(this.props.navigation.state.params.routeName, { this.props.navigation.navigate(this.props.navigation.state.params.routeName, {
id: this.props.navigation.state.params.params.id id: this.props.navigation.state.params.params.id
}); });

View File

@ -13,7 +13,7 @@ import { baseUrl } from '../../webservice/IlinkConstants';
import { IlinkEmitter } from "../../utils/events"; import { IlinkEmitter } from "../../utils/events";
import { Provider, Appbar } from 'react-native-paper'; import { Provider, Appbar } from 'react-native-paper';
import { readUser } from '../../webservice/AuthApi'; import { readUser } from '../../webservice/AuthApi';
import { getNanoCreditAccountReset, getNanoCreditAccountAction } from '../../webservice/user/NanoCreditApi'; import { getNanoCreditAccountReset, getNanoCreditAccountAction, getNanoCreditUserHistoryAction, getNanoCreditUserHistoryReset } from '../../webservice/user/NanoCreditApi';
import _ from 'lodash'; import _ from 'lodash';
import Icons from 'react-native-vector-icons/Ionicons' import Icons from 'react-native-vector-icons/Ionicons'
import { FontWeight, Typography } from '../../config/typography'; import { FontWeight, Typography } from '../../config/typography';
@ -47,10 +47,15 @@ class WalletOptionSelect extends Component {
IlinkEmitter.on("langueChange", this.updateLangue.bind(this)); IlinkEmitter.on("langueChange", this.updateLangue.bind(this));
this.props.getNanoCreditAccountReset(); this.props.getNanoCreditAccountReset();
this.props.getNanoCreditUserHistoryReset();
readUser().then((user) => { readUser().then((user) => {
if (user) { if (user) {
if (user !== undefined) { if (user !== undefined) {
if (typeof user.category === 'undefined') {
this.props.getNanoCreditAccountAction(user.id); this.props.getNanoCreditAccountAction(user.id);
this.props.getNanoCreditUserHistoryAction(user.id);
}
this.setState({ user }); this.setState({ user });
} }
} }
@ -59,9 +64,11 @@ class WalletOptionSelect extends Component {
this.willFocus = this.props.navigation.addListener( this.willFocus = this.props.navigation.addListener(
'willFocus', 'willFocus',
payload => { payload => {
console.log("WIIL FOCUS CALL");
readUser().then((user) => { readUser().then((user) => {
if (user) { if (user) {
if (user !== undefined) { if (user !== undefined) {
this.props.getNanoCreditUserHistoryAction(user.id);
this.props.getNanoCreditAccountAction(user.id); this.props.getNanoCreditAccountAction(user.id);
} }
} }
@ -422,6 +429,9 @@ const mapStateToProps = state => ({
const mapDispatchToProps = dispatch => bindActionCreators({ const mapDispatchToProps = dispatch => bindActionCreators({
getNanoCreditAccountAction, getNanoCreditAccountAction,
getNanoCreditAccountReset, getNanoCreditAccountReset,
getNanoCreditUserHistoryAction,
getNanoCreditUserHistoryReset
}, dispatch); }, dispatch);
export default connect(mapStateToProps, mapDispatchToProps)(connectActionSheet(WalletOptionSelect)); export default connect(mapStateToProps, mapDispatchToProps)(connectActionSheet(WalletOptionSelect));

View File

@ -66,6 +66,7 @@ export const casserEpargneUrl = testBaseUrl + '/walletService/groups/nanoCredit/
export const saveOnesignalIds = testBaseUrl + '/notificationService/onesignal'; export const saveOnesignalIds = testBaseUrl + '/notificationService/onesignal';
export const getNotificationUrl = testBaseUrl + '/notificationService/notifications'; export const getNotificationUrl = testBaseUrl + '/notificationService/notifications';
export const getNanoCreditAccount = testBaseUrl + '/walletService/groups/nanoCredit/accounts'; export const getNanoCreditAccount = testBaseUrl + '/walletService/groups/nanoCredit/accounts';
export const getNanoCreditUserHistoryUrl = testBaseUrl + '/walletService/groups/nanoCredit/all_demands';
export const authKeyUrl = testBaseUrl + '/oauth/token'; export const authKeyUrl = testBaseUrl + '/oauth/token';
export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY"; export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY";

View File

@ -2,8 +2,8 @@
import axios from "axios"; import axios from "axios";
import I18n from 'react-native-i18n'; import I18n from 'react-native-i18n';
import { store } from "../../redux/store"; import { store } from "../../redux/store";
import { fetchCautionCreditDemandUserError, fetchCautionCreditDemandUserPending, fetchCautionCreditDemandUserReset, fetchCautionCreditDemandUserSuccess, fetchGetDemandsGroupError, fetchGetDemandsGroupPending, fetchGetDemandsGroupReset, fetchGetDemandsGroupSuccess, fetchGetUniqueDemandsGroupError, fetchGetUniqueDemandsGroupPending, fetchGetUniqueDemandsGroupReset, fetchGetUniqueDemandsGroupSuccess, fetchGetUserGroupDetailError, fetchGetUserGroupDetailPending, fetchGetUserGroupDetailReset, fetchGetUserGroupDetailSuccess, fetchEpargnerArgentUserPending, fetchEpargnerArgentUserSuccess, fetchEpargnerArgentUserError, fetchEpargnerArgentUserReset, fetchCasserEpargneUserPending, fetchCasserEpargneUserSuccess, fetchCasserEpargneUserError, fetchCasserEpargneUserReset, fetchGetNanoCreditUserAccountPending, fetchGetNanoCreditUserAccountSuccess, fetchGetNanoCreditUserAccountError, fetchGetNanoCreditUserAccountReset } from "../../redux/actions/NanoCreditAction"; import { fetchCautionCreditDemandUserError, fetchCautionCreditDemandUserPending, fetchCautionCreditDemandUserReset, fetchCautionCreditDemandUserSuccess, fetchGetDemandsGroupError, fetchGetDemandsGroupPending, fetchGetDemandsGroupReset, fetchGetDemandsGroupSuccess, fetchGetUniqueDemandsGroupError, fetchGetUniqueDemandsGroupPending, fetchGetUniqueDemandsGroupReset, fetchGetUniqueDemandsGroupSuccess, fetchGetUserGroupDetailError, fetchGetUserGroupDetailPending, fetchGetUserGroupDetailReset, fetchGetUserGroupDetailSuccess, fetchEpargnerArgentUserPending, fetchEpargnerArgentUserSuccess, fetchEpargnerArgentUserError, fetchEpargnerArgentUserReset, fetchCasserEpargneUserPending, fetchCasserEpargneUserSuccess, fetchCasserEpargneUserError, fetchCasserEpargneUserReset, fetchGetNanoCreditUserAccountPending, fetchGetNanoCreditUserAccountSuccess, fetchGetNanoCreditUserAccountError, fetchGetNanoCreditUserAccountReset, fetchGetNanoCreditUserHistoryPending, fetchGetNanoCreditUserHistorySuccess, fetchGetNanoCreditUserHistoryError, fetchGetNanoCreditUserHistoryReset } from "../../redux/actions/NanoCreditAction";
import { cautionCreditDemandtUrl, getCreditDemand, groupUrl, refundCreditDemandUrl, epargnerArgentUrl, casserEpargneUrl, getNanoCreditAccount } from "../IlinkConstants"; import { cautionCreditDemandtUrl, getCreditDemand, groupUrl, refundCreditDemandUrl, getNanoCreditUserHistoryUrl, epargnerArgentUrl, casserEpargneUrl, getNanoCreditAccount } from "../IlinkConstants";
export const getNanoCreditDemandsAction = (id) => { export const getNanoCreditDemandsAction = (id) => {
@ -45,7 +45,10 @@ export const getNanoCreditDemandsReset = () => {
export const getNanoCreditUniqueDemandsAction = (id) => { export const getNanoCreditUniqueDemandsAction = (id) => {
const auth = store.getState().authKeyReducer; const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : ''; const authKey = auth !== null ?
auth.authKey !== null ?
`${auth.authKey.token_type} ${auth.authKey.access_token}` :
'' : '';
return dispatch => { return dispatch => {
dispatch(fetchGetUniqueDemandsGroupPending()); dispatch(fetchGetUniqueDemandsGroupPending());
@ -271,3 +274,41 @@ export const getNanoCreditAccountReset = () => {
dispatch(fetchGetNanoCreditUserAccountReset()); dispatch(fetchGetNanoCreditUserAccountReset());
} }
} }
export const getNanoCreditUserHistoryAction = (idUser) => {
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
return dispatch => {
dispatch(fetchGetNanoCreditUserHistoryPending());
axios({
url: `${getNanoCreditUserHistoryUrl}/${idUser}`,
method: 'GET',
headers: {
'Authorization': authKey,
'X-Localization': I18n.currentLocale()
},
})
.then(response => {
console.log(response);
dispatch(fetchGetNanoCreditUserHistorySuccess(response));
})
.catch(error => {
if (error.response)
dispatch(fetchGetNanoCreditUserHistoryError(error.response));
else if (error.request)
dispatch(fetchGetNanoCreditUserHistoryError(error.request))
else
dispatch(fetchGetNanoCreditUserHistoryError(error.message))
});
}
}
export const getNanoCreditUserHistoryReset = () => {
return dispatch => {
dispatch(fetchGetNanoCreditUserHistoryReset());
}
}