one signal setup

This commit is contained in:
Brice Zele 2020-08-17 22:16:31 +01:00
parent 3fd1528ae7
commit 2f3ddf5a2f
6 changed files with 92 additions and 100 deletions

15
App.js
View File

@ -9,7 +9,7 @@
import React, { Component } from 'react';
import { ActionSheetProvider, connectActionSheet } from '@expo/react-native-action-sheet'
import { Platform, StyleSheet, Text, View, YellowBox, AsyncStorage } from 'react-native';
import { createSwitchNavigator, createStackNavigator, createDrawerNavigator, createAppContainer, createBottomTabNavigator, HeaderBackButton } from 'react-navigation';
import { createSwitchNavigator, createStackNavigator, createDrawerNavigator, createAppContainer, createBottomTabNavigator, HeaderBackButton, withNavigation } from 'react-navigation';
import OneSignal from 'react-native-onesignal';
import _ from 'lodash';
import Connect from "./screens/login/Connect";
@ -352,6 +352,8 @@ class App extends React.Component {
constructor(properties) {
super(properties);
console.log("APP PROPS", this.props);
//Remove this method to stop OneSignal Debugging
OneSignal.setLogLevel(6, 0);
@ -441,11 +443,12 @@ class App extends React.Component {
goToScreen = (routeName, params, isReset = true) => {
const { navigator } = this.refs;
navigator.dispatch({
type: "Navigation/NAVIGATE",
routeName,
params
});
console.log("APP REFS", this.refs);
// navigator.dispatch({
// type: "Navigation/NAVIGATE",
// routeName,
// params
// });
// if (isReset) {
// const resetAction = NavigationActions.reset({

View File

@ -139,7 +139,7 @@ class CreateGroupNanoCredit extends Component {
{
text: I18n.t("OK"), onPress: () => {
this.props.createGroupReset();
IlinkEmitter.emit("refreshWallet");
IlinkEmitter.emit("treatNanoGroupDemand");
this.props.navigation.pop();
}
}

View File

@ -125,19 +125,13 @@ class DemandValidationGroup extends React.Component {
this.navigation = this.props.navigation
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
//moment.locale(this.currentLocale);
IlinkEmitter.on('treatNanoGroupDemand', this.refreshData);
};
componentDidMount() {
const { routeName } = this.navigation.state
this.setState({ position: routeName === "demandeValidationGroupe" ? 0 : 1, isDataSubmit: true });
this.refreshData();
this.animateSlidingUp(false)
this.props.navigation.addListener("didFocus", () => {
this.refreshData(false)
console.warn("loading")
})
}
@ -302,8 +296,8 @@ class DemandValidationGroup extends React.Component {
</ActionButton>)
}
refreshData(autoref = true) {
refreshData() {
this.props.getNanoCreditDemandsAction(this.state.user.id);
}
render() {

View File

@ -1,5 +1,5 @@
import React, { Component } from 'react'
import { StyleSheet, View, Text, Alert, Platform, ProgressBarAndroid } from 'react-native'
import { StyleSheet, View, Text, Alert, Platform, ScrollView, ProgressBarAndroid } from 'react-native'
import CardView from 'react-native-cardview'
import Button from 'apsl-react-native-button'
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'
@ -142,62 +142,18 @@ class DemandGroupNanoCreditDetail extends Component {
if (errorTreatDemand !== null) {
if (typeof errorTreatDemand.data !== 'undefined') {
if (errorTreatDemand.status === 426) {
Alert.alert(
I18n.t("ERROR_TREATMENT_DEMAND"),
errorTreatDemand.data.error,
[{
text: I18n.t('CANCEL_LABEL'),
onPress: () => { },
style: 'cancel'
},
{
text: I18n.t("OK"), onPress: () => {
setTimeout(() => {
this.setState({
displayAmountModifyDialog: true
});
}, 10);
this.props.creditDemandResetReducer();
this.props.creditCancelResetReducer();
}
}],
{ cancelable: false }
);
}
else {
Alert.alert(
I18n.t("ERROR_TREATMENT_DEMAND"),
errorTreatDemand.data.error,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.creditDemandResetReducer();
this.props.creditCancelResetReducer();
}
}
],
{ cancelable: false }
);
}
}
}
if (errorCancelDemand !== null) {
if (typeof errorCancelDemand.data !== 'undefined') {
Alert.alert(
I18n.t("ERROR_TREATMENT_DEMAND"),
errorCancelDemand.data.error,
errorTreatDemand.data.error,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.creditCancelResetReducer();
this.props.creditDemandResetReducer();
this.props.treatDemandGroupReset();
}
}
],
{ cancelable: false }
)
);
}
}
@ -206,22 +162,8 @@ class DemandGroupNanoCreditDetail extends Component {
if (resultTreatDemand.status === 200) {
this.displayToast(resultTreatDemand.response);
this.props.navigation.goBack();
this.props.navigation.state.params.onGoBack();
this.props.creditCancelResetReducer();
this.props.creditDemandResetReducer();
}
}
if (resultCancelDemand !== null) {
console.log("resultCancelDemand", resultCancelDemand);
if (resultCancelDemand.status === 200) {
this.displayToast(resultCancelDemand.response);
this.props.navigation.goBack();
this.props.navigation.state.params.onGoBack();
this.props.creditCancelResetReducer();
this.props.creditDemandResetReducer();
IlinkEmitter.emit('treatNanoGroupDemand');
this.props.treatDemandGroupReset();
}
}
@ -230,7 +172,7 @@ class DemandGroupNanoCreditDetail extends Component {
renderLabelState = (state) => {
if (state === 0)
return I18n.t('NO_TREAT')
else if (statut === 1)
else if (state === 1)
return I18n.t('TREAT')
else
return I18n.t('REFUSED')
@ -359,8 +301,9 @@ class DemandGroupNanoCreditDetail extends Component {
renderDetail = () => {
const resultGetUniqueDemand = this.props.resultGetUniqueDemand;
console.log("resultGetUniqueDemand", resultGetUniqueDemand);
const {resultGetUniqueDemand} = this.props;
let ago = moment.tz(resultGetUniqueDemand.response.date_creation, 'Etc/GMT+0').format();
ago = moment(ago)
return (<View style={styles.container}>
<CardView
style={styles.cardcontainer1}
@ -371,7 +314,7 @@ class DemandGroupNanoCreditDetail extends Component {
color: 'black',
marginLeft: responsiveWidth(5)
}}>
{I18n.t('DEMAND_INFO')}
{resultGetUniqueDemand.response.nom}
</Text>
<View style={{
flexDirection: 'row',
@ -384,7 +327,7 @@ class DemandGroupNanoCreditDetail extends Component {
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{`${I18n.t('CREATOR')} ${resultGetUniqueDemand.response.createur}`}</Text>
<Text style={styles.simpleuser}>{`${I18n.t('CREATOR')}: ${resultGetUniqueDemand.response.createur}`}</Text>
</View>
<View style={{
flexDirection: 'row',
@ -397,11 +340,56 @@ class DemandGroupNanoCreditDetail extends Component {
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{`${I18n.t('COUNTRY')} ${resultGetUniqueDemand.response.country}`}</Text>
<Text style={styles.simpleuser}>{`${I18n.t('COUNTRY')}: ${resultGetUniqueDemand.response.country}`}</Text>
</View>
</CardView>
{/* <CardView style={styles.cardcontainer}>
<Text style={{
<CardView
style={styles.cardcontainer}
>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icon name='account-multiple'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{`SPONSOR 1: ${resultGetUniqueDemand.response.sponsor1}`}</Text>
</View>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icon name='account-multiple'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{`SPONSOR 2: ${resultGetUniqueDemand.response.sponsor2}`}</Text>
</View>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icon name='account-multiple'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{`SPONSOR 3: ${resultGetUniqueDemand.response.sponsor3}`}</Text>
</View>
</CardView>
<CardView style={styles.cardcontainer}>
{/* <Text style={{
fontSize: 17,
fontWeight: 'bold',
color: 'black',
@ -419,45 +407,45 @@ class DemandGroupNanoCreditDetail extends Component {
}}
/>
<Text style={styles.simpleuser}>{this.item.code_parrain}</Text>
</View>
</View> */}
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icon name='md-code-working'
<Icon name='code-tags'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{this.item.reseau}</Text>
<Text style={styles.simpleuser}>{resultGetUniqueDemand.response.code_groupe}</Text>
</View>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icon name='md-wallet'
<Icon name='cash'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{this.item.montant}</Text>
<Text style={styles.simpleuser}>{`${I18n.t('LIMITE_GROUP')}: ${resultGetUniqueDemand.response.limite_credit} ${resultGetUniqueDemand.response.currency_code}`}</Text>
</View>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icon name='md-calendar'
<Icon name='calendar'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{ago.format(" Do MMMM YYYY à HH:mm")}</Text>
<Text style={styles.simpleuser}>{`${I18n.t('CREATION_DATE')}: ${ago.format(" Do MMMM YYYY à HH:mm")}`}</Text>
</View>
<View style={{
flexDirection: 'row',
@ -465,7 +453,7 @@ class DemandGroupNanoCreditDetail extends Component {
marginRight: 20,
justifyContent: 'flex-start'
}}>
<Icon name='md-time'
<Icon name='update'
size={28}
color={theme.accent}
/>
@ -476,22 +464,24 @@ class DemandGroupNanoCreditDetail extends Component {
}}>{ago.fromNow()}</Text>
</View>
</CardView> */}
</CardView>
{this.renderBtn()}
</View>);
}
render() {
console.log("DEMAND GROUP PROPS", this.props);
//let ago = moment.tz(this.item.date_creation, 'Etc/GMT+0').format();
//ago = moment(ago)
return (
<>
{(this.state.triggerTreatmentClick || this.state.triggerCancelClick) && this.renderAlertErrorTreatOrCancelDemand()}
{
this.props.loadingGetUniqueDemand ?
this.renderLoader() :
this.renderDetail()
this.props.resultGetUniqueDemand != null ?
this.renderDetail() :
null
}
</>
);

View File

@ -331,6 +331,10 @@
"SEND": "Send",
"CHANGE_INFORMATION": "Change my information",
"VALIDATE": "Validate",
"NO_VALIDATE": "Invalid",
"VALIDATION": "validation",
"VALIDATIONS": "validations",
"LIMITE_GROUP": "Credit limit",
"CONNECT": "Connection",
"TEXT_BIG_CREATE_1": "Register as a User",
"TEXT_SUBTITLE_CREATE_1": "Fill in your personal information",

View File

@ -337,6 +337,7 @@
"NO_VALIDATE": "Non validé",
"VALIDATION": "validation",
"VALIDATIONS": "validations",
"LIMITE_GROUP": "Limite crédit",
"SELECT_YOUR_WALLET": "Selectionner un wallet",
"CONNECT": "Connexion",
"TEXT_BIG_CREATE_1": "Inscrivez vous en tant qu'Utilisateur",