resolution du bug lier au bouton retour de credit management lors de la connection en tant que agent
This commit is contained in:
parent
78f21b52f4
commit
ce4897eaa2
|
@ -8,8 +8,8 @@
|
|||
# The setting is particularly useful for tweaking memory settings.
|
||||
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
|
||||
org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/Contents/Home
|
||||
# org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
|
||||
# org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/Contents/Home
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
|
|
1113
app/App.js
1113
app/App.js
File diff suppressed because it is too large
Load Diff
|
@ -16,6 +16,7 @@
|
|||
"modalhistoryfilter": "filterhistory",
|
||||
"superviseurgroup": "superviseurgroup",
|
||||
"historyItemDetails": "historyItemDetails",
|
||||
"myHistory": "MyHistory",
|
||||
"forgotpass": "forgottenpass",
|
||||
"confirmcode": "confirmcode",
|
||||
"creationstep2": "step2",
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
/* eslint-disable react-native/no-inline-styles */
|
||||
/* eslint-disable prettier/prettier */
|
||||
import React, {Component} from 'react';
|
||||
import {Alert, Image, ProgressBarAndroid, ScrollView, StatusBar, StyleSheet, Text, View} from 'react-native';
|
||||
import Icon from 'react-native-vector-icons/MaterialIcons';
|
||||
import {deleteUser, readUser} from './../../webservice/AuthApi';
|
||||
import {getAgentNetworksList} from './../../webservice/NetworkApi'
|
||||
import {getAgentNetworksList} from './../../webservice/NetworkApi';
|
||||
import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
|
||||
import MapView, {Marker} from 'react-native-maps';
|
||||
import * as Utils from '../../utils/DeviceUtils';
|
||||
import CardView from "react-native-cardview";
|
||||
import I18n from 'react-native-i18n'
|
||||
import {IlinkEmitter} from "../../utils/events";
|
||||
import {Card, CardAction, CardButton, CardContent, CardTitle} from 'react-native-material-cards'
|
||||
import CardView from 'react-native-cardview';
|
||||
import I18n from 'react-native-i18n';
|
||||
import {IlinkEmitter} from '../../utils/events';
|
||||
import {Card, CardAction, CardButton, CardContent, CardTitle} from 'react-native-material-cards';
|
||||
import {Color} from '../../config/Color';
|
||||
import Fontisto from "react-native-vector-icons/Fontisto";
|
||||
import Fontisto from 'react-native-vector-icons/Fontisto';
|
||||
|
||||
let theme = require('./../../utils/theme.json');
|
||||
let route = require('../../route.json');
|
||||
|
||||
require('./../../utils/Translations')
|
||||
require('./../../utils/Translations');
|
||||
const height = responsiveHeight(100) - 250;
|
||||
/*
|
||||
var Fabric = require('react-native-fabric');
|
||||
|
@ -36,10 +38,10 @@ export default class UserAccount extends Component {
|
|||
headerTitle: I18n.t('USER_ACCOUNT'),
|
||||
headerStyle: {
|
||||
backgroundColor: theme.primary,
|
||||
paddingTop: 10
|
||||
paddingTop: 10,
|
||||
},
|
||||
headerTitleStyle: {
|
||||
color: "white"
|
||||
color: 'white',
|
||||
},
|
||||
drawerIcon: ({tintColor}) => (
|
||||
<Icon
|
||||
|
@ -47,7 +49,7 @@ export default class UserAccount extends Component {
|
|||
size={24}
|
||||
/>
|
||||
),
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
static options(passProps) {
|
||||
|
@ -60,49 +62,49 @@ export default class UserAccount extends Component {
|
|||
background: {
|
||||
color: theme.primaryDark,
|
||||
},
|
||||
rightButtons: []
|
||||
rightButtons: [],
|
||||
},
|
||||
backButton: {
|
||||
visible: true,
|
||||
color: "white"
|
||||
color: 'white',
|
||||
},
|
||||
buttonColor: "white",
|
||||
buttonColor: 'white',
|
||||
background: {
|
||||
color: theme.primaryDark
|
||||
color: theme.primaryDark,
|
||||
},
|
||||
statusBar: {
|
||||
drawBehind: false,
|
||||
visible: true,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
super(props);
|
||||
this.state = this.initState();
|
||||
IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
|
||||
IlinkEmitter.on('langueChange', this.updateLangue.bind(this));
|
||||
readUser().then((user) => {
|
||||
if (user !== null) {
|
||||
this.setState({user: user})
|
||||
this.setState({user: user});
|
||||
|
||||
this.updateContent(user)
|
||||
this.updateContent(user);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
updateLangue() {
|
||||
|
||||
this.props.navigation.setParams({name: I18n.t('USER_ACCOUNT')})
|
||||
this.forceUpdate()
|
||||
this.props.navigation.setParams({name: I18n.t('USER_ACCOUNT')});
|
||||
this.forceUpdate();
|
||||
}
|
||||
|
||||
updateContent(user) {
|
||||
getAgentNetworksList(user.agentId).then((networks) => {
|
||||
console.log("networks", networks.networks);
|
||||
if (networks['success'] !== undefined) {
|
||||
this.setState({mynetworks: networks.networks})
|
||||
console.log('networks', networks.networks);
|
||||
if (networks.success !== undefined) {
|
||||
this.setState({mynetworks: networks.networks});
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -112,22 +114,22 @@ export default class UserAccount extends Component {
|
|||
initState() {
|
||||
return {
|
||||
user: {},
|
||||
mynetworks: []
|
||||
}
|
||||
mynetworks: [],
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
let cat = "";
|
||||
let cat = '';
|
||||
|
||||
const {user} = this.state
|
||||
const {user} = this.state;
|
||||
|
||||
if (user.category !== undefined || user.category !== null)
|
||||
cat = user.category === 'super' ? I18n.t("ADMIN") : user.category === 'hyper' ?
|
||||
I18n.t("SUPER_ADMIN") : user.category === 'geolocated' ?
|
||||
I18n.t("GEOLOCATED") : I18n.t("SIMPLE_USER")
|
||||
{cat = user.category === 'super' ? I18n.t('ADMIN') : user.category === 'hyper' ?
|
||||
I18n.t('SUPER_ADMIN') : user.category === 'geolocated' ?
|
||||
I18n.t('GEOLOCATED') : I18n.t('SIMPLE_USER');}
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<StatusBar
|
||||
|
@ -137,7 +139,7 @@ export default class UserAccount extends Component {
|
|||
/>
|
||||
<ScrollView style={{
|
||||
flex: 1,
|
||||
marginTop: -5
|
||||
marginTop: -5,
|
||||
}}>
|
||||
<View style={styles.userInformation}>
|
||||
<ScrollView>
|
||||
|
@ -156,7 +158,7 @@ export default class UserAccount extends Component {
|
|||
color: 'white',
|
||||
fontSize: 17,
|
||||
fontWeight: 'bold',
|
||||
textAlign: 'center'
|
||||
textAlign: 'center',
|
||||
}}>{cat}</Text>
|
||||
}
|
||||
|
||||
|
@ -173,29 +175,29 @@ export default class UserAccount extends Component {
|
|||
|
||||
<Text style={{
|
||||
marginLeft: 10, marginRight: 10, marginTop: 15, marginBottom: 5, fontSize: 17,
|
||||
fontWeight: 'bold', color: 'black'
|
||||
}}>{I18n.t("ACCOUNT_INFO")}</Text>
|
||||
fontWeight: 'bold', color: 'black',
|
||||
}}>{I18n.t('ACCOUNT_INFO')}</Text>
|
||||
<CardView style={{marginLeft: 10, marginRight: 10, paddingBottom: 20}}>
|
||||
<ScrollView>
|
||||
{user.category !== undefined && user.category !== null ? this
|
||||
.addAgentInformation(user) : null}
|
||||
<Text style={styles.textInformation2}>
|
||||
<Icon name={"location-on"} size={18}/>{" " + this.state.user.country}</Text>
|
||||
<Icon name={'location-on'} size={18}/>{' ' + this.state.user.country}</Text>
|
||||
|
||||
{user.balance !== undefined && user.balance !== null ? this.showBalance(user) : null}
|
||||
<Text style={styles.textInformation2}>
|
||||
<Icon name={"mail"} size={18}/>{" " + this.state.user.email}</Text>
|
||||
<Icon name={'mail'} size={18}/>{' ' + this.state.user.email}</Text>
|
||||
|
||||
|
||||
<Text style={styles.textInformation2}>
|
||||
|
||||
<Icon name={"phone"} size={18}/>
|
||||
{" " + this.state.user.phone}</Text>
|
||||
<Icon name={'phone'} size={18}/>
|
||||
{' ' + this.state.user.phone}</Text>
|
||||
{this.showPhoneSup()}
|
||||
<Text style={styles.textInformation2}>
|
||||
|
||||
<Icon name={"account-balance-wallet"} size={18}/>
|
||||
{" " + this.state.user.network}</Text>
|
||||
<Icon name={'account-balance-wallet'} size={18}/>
|
||||
{' ' + this.state.user.network}</Text>
|
||||
</ScrollView>
|
||||
</CardView>
|
||||
|
||||
|
@ -207,8 +209,8 @@ export default class UserAccount extends Component {
|
|||
marginBottom: 5,
|
||||
fontSize: 17,
|
||||
fontWeight: 'bold',
|
||||
color: 'black'
|
||||
}}>{I18n.t("MY_NETWORK")}</Text>)
|
||||
color: 'black',
|
||||
}}>{I18n.t('MY_NETWORK')}</Text>)
|
||||
|
||||
: null}
|
||||
{user.category === 'geolocated' ? (this.state.mynetworks.length > 0 ? this.state.mynetworks.map(item => this.generateItemNetwork(item)) : this.showLoader()) : null}
|
||||
|
@ -216,7 +218,7 @@ export default class UserAccount extends Component {
|
|||
</ScrollView>
|
||||
|
||||
</View>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
showPhoneSup() {
|
||||
|
@ -224,9 +226,9 @@ export default class UserAccount extends Component {
|
|||
|
||||
return (<Text style={styles.textInformation2}>
|
||||
|
||||
<Icon name={"phone"} size={18}/>
|
||||
{" " + this.state.user.phoneTransaction}</Text>
|
||||
)
|
||||
<Icon name={'phone'} size={18}/>
|
||||
{' ' + this.state.user.phoneTransaction}</Text>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,15 +238,14 @@ export default class UserAccount extends Component {
|
|||
color: 'white',
|
||||
fontSize: 15,
|
||||
fontWeight: 'bold',
|
||||
textAlign: 'center'
|
||||
}}>{I18n.t("NETWORK")}</Text>
|
||||
textAlign: 'center',
|
||||
}}>{I18n.t('NETWORK')}</Text>
|
||||
<Text style={{color: 'white', fontSize: 15, textAlign: 'center'}}>{user.network}</Text>
|
||||
</View>)
|
||||
</View>);
|
||||
}
|
||||
|
||||
getHeaderRight(user) {
|
||||
return (<View style={{flex: 0}}>
|
||||
</View>)
|
||||
return (<View style={{flex: 0}} />);
|
||||
}
|
||||
|
||||
getHeaderRightAgent(user) {
|
||||
|
@ -254,10 +255,10 @@ export default class UserAccount extends Component {
|
|||
color: 'white',
|
||||
fontSize: 15,
|
||||
textAlign: 'center',
|
||||
fontWeight: 'bold'
|
||||
}}>{I18n.t("MEMBER_CODE")}</Text>
|
||||
fontWeight: 'bold',
|
||||
}}>{I18n.t('MEMBER_CODE')}</Text>
|
||||
<Text style={{color: 'white', fontSize: 13, textAlign: 'center'}}>{user.code_membre}</Text>
|
||||
</View>)
|
||||
</View>);
|
||||
|
||||
}
|
||||
|
||||
|
@ -267,69 +268,69 @@ export default class UserAccount extends Component {
|
|||
color: 'white',
|
||||
fontSize: 15,
|
||||
fontWeight: 'bold',
|
||||
textAlign: 'center'
|
||||
}}>{I18n.t("NETWORK")}</Text>
|
||||
textAlign: 'center',
|
||||
}}>{I18n.t('NETWORK')}</Text>
|
||||
<Text style={{color: 'white', fontSize: 13, textAlign: 'center'}}>{user.network}</Text>
|
||||
</View>)
|
||||
</View>);
|
||||
}
|
||||
|
||||
addAgentInformation(user) {
|
||||
console.log(user)
|
||||
if (user.category === "geolocated") {
|
||||
console.log(user);
|
||||
if (user.category === 'geolocated') {
|
||||
(<View>
|
||||
<Text style={{marginLeft: 10, marginTop: 10, color: theme.primaryDark}}>
|
||||
<Icon name={'code'} size={18} color={theme.primaryDark} style={{paddingRight: 10}}/>
|
||||
{" " + user.code_parrain}</Text>
|
||||
</View>)
|
||||
{' ' + user.code_parrain}</Text>
|
||||
</View>);
|
||||
|
||||
} else
|
||||
return (<View>
|
||||
{return (<View>
|
||||
|
||||
<Text style={{marginLeft: 10, marginTop: 10, color: theme.primaryDark}}>
|
||||
<Icon name={'code'} size={18} color={theme.primaryDark} style={{paddingRight: 10}}/>
|
||||
{" " + user.code_parrain}</Text>
|
||||
{' ' + user.code_parrain}</Text>
|
||||
<View style={{
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
width: responsiveWidth(90),
|
||||
marginRight: 50
|
||||
marginRight: 50,
|
||||
}}>
|
||||
<Text style={{marginLeft: 12, marginTop: 10, color: theme.primaryDark}}>
|
||||
<Icon name={"group-work"} color={theme.primaryDark} size={18}/>
|
||||
{" " + ((user.nbre_reseau === null || user.nbre_reseau === undefined) ? 0 : user.nbre_reseau) + " " + I18n.t("FREE")}
|
||||
<Icon name={'group-work'} color={theme.primaryDark} size={18}/>
|
||||
{' ' + ((user.nbre_reseau === null || user.nbre_reseau === undefined) ? 0 : user.nbre_reseau) + ' ' + I18n.t('FREE')}
|
||||
</Text>
|
||||
<Text style={{marginLeft: 12, marginTop: 10, color: theme.primaryDark}}>
|
||||
<Icon name={"book"} color={theme.primaryDark}
|
||||
size={18}/>{" " + ((user.nbre_reseau === null || user.nbre_membre === undefined) ? 0 : user.nbre_membre) + " " + I18n.t("SAVED")}
|
||||
<Icon name={'book'} color={theme.primaryDark}
|
||||
size={18}/>{' ' + ((user.nbre_reseau === null || user.nbre_membre === undefined) ? 0 : user.nbre_membre) + ' ' + I18n.t('SAVED')}
|
||||
</Text>
|
||||
</View>
|
||||
</View>)
|
||||
</View>);}
|
||||
}
|
||||
|
||||
mapUser(user) {
|
||||
const myPosition = {latitude: parseFloat(user.latitude), longitude: parseFloat(user.longitude)}
|
||||
const myPosition = {latitude: parseFloat(user.latitude), longitude: parseFloat(user.longitude)};
|
||||
|
||||
return (<MapView
|
||||
liteMode
|
||||
ref={(ref) => {
|
||||
this.mapRef = ref
|
||||
this.mapRef = ref;
|
||||
}}
|
||||
style={styles.map}
|
||||
>
|
||||
{this.state.myPosition !== undefined ?
|
||||
<Marker
|
||||
title={"Vous êtes ici"}
|
||||
title={'Vous êtes ici'}
|
||||
minZoomLevel={10}
|
||||
coordinate={{longitude: myPosition.longitude, latitude: myPosition.latitude}}
|
||||
/> :
|
||||
null}
|
||||
</MapView>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
showBalance(user) {
|
||||
return <Text style={styles.textInformation2}>
|
||||
<Icon name={"folder"} size={18}/>{" " + this.state.user.balance + " "}</Text>
|
||||
<Icon name={'folder'} size={18}/>{' ' + this.state.user.balance + ' '}</Text>;
|
||||
|
||||
}
|
||||
|
||||
|
@ -343,10 +344,10 @@ export default class UserAccount extends Component {
|
|||
marginBottom: 5,
|
||||
fontSize: 17,
|
||||
fontWeight: 'bold',
|
||||
color: 'black'
|
||||
color: 'black',
|
||||
}}>Mes reseaux</Text>
|
||||
|
||||
</View>)
|
||||
</View>);
|
||||
}
|
||||
|
||||
generateItemNetwork(item) {
|
||||
|
@ -361,13 +362,13 @@ export default class UserAccount extends Component {
|
|||
<CardContent>
|
||||
<View Style={{flex: 1}}>
|
||||
<Text style={styles.textInformation2}>
|
||||
<Icon name={"code"} size={18}/>{" " + item.code_membre + " "}</Text>
|
||||
<Icon name={'code'} size={18}/>{' ' + item.code_membre + ' '}</Text>
|
||||
<Text style={styles.textInformation2}>
|
||||
<Icon name={"people"} size={18}/>{" " + item.code_parrain + " "}</Text>
|
||||
<Icon name={'people'} size={18}/>{' ' + item.code_parrain + ' '}</Text>
|
||||
{item.provider_class !== null && (
|
||||
<>
|
||||
<Text style={styles.textInformation2}>
|
||||
<Fontisto name={"doctor"} size={18}/>{" " + item.provider_class + " "}</Text>
|
||||
<Fontisto name={'doctor'} size={18}/>{' ' + item.provider_class + ' '}</Text>
|
||||
</>
|
||||
|
||||
)}
|
||||
|
@ -380,37 +381,37 @@ export default class UserAccount extends Component {
|
|||
<CardButton
|
||||
onPress={() => {
|
||||
Alert.alert(
|
||||
I18n.t("TITLE_SUPPRESS_CONFIRM"),
|
||||
I18n.t("TEXT_SUPPRESS_CONFIRM"),
|
||||
I18n.t('TITLE_SUPPRESS_CONFIRM'),
|
||||
I18n.t('TEXT_SUPPRESS_CONFIRM'),
|
||||
[
|
||||
{
|
||||
text: I18n.t('NO'), onPress: () => {
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
text: I18n.t("YES"), onPress: () => {
|
||||
text: I18n.t('YES'), onPress: () => {
|
||||
deleteUser(item).then(() => {
|
||||
this.setState({isLoading: true})
|
||||
this.updateContent(this.state.user)
|
||||
})
|
||||
this.setState({isLoading: true});
|
||||
this.updateContent(this.state.user);
|
||||
});
|
||||
},
|
||||
style: 'cancel'
|
||||
style: 'cancel',
|
||||
},
|
||||
],
|
||||
)
|
||||
);
|
||||
}}
|
||||
title={I18n.t('DELETE_GEOLOCATED_USER')}
|
||||
color="crimson"
|
||||
/>
|
||||
</CardAction>
|
||||
</Card>)
|
||||
</Card>);
|
||||
}
|
||||
|
||||
showLoader() {
|
||||
return (<View style={{height: responsiveHeight(20)}}><ProgressBarAndroid
|
||||
|
||||
style={{justifyContent: "center", alignItems: "center"}}
|
||||
/></View>)
|
||||
style={{justifyContent: 'center', alignItems: 'center'}}
|
||||
/></View>);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -420,7 +421,7 @@ const styles = StyleSheet.create({
|
|||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
paddingTop: responsiveHeight(2),
|
||||
paddingBottom: responsiveHeight(5)
|
||||
paddingBottom: responsiveHeight(5),
|
||||
},
|
||||
map: {
|
||||
height: 200,
|
||||
|
@ -431,7 +432,7 @@ const styles = StyleSheet.create({
|
|||
networkInformation: {
|
||||
width: responsiveWidth(100),
|
||||
backgroundColor: '#EEEEEE',
|
||||
flex: 1
|
||||
flex: 1,
|
||||
},
|
||||
container: {
|
||||
flex: 1,
|
||||
|
@ -458,7 +459,7 @@ const styles = StyleSheet.create({
|
|||
shadowOpacity: 1.0,
|
||||
elevation: 5,
|
||||
borderRadius: 10,
|
||||
backgroundColor: Color.cardBackgroundColor
|
||||
backgroundColor: Color.cardBackgroundColor,
|
||||
},
|
||||
contain: {
|
||||
flexDirection: 'row',
|
||||
|
@ -468,7 +469,7 @@ const styles = StyleSheet.create({
|
|||
marginTop: 15,
|
||||
marginLeft: 5,
|
||||
width: Utils.scaleWithPixel(30),
|
||||
height: Utils.scaleWithPixel(30)
|
||||
height: Utils.scaleWithPixel(30),
|
||||
},
|
||||
content: {
|
||||
height: Utils.scaleWithPixel(60),
|
||||
|
@ -483,7 +484,7 @@ const styles = StyleSheet.create({
|
|||
textInformation: {
|
||||
fontSize: 16,
|
||||
color: 'white',
|
||||
textAlign: 'center'
|
||||
textAlign: 'center',
|
||||
},
|
||||
textInformation2: {
|
||||
fontSize: 15,
|
||||
|
@ -494,12 +495,12 @@ const styles = StyleSheet.create({
|
|||
textTitle: {
|
||||
fontSize: 25,
|
||||
color: 'white',
|
||||
fontWeight: 'bold'
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
|
||||
textTitle2: {
|
||||
fontSize: 25,
|
||||
color: theme.primaryDark,
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable prettier/prettier */
|
||||
/**
|
||||
* Sample React Native App
|
||||
* https://github.com/facebook/react-native
|
||||
|
@ -41,9 +42,9 @@ class History extends BaseScreen {
|
|||
navBarButtonColor: '#FFFFFF',
|
||||
contextualMenuStatusBarColor: theme.accent,
|
||||
contextualMenuBackgroundColor: theme.accentLight,
|
||||
contextualMenuButtonsColor: '#ffffff'
|
||||
contextualMenuButtonsColor: '#ffffff',
|
||||
|
||||
};
|
||||
};
|
||||
static navigationOptions = ({ navigation }) => {
|
||||
return {
|
||||
title: I18n.t('CREDIT_MANAGE'),
|
||||
|
@ -63,9 +64,9 @@ class History extends BaseScreen {
|
|||
visible: true,
|
||||
drawBehind: false,
|
||||
background: {
|
||||
color: theme.primaryDark
|
||||
}
|
||||
}
|
||||
color: theme.primaryDark,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +103,6 @@ class History extends BaseScreen {
|
|||
case 'willAppear':
|
||||
this.refreshData()
|
||||
break;
|
||||
break;
|
||||
case 'didAppear':
|
||||
break;
|
||||
case 'willDisappear':
|
||||
|
@ -282,7 +282,7 @@ class History extends BaseScreen {
|
|||
isLoaded: false,
|
||||
isSectionned: false,
|
||||
isDateTimePickerVisible: false,
|
||||
isDateEndTimePickerVisible: false
|
||||
isDateEndTimePickerVisible: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -491,10 +491,10 @@ class History extends BaseScreen {
|
|||
_showDateTimePicker = (type) => {
|
||||
if (type === 1)
|
||||
this.setState({
|
||||
isDateTimePickerVisible: true
|
||||
isDateTimePickerVisible: true,
|
||||
});
|
||||
else this.setState({
|
||||
isDateEndTimePickerVisible: true
|
||||
isDateEndTimePickerVisible: true,
|
||||
});
|
||||
}
|
||||
_showDateEndPicker = () => this.setState({ isDateEndTimePickerVisible: true });
|
||||
|
@ -507,7 +507,7 @@ class History extends BaseScreen {
|
|||
datestart: fromdate,
|
||||
datestartformated: moment(fromdate).format('dddd Do ,MMMM YYYY'),
|
||||
dateend: enddate,
|
||||
dateendformated: moment(enddate).format('dddd Do ,MMMM YYYY')
|
||||
dateendformated: moment(enddate).format('dddd Do ,MMMM YYYY'),
|
||||
});
|
||||
let startdate = this.state.datestart;
|
||||
let enddatemo = moment(enddate);
|
||||
|
@ -518,7 +518,7 @@ class History extends BaseScreen {
|
|||
text: I18n.t('DATE_WRONG'),
|
||||
duration: 'long',
|
||||
backgroundColor: 'red',
|
||||
textColor: 'white'
|
||||
textColor: 'white',
|
||||
})
|
||||
} else {
|
||||
this.setState({ filder_disable: false });
|
||||
|
@ -541,7 +541,7 @@ class History extends BaseScreen {
|
|||
<ActionButton.Item buttonColor={primary} title={I18n.t('MAKE_REQUEST')}
|
||||
onPress={() => {
|
||||
this.props.navigation.push(route.credrequester, {
|
||||
onGoBack: () => this.refreshData()
|
||||
onGoBack: () => this.refreshData(),
|
||||
})
|
||||
}}
|
||||
>
|
||||
|
@ -590,7 +590,7 @@ class History extends BaseScreen {
|
|||
}]
|
||||
return <PagerTabIndicator
|
||||
style={{
|
||||
height: responsiveHeight(8)
|
||||
height: responsiveHeight(8),
|
||||
}}
|
||||
tabs={tabs} />;
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ class History extends BaseScreen {
|
|||
}]
|
||||
return <PagerTabIndicator
|
||||
style={{
|
||||
height: responsiveHeight(8)
|
||||
height: responsiveHeight(8),
|
||||
}}
|
||||
tabs={tabs} />;
|
||||
}
|
||||
|
@ -609,14 +609,14 @@ class History extends BaseScreen {
|
|||
_renderTabs() {
|
||||
let tabs = [{
|
||||
text: I18n.t('MY_DEMANDE'),
|
||||
iconSource: this.state.usersicon
|
||||
iconSource: this.state.usersicon,
|
||||
}, {
|
||||
text: I18n.t('DEMANDE_RECEIVE'),
|
||||
iconSource: this.state.charticon
|
||||
iconSource: this.state.charticon,
|
||||
}]
|
||||
return <PagerTabIndicator
|
||||
style={{
|
||||
height: responsiveHeight(8)
|
||||
height: responsiveHeight(8),
|
||||
}}
|
||||
tabs={tabs} />;
|
||||
}
|
||||
|
@ -653,7 +653,7 @@ const datefilter = StyleSheet.create({
|
|||
},
|
||||
datetext: {
|
||||
fontSize: 16,
|
||||
marginLeft: responsiveWidth(5)
|
||||
marginLeft: responsiveWidth(5),
|
||||
},
|
||||
content: {
|
||||
flex: 2,
|
||||
|
@ -672,12 +672,12 @@ const datefilter = StyleSheet.create({
|
|||
},
|
||||
btntext: {
|
||||
fontWeight: 'bold',
|
||||
color: accent
|
||||
color: accent,
|
||||
},
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'space-evenly'
|
||||
}
|
||||
justifyContent: 'space-evenly',
|
||||
},
|
||||
})
|
||||
const styles = StyleSheet.create({
|
||||
slidingup: {
|
||||
|
@ -695,7 +695,7 @@ const styles = StyleSheet.create({
|
|||
emptylist: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center'
|
||||
alignItems: 'center',
|
||||
},
|
||||
backgroundd_drawer: {
|
||||
backgroundColor: '#000',
|
||||
|
@ -727,10 +727,10 @@ const styles = StyleSheet.create({
|
|||
fontSize: 17,
|
||||
marginLeft: responsiveWidth(10),
|
||||
|
||||
color: 'black'
|
||||
color: 'black',
|
||||
},
|
||||
content: {
|
||||
flex: 8
|
||||
flex: 8,
|
||||
},
|
||||
|
||||
title: {
|
||||
|
@ -738,6 +738,6 @@ const styles = StyleSheet.create({
|
|||
marginLeft: 20,
|
||||
marginTop: 20,
|
||||
color: 'black',
|
||||
fontWeight: 'bold'
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,8 +1,22 @@
|
|||
/* eslint-disable react/jsx-no-duplicate-props */
|
||||
/* eslint-disable react-native/no-inline-styles */
|
||||
/* eslint-disable no-unused-vars */
|
||||
import React, {PureComponent} from 'react';
|
||||
import {FlatList, RefreshControl, SectionList, StyleSheet, Text, TouchableOpacity, View} from 'react-native';
|
||||
import {responsiveFontSize, responsiveWidth} from 'react-native-responsive-dimensions';
|
||||
import {
|
||||
FlatList,
|
||||
RefreshControl,
|
||||
SectionList,
|
||||
StyleSheet,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import {
|
||||
responsiveFontSize,
|
||||
responsiveWidth,
|
||||
} from 'react-native-responsive-dimensions';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import I18n from "react-native-i18n"
|
||||
import I18n from 'react-native-i18n';
|
||||
|
||||
import 'moment/locale/fr';
|
||||
import 'moment/locale/es-us';
|
||||
|
@ -21,312 +35,343 @@ let route = require('./../../route.json');
|
|||
var theme = require('./../../utils/theme.json');
|
||||
|
||||
export class HistoryItem extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.currentLocale = I18n.locale.includes('fr') ? 'fr' : 'en-gb';
|
||||
console.log('Current Locale item', this.currentLocale);
|
||||
moment.locale(this.currentLocale);
|
||||
this.state = this.initState();
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
|
||||
console.log("Current Locale item", this.currentLocale);
|
||||
moment.locale(this.currentLocale);
|
||||
this.state = this.initState();
|
||||
statusLabel = status => {
|
||||
switch (status) {
|
||||
case '0':
|
||||
return I18n.t('NO_TREAT');
|
||||
case '1':
|
||||
return I18n.t('TREAT');
|
||||
case '2':
|
||||
return I18n.t('REFUSED');
|
||||
}
|
||||
};
|
||||
|
||||
statusLabel = (status) => {
|
||||
switch (status) {
|
||||
case '0':
|
||||
return I18n.t('NO_TREAT');
|
||||
case '1':
|
||||
return I18n.t('TREAT');
|
||||
case '2':
|
||||
return I18n.t('REFUSED');
|
||||
}
|
||||
colorLabel = status => {
|
||||
switch (status) {
|
||||
case '0':
|
||||
return Color.accentColor;
|
||||
case '1':
|
||||
return Color.greenColor;
|
||||
case '2':
|
||||
return Color.redColor;
|
||||
}
|
||||
};
|
||||
|
||||
colorLabel = (status) => {
|
||||
switch (status) {
|
||||
case '0':
|
||||
return Color.accentColor;
|
||||
case '1':
|
||||
return Color.greenColor;
|
||||
case '2':
|
||||
return Color.redColor;
|
||||
}
|
||||
descriptionLabelUserType = user => {
|
||||
let textDescription =
|
||||
this.props.selfData.montant +
|
||||
' ' +
|
||||
I18n.t('TO_') +
|
||||
' ' +
|
||||
this.props.selfData.reseau;
|
||||
|
||||
switch (user.category) {
|
||||
case 'geolocated':
|
||||
return `${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}`;
|
||||
case 'super':
|
||||
return this.props.isDemandSend
|
||||
? `${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}`
|
||||
: `${I18n.t('THE_AGENT')} ${this.props.selfData.lastname} (${
|
||||
this.props.selfData.phone
|
||||
}) ${I18n.t('DEMAND_TEXT_FIRST_PART')} ${textDescription}`;
|
||||
|
||||
case 'hyper':
|
||||
return `${I18n.t('THE_SUPERVISOR')} ${this.props.selfData.lastname} (${
|
||||
this.props.selfData.phone
|
||||
}) ${I18n.t('DEMAND_TEXT_FIRST_PART')} ${textDescription}`;
|
||||
}
|
||||
};
|
||||
|
||||
descriptionLabelUserType = (user) => {
|
||||
let textDescription = (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' ' + this.props.selfData.reseau;
|
||||
|
||||
switch (user.category) {
|
||||
case 'geolocated':
|
||||
return `${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}`;
|
||||
case 'super':
|
||||
return this.props.isDemandSend ?
|
||||
`${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}`
|
||||
:
|
||||
`${I18n.t('THE_AGENT')} ${this.props.selfData.lastname} (${this.props.selfData.phone}) ${I18n.t('DEMAND_TEXT_FIRST_PART')} ${textDescription}`;
|
||||
|
||||
case 'hyper':
|
||||
return `${I18n.t('THE_SUPERVISOR')} ${this.props.selfData.lastname} (${this.props.selfData.phone}) ${I18n.t('DEMAND_TEXT_FIRST_PART')} ${textDescription}`;
|
||||
}
|
||||
}
|
||||
|
||||
initState() {
|
||||
var textTitle = ' Transaction ' + this.props.selfData.id;
|
||||
var textDescription = I18n.t('PHONE') + ' ' + this.props.selfData.phone + " " + I18n.t('DEMAND_TEXT_FIRST_PART') + ' ' + (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' ';
|
||||
textDescription += this.props.selfData.reseau;
|
||||
var today = new Date();
|
||||
var l = this.props.selfData.date_creation;
|
||||
let t = this.props.selfData.status;
|
||||
var re = moment.tz(this.props.selfData.date_creation, moment.tz.guess()).format();
|
||||
re = moment(re)
|
||||
return {
|
||||
title: textTitle,
|
||||
description: this.descriptionLabelUserType(this.props.user),
|
||||
status: this.statusLabel(this.props.selfData.status),
|
||||
time: re.fromNow(),
|
||||
navigator: this.props.navigator,
|
||||
type: t,
|
||||
colorstate: this.colorLabel(t)
|
||||
}
|
||||
initState() {
|
||||
var textTitle = ' Transaction ' + this.props.selfData.id;
|
||||
var textDescription =
|
||||
I18n.t('PHONE') +
|
||||
' ' +
|
||||
this.props.selfData.phone +
|
||||
' ' +
|
||||
I18n.t('DEMAND_TEXT_FIRST_PART') +
|
||||
' ' +
|
||||
this.props.selfData.montant +
|
||||
' ' +
|
||||
I18n.t('TO_') +
|
||||
' ';
|
||||
textDescription += this.props.selfData.reseau;
|
||||
var today = new Date();
|
||||
var l = this.props.selfData.date_creation;
|
||||
let t = this.props.selfData.status;
|
||||
var re = moment
|
||||
.tz(this.props.selfData.date_creation, moment.tz.guess())
|
||||
.format();
|
||||
re = moment(re);
|
||||
return {
|
||||
title: textTitle,
|
||||
description: this.descriptionLabelUserType(this.props.user),
|
||||
status: this.statusLabel(this.props.selfData.status),
|
||||
time: re.fromNow(),
|
||||
navigator: this.props.navigator,
|
||||
type: t,
|
||||
colorstate: this.colorLabel(t),
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
//console.log("ITEM RENDER", this.props.selfData)
|
||||
return (
|
||||
<TouchableOpacity onPress={() =>
|
||||
this.props.navigator.navigate(route.historyItemDetails, {
|
||||
item: this.props.selfData,
|
||||
onGoBack: () => this.props.refresh(),
|
||||
}
|
||||
)}>
|
||||
<View style={style.content}>
|
||||
<Text style={style.title}>{this.state.title}</Text>
|
||||
<Text style={style.description}>{this.state.description}</Text>
|
||||
<View style={style.timeContent}>
|
||||
<Text style={{
|
||||
fontWeight: 'bold',
|
||||
marginLeft: 20,
|
||||
marginBottom: 10,
|
||||
color: this.state.colorstate,
|
||||
|
||||
}}>{this.statusLabel(this.props.selfData.status)}</Text>
|
||||
<Text style={style.time}>{this.state.time}</Text>
|
||||
</View>
|
||||
<View style={style.bottomSeparator}/>
|
||||
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
//console.log("ITEM RENDER", this.props.selfData)
|
||||
return (
|
||||
<TouchableOpacity
|
||||
onPress={() =>
|
||||
this.props.navigator.navigate(route.historyItemDetails, {
|
||||
item: this.props.selfData,
|
||||
onGoBack: () => this.props.refresh(),
|
||||
})
|
||||
}>
|
||||
<View style={style.content}>
|
||||
<Text style={style.title}>{this.state.title}</Text>
|
||||
<Text style={style.description}>{this.state.description}</Text>
|
||||
<View style={style.timeContent}>
|
||||
<Text
|
||||
style={{
|
||||
fontWeight: 'bold',
|
||||
marginLeft: 20,
|
||||
marginBottom: 10,
|
||||
color: this.state.colorstate,
|
||||
}}>
|
||||
{this.statusLabel(this.props.selfData.status)}
|
||||
</Text>
|
||||
<Text style={style.time}>{this.state.time}</Text>
|
||||
</View>
|
||||
<View style={style.bottomSeparator} />
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class HistoryItemSectionned extends PureComponent {
|
||||
_keyExtractor = (item, index) => item.id;
|
||||
_renderItem = ({item}) => (
|
||||
<HistoryItem
|
||||
navigator={this.props.navigator}
|
||||
selfData={item}
|
||||
/>
|
||||
);
|
||||
_keyExtractor = (item, index) => item.id;
|
||||
_renderItem = ({item}) => (
|
||||
<HistoryItem navigator={this.props.navigator} selfData={item} />
|
||||
);
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = this.initState();
|
||||
this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
|
||||
moment.locale(this.currentLocale);
|
||||
}
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = this.initState();
|
||||
this.currentLocale = I18n.locale.includes('fr') ? 'fr' : 'en-gb';
|
||||
moment.locale(this.currentLocale);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
||||
<SectionList
|
||||
sections={[
|
||||
{
|
||||
title: 'Demande traité',
|
||||
type: 0,
|
||||
data: this.state.treat,
|
||||
size: this.state.conservetreat.length,
|
||||
expandState: this.state.istreatexpand
|
||||
},
|
||||
{
|
||||
title: 'Demande non traité',
|
||||
type: 1,
|
||||
data: this.state.untreat,
|
||||
size: this.state.conserveuntreat.length,
|
||||
expandState: this.state.isuntreatexpand
|
||||
}
|
||||
]}
|
||||
renderSectionHeader={({section: {title, type, data, size, expandState}}) => (
|
||||
<TouchableOpacity onPress={() => this.onPressedHeader(type)} style={{
|
||||
backgroundColor: theme.accent,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'row', flex: 1, height: 70, width: responsiveWidth(100)
|
||||
}}>
|
||||
<View style={{
|
||||
height: 70,
|
||||
justifyContent: 'center',
|
||||
flex: 1,
|
||||
width: responsiveWidth(100),
|
||||
}}>
|
||||
<Text style={{
|
||||
fontWeight: 'bold',
|
||||
marginLeft: 20,
|
||||
fontSize: 20,
|
||||
color: 'white'
|
||||
}}>{title}</Text>
|
||||
<Text style={{
|
||||
fontWeight: 'bold',
|
||||
marginLeft: 20,
|
||||
fontSize: 16,
|
||||
color: 'white'
|
||||
}}>{size} demande(s)</Text>
|
||||
</View>
|
||||
<Icon name={expandState ? 'sort-up' : 'sort-down'} size={30} color={'white'}
|
||||
style={{marginRight: 20}}/>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
style={style.listStyle}
|
||||
extraData={this.state}
|
||||
keyExtractor={this._keyExtractor}
|
||||
renderItem={this._renderItem}
|
||||
render() {
|
||||
return (
|
||||
<SectionList
|
||||
sections={[
|
||||
{
|
||||
title: 'Demande traité',
|
||||
type: 0,
|
||||
data: this.state.treat,
|
||||
size: this.state.conservetreat.length,
|
||||
expandState: this.state.istreatexpand,
|
||||
},
|
||||
{
|
||||
title: 'Demande non traité',
|
||||
type: 1,
|
||||
data: this.state.untreat,
|
||||
size: this.state.conserveuntreat.length,
|
||||
expandState: this.state.isuntreatexpand,
|
||||
},
|
||||
]}
|
||||
renderSectionHeader={({
|
||||
section: {title, type, data, size, expandState},
|
||||
}) => (
|
||||
<TouchableOpacity
|
||||
onPress={() => this.onPressedHeader(type)}
|
||||
style={{
|
||||
backgroundColor: theme.accent,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'row',
|
||||
flex: 1,
|
||||
height: 70,
|
||||
width: responsiveWidth(100),
|
||||
}}>
|
||||
<View
|
||||
style={{
|
||||
height: 70,
|
||||
justifyContent: 'center',
|
||||
flex: 1,
|
||||
width: responsiveWidth(100),
|
||||
}}>
|
||||
<Text
|
||||
style={{
|
||||
fontWeight: 'bold',
|
||||
marginLeft: 20,
|
||||
fontSize: 20,
|
||||
color: 'white',
|
||||
}}>
|
||||
{title}
|
||||
</Text>
|
||||
<Text
|
||||
style={{
|
||||
fontWeight: 'bold',
|
||||
marginLeft: 20,
|
||||
fontSize: 16,
|
||||
color: 'white',
|
||||
}}>
|
||||
{size} demande(s)
|
||||
</Text>
|
||||
</View>
|
||||
<Icon
|
||||
name={expandState ? 'sort-up' : 'sort-down'}
|
||||
size={30}
|
||||
color={'white'}
|
||||
style={{marginRight: 20}}
|
||||
/>
|
||||
);
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
style={style.listStyle}
|
||||
extraData={this.state}
|
||||
keyExtractor={this._keyExtractor}
|
||||
renderItem={this._renderItem}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
onPressedHeader(type) {
|
||||
if (type === 0) {
|
||||
this.setState({
|
||||
istreatexpand: !this.state.istreatexpand,
|
||||
treat: this.state.istreatexpand ? [] : this.state.conservetreat,
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
isuntreatexpand: !this.state.isuntreatexpand,
|
||||
untreat: this.state.isuntreatexpand ? [] : this.state.conserveuntreat,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onPressedHeader(type) {
|
||||
if (type === 0) {
|
||||
this.setState({
|
||||
istreatexpand: !this.state.istreatexpand,
|
||||
treat: this.state.istreatexpand ? [] : this.state.conservetreat
|
||||
})
|
||||
} else {
|
||||
this.setState({
|
||||
isuntreatexpand: !this.state.isuntreatexpand,
|
||||
untreat: this.state.isuntreatexpand ? [] : this.state.conserveuntreat
|
||||
})
|
||||
initState() {
|
||||
let data = this.props.list;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
initState() {
|
||||
let data = this.props.list
|
||||
|
||||
return {
|
||||
conservetreat: data.filter(item => item.statut === I18n.t('TREAT')),
|
||||
treat: data.filter(item => item.statut === I18n.t('TREAT')),
|
||||
istreatexpand: true,
|
||||
conserveuntreat: data.filter(item => item.statut !== I18n.t('TREAT')),
|
||||
untreat: data.filter(item => item.statut !== I18n.t('TREAT')),
|
||||
isuntreatexpand: true
|
||||
}
|
||||
}
|
||||
return {
|
||||
conservetreat: data.filter(item => item.statut === I18n.t('TREAT')),
|
||||
treat: data.filter(item => item.statut === I18n.t('TREAT')),
|
||||
istreatexpand: true,
|
||||
conserveuntreat: data.filter(item => item.statut !== I18n.t('TREAT')),
|
||||
untreat: data.filter(item => item.statut !== I18n.t('TREAT')),
|
||||
isuntreatexpand: true,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export class HistoryListItem extends React.Component {
|
||||
_keyExtractor = (item, index) => item.id;
|
||||
_keyExtractor = (item, index) => item.id;
|
||||
|
||||
_onPressItem = (id: string) => {
|
||||
_onPressItem = id => {};
|
||||
_renderItem = ({item}) => {
|
||||
//console.log('ITEM ', item);
|
||||
return (
|
||||
<HistoryItem
|
||||
isDemandSend={this.props.isDemandSend}
|
||||
user={this.props.user}
|
||||
refresh={this.props.refresh}
|
||||
navigator={this.props.navigator}
|
||||
selfData={item}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = this.initState();
|
||||
this.currentLocale = I18n.locale.includes('fr') ? 'fr' : 'en-gb';
|
||||
moment.locale(this.currentLocale);
|
||||
}
|
||||
|
||||
initState() {
|
||||
return {
|
||||
refreshing: false,
|
||||
};
|
||||
_renderItem = ({item}) => {
|
||||
//console.log('ITEM ', item);
|
||||
return (
|
||||
<HistoryItem
|
||||
isDemandSend={this.props.isDemandSend}
|
||||
user={this.props.user}
|
||||
refresh={this.props.refresh}
|
||||
navigator={this.props.navigator}
|
||||
selfData={item}
|
||||
refresh={this.props.refresh}
|
||||
/>
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = this.initState();
|
||||
this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
|
||||
moment.locale(this.currentLocale);
|
||||
}
|
||||
|
||||
initState() {
|
||||
return {
|
||||
refreshing: false,
|
||||
render() {
|
||||
return (
|
||||
<FlatList
|
||||
style={style.listStyle}
|
||||
data={this.props.list}
|
||||
extraData={this.state}
|
||||
keyExtractor={this._keyExtractor}
|
||||
renderItem={this._renderItem}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={this.props.isRefreshing}
|
||||
colors={[
|
||||
theme.primary,
|
||||
theme.purpleLight,
|
||||
theme.reddeconnect,
|
||||
theme.accentLight,
|
||||
]}
|
||||
onRefresh={this.props.refreshing}
|
||||
/>
|
||||
}
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<FlatList
|
||||
style={style.listStyle}
|
||||
data={this.props.list}
|
||||
extraData={this.state}
|
||||
keyExtractor={this._keyExtractor}
|
||||
renderItem={this._renderItem}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={this.props.isRefreshing}
|
||||
colors={[theme.primary, theme.purpleLight, theme.reddeconnect, theme.accentLight]}
|
||||
onRefresh={this.props.refreshing}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
_onRefresh() {
|
||||
this.setState({refreshing: true})
|
||||
setTimeout(() => {
|
||||
this.setState({refreshing: false})
|
||||
}, 5000);
|
||||
}
|
||||
_onRefresh() {
|
||||
this.setState({refreshing: true});
|
||||
setTimeout(() => {
|
||||
this.setState({refreshing: false});
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
const style = StyleSheet.create({
|
||||
content: {
|
||||
width: responsiveWidth(100),
|
||||
borderBottomColor: '#FFFFFF',
|
||||
flex: 1,
|
||||
flexDirection: 'column',
|
||||
paddingTop: 10,
|
||||
|
||||
},
|
||||
listStyle: {
|
||||
backgroundColor: 'white'
|
||||
},
|
||||
bottomSeparator: {
|
||||
width: responsiveWidth(100),
|
||||
height: 5,
|
||||
justifyContent: 'center',
|
||||
alignSelf: 'center',
|
||||
backgroundColor: '#EEE',
|
||||
},
|
||||
title: {
|
||||
color: '#000',
|
||||
paddingLeft: 10,
|
||||
fontSize: responsiveFontSize(2.2)
|
||||
},
|
||||
description: {
|
||||
fontSize: responsiveFontSize(1.8),
|
||||
color: '#4f5b62',
|
||||
paddingLeft: 10,
|
||||
|
||||
},
|
||||
timeContent: {
|
||||
justifyContent: 'space-between',
|
||||
flex: 1,
|
||||
marginTop: 10,
|
||||
marginBottom: 5,
|
||||
flexDirection: 'row',
|
||||
},
|
||||
time: {
|
||||
fontWeight: 'bold',
|
||||
marginRight: 20,
|
||||
marginBottom: 10,
|
||||
color: theme.accent,
|
||||
},
|
||||
treat: {},
|
||||
|
||||
});
|
||||
content: {
|
||||
width: responsiveWidth(100),
|
||||
borderBottomColor: '#FFFFFF',
|
||||
flex: 1,
|
||||
flexDirection: 'column',
|
||||
paddingTop: 10,
|
||||
},
|
||||
listStyle: {
|
||||
backgroundColor: 'white',
|
||||
},
|
||||
bottomSeparator: {
|
||||
width: responsiveWidth(100),
|
||||
height: 5,
|
||||
justifyContent: 'center',
|
||||
alignSelf: 'center',
|
||||
backgroundColor: '#EEE',
|
||||
},
|
||||
title: {
|
||||
color: '#000',
|
||||
paddingLeft: 10,
|
||||
fontSize: responsiveFontSize(2.2),
|
||||
},
|
||||
description: {
|
||||
fontSize: responsiveFontSize(1.8),
|
||||
color: '#4f5b62',
|
||||
paddingLeft: 10,
|
||||
},
|
||||
timeContent: {
|
||||
justifyContent: 'space-between',
|
||||
flex: 1,
|
||||
marginTop: 10,
|
||||
marginBottom: 5,
|
||||
flexDirection: 'row',
|
||||
},
|
||||
time: {
|
||||
fontWeight: 'bold',
|
||||
marginRight: 20,
|
||||
marginBottom: 10,
|
||||
color: theme.accent,
|
||||
},
|
||||
treat: {},
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -36,6 +36,7 @@ import WalletRetrait from './wallet/WalletRetrait';
|
|||
import WalletSelect from './wallet/WalletSelect';
|
||||
import CreateIdentification from './identification/createIdentification';
|
||||
import DemandGroupNanoCredit from './nano-credit/DemandGroupNanoCredit';
|
||||
import MyHistory from './history-request/MyHistory';
|
||||
let route = require('./../route.json')
|
||||
export function registerScreens() {
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,99 +6,118 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import { Platform, StyleSheet, Alert, FlatList, Text, View, TouchableOpacity, Linking } from 'react-native';
|
||||
import React, {Component} from 'react';
|
||||
import {
|
||||
Platform,
|
||||
StyleSheet,
|
||||
Alert,
|
||||
FlatList,
|
||||
Text,
|
||||
View,
|
||||
TouchableOpacity,
|
||||
Linking,
|
||||
} from 'react-native';
|
||||
import ActionButton from 'react-native-action-button';
|
||||
import Icon from 'react-native-vector-icons/Ionicons';
|
||||
import { responsiveFontSize, responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
|
||||
import {
|
||||
responsiveFontSize,
|
||||
responsiveHeight,
|
||||
responsiveWidth,
|
||||
} from 'react-native-responsive-dimensions';
|
||||
import HeaderMenu from './HeaderMenu';
|
||||
import { historiques as histo, first, useraccount, notification, configurations } from './../../route.json';
|
||||
import { primary, primaryDarkAdvanced } from './../../utils/theme.json';
|
||||
import { readUser, disconnect } from './../../webservice/AuthApi';
|
||||
import I18n from 'react-native-i18n'
|
||||
const route = require("./../../route.json")
|
||||
require('./../../utils/Translations')
|
||||
var DBEvents = require('react-native-db-models').DBEvents
|
||||
import {
|
||||
historiques as histo,
|
||||
first,
|
||||
useraccount,
|
||||
notification,
|
||||
configurations,
|
||||
} from './../../route.json';
|
||||
import {primary, primaryDarkAdvanced} from './../../utils/theme.json';
|
||||
import {readUser, disconnect} from './../../webservice/AuthApi';
|
||||
import I18n from 'react-native-i18n';
|
||||
const route = require('./../../route.json');
|
||||
require('./../../utils/Translations');
|
||||
var DBEvents = require('react-native-db-models').DBEvents;
|
||||
type Props = {};
|
||||
let theme = require('./../../utils/theme.json')
|
||||
import Button from 'apsl-react-native-button'
|
||||
import { IlinkEmitter } from "./../../utils/events"
|
||||
import { DrawerItems, SafeAreaView } from 'react-navigation';
|
||||
import RNDeviceInformation from "fm-react-native-device-info"
|
||||
import AppContainer, { AppNavigator } from "../../App";
|
||||
import Configuration from "../../webservice/persistences/Configuration";
|
||||
let theme = require('./../../utils/theme.json');
|
||||
import Button from 'apsl-react-native-button';
|
||||
import {IlinkEmitter} from './../../utils/events';;
|
||||
import {DrawerItems, SafeAreaView} from 'react-navigation';
|
||||
import RNDeviceInformation from 'fm-react-native-device-info';;
|
||||
import AppContainer, {AppNavigator} from '../../App';
|
||||
import Configuration from '../../webservice/persistences/Configuration';
|
||||
|
||||
export default class OptionsMenu extends Component<Props> {
|
||||
static navigatorStyle = {
|
||||
statusBarColor: primaryDarkAdvanced,
|
||||
};
|
||||
commandeListe;
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = this.initState();
|
||||
IlinkEmitter.on('menuLink', this.onMenuNavigationEvent.bind(this));;
|
||||
IlinkEmitter.on('userconnect', this.onUserConnect.bind(this));;
|
||||
IlinkEmitter.on('userdisconnect', this.hideSideMenu.bind(this));;
|
||||
IlinkEmitter.on('langueChange', this.updateLangue.bind(this));;
|
||||
this.configuration = new Configuration();
|
||||
}
|
||||
|
||||
static navigatorStyle = {
|
||||
statusBarColor: primaryDarkAdvanced,
|
||||
};
|
||||
commandeListe
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = this.initState();
|
||||
IlinkEmitter.on("menuLink", this.onMenuNavigationEvent.bind(this))
|
||||
IlinkEmitter.on("userconnect", this.onUserConnect.bind(this))
|
||||
IlinkEmitter.on("userdisconnect", this.hideSideMenu.bind(this))
|
||||
IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
|
||||
this.configuration = new Configuration();
|
||||
}
|
||||
retrieveAndroidInformation() {
|
||||
this.configuration
|
||||
._getData()
|
||||
.then(lang => {
|
||||
if (lang) {
|
||||
I18n.locale = lang;;
|
||||
readUser().then(result => {
|
||||
setTimeout(() => {
|
||||
this.updateUser(result);
|
||||
}, 3000);;
|
||||
});;
|
||||
} else {
|
||||
RNDeviceInformation.getDeviceCountryCode().then(code => {
|
||||
I18n.locale = code.toLowerCase();;
|
||||
readUser()
|
||||
.then(result => {
|
||||
setTimeout(() => {
|
||||
this.updateUser(result);
|
||||
}, 3000);;
|
||||
})
|
||||
.catch(e => {
|
||||
this.props.navigation.navigate('Auth');;
|
||||
});
|
||||
});;
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
RNDeviceInformation.getDeviceCountryCode().then(code => {
|
||||
I18n.locale = code.toLowerCase();;
|
||||
readUser()
|
||||
.then(result => {
|
||||
setTimeout(() => {
|
||||
this.updateUser(result);
|
||||
}, 3000);;
|
||||
})
|
||||
.catch(e => {
|
||||
this.props.navigation.navigate('Auth');;
|
||||
});
|
||||
});
|
||||
});;
|
||||
|
||||
retrieveAndroidInformation() {
|
||||
this.configuration._getData().then((lang) => {
|
||||
if (lang) {
|
||||
I18n.locale = lang
|
||||
readUser().then((result) => {
|
||||
setTimeout(() => {
|
||||
this.updateUser(result);
|
||||
}, 3000)
|
||||
})
|
||||
} else {
|
||||
RNDeviceInformation.getDeviceCountryCode().then((code) => {
|
||||
I18n.locale = code.toLowerCase()
|
||||
readUser().then((result) => {
|
||||
setTimeout(() => {
|
||||
this.updateUser(result);
|
||||
}, 3000)
|
||||
}).catch((e) => {
|
||||
this.props.navigation.navigate("Auth")
|
||||
});
|
||||
})
|
||||
}
|
||||
}).catch((e) => {
|
||||
RNDeviceInformation.getDeviceCountryCode().then((code) => {
|
||||
I18n.locale = code.toLowerCase()
|
||||
readUser().then((result) => {
|
||||
setTimeout(() => {
|
||||
this.updateUser(result);
|
||||
}, 3000)
|
||||
}).catch((e) => {
|
||||
this.props.navigation.navigate("Auth")
|
||||
});
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
return ""
|
||||
}
|
||||
componentDidMount() {
|
||||
const items = this.props.navigation.router.childRouters.sta.childRouters;
|
||||
// items.filter((item)=>item.)
|
||||
this.setState({ items: items })
|
||||
this.retrieveAndroidInformation()
|
||||
|
||||
|
||||
}
|
||||
updateLangue() {
|
||||
this.setState({ lang: "change" })
|
||||
this.forceUpdate()
|
||||
}
|
||||
componentWillUnmount() {
|
||||
|
||||
}
|
||||
onMenuNavigationEvent(menuOption) {
|
||||
/* Navigation.mergeOptions(this.props.componentId,{
|
||||
return '';;
|
||||
}
|
||||
componentDidMount() {
|
||||
const items = this.props.navigation.router.childRouters.sta.childRouters;
|
||||
// items.filter((item)=>item.)
|
||||
this.setState({items: items});;
|
||||
this.retrieveAndroidInformation();
|
||||
}
|
||||
updateLangue() {
|
||||
this.setState({lang: 'change'});;
|
||||
this.forceUpdate();;
|
||||
}
|
||||
componentWillUnmount() {}
|
||||
onMenuNavigationEvent(menuOption) {
|
||||
/* Navigation.mergeOptions(this.props.componentId,{
|
||||
sideMenu: {
|
||||
left: {
|
||||
visible: false,
|
||||
|
@ -114,19 +133,17 @@ export default class OptionsMenu extends Component<Props> {
|
|||
this.setState({currentId:1})
|
||||
}
|
||||
}*/
|
||||
}
|
||||
onUserConnect() {
|
||||
readUser().then((user) => {
|
||||
if (user !== null && user !== undefined) {
|
||||
this.updateUser(user);
|
||||
}
|
||||
});
|
||||
}
|
||||
onNavigatorEvent(event) {
|
||||
|
||||
}
|
||||
hideSideMenu() {
|
||||
/* Navigation.mergeOptions("drawer", {
|
||||
}
|
||||
onUserConnect() {
|
||||
readUser().then(user => {
|
||||
if (user !== null && user !== undefined) {
|
||||
this.updateUser(user);
|
||||
}
|
||||
});
|
||||
}
|
||||
onNavigatorEvent(event) {}
|
||||
hideSideMenu() {
|
||||
/* Navigation.mergeOptions("drawer", {
|
||||
sideMenu: {
|
||||
left: {
|
||||
visible: false,
|
||||
|
@ -134,46 +151,142 @@ export default class OptionsMenu extends Component<Props> {
|
|||
}
|
||||
}
|
||||
});*/
|
||||
}
|
||||
initState() {
|
||||
return {
|
||||
user: null,
|
||||
menu: [],
|
||||
currentId: 0,
|
||||
}
|
||||
}
|
||||
getGeolocatedUserMenu() {
|
||||
return [
|
||||
{ title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true }
|
||||
, { title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false }
|
||||
, { title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false }
|
||||
, { title: I18n.t('ADD_NETWORK'), id: 11, key: 11, icon: 'md-people', active: false }
|
||||
, { title: I18n.t('CHANGE_INFORMATION'), id: 13, key: 13, icon: 'md-person', active: false }
|
||||
, { title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
|
||||
, { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
|
||||
}
|
||||
getSuperUserMenu() {
|
||||
return [
|
||||
{ title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true }
|
||||
, { title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false }
|
||||
, { title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false }
|
||||
, { title: I18n.t('GROUP_MANAGE'), id: 5, key: 5, icon: 'md-people', active: false }
|
||||
, { title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
|
||||
, { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
|
||||
}
|
||||
getHyperUsermenu() {
|
||||
return [
|
||||
{ title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true }
|
||||
, { title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false }
|
||||
, { title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false }
|
||||
, { title: I18n.t('GROUP_MANAGE'), id: 5, key: 5, icon: 'md-people', active: false }
|
||||
, { title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
|
||||
, { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
|
||||
}
|
||||
updateUser(user) {
|
||||
let menu = [];
|
||||
if (user !== undefined) {
|
||||
/* Navigation.mergeOptions("drawer", {
|
||||
}
|
||||
initState() {
|
||||
return {
|
||||
user: null,
|
||||
menu: [],
|
||||
currentId: 0,
|
||||
};;
|
||||
}
|
||||
getGeolocatedUserMenu() {
|
||||
return [
|
||||
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true},
|
||||
{
|
||||
title: I18n.t('MY_ACCOUNT'),
|
||||
id: 1,
|
||||
key: 1,
|
||||
icon: 'md-person',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('CREDIT_MANAGE'),
|
||||
id: 2,
|
||||
key: 2,
|
||||
icon: 'md-card',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('ADD_NETWORK'),
|
||||
id: 11,
|
||||
key: 11,
|
||||
icon: 'md-people',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('CHANGE_INFORMATION'),
|
||||
id: 13,
|
||||
key: 13,
|
||||
icon: 'md-person',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('NOTIFICATIONS'),
|
||||
id: 3,
|
||||
key: 3,
|
||||
icon: 'md-notifications',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('CONFIGURATIONS'),
|
||||
id: 4,
|
||||
icon: 'md-settings',
|
||||
active: false,;
|
||||
},
|
||||
];
|
||||
}
|
||||
getSuperUserMenu() {
|
||||
return [
|
||||
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true},
|
||||
{
|
||||
title: I18n.t('MY_ACCOUNT'),
|
||||
id: 1,
|
||||
key: 1,
|
||||
icon: 'md-person',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('CREDIT_MANAGE'),
|
||||
id: 2,
|
||||
key: 2,
|
||||
icon: 'md-card',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('GROUP_MANAGE'),
|
||||
id: 5,
|
||||
key: 5,
|
||||
icon: 'md-people',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('NOTIFICATIONS'),
|
||||
id: 3,
|
||||
key: 3,
|
||||
icon: 'md-notifications',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('CONFIGURATIONS'),
|
||||
id: 4,
|
||||
icon: 'md-settings',
|
||||
active: false,
|
||||
},
|
||||
];
|
||||
}
|
||||
getHyperUsermenu() {
|
||||
return [
|
||||
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true},
|
||||
{
|
||||
title: I18n.t('MY_ACCOUNT'),
|
||||
id: 1,
|
||||
key: 1,
|
||||
icon: 'md-person',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('CREDIT_MANAGE'),
|
||||
id: 2,
|
||||
key: 2,
|
||||
icon: 'md-card',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('GROUP_MANAGE'),
|
||||
id: 5,
|
||||
key: 5,
|
||||
icon: 'md-people',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('NOTIFICATIONS'),
|
||||
id: 3,
|
||||
key: 3,
|
||||
icon: 'md-notifications',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('CONFIGURATIONS'),
|
||||
id: 4,
|
||||
icon: 'md-settings',
|
||||
active: false,;
|
||||
},
|
||||
];
|
||||
}
|
||||
updateUser(user) {
|
||||
let menu = [];
|
||||
if (user !== undefined) {
|
||||
/* Navigation.mergeOptions("drawer", {
|
||||
sideMenu: {
|
||||
left: {
|
||||
visible: false,
|
||||
|
@ -181,76 +294,97 @@ export default class OptionsMenu extends Component<Props> {
|
|||
}
|
||||
}
|
||||
});*/
|
||||
if (user.category !== undefined) {
|
||||
switch (user.category) {
|
||||
case "geolocated":
|
||||
menu = this.getGeolocatedUserMenu();
|
||||
break;
|
||||
case "super":
|
||||
menu = this.getSuperUserMenu();
|
||||
break;
|
||||
case "hyper":
|
||||
menu = this.getHyperUsermenu();
|
||||
break;
|
||||
if (user.category !== undefined) {
|
||||
switch (user.category) {
|
||||
case 'geolocated':
|
||||
menu = this.getGeolocatedUserMenu();
|
||||
break;
|
||||
case 'super':
|
||||
menu = this.getSuperUserMenu();
|
||||
break;
|
||||
case 'hyper':
|
||||
menu = this.getHyperUsermenu();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
menu = this.getUserMenu();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
menu = this.getUserMenu();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.setState({ user: user, menu: menu });
|
||||
}
|
||||
getUserMenu() {
|
||||
return [
|
||||
{ title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true }
|
||||
, { title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false }
|
||||
, { title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
|
||||
, { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
|
||||
}
|
||||
_renderItem = (item) => {
|
||||
if (item === "creditrequest" || item === 'historyItemDetails' || item === 'filter' || item === 'networks' || item === 'createIdentification') {
|
||||
return null
|
||||
} else {
|
||||
const color = this.state.currentId === item.id ? theme.accent : "grey"
|
||||
return (
|
||||
<TouchableOpacity onPress={() => {
|
||||
this.props.navigation.toggleDrawer();
|
||||
this.setState({ currentId: item.id })
|
||||
this.props.navigation.navigate(item)
|
||||
}}
|
||||
>
|
||||
<View
|
||||
style={items.content}
|
||||
>
|
||||
<Icon
|
||||
name={this.getIcon(item)}
|
||||
size={32}
|
||||
/>
|
||||
<Text style={{
|
||||
marginLeft: 20,
|
||||
fontSize: 16,
|
||||
}}>{this.getNameItems(item)}
|
||||
</Text>
|
||||
</View></TouchableOpacity>)
|
||||
}
|
||||
};
|
||||
_onPress = ((item) => {
|
||||
|
||||
this.setState({ currentId: item.id })
|
||||
let current = this.state.menu.filter((item) => { return item.active })[0]
|
||||
current.active = false;
|
||||
item.active = true;
|
||||
let newMenu = [];
|
||||
this.state.menu.forEach(function (it) {
|
||||
if (it.id === current.id) newMenu.push(current)
|
||||
else if (it.id === item.id) newMenu.push(item)
|
||||
else newMenu.push(it)
|
||||
}
|
||||
)
|
||||
this.setState({ menu: newMenu })
|
||||
/* switch(item.id){
|
||||
this.setState({user: user, menu: menu});
|
||||
}
|
||||
getUserMenu() {
|
||||
return [
|
||||
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true},
|
||||
{
|
||||
title: I18n.t('MY_ACCOUNT'),
|
||||
id: 1,
|
||||
key: 1,
|
||||
icon: 'md-person',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('NOTIFICATIONS'),
|
||||
id: 3,
|
||||
key: 3,
|
||||
icon: 'md-notifications',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
title: I18n.t('CONFIGURATIONS'),
|
||||
id: 4,
|
||||
icon: 'md-settings',
|
||||
active: false,
|
||||
},
|
||||
];
|
||||
}
|
||||
_renderItem = item => {
|
||||
if (
|
||||
item === 'creditrequest' ||
|
||||
item === 'historyItemDetails' ||
|
||||
item === 'filter' ||
|
||||
item === 'networks' ||
|
||||
item === 'createIdentification'
|
||||
) {
|
||||
return null;;
|
||||
} else {
|
||||
const color = this.state.currentId === item.id ? theme.accent : 'grey';;
|
||||
return (
|
||||
<TouchableOpacity
|
||||
onPress={() => {
|
||||
this.props.navigation.toggleDrawer();
|
||||
this.setState({currentId: item.id});;
|
||||
this.props.navigation.navigate(item);;
|
||||
}}>
|
||||
<View style={items.content}>
|
||||
<Icon name={this.getIcon(item)} size={32} />
|
||||
<Text
|
||||
style={{
|
||||
marginLeft: 20,
|
||||
fontSize: 16,
|
||||
}}>
|
||||
{this.getNameItems(item)}
|
||||
</Text>
|
||||
</View>
|
||||
</TouchableOpacity>;
|
||||
);
|
||||
}
|
||||
};
|
||||
_onPress = item => {
|
||||
this.setState({currentId: item.id});;
|
||||
let current = this.state.menu.filter(item => {
|
||||
return item.active;
|
||||
})[0];;
|
||||
current.active = false;
|
||||
item.active = true;
|
||||
let newMenu = [];
|
||||
this.state.menu.forEach(function (it) {
|
||||
if (it.id === current.id) newMenu.push(current);;
|
||||
else if (it.id === item.id) newMenu.push(item);;
|
||||
else newMenu.push(it);;
|
||||
});;
|
||||
this.setState({menu: newMenu});;
|
||||
/* switch(item.id){
|
||||
case 2:
|
||||
Navigation.push(route.stackRoot,{
|
||||
component: {
|
||||
|
@ -393,60 +527,80 @@ export default class OptionsMenu extends Component<Props> {
|
|||
}
|
||||
}
|
||||
})
|
||||
*/ });
|
||||
getNameItems(item) {
|
||||
*/
|
||||
};
|
||||
getNameItems(item) {
|
||||
let icon = item;;
|
||||
switch (item) {
|
||||
case 'home':
|
||||
icon = I18n.t('MAP');;
|
||||
break;;
|
||||
case 'useraccount':
|
||||
icon = I18n.t('MY_ACCOUNT');;
|
||||
break;;
|
||||
case 'Historique':
|
||||
icon = I18n.t('CREDIT_MANAGE');;
|
||||
break;;
|
||||
case 'superviseurgroup':
|
||||
icon = I18n.t('GROUP_MANAGE');;
|
||||
break;;
|
||||
case 'updateinformation':
|
||||
icon = I18n.t('CHANGE_INFORMATION');;
|
||||
break;;
|
||||
case 'notificationview':
|
||||
icon = I18n.t('NOTIFICATIONS');;
|
||||
break;;
|
||||
case 'configuration':
|
||||
icon = I18n.t('CONFIGURATIONS');;
|
||||
break;;
|
||||
case 'addNetwork':
|
||||
icon = I18n.t('ADD_NETWORK');;
|
||||
break;;
|
||||
case 'about':
|
||||
icon = I18n.t('ABOUT_');;
|
||||
|
||||
|
||||
let icon = item
|
||||
switch (item) {
|
||||
case "home": icon = I18n.t('MAP')
|
||||
break
|
||||
case 'useraccount': icon = I18n.t('MY_ACCOUNT')
|
||||
break
|
||||
case 'Historique': icon = I18n.t('CREDIT_MANAGE')
|
||||
break
|
||||
case "superviseurgroup": icon = I18n.t('GROUP_MANAGE')
|
||||
break
|
||||
case "updateinformation": icon = I18n.t("CHANGE_INFORMATION")
|
||||
break
|
||||
case 'notificationview': icon = I18n.t('NOTIFICATIONS')
|
||||
break
|
||||
case 'configuration': icon = I18n.t('CONFIGURATIONS')
|
||||
break;
|
||||
case 'addNetwork': icon = I18n.t('ADD_NETWORK')
|
||||
break
|
||||
case 'about': icon = I18n.t('ABOUT_')
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
getIcon(item) {
|
||||
let icon = "md-map"
|
||||
switch (item) {
|
||||
case "home": icon = "md-map"
|
||||
break
|
||||
case 'useraccount': icon = "md-person"
|
||||
break
|
||||
case 'Historique': icon = "md-card"
|
||||
break
|
||||
case "superviseurgroup": icon = "md-people"
|
||||
break
|
||||
case 'notificationview': icon = "md-notifications";
|
||||
break
|
||||
case "updateinformation": icon = "md-people"
|
||||
break
|
||||
case 'configuration': icon = 'md-settings'
|
||||
break;
|
||||
case 'addNetwork': icon = "md-people"
|
||||
break
|
||||
case 'about': icon = 'md-contacts';
|
||||
break;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
render() {
|
||||
var name = this.state.user ? this.state.user.firstname : "";
|
||||
const surname = this.state.user ? this.state.user.lastname : "";
|
||||
if (!this.state.lang && this.state.lang !== "change")
|
||||
return (
|
||||
return icon;
|
||||
}
|
||||
getIcon(item) {
|
||||
let icon = 'md-map';;
|
||||
switch (item) {
|
||||
case 'home':
|
||||
icon = 'md-map';;
|
||||
break;;
|
||||
case 'useraccount':
|
||||
icon = 'md-person';;
|
||||
break;;
|
||||
case 'Historique':
|
||||
icon = 'md-card';;
|
||||
break;;
|
||||
case 'superviseurgroup':
|
||||
icon = 'md-people';;
|
||||
break;;
|
||||
case 'notificationview':
|
||||
icon = 'md-notifications';
|
||||
break;;
|
||||
case 'updateinformation':
|
||||
icon = 'md-people';;
|
||||
break;;
|
||||
case 'configuration':
|
||||
icon = 'md-settings';;
|
||||
break;
|
||||
case 'addNetwork':
|
||||
icon = 'md-people';;
|
||||
break;;
|
||||
case 'about':
|
||||
icon = 'md-contacts';
|
||||
break;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
render() {
|
||||
var name = this.state.user ? this.state.user.firstname : '';
|
||||
const surname = this.state.user ? this.state.user.lastname : '';
|
||||
if (!this.state.lang && this.state.lang !== 'change')
|
||||
{return (
|
||||
<View style={styles.container}>
|
||||
<View
|
||||
style={styles.headercontent}
|
||||
|
@ -470,112 +624,114 @@ export default class OptionsMenu extends Component<Props> {
|
|||
onPress={() => this.userDeconnect()}
|
||||
>{I18n.t('DISCONNEXION')}</Button>
|
||||
</View>
|
||||
)
|
||||
else {
|
||||
setTimeout(() => this.setState({ lang: "" }), 500)
|
||||
return (<View />)
|
||||
}
|
||||
}
|
||||
userDeconnect() {
|
||||
Alert.alert(
|
||||
I18n.t('DISCONNEXION'),
|
||||
I18n.t('DISCONNEXION_TEXT'),
|
||||
[
|
||||
{},
|
||||
{ text: I18n.t('NO'), onPress: () => console.log('Cancel Pressed'), style: 'cancel' },
|
||||
{
|
||||
text: I18n.t('YES'), onPress: () => {
|
||||
disconnect().then(() => {
|
||||
IlinkEmitter.emit("userdisconnect");
|
||||
this.props.navigation.navigate("Auth")
|
||||
})
|
||||
}
|
||||
},
|
||||
],
|
||||
{ cancelable: false }
|
||||
)
|
||||
}
|
||||
watchUser() {
|
||||
readUser().then((user) => {
|
||||
if (user !== null && user !== undefined) {
|
||||
this.updateUser(user);
|
||||
}
|
||||
});
|
||||
}
|
||||
)};
|
||||
else {
|
||||
setTimeout(() => this.setState({lang: ''}), 500);;
|
||||
return <View />;;
|
||||
}
|
||||
}
|
||||
userDeconnect() {
|
||||
Alert.alert(
|
||||
I18n.t('DISCONNEXION'),
|
||||
I18n.t('DISCONNEXION_TEXT'),
|
||||
[
|
||||
{},
|
||||
{
|
||||
text: I18n.t('NO'),
|
||||
onPress: () => console.log('Cancel Pressed'),
|
||||
style: 'cancel',
|
||||
},
|
||||
{
|
||||
text: I18n.t('YES'),
|
||||
onPress: () => {
|
||||
disconnect().then(() => {
|
||||
IlinkEmitter.emit('userdisconnect');
|
||||
this.props.navigation.navigate('Auth');;
|
||||
});;
|
||||
},,
|
||||
},
|
||||
],
|
||||
{cancelable: false},
|
||||
);;
|
||||
}
|
||||
watchUser() {
|
||||
readUser().then(user => {
|
||||
if (user !== null && user !== undefined) {
|
||||
this.updateUser(user);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const items = StyleSheet.create({
|
||||
content: {
|
||||
width: responsiveWidth(100),
|
||||
height: 50,
|
||||
paddingLeft: 20,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center'
|
||||
},
|
||||
itemText: {
|
||||
color: '#000000',
|
||||
marginLeft: 20,
|
||||
fontSize: responsiveFontSize(2),
|
||||
}
|
||||
content: {
|
||||
width: responsiveWidth(100),
|
||||
height: 50,
|
||||
paddingLeft: 20,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',,
|
||||
},
|
||||
itemText: {
|
||||
color: '#000000',
|
||||
marginLeft: 20,
|
||||
fontSize: responsiveFontSize(2),
|
||||
},,
|
||||
});
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: "white",
|
||||
},
|
||||
btnDeconnect: {
|
||||
borderColor: "transparent",
|
||||
marginLeft: 20,
|
||||
marginRight: 20,
|
||||
backgroundColor: theme.accent
|
||||
},
|
||||
btntext: {
|
||||
color: "white",
|
||||
fontSize: 17,
|
||||
fontWeight: "bold"
|
||||
},
|
||||
headerTitle: {
|
||||
fontSize: 14,
|
||||
marginBottom: 5,
|
||||
color: "white",
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
headerPhone: {
|
||||
fontSize: 12,
|
||||
marginBottom: 20,
|
||||
color: "white",
|
||||
justifyContent: 'flex-end'
|
||||
|
||||
},
|
||||
listMenu: {
|
||||
paddingTop: 15,
|
||||
},
|
||||
headercontent: {
|
||||
height: responsiveHeight(30),
|
||||
backgroundColor: primary,
|
||||
justifyContent: 'flex-end',
|
||||
alignItems: 'flex-start',
|
||||
paddingLeft: 20
|
||||
|
||||
},
|
||||
backgroundd_drawer: {
|
||||
backgroundColor: '#000',
|
||||
},
|
||||
listbackground: {
|
||||
},
|
||||
actionButtonIcon: {
|
||||
fontSize: 20,
|
||||
height: 22,
|
||||
color: 'white',
|
||||
},
|
||||
welcome: {
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
margin: 10,
|
||||
},
|
||||
instructions: {
|
||||
textAlign: 'center',
|
||||
color: '#333333',
|
||||
marginBottom: 5,
|
||||
},
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: 'white',
|
||||
},
|
||||
btnDeconnect: {
|
||||
borderColor: 'transparent',
|
||||
marginLeft: 20,
|
||||
marginRight: 20,
|
||||
backgroundColor: theme.accent,,
|
||||
},
|
||||
btntext: {
|
||||
color: 'white',
|
||||
fontSize: 17,
|
||||
fontWeight: 'bold',,
|
||||
},
|
||||
headerTitle: {
|
||||
fontSize: 14,
|
||||
marginBottom: 5,
|
||||
color: 'white',
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
headerPhone: {
|
||||
fontSize: 12,
|
||||
marginBottom: 20,
|
||||
color: 'white',
|
||||
justifyContent: 'flex-end',
|
||||
},
|
||||
listMenu: {
|
||||
paddingTop: 15,
|
||||
},
|
||||
headercontent: {
|
||||
height: responsiveHeight(30),
|
||||
backgroundColor: primary,
|
||||
justifyContent: 'flex-end',
|
||||
alignItems: 'flex-start',
|
||||
paddingLeft: 20,
|
||||
},
|
||||
backgroundd_drawer: {
|
||||
backgroundColor: '#000',
|
||||
},
|
||||
listbackground: {},
|
||||
actionButtonIcon: {
|
||||
fontSize: 20,
|
||||
height: 22,
|
||||
color: 'white',
|
||||
},
|
||||
welcome: {
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
margin: 10,
|
||||
},
|
||||
instructions: {
|
||||
textAlign: 'center',
|
||||
color: '#333333',
|
||||
marginBottom: 5,
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,104 +1,123 @@
|
|||
/* eslint-disable react-native/no-inline-styles */
|
||||
import React, {Component} from 'react';
|
||||
import {Image, PermissionsAndroid, StatusBar, StyleSheet, View} from 'react-native';
|
||||
import {responsiveFontSize, responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
|
||||
import I18n from 'react-native-i18n'
|
||||
import {getPasObject, getPubActiveObject, readUser} from '../../webservice/AuthApi';
|
||||
import Configuration from "../../webservice/persistences/Configuration";
|
||||
import '../ads/InterticielAds'
|
||||
import {
|
||||
Image,
|
||||
PermissionsAndroid,
|
||||
StatusBar,
|
||||
StyleSheet,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import {
|
||||
responsiveFontSize,
|
||||
responsiveHeight,
|
||||
responsiveWidth,
|
||||
} from 'react-native-responsive-dimensions';
|
||||
import I18n from 'react-native-i18n';
|
||||
import {
|
||||
getPasObject,
|
||||
getPubActiveObject,
|
||||
readUser,
|
||||
} from '../../webservice/AuthApi';
|
||||
import Configuration from '../../webservice/persistences/Configuration';
|
||||
import '../ads/InterticielAds';
|
||||
import * as Animatable from 'react-native-animatable';
|
||||
import DeviceInfo from 'react-native-device-info';
|
||||
import {bindActionCreators} from "redux";
|
||||
import getAuthApiKey from "../../webservice/AuthKeyApi";
|
||||
import {connect} from "react-redux";
|
||||
import {bindActionCreators} from 'redux';
|
||||
import getAuthApiKey from '../../webservice/AuthKeyApi';
|
||||
import {connect} from 'react-redux';
|
||||
|
||||
const theme = require('./../../utils/theme.json');
|
||||
const route = require('./../../route.json');
|
||||
|
||||
class SplashScreen extends Component {
|
||||
static navigatorStyle = {
|
||||
drawUnderNavBar: true,
|
||||
navBarHidden: true,
|
||||
drawUnderStatusBar: false,
|
||||
statusBarHidden: false,
|
||||
statusBarTextColorScheme: 'light',
|
||||
};
|
||||
static options(passProps) {
|
||||
return {
|
||||
statusBar: {
|
||||
visible: false,
|
||||
style: 'light' | 'dark',
|
||||
drawBehind: true
|
||||
},
|
||||
topBar: {
|
||||
title: {
|
||||
text: 'My Screen'
|
||||
},
|
||||
drawBehind: true,
|
||||
visible: false,
|
||||
animate: false
|
||||
}
|
||||
};
|
||||
}
|
||||
static navigatorStyle = {
|
||||
drawUnderNavBar: true,
|
||||
navBarHidden: true,
|
||||
drawUnderStatusBar: false,
|
||||
statusBarHidden: false,
|
||||
statusBarTextColorScheme: 'light',
|
||||
};
|
||||
static options(passProps) {
|
||||
return {
|
||||
statusBar: {
|
||||
visible: false,
|
||||
style: 'light' | 'dark',
|
||||
drawBehind: true,
|
||||
},
|
||||
topBar: {
|
||||
title: {
|
||||
text: 'My Screen',
|
||||
},
|
||||
drawBehind: true,
|
||||
visible: false,
|
||||
animate: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {};
|
||||
}
|
||||
workUserResult(result) {
|
||||
console.log('SPLASHSCREEN PROPS', this.props);
|
||||
if (typeof this.props.navigation.state.params !== 'undefined') {
|
||||
if (result === null || result === undefined) {
|
||||
this.props.navigation.navigate('Auth');
|
||||
} else {
|
||||
switch (this.props.navigation.state.params.routeName) {
|
||||
case 'historyItemDetails':
|
||||
this.props.navigation.navigate(
|
||||
this.props.navigation.state.params.routeName,
|
||||
{
|
||||
item: this.props.navigation.state.params.params,
|
||||
},
|
||||
);
|
||||
break;
|
||||
|
||||
//
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
|
||||
default:
|
||||
this.props.navigation.navigate(
|
||||
this.props.navigation.state.params.routeName,
|
||||
{
|
||||
id: this.props.navigation.state.params.params.id,
|
||||
},
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var way = '';
|
||||
var way2 = '';
|
||||
if (result === null || result === undefined) {
|
||||
way = 'Auth';
|
||||
way2 = route.first;
|
||||
} else {
|
||||
if (!result.category) {
|
||||
way = 'App';
|
||||
} else {
|
||||
switch (result.category) {
|
||||
case 'geolocated':
|
||||
way = 'AgentApp';
|
||||
break;
|
||||
case 'super':
|
||||
way = 'adminApp';
|
||||
break;
|
||||
default:
|
||||
way = 'supAdminApp';
|
||||
}
|
||||
};
|
||||
workUserResult(result) {
|
||||
console.log("SPLASHSCREEN PROPS", this.props);
|
||||
if (typeof this.props.navigation.state.params !== 'undefined') {
|
||||
if (result === null || result === undefined) {
|
||||
this.props.navigation.navigate("Auth");
|
||||
} else {
|
||||
switch (this.props.navigation.state.params.routeName) {
|
||||
case 'historyItemDetails':
|
||||
this.props.navigation.navigate(this.props.navigation.state.params.routeName, {
|
||||
item: this.props.navigation.state.params.params
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
this.props.navigation.navigate(this.props.navigation.state.params.routeName, {
|
||||
id: this.props.navigation.state.params.params.id
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
way2 = route.login;
|
||||
}
|
||||
this.props.navigation.navigate(way);
|
||||
}
|
||||
|
||||
} else {
|
||||
var way = "";
|
||||
var way2 = "";
|
||||
if (result === null || result === undefined) {
|
||||
way = "Auth"
|
||||
way2 = route.first
|
||||
} else {
|
||||
if (!result.category)
|
||||
way = "App"
|
||||
else {
|
||||
switch (result.category) {
|
||||
case 'geolocated': way = "AgentApp"
|
||||
break;
|
||||
case 'super': way = "adminApp"
|
||||
break
|
||||
default:
|
||||
way = "supAdminApp"
|
||||
}
|
||||
}
|
||||
way2 = route.login
|
||||
}
|
||||
this.props.navigation.navigate(way)
|
||||
}
|
||||
|
||||
/* Navigation.setStackRoot(route.stackRoot,
|
||||
/* Navigation.setStackRoot(route.stackRoot,
|
||||
{ component: {
|
||||
name: way,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
Navigation.showOverlay({
|
||||
|
@ -112,187 +131,200 @@ class SplashScreen extends Component {
|
|||
}
|
||||
}
|
||||
});*/
|
||||
|
||||
}
|
||||
componentDidMount() {
|
||||
try {
|
||||
this.requestCameraPermission()
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
componentDidMount() {
|
||||
try {
|
||||
this.requestCameraPermission();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
this.config = new Configuration();
|
||||
this.retrieveAndroidInformation();
|
||||
setTimeout(() => this.bounce(), 500);
|
||||
this.bounce();
|
||||
readUser().then(async user => {
|
||||
if (user) {
|
||||
if (user !== undefined) {
|
||||
if (user.phone !== undefined) {
|
||||
this.props.getAuthApiKey(user.phone);
|
||||
}
|
||||
this.config = new Configuration();
|
||||
this.retrieveAndroidInformation()
|
||||
setTimeout(() => this.bounce(), 500)
|
||||
this.bounce()
|
||||
readUser().then(async (user) => {
|
||||
if (user) {
|
||||
if (user !== undefined) {
|
||||
if (user.phone !== undefined)
|
||||
this.props.getAuthApiKey(user.phone);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async requestCameraPermission() {
|
||||
try {
|
||||
const granted = await PermissionsAndroid.request(
|
||||
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
|
||||
{
|
||||
title: 'Cool Photo App Camera Permission',
|
||||
message:
|
||||
'Cool Photo App needs access to your camera ' +
|
||||
'so you can take awesome pictures.',
|
||||
},
|
||||
);
|
||||
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
||||
} else {
|
||||
console.log('try get information else');
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('try get information error');
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
handleViewRef = ref => (this.view = ref);
|
||||
|
||||
bounce = () => this.view.transition({translateX: 0}, {translateX: 700}, 5000);
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<StatusBar translucent={true} />
|
||||
<Image
|
||||
style={styles.logo}
|
||||
source={require('./../../datas/img/icon3up.png')}
|
||||
/>
|
||||
<View style={{flexDirection: 'row'}}>
|
||||
<Image
|
||||
style={styles.logo}
|
||||
source={require('./../../datas/img/iconsub3.png')}
|
||||
/>
|
||||
<Animatable.View
|
||||
style={{
|
||||
width: responsiveWidth(90),
|
||||
height: 92,
|
||||
backgroundColor: theme.primary,
|
||||
position: 'absolute',
|
||||
zIndex: 100,
|
||||
}}
|
||||
ref={this.handleViewRef}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
retreiveIosInformation() {
|
||||
readUser()
|
||||
.then(result => {
|
||||
setTimeout(() => {
|
||||
this.workUserResult(result);
|
||||
}, 3000);
|
||||
})
|
||||
.catch(e => {
|
||||
this.props.navigation.navigate('Auth');
|
||||
});
|
||||
return '';
|
||||
}
|
||||
|
||||
retrieveAndroidInformation() {
|
||||
getPasObject().then(data => {
|
||||
console.warn(data);
|
||||
this.config.setCurrentPas(data);
|
||||
});
|
||||
|
||||
this.config
|
||||
._getData()
|
||||
.then(lang => {
|
||||
if (lang) {
|
||||
I18n.locale = lang;
|
||||
readUser().then(result => {
|
||||
console.warn(result);
|
||||
if (result) {
|
||||
getPubActiveObject(result.country_id).then(data => {
|
||||
console.warn(data);
|
||||
this.config.setPubActive(data);
|
||||
});
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.workUserResult(result);
|
||||
}, 3000);
|
||||
});
|
||||
} else {
|
||||
const code = DeviceInfo.getDeviceLocale();
|
||||
console.warn(code);
|
||||
I18n.locale = code.toLowerCase();
|
||||
readUser()
|
||||
.then(result => {
|
||||
console.warn(result);
|
||||
if (result) {
|
||||
getPubActiveObject(result.country_id).then(data => {
|
||||
console.warn(data);
|
||||
this.config.setPubActive(data);
|
||||
});
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.workUserResult(result);
|
||||
}, 3000);
|
||||
})
|
||||
.catch(e => {
|
||||
this.setPubActive(data);
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
console.warn(e.message);
|
||||
DeviceInfo.getDeviceLocale().then(code => {
|
||||
console.warn(code);
|
||||
|
||||
}
|
||||
async requestCameraPermission() {
|
||||
try {
|
||||
const granted = await PermissionsAndroid.request(
|
||||
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
|
||||
{
|
||||
'title': 'Cool Photo App Camera Permission',
|
||||
'message': 'Cool Photo App needs access to your camera ' +
|
||||
'so you can take awesome pictures.'
|
||||
}
|
||||
)
|
||||
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
||||
I18n.locale = code.toLowerCase();
|
||||
readUser()
|
||||
.then(result => {
|
||||
setTimeout(() => {
|
||||
this.workUserResult(result);
|
||||
}, 3000);
|
||||
})
|
||||
.catch(e => {
|
||||
this.props.navigation.navigate('Auth');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
} else {
|
||||
console.log("try get information else")
|
||||
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("try get information error")
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
handleViewRef = ref => this.view = ref;
|
||||
|
||||
bounce = () => this.view.transition({ translateX: 0 }, { translateX: 700 }, 5000);
|
||||
|
||||
render() {
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<StatusBar
|
||||
translucent={true}
|
||||
/>
|
||||
<Image style={styles.logo} source={require('./../../datas/img/icon3up.png')} />
|
||||
<View style={{ flexDirection: 'row' }}>
|
||||
<Image style={styles.logo} source={require('./../../datas/img/iconsub3.png')} />
|
||||
<Animatable.View
|
||||
style={{ width: responsiveWidth(90), height: 92, backgroundColor: theme.primary, position: 'absolute', zIndex: 100 }}
|
||||
ref={this.handleViewRef}>
|
||||
</Animatable.View>
|
||||
|
||||
|
||||
</View>
|
||||
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
retreiveIosInformation() {
|
||||
readUser().then((result) => {
|
||||
setTimeout(() => {
|
||||
this.workUserResult(result)
|
||||
}, 3000)
|
||||
}).catch((e) => {
|
||||
this.props.navigation.navigate("Auth")
|
||||
});
|
||||
return "";
|
||||
}
|
||||
|
||||
retrieveAndroidInformation() {
|
||||
getPasObject().then((data) => {
|
||||
console.warn(data);
|
||||
this.config.setCurrentPas(data)
|
||||
})
|
||||
|
||||
this.config._getData().then((lang) => {
|
||||
if (lang) {
|
||||
I18n.locale = lang
|
||||
readUser().then((result) => {
|
||||
console.warn(result)
|
||||
if (result) {
|
||||
getPubActiveObject(result['country_id']).then((data) => {
|
||||
console.warn(data)
|
||||
this.config.setPubActive(data);
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.workUserResult(result)
|
||||
}, 3000)
|
||||
})
|
||||
} else {
|
||||
const code = DeviceInfo.getDeviceLocale();
|
||||
console.warn(code)
|
||||
I18n.locale = code.toLowerCase()
|
||||
readUser().then((result) => {
|
||||
console.warn(result)
|
||||
if (result) {
|
||||
getPubActiveObject(result['country_id']).then((data) => {
|
||||
console.warn(data)
|
||||
this.config.setPubActive(data);
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.workUserResult(result)
|
||||
}, 3000)
|
||||
}).catch((e) => {
|
||||
this.setPubActive(data)
|
||||
});
|
||||
|
||||
}
|
||||
}).catch((e) => {
|
||||
console.warn(e.message)
|
||||
DeviceInfo.getDeviceLocale().then((code) => {
|
||||
console.warn(code)
|
||||
|
||||
I18n.locale = code.toLowerCase()
|
||||
readUser().then((result) => {
|
||||
setTimeout(() => {
|
||||
this.workUserResult(result)
|
||||
}, 3000)
|
||||
}).catch((e) => {
|
||||
this.props.navigation.navigate("Auth")
|
||||
});
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
return ""
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
loading: state.authKeyReducer.loading,
|
||||
authKey: state.authKeyReducer.authKey,
|
||||
error: state.authKeyReducer.error,
|
||||
loading: state.authKeyReducer.loading,
|
||||
authKey: state.authKeyReducer.authKey,
|
||||
error: state.authKeyReducer.error,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||
getAuthApiKey,
|
||||
}, dispatch);
|
||||
const mapDispatchToProps = dispatch =>
|
||||
bindActionCreators(
|
||||
{
|
||||
getAuthApiKey,
|
||||
},
|
||||
dispatch,
|
||||
);
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(SplashScreen);
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: theme.primary,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
logoContaner: {
|
||||
|
||||
flexDirection: 'row',
|
||||
marginTop: responsiveHeight(20),
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
logo: {
|
||||
width: responsiveWidth(90),
|
||||
resizeMode: 'contain'
|
||||
},
|
||||
lottie: {
|
||||
width: 48
|
||||
,
|
||||
height: 64
|
||||
},
|
||||
title: {
|
||||
fontSize: responsiveFontSize(4),
|
||||
alignSelf: 'center',
|
||||
fontWeight: 'bold',
|
||||
color: 'white',
|
||||
},
|
||||
})
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: theme.primary,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
logoContaner: {
|
||||
flexDirection: 'row',
|
||||
marginTop: responsiveHeight(20),
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
logo: {
|
||||
width: responsiveWidth(90),
|
||||
resizeMode: 'contain',
|
||||
},
|
||||
lottie: {
|
||||
width: 48,
|
||||
height: 64,
|
||||
},
|
||||
title: {
|
||||
fontSize: responsiveFontSize(4),
|
||||
alignSelf: 'center',
|
||||
fontWeight: 'bold',
|
||||
color: 'white',
|
||||
},
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,7 @@
|
|||
"debug-build": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res/ ; cd ./android ; sudo ./gradlew clean ; sudo ./gradlew assembleDebug && cd .. && sudo adb install ./android/app/build/outputs/apk/debug/app-debug.apk",
|
||||
"start-emulator": "emulator -avd Nexus_5X_API_29 -dns-server 8.8.8.8",
|
||||
"start-emulator-pixel": "emulator -avd Pixel_2_API_29 -dns-server 8.8.8.8",
|
||||
"run-debug": "cd android && ./gradlew clean && cd .. && react-native run-android",
|
||||
"run-debug": "cd android && gradlew clean && cd .. && react-native run-android",
|
||||
"run-release": "cd android && ./gradlew clean && cd .. && react-native run-android --variant=release"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -56,7 +56,7 @@
|
|||
"react-native-loader": "^1.2.1",
|
||||
"react-native-loading-spinner-overlay": "^1.0.1",
|
||||
"react-native-local-mongodb": "^2.2.9",
|
||||
"react-native-maps": "0.26.1",
|
||||
"react-native-maps": "^1.4.0",
|
||||
"react-native-maps-directions": "^1.7.0",
|
||||
"react-native-material-bottom-navigation": "^1.0.3",
|
||||
"react-native-material-bottom-navigation-performance": "^0.7.8",
|
||||
|
|
129
qApp.android.js
129
qApp.android.js
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable prettier/prettier */
|
||||
/**
|
||||
* Sample React Native App
|
||||
* https://github.com/facebook/react-native
|
||||
|
@ -13,37 +14,37 @@ import {
|
|||
createStackNavigator,
|
||||
createDrawerNavigator,
|
||||
createAppContainer,
|
||||
createBottomTabNavigator
|
||||
createBottomTabNavigator,
|
||||
} from 'react-navigation';
|
||||
import Connect from "./screens/login/Connect";
|
||||
import SplashScreen from "./screens/splashscreen/SplashScreen";
|
||||
import HelpMenu from "./screens/help/HelpMenu";
|
||||
import Help from "./screens/help/Help";
|
||||
import ForgottenPassword from "./screens/login/ForgottenPassword";
|
||||
import TypeChoiser from "./screens/login/TypeChoiser";
|
||||
import CreateUserStep2 from "./screens/login/createUserStep2";
|
||||
import createAccount from "./screens/login/createAccount";
|
||||
import UpdateInformations from "./screens/account/UpdateInformations";
|
||||
import UserAccount from "./screens/account/UserAccount";
|
||||
import ActivateAccount from "./screens/login/ActivateAccount";
|
||||
import Notifications from "./screens/notifications/Notifications";
|
||||
import About from "./screens/configurations/About";
|
||||
import Configurations from "./screens/configurations/Configurations";
|
||||
import Connect from './screens/login/Connect';
|
||||
import SplashScreen from './screens/splashscreen/SplashScreen';
|
||||
import HelpMenu from './screens/help/HelpMenu';
|
||||
import Help from './screens/help/Help';
|
||||
import ForgottenPassword from './screens/login/ForgottenPassword';
|
||||
import TypeChoiser from './screens/login/TypeChoiser';
|
||||
import CreateUserStep2 from './screens/login/createUserStep2';
|
||||
import createAccount from './screens/login/createAccount';
|
||||
import UpdateInformations from './screens/account/UpdateInformations';
|
||||
import UserAccount from './screens/account/UserAccount';
|
||||
import ActivateAccount from './screens/login/ActivateAccount';
|
||||
import Notifications from './screens/notifications/Notifications';
|
||||
import About from './screens/configurations/About';
|
||||
import Configurations from './screens/configurations/Configurations';
|
||||
|
||||
import History from './screens/history-request/History'
|
||||
import OptionsMenu from "./screens/optionMenu/OptionsMenu";
|
||||
import Home from "./screens/home/Home";
|
||||
import HistoryItemDetails from "./screens/history-request/HistoryItemDetails";
|
||||
import SuperViseurGroupeHome from "./screens/groupes/SuperViseurGroupeHome";
|
||||
import HistoryRequester from "./screens/history-request/HistoryRequester";
|
||||
import AddNetwork from "./screens/account/AddNetwork";
|
||||
import MyHistory from "./screens/history-request/MyHistory";
|
||||
import Icon from "react-native-vector-icons/FontAwesome5";
|
||||
import History from './screens/history-request/History';
|
||||
import OptionsMenu from './screens/optionMenu/OptionsMenu';
|
||||
import Home from './screens/home/Home';
|
||||
import HistoryItemDetails from './screens/history-request/HistoryItemDetails';
|
||||
import SuperViseurGroupeHome from './screens/groupes/SuperViseurGroupeHome';
|
||||
import HistoryRequester from './screens/history-request/HistoryRequester';
|
||||
import AddNetwork from './screens/account/AddNetwork';
|
||||
import MyHistory from './screens/history-request/MyHistory';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import {GoogleAnalyticsTracker} from 'react-native-google-analytics-bridge';
|
||||
import {Appbar} from 'react-native-paper';
|
||||
|
||||
import IconWithBadge from "./screens/IconWithBadge"
|
||||
import I18n from "react-native-i18n";
|
||||
import IconWithBadge from './screens/IconWithBadge';
|
||||
import I18n from 'react-native-i18n';
|
||||
import Filter from './screens/home/Filter';
|
||||
import {createMaterialBottomTabNavigator} from 'react-navigation-material-bottom-tabs';
|
||||
import Networks from './screens/home/Networks';
|
||||
|
@ -56,7 +57,7 @@ const instructions = Platform.select({
|
|||
});
|
||||
|
||||
type Props = {};
|
||||
const theme = require("./utils/theme")
|
||||
const theme = require('./utils/theme');
|
||||
|
||||
class HomeScreen extends Component<Props> {
|
||||
render() {
|
||||
|
@ -78,11 +79,11 @@ const AuthStack = createStackNavigator({
|
|||
typeaccountcreate: TypeChoiser,
|
||||
simpleusercreate: createAccount,
|
||||
step2: CreateUserStep2,
|
||||
activateaccout: ActivateAccount
|
||||
activateaccout: ActivateAccount,
|
||||
|
||||
}, {
|
||||
headerMode: 'none'
|
||||
})
|
||||
headerMode: 'none',
|
||||
});
|
||||
const AppStack = createDrawerNavigator({
|
||||
sta: createStackNavigator({
|
||||
home: Home,
|
||||
|
@ -94,10 +95,10 @@ const AppStack = createDrawerNavigator({
|
|||
},
|
||||
notificationview: Notifications,
|
||||
configuration: Configurations,
|
||||
about: About
|
||||
about: About,
|
||||
|
||||
})
|
||||
}, {contentComponent: OptionsMenu, headerMode: 'none', contentOptions: {activeTintColor: theme.accent}})
|
||||
}),
|
||||
}, {contentComponent: OptionsMenu, headerMode: 'none', contentOptions: {activeTintColor: theme.accent}});
|
||||
const AppAgentStack = createDrawerNavigator({
|
||||
sta: createStackNavigator({
|
||||
home: Home,
|
||||
|
@ -105,16 +106,16 @@ const AppAgentStack = createDrawerNavigator({
|
|||
Historique:
|
||||
{
|
||||
screen: createBottomTabNavigator({myDemand: MyHistory}, {
|
||||
headerMode: "none",
|
||||
headerMode: 'none',
|
||||
header: null,
|
||||
headerTitle: null,
|
||||
headerTitle: I18n.t('CREDIT_MANAGE'),
|
||||
tabBarOptions: {
|
||||
labelStyle: {
|
||||
fontSize: 13,
|
||||
fontWeight: "bold"
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
}
|
||||
},
|
||||
}),
|
||||
navigationOptions: ({navigation}) => ({
|
||||
header: null,
|
||||
|
@ -129,7 +130,7 @@ const AppAgentStack = createDrawerNavigator({
|
|||
<Icon
|
||||
name={'credit-card'}
|
||||
size={24}
|
||||
/>)
|
||||
/>),
|
||||
}),
|
||||
},
|
||||
|
||||
|
@ -139,23 +140,23 @@ const AppAgentStack = createDrawerNavigator({
|
|||
updateinformation: UpdateInformations,
|
||||
notificationview: Notifications,
|
||||
configuration: Configurations,
|
||||
about: About
|
||||
})
|
||||
about: About,
|
||||
}),
|
||||
}, {
|
||||
contentComponent: OptionsMenu,
|
||||
backBehavior: "none",
|
||||
backBehavior: 'none',
|
||||
lazy: false,
|
||||
headerMode: 'none', contentOptions: {activeTintColor: theme.accent}
|
||||
})
|
||||
headerMode: 'none', contentOptions: {activeTintColor: theme.accent},
|
||||
});
|
||||
const AppAdministratorStack = createDrawerNavigator({
|
||||
sta: createStackNavigator({
|
||||
home: Home,
|
||||
useraccount: UserAccount,
|
||||
Historique: {
|
||||
screen: createBottomTabNavigator({
|
||||
myDemand: MyHistory, OthersDemand: MyHistory
|
||||
myDemand: MyHistory, OthersDemand: MyHistory,
|
||||
}, {
|
||||
headerMode: "none",
|
||||
headerMode: 'none',
|
||||
header: null,
|
||||
headerTitle: null,
|
||||
title: I18n.t('CREDIT_MANAGE'),
|
||||
|
@ -163,7 +164,7 @@ const AppAdministratorStack = createDrawerNavigator({
|
|||
labelStyle: {
|
||||
fontSize: 13,
|
||||
},
|
||||
}
|
||||
},
|
||||
}),
|
||||
navigationOptions: ({navigation}) => ({
|
||||
header: null,
|
||||
|
@ -178,7 +179,7 @@ const AppAdministratorStack = createDrawerNavigator({
|
|||
<Icon
|
||||
name={'credit-card'}
|
||||
size={24}
|
||||
/>)
|
||||
/>),
|
||||
}),
|
||||
},
|
||||
creditrequest: HistoryRequester,
|
||||
|
@ -187,42 +188,42 @@ const AppAdministratorStack = createDrawerNavigator({
|
|||
superviseurgroup: SuperViseurGroupeHome,
|
||||
notificationview: Notifications,
|
||||
configuration: Configurations,
|
||||
about: About
|
||||
about: About,
|
||||
|
||||
})
|
||||
}),
|
||||
},
|
||||
{
|
||||
contentComponent: OptionsMenu,
|
||||
backBehavior: "none",
|
||||
headerMode: 'none'
|
||||
})
|
||||
backBehavior: 'none',
|
||||
headerMode: 'none',
|
||||
});
|
||||
const AppSuperAdministrator = createDrawerNavigator({
|
||||
sta: createStackNavigator({
|
||||
home: Home,
|
||||
useraccount: UserAccount,
|
||||
Historique: {
|
||||
screen: createBottomTabNavigator({OthersDemand: MyHistory}, {
|
||||
headerMode: "none",
|
||||
headerMode: 'none',
|
||||
header: null,
|
||||
headerTitle: null,
|
||||
title: I18n.t('CREDIT_MANAGE'),
|
||||
tabBarOptions: {
|
||||
labelStyle: {
|
||||
fontSize: 13,
|
||||
fontWeight: "bold"
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
}
|
||||
},
|
||||
}),
|
||||
navigationOptions: ({navigation}) => ({
|
||||
title: I18n.t('CREDIT_MANAGE'),
|
||||
headerMode: "none",
|
||||
headerMode: 'none',
|
||||
header: null,
|
||||
headerTitle: null,
|
||||
drawerIcon: ({tintColor}) => (
|
||||
<Icon
|
||||
name={'credit-card'}
|
||||
size={24}
|
||||
/>)
|
||||
/>),
|
||||
}),
|
||||
},
|
||||
creditrequest: HistoryRequester,
|
||||
|
@ -230,25 +231,25 @@ const AppSuperAdministrator = createDrawerNavigator({
|
|||
superviseurgroup: SuperViseurGroupeHome,
|
||||
notificationview: Notifications,
|
||||
configuration: Configurations,
|
||||
about: About
|
||||
about: About,
|
||||
|
||||
})
|
||||
}),
|
||||
}, {
|
||||
contentComponent: OptionsMenu,
|
||||
backBehavior: "none",
|
||||
headerMode: 'none'
|
||||
})
|
||||
backBehavior: 'none',
|
||||
headerMode: 'none',
|
||||
});
|
||||
export const AppNavigator = createSwitchNavigator({
|
||||
first: {
|
||||
screen: SplashScreen
|
||||
screen: SplashScreen,
|
||||
},
|
||||
App: AppStack,
|
||||
AgentApp: AppAgentStack,
|
||||
adminApp: AppAdministratorStack,
|
||||
supAdminApp: AppSuperAdministrator,
|
||||
Auth: AuthStack
|
||||
Auth: AuthStack,
|
||||
}, {
|
||||
initialRouteName: 'first'
|
||||
initialRouteName: 'first',
|
||||
});
|
||||
const AppContainer = createAppContainer(AppNavigator);
|
||||
|
||||
|
|
Loading…
Reference in New Issue