Before fixing release issue

This commit is contained in:
Brice Zele 2020-03-20 19:28:22 +01:00
parent 35bd407195
commit e28fecc645
61 changed files with 5539 additions and 4488 deletions

View File

@ -6,9 +6,9 @@
* @flow
*/
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import { createSwitchNavigator, createStackNavigator,createDrawerNavigator, createAppContainer,createBottomTabNavigator } from 'react-navigation';
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View, YellowBox } from 'react-native';
import { createSwitchNavigator, createStackNavigator, createDrawerNavigator, createAppContainer, createBottomTabNavigator } from 'react-navigation';
import Connect from "./screens/login/Connect";
import SplashScreen from "./screens/splashscreen/SplashScreen";
import HelpMenu from "./screens/help/HelpMenu";
@ -41,208 +41,227 @@ import Filter from './screens/home/Filter';
import { createMaterialBottomTabNavigator } from 'react-navigation-material-bottom-tabs';
import Networks from './screens/home/Networks';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
type Props = {};
const theme=require("./utils/theme")
const theme = require("./utils/theme")
class HomeScreen extends Component<Props> {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to iLink World!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
</View>
);
}
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to iLink World!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
</View>
);
}
}
const AuthStack=createStackNavigator({
login:Connect,
helpMenu:HelpMenu,
help:Help,
forgottenpass:ForgottenPassword,
typeaccountcreate:TypeChoiser,
simpleusercreate:createAccount,
step2:CreateUserStep2,
activateaccout:ActivateAccount
const AuthStack = createStackNavigator({
login: Connect,
helpMenu: HelpMenu,
help: Help,
forgottenpass: ForgottenPassword,
typeaccountcreate: TypeChoiser,
simpleusercreate: createAccount,
step2: CreateUserStep2,
activateaccout: ActivateAccount
},{
headerMode: 'none'
}, {
headerMode: 'none'
})
const AppStack=createDrawerNavigator({sta:createStackNavigator({
home:Home,
/* filtre:Filter,
network:Networks,*/
useraccount:{
screen:UserAccount,
navigationOptions: {
},
},
notificationview:Notifications,
configuration:Configurations,
about:About
const AppStack = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
/* filtre:Filter,
network:Networks,*/
useraccount: {
screen: UserAccount,
navigationOptions: {
},
},
notificationview: Notifications,
configuration: Configurations,
about: About
})},{contentComponent:OptionsMenu,headerMode: 'none',contentOptions:{activeTintColor: theme.accent}})
const AppAgentStack=createDrawerNavigator({sta:createStackNavigator({
home:Home,
useraccount:UserAccount,
Historique:
{
screen: createBottomTabNavigator({myDemand: MyHistory}, {
headerMode: "none",
header:null,
headerTitle:null,
headerTitle: I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
fontWeight: "bold"
},
}
}),
navigationOptions: ({ navigation }) => ({
header:null,
headerMode:'none',
headerTitle:null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
})
}, { contentComponent: OptionsMenu, headerMode: 'none', contentOptions: { activeTintColor: theme.accent } })
const AppAgentStack = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
useraccount: UserAccount,
Historique:
{
screen: createBottomTabNavigator({ myDemand: MyHistory }, {
headerMode: "none",
header: null,
headerTitle: null,
headerTitle: I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
fontWeight: "bold"
},
}
}),
navigationOptions: ({ navigation }) => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
historyItemDetails:HistoryItemDetails,
creditrequest:HistoryRequester,
addNetwork:AddNetwork,
updateinformation:UpdateInformations,
notificationview:Notifications,
configuration:Configurations,
about:About
})},{contentComponent:OptionsMenu,
backBehavior:"none",
lazy:false,
headerMode: 'none',contentOptions:{activeTintColor:theme.accent}})
const AppAdministratorStack=createDrawerNavigator({sta:createStackNavigator({
home:Home,
useraccount:UserAccount,
Historique:{
screen:createBottomTabNavigator({
myDemand:MyHistory,OthersDemand:MyHistory}, {
headerMode:"none",
header:null,
headerTitle:null,
title:I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
},
}}),
navigationOptions: ({ navigation }) => ({
header:null,
headerMode:'none',
headerTitle:null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
creditrequest:HistoryRequester,
historyItemDetails:HistoryItemDetails,
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
superviseurgroup:SuperViseurGroupeHome,
notificationview:Notifications,
configuration:Configurations,
about:About
historyItemDetails: HistoryItemDetails,
creditrequest: HistoryRequester,
addNetwork: AddNetwork,
updateinformation: UpdateInformations,
notificationview: Notifications,
configuration: Configurations,
about: About
})
}, {
contentComponent: OptionsMenu,
backBehavior: "none",
lazy: false,
headerMode: 'none', contentOptions: { activeTintColor: theme.accent }
})
const AppAdministratorStack = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
useraccount: UserAccount,
Historique: {
screen: createBottomTabNavigator({
myDemand: MyHistory, OthersDemand: MyHistory
}, {
headerMode: "none",
header: null,
headerTitle: null,
title: I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
},
}
}),
navigationOptions: ({ navigation }) => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
})},
{contentComponent:OptionsMenu,
backBehavior:"none",
headerMode: 'none'})
const AppSuperAdministrator=createDrawerNavigator({sta:createStackNavigator({
home:Home,
useraccount:UserAccount,
Historique:{
screen:createBottomTabNavigator({OthersDemand:MyHistory}, {
headerMode:"none",
header:null,
headerTitle:null,
title:I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
fontWeight:"bold"
},
}}),
navigationOptions: ({ navigation }) => ({
title: I18n.t('CREDIT_MANAGE'),
headerMode:"none",
header:null,
headerTitle:null,
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
creditrequest:HistoryRequester,
historyItemDetails:HistoryItemDetails,
superviseurgroup:SuperViseurGroupeHome,
notificationview:Notifications,
configuration:Configurations,
about:About
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
creditrequest: HistoryRequester,
historyItemDetails: HistoryItemDetails,
})},{contentComponent:OptionsMenu,
backBehavior:"none",
headerMode: 'none'})
export const AppNavigator =createSwitchNavigator({
first: {
screen: SplashScreen
},
App:AppStack,
AgentApp:AppAgentStack,
adminApp:AppAdministratorStack,
supAdminApp:AppSuperAdministrator,
Auth:AuthStack
},{
initialRouteName: 'first'
superviseurgroup: SuperViseurGroupeHome,
notificationview: Notifications,
configuration: Configurations,
about: About
})
},
{
contentComponent: OptionsMenu,
backBehavior: "none",
headerMode: 'none'
})
const AppSuperAdministrator = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
useraccount: UserAccount,
Historique: {
screen: createBottomTabNavigator({ OthersDemand: MyHistory }, {
headerMode: "none",
header: null,
headerTitle: null,
title: I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
fontWeight: "bold"
},
}
}),
navigationOptions: ({ navigation }) => ({
title: I18n.t('CREDIT_MANAGE'),
headerMode: "none",
header: null,
headerTitle: null,
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
creditrequest: HistoryRequester,
historyItemDetails: HistoryItemDetails,
superviseurgroup: SuperViseurGroupeHome,
notificationview: Notifications,
configuration: Configurations,
about: About
})
}, {
contentComponent: OptionsMenu,
backBehavior: "none",
headerMode: 'none'
})
export const AppNavigator = createSwitchNavigator({
first: {
screen: SplashScreen
},
App: AppStack,
AgentApp: AppAgentStack,
adminApp: AppAdministratorStack,
supAdminApp: AppSuperAdministrator,
Auth: AuthStack
}, {
initialRouteName: 'first'
});
const AppContainer = createAppContainer(AppNavigator);
export default AppContainer;
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

400
App.js
View File

@ -6,9 +6,9 @@
* @flow
*/
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import { createSwitchNavigator, createStackNavigator,createDrawerNavigator, createAppContainer,createBottomTabNavigator } from 'react-navigation';
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View, YellowBox } from 'react-native';
import { createSwitchNavigator, createStackNavigator, createDrawerNavigator, createAppContainer, createBottomTabNavigator } from 'react-navigation';
import Connect from "./screens/login/Connect";
import SplashScreen from "./screens/splashscreen/SplashScreen";
import HelpMenu from "./screens/help/HelpMenu";
@ -41,208 +41,230 @@ import Filter from './screens/home/Filter';
import { createMaterialBottomTabNavigator } from 'react-navigation-material-bottom-tabs';
import Networks from './screens/home/Networks';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
type Props = {};
const theme=require("./utils/theme")
const theme = require("./utils/theme")
class HomeScreen extends Component<Props> {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to iLink World!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
</View>
);
}
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to iLink World!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
</View>
);
}
}
const AuthStack=createStackNavigator({
login:Connect,
helpMenu:HelpMenu,
help:Help,
forgottenpass:ForgottenPassword,
typeaccountcreate:TypeChoiser,
simpleusercreate:createAccount,
step2:CreateUserStep2,
activateaccout:ActivateAccount
const AuthStack = createStackNavigator({
login: Connect,
helpMenu: HelpMenu,
help: Help,
forgottenpass: ForgottenPassword,
typeaccountcreate: TypeChoiser,
simpleusercreate: createAccount,
step2: CreateUserStep2,
activateaccout: ActivateAccount
},{
headerMode: 'none'
}, {
headerMode: 'none'
})
const AppStack=createDrawerNavigator({sta:createStackNavigator({
home:Home,
/* filtre:Filter,
network:Networks,*/
useraccount:{
screen:UserAccount,
navigationOptions: {
},
},
notificationview:Notifications,
configuration:Configurations,
about:About
const AppStack = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
/* filtre:Filter,
network:Networks,*/
useraccount: {
screen: UserAccount,
navigationOptions: {
},
},
notificationview: Notifications,
configuration: Configurations,
about: About
})},{contentComponent:OptionsMenu,headerMode: 'none',contentOptions:{activeTintColor: theme.accent}})
const AppAgentStack=createDrawerNavigator({sta:createStackNavigator({
home:Home,
useraccount:UserAccount,
Historique:
{
screen: createBottomTabNavigator({myDemand: MyHistory}, {
headerMode: "none",
header:null,
headerTitle:null,
headerTitle: I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
fontWeight: "bold"
},
}
}),
navigationOptions: ({ navigation }) => ({
header:null,
headerMode:'none',
headerTitle:null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
})
}, { contentComponent: OptionsMenu, headerMode: 'none', contentOptions: { activeTintColor: theme.accent } })
const AppAgentStack = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
useraccount: UserAccount,
Historique:
{
screen: createBottomTabNavigator({ myDemand: MyHistory }, {
headerMode: "none",
header: null,
headerTitle: null,
headerTitle: I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
fontWeight: "bold"
},
}
}),
navigationOptions: ({ navigation }) => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
historyItemDetails:HistoryItemDetails,
creditrequest:HistoryRequester,
addNetwork:AddNetwork,
updateinformation:UpdateInformations,
notificationview:Notifications,
configuration:Configurations,
about:About
})},{contentComponent:OptionsMenu,
backBehavior:"none",
lazy:false,
headerMode: 'none',contentOptions:{activeTintColor:theme.accent}})
const AppAdministratorStack=createDrawerNavigator({sta:createStackNavigator({
home:Home,
useraccount:UserAccount,
Historique:{
screen:createBottomTabNavigator({
myDemand:MyHistory,OthersDemand:MyHistory}, {
headerMode:"none",
header:null,
headerTitle:null,
title:I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
},
}}),
navigationOptions: ({ navigation }) => ({
header:null,
headerMode:'none',
headerTitle:null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
creditrequest:HistoryRequester,
historyItemDetails:HistoryItemDetails,
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
superviseurgroup:SuperViseurGroupeHome,
notificationview:Notifications,
configuration:Configurations,
about:About
historyItemDetails: HistoryItemDetails,
creditrequest: HistoryRequester,
addNetwork: AddNetwork,
updateinformation: UpdateInformations,
notificationview: Notifications,
configuration: Configurations,
about: About
})
}, {
contentComponent: OptionsMenu,
backBehavior: "none",
lazy: false,
headerMode: 'none', contentOptions: { activeTintColor: theme.accent }
})
const AppAdministratorStack = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
useraccount: UserAccount,
Historique: {
screen: createBottomTabNavigator({
myDemand: MyHistory, OthersDemand: MyHistory
}, {
headerMode: "none",
header: null,
headerTitle: null,
title: I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
},
}
}),
navigationOptions: ({ navigation }) => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
})},
{contentComponent:OptionsMenu,
backBehavior:"none",
headerMode: 'none'})
const AppSuperAdministrator=createDrawerNavigator({sta:createStackNavigator({
home:Home,
useraccount:UserAccount,
Historique:{
screen:createBottomTabNavigator({OthersDemand:MyHistory}, {
headerMode:"none",
header:null,
headerTitle:null,
title:I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
fontWeight:"bold"
},
}}),
navigationOptions: ({ navigation }) => ({
title: I18n.t('CREDIT_MANAGE'),
headerMode:"none",
header:null,
headerTitle:null,
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
creditrequest:HistoryRequester,
historyItemDetails:HistoryItemDetails,
superviseurgroup:SuperViseurGroupeHome,
notificationview:Notifications,
configuration:Configurations,
about:About
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
creditrequest: HistoryRequester,
historyItemDetails: HistoryItemDetails,
})},{contentComponent:OptionsMenu,
backBehavior:"none",
headerMode: 'none'})
export const AppNavigator =createSwitchNavigator({
first: {
screen: SplashScreen
},
App:AppStack,
AgentApp:AppAgentStack,
adminApp:AppAdministratorStack,
supAdminApp:AppSuperAdministrator,
Auth:AuthStack
},{
initialRouteName: 'first'
superviseurgroup: SuperViseurGroupeHome,
notificationview: Notifications,
configuration: Configurations,
about: About
})
},
{
contentComponent: OptionsMenu,
backBehavior: "none",
headerMode: 'none'
})
const AppSuperAdministrator = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
useraccount: UserAccount,
Historique: {
screen: createBottomTabNavigator({ OthersDemand: MyHistory }, {
headerMode: "none",
header: null,
headerTitle: null,
title: I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
fontWeight: "bold"
},
}
}),
navigationOptions: ({ navigation }) => ({
title: I18n.t('CREDIT_MANAGE'),
headerMode: "none",
header: null,
headerTitle: null,
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
creditrequest: HistoryRequester,
historyItemDetails: HistoryItemDetails,
superviseurgroup: SuperViseurGroupeHome,
notificationview: Notifications,
configuration: Configurations,
about: About
})
}, {
contentComponent: OptionsMenu,
backBehavior: "none",
headerMode: 'none'
})
export const AppNavigator = createSwitchNavigator({
first: {
screen: SplashScreen
},
App: AppStack,
AgentApp: AppAgentStack,
adminApp: AppAdministratorStack,
supAdminApp: AppSuperAdministrator,
Auth: AuthStack
}, {
initialRouteName: 'first'
});
const AppContainer = createAppContainer(AppNavigator);
export default AppContainer;
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

View File

@ -128,7 +128,7 @@ android {
}
defaultConfig {
applicationId "com.ilink"
applicationId "com.ilinktest"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1

View File

@ -1,26 +1,39 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ilink">
xmlns:tools="http://schemas.android.com/tools"
package="com.ilinktest">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-sdk tools:overrideLibrary="com.shazam.android.widget.text.reflow" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:name=".MainApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
android:largeHeap="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCz4B9uUu3gkuu78Sf72gPWZ3t_qKqf5zg" />
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>

File diff suppressed because one or more lines are too long

View File

@ -1,15 +0,0 @@
package com.ilink;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "iLinkWorld";
}
}

View File

@ -0,0 +1,28 @@
package com.ilinktest;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "iLinkWorld";
}
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
}

View File

@ -1,4 +1,4 @@
package com.ilink;
package com.ilinktest;
import android.app.Application;
import android.content.Context;

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 KiB

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -2,6 +2,8 @@
"WELCOME": "Welcome to iLink World !",
"HELP": "Help",
"SIMPLE_USER": "Simple User",
"ABOUT": "About us",
"ABOUT_TEXT": "iLink is an application that will facilitate your financial transactions near your location, and give you multiservice points near you.",
"GEOLOCATED_USER": "Geo located user",
"SUPERVISOR": "Supervisor",
"AGENT": "Agent",
@ -15,6 +17,7 @@
"ACCOUNT_CREATED_SUCCESS": "Account created successfully.\nYou will receive in a few minutes an email and an SMS with your informations.\nWe will redirect you to the login page",
"OR_BIG": "OR",
"FOR_NUMB": "For the ",
"FILTER_DATE": "Filter date",
"SUBTITLE_ACTIVE_ACCOUNT": "Activate your account using the code that was sent on your email or phone number",
"ASK_FOR_CREDIT": "Apply for credit",
"ASK_CREDIT": "Credit applications",
@ -26,14 +29,15 @@
"ASK_FOR_SUPERVISOR1": "Ask to become a supervisor",
"CREDIT_ASK_FROM_MEMBERS": "Credit requests from your members",
"ASK_MEMBERS": "Membership applications",
"MY_ACCOUNT": "Mon compte",
"THE_ACCOUNT": "Le compte ",
"MY_ACCOUNT": "My account",
"THE_ACCOUNT": "Account ",
"NO_GEO_POINT_CODE": "You have no free geolocated point",
"NO_DEMAND_ADHESION": "You have no membership request",
"ACTIVATED": "has been activated",
"CREDIT_MANAGE": "Credit Management",
"GROUP_MANAGE": "Group Management",
"NOTIFICATIONS": "Notification",
"NO_NOTIFICATION": "You haven't any notification",
"CONFIGURATIONS": "Configuration",
"LOGOUT": "Sign Out",
"HINT_HOME_SEARCH": " Find a place, neighborhood or city ",
@ -176,6 +180,8 @@
"SEARCH_20": "20 km",
"SEARCH_25": "25 km",
"SEARCH": "Search",
"SEE_VIDEO": "Watch the video",
"SEE_TUTO": "See the tutorial",
"DELETE": "Delete",
"FREE": "Available",
"SAVED": "Registered",
@ -195,12 +201,14 @@
"PHONE_TRANSACTION": "Transaction number",
"DEMAND_TEXT_FIRST_PART": "made a request for",
"REQUEST_SEND": "Request Sent",
"DEMAND_RECEIVE": "Requests received",
"TO_": "credit to",
"DEMAND_SEND_SUCCESFUL": "Your request has been sent successfully!",
"SAVE_HISTORY": "Save history",
"MAKE_REQUEST": "Make a request",
"DATE_WRONG": "The end date can not be earlier than the start date",
"LOADING_DOTS": "Loads ...",
"LOADING_DOTS": "Loading...",
"LOADING_PROGRESS": "Loading",
"EMPTY_LIST_REQUEST": "No request",
"MEMBER_LIST": "List of members",
"FREE_CODE_LIST": "List of available codes",

View File

@ -1,7 +1,9 @@
{
"WELCOME": "Bienvenue sur iLink World !",
"HELP": "Aide à l'utilisation",
"HELP": "Aide",
"SIMPLE_USER": "Utilisateur simple",
"ABOUT": "A Propos",
"ABOUT_TEXT": "iLink est une application qui facilitera vos transactions financières près de votre position, et vous donne les points multiservices prêt de chez vous.",
"GEOLOCATED_USER": "Utilisateur géo-localisé",
"SUPERVISOR": "Superviseur",
"AGENT": "Agent",
@ -15,6 +17,7 @@
"ACCOUNT_CREATED_SUCCESS": "Le compte a été crée avec succès.\nVous recevrez dans quelques minutes un email et un sms avec vos informations.\nNous allons vous rediriger vers la page de connexion",
"OR_BIG": "OU",
"FOR_NUMB": "Pour le ",
"FILTER_DATE": "Filtre de date",
"SUBTITLE_ACTIVE_ACCOUNT": "Activez votre compte à l'aide du code qui a été envoyé sur votre mail ou votre numéro de téléphone",
"ASK_FOR_CREDIT": "Demander du crédit",
"ASK_CREDIT": "Demandes de crédit",
@ -34,6 +37,7 @@
"CREDIT_MANAGE": "Gestion de credit",
"GROUP_MANAGE": "Gestion du groupe",
"NOTIFICATIONS": "Notification",
"NO_NOTIFICATION": "Vous n'avez aucune notification",
"CONFIGURATIONS": "Configuration",
"LOGOUT": "Déconnexion",
"HINT_HOME_SEARCH": " Chercher un lieu, quartier ou ville ",
@ -176,6 +180,8 @@
"SEARCH_20": "20 km",
"SEARCH_25": "25 km",
"SEARCH": "Rechercher",
"SEE_VIDEO": "Voir la vidéo",
"SEE_TUTO": "Voir le tutoriel",
"DELETE": "Supprimer",
"FREE": "disponibles",
"SAVED": "enregistrés",
@ -195,12 +201,14 @@
"PHONE_TRANSACTION": "Numéro de transaction",
"DEMAND_TEXT_FIRST_PART": "a effectué une demande de ",
"DEMANDE_SEND": " Demande Envoyée",
"DEMAND_RECEIVE": "Demandes reçues",
"TO_": " crédit auprès de ",
"DEMAND_SEND_SUCCESFUL": "Votre demande a été envoyée avec succès !",
"SAVE_HISTORY": "Enregistrer l'historique",
"MAKE_REQUEST": "Faire une demande",
"DATE_WRONG": "La date de fin ne peut être antérieure à la date de début",
"LOADING_DOTS": "Chargements...",
"LOADING_DOTS": "Chargement...",
"LOADING_PROGRESS": "Chargement en cours",
"EMPTY_LIST_REQUEST": "Aucune demande",
"MEMBER_LIST": "Liste des membres",
"FREE_CODE_LIST": "Liste des codes disponibles",

View File

@ -1,3 +1,3 @@
<resources>
<string name="app_name">iLink</string>
<string name="app_name">iLink Test</string>
</resources>

View File

@ -3,7 +3,9 @@
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
</resources>

View File

@ -2,8 +2,12 @@
* @format
*/
import {AppRegistry} from 'react-native';
import { AppRegistry, YellowBox } from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import { name as appName } from './app.json';
YellowBox.ignoredYellowBox = ['Warning: Each', 'Warning: Failed'];
console.disableYellowBox = true;
AppRegistry.registerComponent(appName, () => App);

View File

@ -1,19 +1,19 @@
import React,{Component} from 'react'
import {StyleSheet,Text,View} from 'react-native'
export const theme=require('./../utils/theme.json')
import React, { Component } from 'react'
import { StyleSheet, Text, View } from 'react-native'
export const theme = require('./../utils/theme.json')
export default class BaseScreen extends Component{
export default class BaseScreen extends Component {
constructor(props,needToCloseDrawer:Boolean=false){
super(props)
if(needToCloseDrawer){
/* this.props.navigator.toggleDrawer({
side: 'left', // the side of the drawer since you can have two, 'left' / 'right'
to: 'close' // optional, 'open' = open the drawer, 'closed' = close it, missing = the opposite of current state
});*/
}
constructor(props, needToCloseDrawer) {
super(props)
if (needToCloseDrawer) {
/* this.props.navigator.toggleDrawer({
side: 'left', // the side of the drawer since you can have two, 'left' / 'right'
to: 'close' // optional, 'open' = open the drawer, 'closed' = close it, missing = the opposite of current state
});*/
}
}
}
}

View File

@ -58,7 +58,7 @@ export default class About extends React.Component {
</View>
<View style={{ flex: 3 }}>
<Button onPress={() => { Linking.openURL(videoUrl) }} style={{ width: responsiveWidth(40), backgroundColor: "white", borderRadius: responsiveWidth(20), alignSelf: "center", borderColor: "white" }} textStyle={{ color: theme.primary }}>{I18n.t('SEE_VIDEO')}</Button>
<Button style={{ width: responsiveWidth(40), backgroundColor: "transparent", borderRadius: responsiveWidth(20), alignSelf: "center", borderColor: "white" }} textStyle={{ color: "white" }}><View style={{ justifyContent: "center", alignContent: "center" }}><Text style={{ color: "white", fontWeight: "bold" }}>{I18n.t("SEE_TUTO")}</Text><Text style={{ color: "white" }}>{I18n.t('UNAVAILABLE')}</Text></View></Button>
<Button style={{ width: responsiveWidth(40), backgroundColor: "transparent", borderRadius: responsiveWidth(20), alignSelf: "center", borderColor: "white" }} textStyle={{ color: "white" }}><View style={{ justifyContent: "center", alignContent: "center" }}><Text style={{ color: "white" }}>{I18n.t('SEE_TUTO')}</Text></View></Button>
</View>
<View style={{ flexDirection: "row", flex: 0.3, width: responsiveWidth(95), height: responsiveHeight(100), justifyContent: "space-between", alignItems: "stretch" }}>
<Text style={{ color: "white", fontWeight: "bold" }}>Version 1.0.0</Text>

View File

@ -1,5 +1,5 @@
import React, { Component } from 'react'
import { StyleSheet, Text, View, Alert } from 'react-native'
import { StyleSheet, Text, View, Alert, Platform, StatusBar } from 'react-native'
import BaseScreen from "../BaseScreen";
import { responsiveWidth, responsiveHeight } from 'react-native-responsive-dimensions'
import { Dropdown } from 'react-native-material-dropdown'
@ -13,22 +13,26 @@ require("./../../utils/Translations")
import { IlinkEmitter } from "./../../utils/events"
import { Header } from "react-native-elements";
import Icon from 'react-native-vector-icons/MaterialIcons';
import { SafeAreaView } from 'react-navigation';
export default class Configurations extends BaseScreen {
static navigationOptions = {
headerTItle: I18n.t('CONFIGURATIONS'),
headerTitle: I18n.t('CONFIGURATIONS'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'settings'}
size={24}
/>
),
)
};
constructor(props) {
super(props, true)
this.state = this.initState()
this.configuration = new Configuration();
if (Platform.OS === 'android') {
SafeAreaView.setStatusBarHeight(StatusBar.currentHeight);
}
}
initState() {
@ -79,7 +83,7 @@ export default class Configurations extends BaseScreen {
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white'
backgroundColor: 'white',
},
})

View File

@ -1,104 +1,104 @@
import React, { Component,PureComponent } from 'react';
import React, { Component, PureComponent } from 'react';
import PropTypes from 'prop-types';
import {StyleSheet,Text,View,FlatList} from 'react-native';
import {responsiveFontSize,responsiveWidth,responsiveHeight} from 'react-native-responsive-dimensions';
import { StyleSheet, Text, View, FlatList } from 'react-native';
import { responsiveFontSize, responsiveWidth, responsiveHeight } from 'react-native-responsive-dimensions';
export class DrawerItem extends React.PureComponent{
export class DrawerItem extends React.PureComponent {
render() {
return (
<View style={style.content}>
<Text style={style.title}>{this.props.title}</Text>
<Text style={style.description}>{this.props.description}</Text>
<View style={style.timeContent}>
<Text style={style.time}>{this.props.time}</Text>
</View>
<View style={style.bottomSeparator} />
</View>
)
}
render(){
return (
<View style={style.content}>
<Text style={style.title}>{this.props.title}</Text>
<Text style={style.description}>{this.props.description}</Text>
<View style={style.timeContent}>
<Text style={style.time}>{this.props.time}</Text>
</View>
<View style={style.bottomSeparator}/>
</View>
)
}
}
export class DrawerListItem extends PureComponent{
state = {selected: (new Map(): Map<string, boolean>)};
export class DrawerListItem extends PureComponent {
state = { selected: (new Map(): Map<string, boolean>) };
_keyExtractor = (item, index) => item.id;
_keyExtractor = (item, index) => item.id;
_onPressItem = (id: string) => {
this.setState((state) => {
const selected = new Map(state.selected);
selected.set(id, !selected.get(id)); // toggle
return {selected};
});
};
_renderItem = ({item}) => (
<HistoryItem
title={item.title}
description={item.description}
time={item.time}
/>
);
_onPressItem = (id: string) => {
this.setState((state) => {
const selected = new Map(state.selected);
selected.set(id, !selected.get(id)); // toggle
return { selected };
});
};
_renderItem = ({ item }) => (
<HistoryItem
title={item.title}
description={item.description}
time={item.time}
/>
);
render() {
return (
<FlatList
data={[{title:'titre de la demande',description:'test description de la demande',time:'Hier'},
{title:'titre de la demande',description:'test description de la demande',time:'Hier'},
{title:'titre de la demande',description:'test description de la demande',time:'Hier'},
{title:'titre de la demande',description:'test description de la demande',time:'Hier'},
{title:'titre de la demande',description:'test description de la demande',time:'Hier'},
{title:'titre de la demande',description:'test description de la demande',time:'Hier'},
{title:'titre de la demande',description:'test description de la demande',time:'Hier'},
{title:'titre de la demande',description:'test description de la demande',time:'Hier'},
{title:'titre de la demande',description:'test description de la demande',time:'Hier'},
{title:'titre de la demande',description:'test description de la demande',time:'Hier'},
]}
extraData={this.state}
keyExtractor={this._keyExtractor}
renderItem={this._renderItem}
/>
);
}
render() {
return (
<FlatList
data={[{ title: 'titre de la demande', description: 'test description de la demande', time: 'Hier' },
{ title: 'titre de la demande', description: 'test description de la demande', time: 'Hier' },
{ title: 'titre de la demande', description: 'test description de la demande', time: 'Hier' },
{ title: 'titre de la demande', description: 'test description de la demande', time: 'Hier' },
{ title: 'titre de la demande', description: 'test description de la demande', time: 'Hier' },
{ title: 'titre de la demande', description: 'test description de la demande', time: 'Hier' },
{ title: 'titre de la demande', description: 'test description de la demande', time: 'Hier' },
{ title: 'titre de la demande', description: 'test description de la demande', time: 'Hier' },
{ title: 'titre de la demande', description: 'test description de la demande', time: 'Hier' },
{ title: 'titre de la demande', description: 'test description de la demande', time: 'Hier' },
]}
extraData={this.state}
keyExtractor={this._keyExtractor}
renderItem={this._renderItem}
/>
);
}
}
const style=StyleSheet.create({
content:{
width:responsiveWidth(100),
height:responsiveHeight(12),
borderBottomColor: '#FFFFFF',
flex:1,
flexDirection: 'column',
paddingLeft: 10,
paddingTop: 10,
},
bottomSeparator:{
width:responsiveWidth(80),
height:1,
justifyContent:'center',
alignSelf: 'center',
const style = StyleSheet.create({
content: {
width: responsiveWidth(100),
height: responsiveHeight(12),
borderBottomColor: '#FFFFFF',
flex: 1,
flexDirection: 'column',
paddingLeft: 10,
paddingTop: 10,
backgroundColor:'#4f5b62',
},
title:{
color:'#000',
fontSize:responsiveFontSize(2.2)
},
description:{
fontSize:responsiveFontSize(1.8),
color:'#4f5b62',
},
timeContent:{
justifyContent:'flex-end',
flex:1,
alignItems: 'flex-end',
},
time:{
fontWeight: 'bold',
marginRight: 20,
marginBottom: 10,
color:'#263238',
},
});
},
bottomSeparator: {
width: responsiveWidth(80),
height: 1,
justifyContent: 'center',
alignSelf: 'center',
backgroundColor: '#4f5b62',
},
title: {
color: '#000',
fontSize: responsiveFontSize(2.2)
},
description: {
fontSize: responsiveFontSize(1.8),
color: '#4f5b62',
},
timeContent: {
justifyContent: 'flex-end',
flex: 1,
alignItems: 'flex-end',
},
time: {
fontWeight: 'bold',
marginRight: 20,
marginBottom: 10,
color: '#263238',
},
});

View File

@ -1,58 +1,57 @@
import React, { Component,PureComponent } from 'react';
import React, { Component, PureComponent } from 'react';
import {Platform, StyleSheet,FlatList, Text, View} from 'react-native';
import { Platform, StyleSheet, FlatList, Text, View } 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 {HistoryListItem} from '../history-request/HistoryItem';
import { responsiveFontSize, responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
import { HistoryListItem } from '../history-request/HistoryItem';
export class ListOptions extends Component{
render () {
export class ListOptions extends Component {
render() {
return (
<View style={styles.container}>
<HistoryListItem
style={styles.listbackground}/>
<ActionButton>
<ActionButton.Item buttonColor='#9b59b6' title="Faire une demande" onPress={() => console.log("notes tapped!")}>
<Icon name="md-create" style={styles.actionButtonIcon} />
</ActionButton.Item>
<ActionButton.Item buttonColor='#3498db' title="Enregistrer l'historique" onPress={() => {}}>
<Icon name="md-save" style={styles.actionButtonIcon} />
</ActionButton.Item>
<View style={styles.container}>
<HistoryListItem
style={styles.listbackground} />
<ActionButton>
<ActionButton.Item buttonColor='#9b59b6' title="Faire une demande" onPress={() => console.log("notes tapped!")}>
<Icon name="md-create" style={styles.actionButtonIcon} />
</ActionButton.Item>
<ActionButton.Item buttonColor='#3498db' title="Enregistrer l'historique" onPress={() => { }}>
<Icon name="md-save" style={styles.actionButtonIcon} />
</ActionButton.Item>
</ActionButton>
</View>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
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,
},
});
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
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,
},
});

View File

@ -15,7 +15,7 @@ require("./../../utils/Translations");
import I18n from 'react-native-i18n'
const route = require('./../../route.json')
import LottieView from 'lottie-react-native'; // if you have "esModuleInterop": true
import { IndicatorViewPager } from 'react-native-best-viewpager';
import { IndicatorViewPager, PagerTabIndicator } from 'react-native-best-viewpager';
import { Card, CardTitle, CardContent, CardAction, CardButton, CardImage } from 'react-native-material-cards'
let moment = require('moment-timezone');

View File

@ -1,11 +1,11 @@
import React, { Component,PureComponent } from 'react';
import React, { Component, PureComponent } from 'react';
import PropTypes from 'prop-types';
import {StyleSheet,Text,View,FlatList,TouchableOpacity,SectionList,RefreshControl} from 'react-native';
import {responsiveFontSize,responsiveWidth,responsiveHeight} from 'react-native-responsive-dimensions';
import {convertDateToHumanText} from './../../utils/DateUtils';
import { StyleSheet, Text, View, FlatList, TouchableOpacity, SectionList, RefreshControl } from 'react-native';
import { responsiveFontSize, responsiveWidth, responsiveHeight } from 'react-native-responsive-dimensions';
import { convertDateToHumanText } from './../../utils/DateUtils';
import Icon from 'react-native-vector-icons/FontAwesome5';
var moment=require('moment-timezone')
const momentJS=require('moment')
var moment = require('moment-timezone')
const momentJS = require('moment')
import I18n from "react-native-i18n"
import 'moment/locale/fr'
@ -16,230 +16,232 @@ import 'moment/locale/en-ie'
import 'moment/locale/en-il'
import 'moment/locale/en-nz'
let route=require('./../../route.json');
var theme=require('./../../utils/theme.json');
let route = require('./../../route.json');
var theme = require('./../../utils/theme.json');
export class HistoryItem extends React.Component{
export class HistoryItem extends React.Component {
constructor(props){
super(props);
this.state=this.initState();
}
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;
moment.locale(I18n.locale)
var re= moment.tz(this.props.selfData.date_creation,'Etc/GMT+0').format();
re=moment(re)
return {
title:textTitle,
description:textDescription,
status:this.props.selfData.status==='1'?I18n.t('TREAT'):I18n.t('NO_TREAT'),
time:re.fromNow(),
navigator:this.props.navigator,
type:t,
colorstate:t==='1'?'green':'red'
}
};
constructor(props) {
super(props);
this.state = this.initState();
}
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;
moment.locale(I18n.locale)
var re = moment.tz(this.props.selfData.date_creation, 'Etc/GMT+0').format();
re = moment(re)
return {
title: textTitle,
description: textDescription,
status: this.props.selfData.status === '1' ? I18n.t('TREAT') : I18n.t('NO_TREAT'),
time: re.fromNow(),
navigator: this.props.navigator,
type: t,
colorstate: t === '1' ? 'green' : 'red'
}
};
render(){
return (
<TouchableOpacity onPress={()=>
this.props.navigator.navigate(route.historyItemDetails,
{item:this.props.selfData}
render() {
return (
<TouchableOpacity onPress={() =>
this.props.navigator.navigate(route.historyItemDetails,
{ item: this.props.selfData }
)}>
<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,
)}>
<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.state.status}</Text>
<Text style={style.time}>{this.state.time}</Text>
</View>
<View style={style.bottomSeparator}/>
}}>{this.state.status}</Text>
<Text style={style.time}>{this.state.time}</Text>
</View>
<View style={style.bottomSeparator} />
</View>
</TouchableOpacity>
)
}
</View>
</TouchableOpacity>
)
}
}
export class HistoryItemSectionned extends PureComponent{
_keyExtractor = (item, index) => item.id;
_renderItem = ({item}) => (
<HistoryItem
navigator={this.props.navigator}
selfData={item}
/>
);
constructor(props){
super(props);
this.state=this.initState();
}
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})
}
}
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
}
}
}
export class HistoryListItem extends React.Component{
_keyExtractor = (item, index) => item.id;
_onPressItem = (id: string) => {
};
_renderItem = ({item}) => (
<HistoryItem
navigator={this.props.navigator}
selfData={item}
/>
);
constructor(props){
super(props);
this.state=this.initState();
}
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}
export class HistoryItemSectionned extends PureComponent {
_keyExtractor = (item, index) => item.id;
_renderItem = ({ item }) => (
<HistoryItem
navigator={this.props.navigator}
selfData={item}
/>
}
/>
);
}
);
constructor(props) {
super(props);
this.state = this.initState();
}
render() {
return (
_onRefresh(){
this.setState({refreshing:true})
setTimeout(()=>{this.setState({refreshing:false})},5000);
}
<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 })
}
}
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
}
}
}
export class HistoryListItem extends React.Component {
_keyExtractor = (item, index) => item.id;
_onPressItem = (id: string) => {
};
_renderItem = ({ item }) => (
<HistoryItem
navigator={this.props.navigator}
selfData={item}
/>
);
constructor(props) {
super(props);
this.state = this.initState();
}
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}
/>
}
/>
);
}
_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:{
},
});
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: {
},
});

File diff suppressed because it is too large Load Diff

View File

@ -1,281 +1,286 @@
import React,{PureComponent} from 'react';
import MapView,{Marker,MarkerAnimated} from "react-native-maps"
import React, { PureComponent } from 'react';
import MapView, { Marker, MarkerAnimated } from "react-native-maps"
import PropTypes from 'prop-types';
import {
StyleSheet,
View,
Image,
Text,
StyleSheet,
View,
Image,
Text,
} from 'react-native';
const theme=require("../../utils/theme");
import {responsiveHeight, responsiveWidth} from "react-native-responsive-dimensions";
const theme = require("../../utils/theme");
import { responsiveHeight, responsiveWidth } from "react-native-responsive-dimensions";
import IMarker from "./IMarker";
import I18n from "react-native-i18n";
import MapViewDirections from 'react-native-maps-directions';
const API_KEY="AIzaSyAYOEp-Pckvc3TwOIulCICokKgmp14rGHI";
const mnetwork=require('./../../datas/img/png/home_network.png');
const othernetwork=require('./../../datas/img/png/other_net.png');
const API_KEY = "AIzaSyAYOEp-Pckvc3TwOIulCICokKgmp14rGHI";
const mnetwork = require('./../../datas/img/png/home_network.png');
const othernetwork = require('./../../datas/img/png/other_net.png');
import { copilot, CopilotStep } from 'react-native-copilot';
class IMap extends PureComponent {
static propTypes = {
markers: PropTypes.array,
map:PropTypes.object,
network:PropTypes.object,
myNetwork:PropTypes.object,
selectedMarker:PropTypes.object,
myPosition:PropTypes.object,
onMarkerClick:PropTypes.func,
initialRegion:PropTypes.object,
typeMap:PropTypes.string,
needRoad:PropTypes.bool,
isNeedUserFocus:PropTypes.bool,
onNeedRoadReady:PropTypes.func,
onNeedRoadError:PropTypes.func,
onMapReady:PropTypes.func
};
static propTypes = {
markers: PropTypes.array,
map: PropTypes.object,
network: PropTypes.object,
myNetwork: PropTypes.object,
selectedMarker: PropTypes.object,
myPosition: PropTypes.object,
onMarkerClick: PropTypes.func,
initialRegion: PropTypes.object,
typeMap: PropTypes.string,
needRoad: PropTypes.bool,
isNeedUserFocus: PropTypes.bool,
onNeedRoadReady: PropTypes.func,
onNeedRoadError: PropTypes.func,
onMapReady: PropTypes.func
};
static defaultProps = {
isNeedUserFocus:false
};
constructor(props){
super(props)
this.state={
markers:[],
roadReady:false,
isNeedUserFocus:false,
}
}
mapRef = (ref) => {
this.mapview = ref
}
static defaultProps = {
isNeedUserFocus: false
};
constructor(props) {
super(props)
this.state = {
markers: [],
roadReady: false,
isNeedUserFocus: false,
}
}
mapRef = (ref) => {
this.mapview = ref
}
getMapRef = () => this.mapview
componentWillReceiveProps(nextProps: Readonly<P>, nextContext: any): void {
const markers=this.state.markers
const newmarkers=nextProps.markers
if(markers.length<=0)
this.setState({markers:newmarkers})
else if(markers.length!==newmarkers){
this.setState({markers:newmarkers})
}
this.setState({isNeedUserFocus:nextProps.isNeedUserFocus})
getMapRef = () => this.mapview
componentWillReceiveProps(nextProps: Readonly<P>, nextContext: any): void {
const markers = this.state.markers
const newmarkers = nextProps.markers
if (markers.length <= 0)
this.setState({ markers: newmarkers })
else if (markers.length !== newmarkers) {
this.setState({ markers: newmarkers })
}
this.setState({ isNeedUserFocus: nextProps.isNeedUserFocus })
}
render() {
const { markers, initialRegion, myPosition, myNetwork, typeMap, selectedMarker } = this.props
if (initialRegion !== null && myNetwork !== null)
return (
<View style={styles.container}>
<MapView
style={{ flex: 1 }}
initialRegion={initialRegion}
mapType={typeMap}
ref={(re) => this.mapview = re}
onMapReady={this.props.onMapReady}
onRegionChangeComplete={(re) => { this.onRegionChangeOver(re) }}>
{this.state.markers.map((item, index) => {
return (
<IMarker
isUser={false}
title={item.lastname}
isSelected={(selectedMarker && selectedMarker.id === item.id)}
data={item}
onPress={(e, marker) => this.props.onMarkerClick(e, marker)}
network={myNetwork}
/>)
})}
{this.renderMyPosition()}
{this.makeDirection()}
</MapView>
</View>)
else return (<View />)
}
focusToUser() {
this.setState({ isNeedUserFocus: true })
}
closeUserFocus() {
this.setState({ isNeedUserFocus: false })
}
onRegionChangeOver(region) {
}
makeDirection() {
let { myPosition, selectedMarker, needRoad } = this.props
if (myPosition !== null && selectedMarker !== null && selectedMarker !== undefined && myPosition !== undefined && needRoad) {
setTimeout(() => {
if (!this.state.roadReady) {
this.setState({ roadReady: true })
this.props.onNeedRoadError()
}
}, 10000)
return (<MapViewDirections
origin={myPosition}
destination={selectedMarker}
apikey={API_KEY}
strokeWidth={3}
onReady={(data) => {
this.setState({ roadReady: true })
this.props.onNeedRoadReady(data)
}
}
onError={() => {
this.setState({ roadReady: true })
this.props.onNeedRoadError()
}
}
strokeColor={theme.primary}
/>)
}
}
renderMyPosition() {
const { myPosition, myNetwork } = this.props
if (myPosition != null) {
if (false) {
return (
<CopilotStep>
<IMarker
isUser={true}
lang={this.props.lang}
isNeedFocus={this.state.isNeedUserFocus}
title={I18n.t("YOUR_THERE")}
data={{
longitude: myPosition.longitude,
latitude: myPosition.latitude
}}
/>
</CopilotStep>
)
} else
return (<IMarker
isUser={true}
lang={this.props.lang}
isNeedFocus={this.state.isNeedUserFocus}
title={I18n.t("YOUR_THERE")}
data={{
longitude: myPosition.longitude,
latitude: myPosition.latitude
}}
/>)
}
}
}
render(){
const {markers,initialRegion,myPosition,myNetwork,typeMap,selectedMarker}=this.props
if(initialRegion!==null && myNetwork!==null)
return (
<View style={styles.container}>
<MapView
style={{flex: 1}}
initialRegion={initialRegion}
mapType={typeMap}
ref={(re) => this.mapview = re}
onMapReady={this.props.onMapReady}
onRegionChangeComplete={(re)=>{this.onRegionChangeOver(re)}}>
{this.state.markers.map((item,index)=>{
return (
<IMarker
isUser={false}
title={item.lastname}
isSelected={(selectedMarker && selectedMarker.id===item.id)}
data={item}
onPress={(e,marker)=>this.props.onMarkerClick(e,marker)}
network={myNetwork}
/>)
})}
{this.renderMyPosition()}
{this.makeDirection()}
</MapView>
</View>)
else return(<View/>)
}
focusToUser(){
this.setState({isNeedUserFocus:true})
}
closeUserFocus(){
this.setState({isNeedUserFocus:false})
}
onRegionChangeOver(region){
}
makeDirection() {
let {myPosition, selectedMarker,needRoad} = this.props
if (myPosition !== null && selectedMarker !== null && selectedMarker !== undefined && myPosition !== undefined && needRoad) {
setTimeout(()=>{
if(!this.state.roadReady){
this.setState({roadReady:true})
this.props.onNeedRoadError()}
},10000)
return (<MapViewDirections
origin={myPosition}
destination={selectedMarker}
apikey={API_KEY}
strokeWidth={3}
onReady={(data)=>{
this.setState({roadReady:true})
this.props.onNeedRoadReady(data)}
}
onError={()=>{
this.setState({roadReady:true})
this.props.onNeedRoadError()}
}
strokeColor={theme.primary}
/>)
}
}
renderMyPosition() {
const {myPosition,myNetwork}=this.props
if(myPosition!=null){
if(false){
return (
<CopilotStep>
<IMarker
isUser={true}
lang={this.props.lang}
isNeedFocus={this.state.isNeedUserFocus}
title={I18n.t("YOUR_THERE")}
data={{
longitude:myPosition.longitude,
latitude:myPosition.latitude}}
/>
</CopilotStep>
)
}else
return (<IMarker
isUser={true}
lang={this.props.lang}
isNeedFocus={this.state.isNeedUserFocus}
title={I18n.t("YOUR_THERE")}
data={{
longitude:myPosition.longitude,
latitude:myPosition.latitude}}
/>)
}
}
}
export default IMap;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#FFF',
},
myClusterTextStyle:{
color:"white"
},
myClusterStyle: {
backgroundColor:theme.accent,
height:32,
justifyContent:'center',
alignItems:'center',
width:32,
borderRadius:16
},
rowContainer: {
height: 52,
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-start',
alignItems: 'center',
},
iconContainer: {
marginRight: 16,
},
mapmarker:{
width:52,
height:52,
},
slidingup:{
backgroundColor:"transparent",
position:"absolute",
height:300,
bottom:0,
right:35,
zIndex: 1
},
panel: {
flex: 1,
backgroundColor: 'white',
position: 'relative'
},
panelHeader: {
height: 120,
backgroundColor: '#b197fc',
alignItems: 'center',
justifyContent: 'center'
},
favoriteIcon: {
left: responsiveWidth(75),
backgroundColor: theme.primary,
width: 64,
justifyContent:'center',
alignContent: 'center',
bottom:-64,
position:'absolute',
height: 64,
padding: 8,
zIndex:1,
borderRadius: 32,
},
hambuger:{
},
topBar:{
position:'absolute',
alignSelf: 'center',
justifyContent:'center',
alignItems: 'center',
marginTop:responsiveHeight(4),
width:responsiveWidth(95),
container: {
flex: 1,
backgroundColor: '#FFF',
},
myClusterTextStyle: {
color: "white"
},
myClusterStyle: {
backgroundColor: theme.accent,
height: 32,
justifyContent: 'center',
alignItems: 'center',
width: 32,
borderRadius: 16
},
rowContainer: {
height: 52,
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-start',
alignItems: 'center',
},
iconContainer: {
marginRight: 16,
},
mapmarker: {
width: 52,
height: 52,
},
slidingup: {
backgroundColor: "transparent",
position: "absolute",
height: 300,
bottom: 0,
right: 35,
zIndex: 1
},
panel: {
flex: 1,
backgroundColor: 'white',
position: 'relative'
},
panelHeader: {
height: 120,
backgroundColor: '#b197fc',
alignItems: 'center',
justifyContent: 'center'
},
favoriteIcon: {
left: responsiveWidth(75),
backgroundColor: theme.primary,
width: 64,
justifyContent: 'center',
alignContent: 'center',
bottom: -64,
position: 'absolute',
height: 64,
padding: 8,
zIndex: 1,
borderRadius: 32,
},
hambuger: {
},
topBar: {
position: 'absolute',
alignSelf: 'center',
justifyContent: 'center',
alignItems: 'center',
marginTop: responsiveHeight(4),
width: responsiveWidth(95),
},
searchInput:{
width:responsiveWidth(70),
fontSize:14
},
search: {
width:responsiveWidth(70),
height:responsiveHeight(10),
backgroundColor:'#00000000',
},
searchInput: {
width: responsiveWidth(70),
fontSize: 14
},
search: {
width: responsiveWidth(70),
height: responsiveHeight(10),
backgroundColor: '#00000000',
},
},
map:{
width:responsiveWidth(100),
height:responsiveHeight(100),
},
backgroundd_drawer:{
backgroundColor:'#000',
},
cardsearch:{
width:responsiveWidth(90),
height:responsiveHeight(10),
position:'absolute',
alignSelf: 'center',
marginTop: 5,
map: {
width: responsiveWidth(100),
height: responsiveHeight(100),
},
backgroundd_drawer: {
backgroundColor: '#000',
},
cardsearch: {
width: responsiveWidth(90),
height: responsiveHeight(10),
position: 'absolute',
alignSelf: 'center',
marginTop: 5,
},
actionButtonIcon: {
fontSize: 20,
height: 22,
},
actionButtonIcon: {
fontSize: 20,
height: 22,
color: 'white',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
color: 'white',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

View File

@ -6,247 +6,250 @@
* @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 { 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")
const route = require("./../../route.json")
require('./../../utils/Translations')
var DBEvents = require('react-native-db-models').DBEvents
type Props = {};
let theme=require('./../../utils/theme.json')
let theme = require('./../../utils/theme.json')
import Button from 'apsl-react-native-button'
import {IlinkEmitter} from "./../../utils/events"
import { IlinkEmitter } from "./../../utils/events"
import { DrawerItems, SafeAreaView } from 'react-navigation';
import DeviceInfo from "react-native-device-info"
import AppContainer, {AppNavigator} from "../../App";
import AppContainer, { AppNavigator } from "../../App";
import Configuration from "../../webservice/persistences/Configuration";
import { ScrollView } from 'react-native-gesture-handler';
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{
let code= DeviceInfo.getDeviceLocale();
I18n.locale=code.toLowerCase()
readUser().then((result) => {
setTimeout(() => {
this.updateUser(result);
}, 3000)
}).catch((e) => {
this.props.navigation.navigate("Auth")
});
}
}).catch((e)=>{
let code=DeviceInfo.getDeviceLocale()
I18n.locale=code.toLowerCase()
readUser().then((result) => {
setTimeout(() => {
this.updateUser(result);
retrieveAndroidInformation() {
this.configuration._getData().then((lang) => {
if (lang) {
I18n.locale = lang
readUser().then((result) => {
setTimeout(() => {
this.updateUser(result);
}, 3000)
})
} else {
let code = DeviceInfo.getDeviceLocale();
I18n.locale = code.toLowerCase()
readUser().then((result) => {
setTimeout(() => {
this.updateUser(result);
}, 3000)
}).catch((e) => {
this.props.navigation.navigate("Auth")
});
}
}).catch((e) => {
let code = DeviceInfo.getDeviceLocale()
I18n.locale = code.toLowerCase()
readUser().then((result) => {
setTimeout(() => {
this.updateUser(result);
}, 3000)
}).catch((e) => {
this.props.navigation.navigate("Auth")
});
}).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() {
return ""
}
componentDidMount() {
const items = this.props.navigation.router.childRouters.sta.childRouters;
// items.filter((item)=>item.)
this.setState({ items: items })
this.retrieveAndroidInformation()
}
onMenuNavigationEvent(menuOption){
/* Navigation.mergeOptions(this.props.componentId,{
sideMenu: {
left: {
visible: false,
}
updateLangue() {
this.setState({ lang: "change" })
this.forceUpdate()
}
componentWillUnmount() {
}
onMenuNavigationEvent(menuOption) {
/* Navigation.mergeOptions(this.props.componentId,{
sideMenu: {
left: {
visible: false,
}
}
})
switch (menuOption){
case "home":{
this.setState({currentId:0})
}
break;
case "userInfo":{
this.setState({currentId:1})
}
}*/
}
onUserConnect() {
readUser().then((user) => {
if (user !== null && user !== undefined) {
this.updateUser(user);
}
});
}
onNavigatorEvent(event) {
}
hideSideMenu() {
/* Navigation.mergeOptions("drawer", {
sideMenu: {
left: {
visible: false,
enabled:false
}
}
}
})
switch (menuOption){
case "home":{
this.setState({currentId:0})
}
break;
case "userInfo":{
this.setState({currentId:1})
}
}*/
}
onUserConnect() {
readUser().then((user) => {
if (user !== null && user !== undefined) {
this.updateUser(user);
}
});
}
onNavigatorEvent(event) {
}
hideSideMenu() {
/* Navigation.mergeOptions("drawer", {
sideMenu: {
left: {
visible: false,
enabled:false
}
}
});*/
}
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,
enabled:true
}
});*/
}
initState() {
return {
user: null,
menu: [],
currentId: 0,
}
});*/
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;
}
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,
enabled:true
}
}
});*/
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') {
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({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'){
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})
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,{
@ -391,189 +394,192 @@ 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_')
}
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}
>
<Text style={styles.headerTitle}>{name}</Text>
<Text style={styles.headerTitle}>{surname}</Text>
<Text style={styles.headerPhone}>{this.state.user?""+this.state.user.phone:""}</Text>
</View>
<ScrollView style={{flex:1,height:responsiveHeight(40)
}} >
<SafeAreaView forceInset={{ top: 'always', horizontal: 'never' }}>
{
this.state.items && Object.keys(this.state.items).map((item,key)=>{
return this._renderItem(item)
})
}
</SafeAreaView>
</ScrollView>
<Button
textStyle={styles.btntext}
style={styles.btnDeconnect}
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.id!==this.state.user.id) {
if (user !== null && user !== undefined) {
this.updateUser(user);
}
}
});
}
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 (
<View style={styles.container}>
<View
style={styles.headercontent}
>
<Text style={styles.headerTitle}>{name}</Text>
<Text style={styles.headerTitle}>{surname}</Text>
<Text style={styles.headerPhone}>{this.state.user ? "" + this.state.user.phone : ""}</Text>
</View>
<ScrollView style={{
flex: 1, height: responsiveHeight(40)
}} >
<SafeAreaView forceInset={{ top: 'always', horizontal: 'never' }}>
{
this.state.items && Object.keys(this.state.items).map((item, key) => {
return this._renderItem(item)
})
}
</SafeAreaView>
</ScrollView>
<Button
textStyle={styles.btntext}
style={styles.btnDeconnect}
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.id !== this.state.user.id) {
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),
}
});
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,
},
const items = StyleSheet.create({
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,
},
});

View File

@ -6,247 +6,250 @@
* @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 { 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")
const route = require("./../../route.json")
require('./../../utils/Translations')
var DBEvents = require('react-native-db-models').DBEvents
type Props = {};
let theme=require('./../../utils/theme.json')
let theme = require('./../../utils/theme.json')
import Button from 'apsl-react-native-button'
import {IlinkEmitter} from "./../../utils/events"
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 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) => {
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.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")
});
})
});
})
}
}).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() {
return ""
}
componentDidMount() {
const items = this.props.navigation.router.childRouters.sta.childRouters;
// items.filter((item)=>item.)
this.setState({ items: items })
this.retrieveAndroidInformation()
}
onMenuNavigationEvent(menuOption){
/* Navigation.mergeOptions(this.props.componentId,{
sideMenu: {
left: {
visible: false,
}
updateLangue() {
this.setState({ lang: "change" })
this.forceUpdate()
}
componentWillUnmount() {
}
onMenuNavigationEvent(menuOption) {
/* Navigation.mergeOptions(this.props.componentId,{
sideMenu: {
left: {
visible: false,
}
}
})
switch (menuOption){
case "home":{
this.setState({currentId:0})
}
break;
case "userInfo":{
this.setState({currentId:1})
}
}*/
}
onUserConnect() {
readUser().then((user) => {
if (user !== null && user !== undefined) {
this.updateUser(user);
}
});
}
onNavigatorEvent(event) {
}
hideSideMenu() {
/* Navigation.mergeOptions("drawer", {
sideMenu: {
left: {
visible: false,
enabled:false
}
}
}
})
switch (menuOption){
case "home":{
this.setState({currentId:0})
}
break;
case "userInfo":{
this.setState({currentId:1})
}
}*/
}
onUserConnect() {
readUser().then((user) => {
if (user !== null && user !== undefined) {
this.updateUser(user);
}
});
}
onNavigatorEvent(event) {
}
hideSideMenu() {
/* Navigation.mergeOptions("drawer", {
sideMenu: {
left: {
visible: false,
enabled:false
}
}
});*/
}
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,
enabled:true
}
});*/
}
initState() {
return {
user: null,
menu: [],
currentId: 0,
}
});*/
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;
}
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,
enabled:true
}
}
});*/
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') {
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({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'){
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})
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,{
@ -391,187 +394,190 @@ 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_')
}
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}
>
<Text style={styles.headerTitle}>{name}</Text>
<Text style={styles.headerTitle}>{surname}</Text>
<Text style={styles.headerPhone}>{this.state.user?""+this.state.user.phone:""}</Text>
</View>
<SafeAreaView style={{flex:1,
}} forceInset={{ top: 'always', horizontal: 'never' }}>
{
this.state.items && Object.keys(this.state.items).map((item,key)=>{
return this._renderItem(item)
})
}
</SafeAreaView>
<Button
textStyle={styles.btntext}
style={styles.btnDeconnect}
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.id!==this.state.user.id) {
if (user !== null && user !== undefined) {
this.updateUser(user);
}
}
});
}
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 (
<View style={styles.container}>
<View
style={styles.headercontent}
>
<Text style={styles.headerTitle}>{name}</Text>
<Text style={styles.headerTitle}>{surname}</Text>
<Text style={styles.headerPhone}>{this.state.user ? "" + this.state.user.phone : ""}</Text>
</View>
<SafeAreaView style={{
flex: 1,
}} forceInset={{ top: 'always', horizontal: 'never' }}>
{
this.state.items && Object.keys(this.state.items).map((item, key) => {
return this._renderItem(item)
})
}
</SafeAreaView>
<Button
textStyle={styles.btntext}
style={styles.btnDeconnect}
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.id !== this.state.user.id) {
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),
}
});
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,
},
const items = StyleSheet.create({
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,
},
});

View File

@ -1,14 +1,14 @@
import React, { Component } from 'react';
import {
StyleSheet, View, Text, Image, ProgressBarAndroid,
TouchableNativeFeedback,TouchableOpacity,
PermissionsAndroid, NativeModules, StatusBar, Platform,Animated
StyleSheet, View, Text, Image, ProgressBarAndroid,
TouchableNativeFeedback, TouchableOpacity,
PermissionsAndroid, NativeModules, StatusBar, Platform, Animated
} from 'react-native';
import {responsiveHeight,responsiveWidth,responsiveFontSize} from 'react-native-responsive-dimensions';
import { responsiveHeight, responsiveWidth, responsiveFontSize } from 'react-native-responsive-dimensions';
import I18n from 'react-native-i18n'
const theme=require('./../../utils/theme.json');
const route=require('./../../route.json');
import {readUser,getPasObject,getPubActiveObject} from '../../webservice/AuthApi';
const theme = require('./../../utils/theme.json');
const route = require('./../../route.json');
import { readUser, getPasObject, getPubActiveObject } from '../../webservice/AuthApi';
import { Bubbles, DoubleBounce, Bars, Pulse } from 'react-native-loader';
import Configuration from "../../webservice/persistences/Configuration";
import '../ads/InterticielAds'
@ -17,241 +17,242 @@ import LottieView from 'lottie-react-native'; // if you have "esModuleInterop":
import InterticielAds from '../ads/InterticielAds';
import Overlay from 'react-native-elements'
import DeviceInfo from 'react-native-device-info';
export default class SplashScreen extends Component{
static navigatorStyle = {
drawUnderNavBar: true,
navBarHidden:true,
drawUnderStatusBar: false,
statusBarHidden: true,
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){
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,
{ component: {
name: way,
}
export default 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
}
);
Navigation.showOverlay({
component: {
name: route.intersticielAds,
id:"interticiel",
options: {
overlay: {
interceptTouchOutside: false
}
}
}
});*/
};
}
componentDidMount(){
try {
this.requestCameraPermission()
}catch (e){
console.log(e)
}
this.config=new Configuration();
this.retrieveAndroidInformation()
setTimeout(()=>this.bounce(),500)
this.bounce()
}
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")
//
constructor(props) {
super(props);
this.state = {
}
} 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);
})
}
};
workUserResult(result) {
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"
}
setTimeout(() => {
this.workUserResult(result)
}, 3000)})
}else{
}
way2 = route.login
}
this.props.navigation.navigate(way)
/* Navigation.setStackRoot(route.stackRoot,
{ component: {
name: way,
}
}
);
Navigation.showOverlay({
component: {
name: route.intersticielAds,
id:"interticiel",
options: {
overlay: {
interceptTouchOutside: false
}
}
}
});*/
}
componentDidMount() {
try {
this.requestCameraPermission()
} catch (e) {
console.log(e)
}
this.config = new Configuration();
this.retrieveAndroidInformation()
setTimeout(() => this.bounce(), 500)
this.bounce()
}
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}>
</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) => {
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)
});
I18n.locale=code.toLowerCase()
readUser().then((result) => {
setTimeout(() => {
this.workUserResult(result)
}, 3000)
}).catch((e) => {
this.props.navigation.navigate("Auth")
});
})
})
return ""
}
}
}).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 ""
}
}
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',
},
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',
},
})

View File

@ -2,6 +2,8 @@
"WELCOME": "Welcome to iLink World !",
"HELP": "Help",
"SIMPLE_USER": "Simple User",
"ABOUT": "About us",
"ABOUT_TEXT": "iLink is an application that will facilitate your financial transactions near your location, and give you multiservice points near you.",
"GEOLOCATED_USER": "Geo located user",
"SUPERVISOR": "Supervisor",
"AGENT": "Agent",
@ -15,6 +17,7 @@
"ACCOUNT_CREATED_SUCCESS": "Account created successfully.\nYou will receive in a few minutes an email and an SMS with your informations.\nWe will redirect you to the login page",
"OR_BIG": "OR",
"FOR_NUMB": "For the ",
"FILTER_DATE": "Filter date",
"SUBTITLE_ACTIVE_ACCOUNT": "Activate your account using the code that was sent on your email or phone number",
"ASK_FOR_CREDIT": "Apply for credit",
"ASK_CREDIT": "Credit applications",
@ -26,14 +29,15 @@
"ASK_FOR_SUPERVISOR1": "Ask to become a supervisor",
"CREDIT_ASK_FROM_MEMBERS": "Credit requests from your members",
"ASK_MEMBERS": "Membership applications",
"MY_ACCOUNT": "Mon compte",
"THE_ACCOUNT": "Le compte ",
"MY_ACCOUNT": "My account",
"THE_ACCOUNT": "Account ",
"NO_GEO_POINT_CODE": "You have no free geolocated point",
"NO_DEMAND_ADHESION": "You have no membership request",
"ACTIVATED": "has been activated",
"CREDIT_MANAGE": "Credit Management",
"GROUP_MANAGE": "Group Management",
"NOTIFICATIONS": "Notification",
"NO_NOTIFICATION": "You haven't any notification",
"CONFIGURATIONS": "Configuration",
"LOGOUT": "Sign Out",
"HINT_HOME_SEARCH": " Find a place, neighborhood or city ",
@ -55,6 +59,7 @@
"CREDIT": "Credit",
"NEXT": "Next",
"SPONSOR_CODE": "Sponsor Code",
"SOLDE_UNVAIBLE": "solde unavailable",
"TEXT_BIG_CREATE_AGENT_1": "Register as Agent",
"EMAIL": "Email",
"COUNTRY": "Country",
@ -176,6 +181,8 @@
"SEARCH_20": "20 km",
"SEARCH_25": "25 km",
"SEARCH": "Search",
"SEE_VIDEO": "Watch the video",
"SEE_TUTO": "See the tutorial",
"DELETE": "Delete",
"FREE": "Available",
"SAVED": "Registered",
@ -195,12 +202,14 @@
"PHONE_TRANSACTION": "Transaction number",
"DEMAND_TEXT_FIRST_PART": "made a request for",
"REQUEST_SEND": "Request Sent",
"DEMAND_RECEIVE": "Requests received",
"TO_": "credit to",
"DEMAND_SEND_SUCCESFUL": "Your request has been sent successfully!",
"SAVE_HISTORY": "Save history",
"MAKE_REQUEST": "Make a request",
"DATE_WRONG": "The end date can not be earlier than the start date",
"LOADING_DOTS": "Loads ...",
"LOADING_DOTS": "Loading...",
"LOADING_PROGRESS": "Loading",
"EMPTY_LIST_REQUEST": "No request",
"MEMBER_LIST": "List of members",
"FREE_CODE_LIST": "List of available codes",

View File

@ -1,7 +1,9 @@
{
"WELCOME": "Bienvenue sur iLink World !",
"HELP": "Aide à l'utilisation",
"HELP": "Aide",
"SIMPLE_USER": "Utilisateur simple",
"ABOUT": "A Propos",
"ABOUT_TEXT": "iLink est une application qui facilitera vos transactions financières près de votre position, et vous donne les points multiservices prêt de chez vous.",
"GEOLOCATED_USER": "Utilisateur géo-localisé",
"SUPERVISOR": "Superviseur",
"AGENT": "Agent",
@ -15,6 +17,7 @@
"ACCOUNT_CREATED_SUCCESS": "Le compte a été crée avec succès.\nVous recevrez dans quelques minutes un email et un sms avec vos informations.\nNous allons vous rediriger vers la page de connexion",
"OR_BIG": "OU",
"FOR_NUMB": "Pour le ",
"FILTER_DATE": "Filtre de date",
"SUBTITLE_ACTIVE_ACCOUNT": "Activez votre compte à l'aide du code qui a été envoyé sur votre mail ou votre numéro de téléphone",
"ASK_FOR_CREDIT": "Demander du crédit",
"ASK_CREDIT": "Demandes de crédit",
@ -34,6 +37,7 @@
"CREDIT_MANAGE": "Gestion de credit",
"GROUP_MANAGE": "Gestion du groupe",
"NOTIFICATIONS": "Notification",
"NO_NOTIFICATION": "Vous n'avez aucune notification",
"CONFIGURATIONS": "Configuration",
"LOGOUT": "Déconnexion",
"HINT_HOME_SEARCH": " Chercher un lieu, quartier ou ville ",
@ -55,6 +59,7 @@
"CREDIT": "Crédit",
"NEXT": "Suivant",
"SPONSOR_CODE": "Code parrain",
"SOLDE_UNVAIBLE": "solde non disponible",
"TEXT_BIG_CREATE_AGENT_1": "Inscrivez-vous en comme Agent",
"EMAIL": "Email",
"COUNTRY": "Pays",
@ -176,6 +181,8 @@
"SEARCH_20": "20 km",
"SEARCH_25": "25 km",
"SEARCH": "Rechercher",
"SEE_VIDEO": "Voir la vidéo",
"SEE_TUTO": "Voir le tutoriel",
"DELETE": "Supprimer",
"FREE": "disponibles",
"SAVED": "enregistrés",
@ -195,12 +202,14 @@
"PHONE_TRANSACTION": "Numéro de transaction",
"DEMAND_TEXT_FIRST_PART": "a effectué une demande de ",
"DEMANDE_SEND": " Demande Envoyée",
"DEMAND_RECEIVE": "Demandes reçues",
"TO_": " crédit auprès de ",
"DEMAND_SEND_SUCCESFUL": "Votre demande a été envoyée avec succès !",
"SAVE_HISTORY": "Enregistrer l'historique",
"MAKE_REQUEST": "Faire une demande",
"DATE_WRONG": "La date de fin ne peut être antérieure à la date de début",
"LOADING_DOTS": "Chargements...",
"LOADING_DOTS": "Chargement...",
"LOADING_PROGRESS": "Chargement en cours",
"EMPTY_LIST_REQUEST": "Aucune demande",
"MEMBER_LIST": "Liste des membres",
"FREE_CODE_LIST": "Liste des codes disponibles",

View File

@ -1,236 +1,250 @@
import React, { Component } from 'react';
var DBEvents=require('react-native-db-models').DBEvents;
var DBEvents = require('react-native-db-models').DBEvents;
import I18n from 'react-native-i18n'
import {db} from './persistences/db';
import {configActionUrl,isDebugMode,adhesionUrl,locationActionUrl,memberActionUrl,networkActionUrl,demandeActionUrl} from "./IlinkConstants"
import { db } from './persistences/db';
import { configActionUrl, isDebugMode, adhesionUrl, locationActionUrl, memberActionUrl, networkActionUrl, demandeActionUrl } from "./IlinkConstants"
import Configuration from './persistences/Configuration';
var serializeJSON = function(data) {
var serializeJSON = function (data) {
return Object.keys(data).map(function (keyName) {
return encodeURIComponent(keyName) + '=' + encodeURIComponent(data[keyName])
}).join('&');
return Object.keys(data).map(function (keyName) {
return encodeURIComponent(keyName) + '=' + encodeURIComponent(data[keyName])
}).join('&');
};
export const getCodeInformation=(code)=>{
var data={"tag":'member',"type":"agen_info_code","code":code,
"lang":I18n.currentLocale()};
return queryData(data,memberActionUrl)
export const getCodeInformation = (code) => {
var data = {
"tag": 'member', "type": "agen_info_code", "code": code,
"lang": I18n.currentLocale()
};
return queryData(data, memberActionUrl)
}
export const getPubActiveObject=(idcpuntry)=>{
return queryData({"tag":"get_pub","id_country":idcpuntry},configActionUrl);
export const getPubActiveObject = (idcpuntry) => {
return queryData({ "tag": "get_pub", "id_country": idcpuntry }, configActionUrl);
}
export const getPasObject=()=>{
return queryData({"tag":"get_pas"},configActionUrl);
export const getPasObject = () => {
return queryData({ "tag": "get_pas" }, configActionUrl);
}
function queryAuth(data) {
return timeout(50000,queryData(data,adhesionUrl))
return timeout(50000, queryData(data, adhesionUrl))
}
async function queryData(data,url){
async function queryData(data, url) {
data["lang"]=I18n.currentLocale()
data["isTest"]=isDebugMode
let response= await fetch(url,{
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
let responseJson=null;
let responseText=await response.text()
try {
responseJson =JSON.parse(responseText)
}catch(e){
console.log(responseText)
return {"error":"error","error_msg":responseText}
}
return responseJson;
data["lang"] = I18n.currentLocale()
data["isTest"] = isDebugMode
let response = await fetch(url, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
let responseJson = null;
let responseText = await response.text()
try {
responseJson = JSON.parse(responseText)
} catch (e) {
console.log(responseText)
return { "error": "error", "error_msg": responseText }
}
return responseJson;
}
function timeout(ms, promise) {
return new Promise(function(resolve, reject) {
setTimeout(function() {
reject(new Error(I18n.t("TEXT_NETWORK_UNABLE")))
}, ms)
promise.then(resolve, reject)
})
return new Promise(function (resolve, reject) {
setTimeout(function () {
reject(new Error(I18n.t("TEXT_NETWORK_UNABLE")))
}, ms)
promise.then(resolve, reject)
})
}
export const validateUser=(user)=>{
var data={"tag":'member',"type":"valider_simple","phone":user.phone,
"lang":I18n.currentLocale()};
return queryData(data,memberActionUrl)
export const validateUser = (user) => {
var data = {
"tag": 'member', "type": "valider_simple", "phone": user.phone,
"lang": I18n.currentLocale()
};
return queryData(data, memberActionUrl)
};
export const updatePosition=async (longitude,latitude)=>{
const user=await readUser()
const data={'tag':'member','type':'update_position',"agentId":user['agentId'],"longitude":longitude,latitude:latitude}
return queryData(data,memberActionUrl)
export const updatePosition = async (longitude, latitude) => {
const user = await readUser()
const data = { 'tag': 'member', 'type': 'update_position', "agentId": user['agentId'], "longitude": longitude, latitude: latitude }
return queryData(data, memberActionUrl)
}
export const valifateAgent=(user,info)=>{
var data=info;
if(data===null)data={}
data["tag"]="member";
data['type']="validate_agent";
data["phone"]=user.phone;
data['code_validation']=user.validation_code;
if(user.category==="super" && (info===null || (info!==null && (info.nbre_code===undefined || info.nbr_code===null)))){
data["nbre_code"]=10;
data["nbre_code_superviseur"]=0
}else if(info===null || (info!==null && (info.nbre_code===undefined || info.nbre_code===null))){
data["nbre_code"]=0;
data["nbre_code_superviseur"]=0
}
console.log(data);
export const valifateAgent = (user, info) => {
var data = info;
if (data === null) data = {}
data["tag"] = "member";
data['type'] = "validate_agent";
data["phone"] = user.phone;
data['code_validation'] = user.validation_code;
if (user.category === "super" && (info === null || (info !== null && (info.nbre_code === undefined || info.nbr_code === null)))) {
data["nbre_code"] = 10;
data["nbre_code_superviseur"] = 0
} else if (info === null || (info !== null && (info.nbre_code === undefined || info.nbre_code === null))) {
data["nbre_code"] = 0;
data["nbre_code_superviseur"] = 0
}
console.log(data);
return queryData(data,memberActionUrl)
return queryData(data, memberActionUrl)
}
export const disconnect=()=>{
return new Promise((resolve,reject)=>{
readBrutUser().then((user)=>{
export const disconnect = () => {
return new Promise((resolve, reject) => {
readBrutUser().then((user) => {
db.remove({"_id": user._id},{multi:true},(error,numRemoved)=>{
if(error!==null){
reject(error)
}else {
console.log(numRemoved)
if (numRemoved > 0) {
resolve()
}
db.remove({ "_id": user._id }, { multi: true }, (error, numRemoved) => {
if (error !== null) {
reject(error)
} else {
console.log(numRemoved)
if (numRemoved > 0) {
resolve()
}
}
})
})
})
})
})
})
}
export const login=(phone:String,password:String,type:Number)=>{
const configuration=new Configuration()
var data={"tag":type===0?"login_user":"login_agent","phone":phone,"password":password,"lang":configuration.getCurrentLangue()};
export const login = (phone: String, password: String, type: Number) => {
console.log("CURRENT_LANG", I18n.currentLocale());
var data = {
tag: type === 0 ? "login_user" : "login_agent",
phone: phone,
password: password,
lang: I18n.currentLocale()
};
return queryAuth(data)
return queryAuth(data);
};
export const reinitpassword = ($phone, $type) => {
var data = { "tag": "forgot_pass", "number": $phone, "typeaccount": $type, "lang": I18n.currentLocale() };
return queryAuth(data)
}
export const reinitpassword=($phone,$type)=>{
var data={"tag":"forgot_pass","number":$phone,"typeaccount":$type,"lang":I18n.currentLocale()};
return queryAuth(data)
}
export const updateUserData=async (data)=>{
const user=await readUser()
user.longitude=data.longitude
user.latitude=data.latitude
db.update({"user":{$exists:true}},{user:user},{}, function (err, numReplaced) {
console.warn(err,numReplaced)
})
/* new Promise((resolve,reject)=>{
readBrutUser().then((user)=>{
db.remove({"_id": user._id},{multi:true},(error,numRemoved)=>{
if(error!==null){
reject(error)
}else {
let muser=user
db.insert(muser, function(err){
if(err!==null) {
console.log("error when save user")
console.log(err)
}
})
console.log(numRemoved)
if (numRemoved > 0) {
resolve()
}
}
})
})
})*/
export const updateUserData = async (data) => {
const user = await readUser()
user.longitude = data.longitude
user.latitude = data.latitude
db.update({ "user": { $exists: true } }, { user: user }, {}, function (err, numReplaced) {
console.warn(err, numReplaced)
})
/* new Promise((resolve,reject)=>{
readBrutUser().then((user)=>{
db.remove({"_id": user._id},{multi:true},(error,numRemoved)=>{
if(error!==null){
reject(error)
}else {
let muser=user
db.insert(muser, function(err){
if(err!==null) {
console.log("error when save user")
console.log(err)
}
})
console.log(numRemoved)
if (numRemoved > 0) {
resolve()
}
}
})
})
})*/
}
export const saveNewuser=(muser)=>{
let user={
user:muser
}
db.insert(user, function(err){
if(err!==null) {
console.log("error when save user")
console.log(err)
}
export const saveNewuser = (muser) => {
let user = {
user: muser
}
db.insert(user, function (err) {
if (err !== null) {
console.log("error when save user")
console.log(err)
}
})
})
}
const readBrutUser=()=>{
return new Promise((resolve, reject)=> {
db.findOne({"user":{$exists:true}},(err,result)=>{
if(err!==null || result===null || result.user===undefined) {
resolve(null)
}else{
if(result.user===null){resolve(null)}
else
resolve(result)};})});
}
export const readUser=()=>{
return new Promise((resolve, reject)=> {
db.findOne({"user":{$exists:true}},async (err,result)=>{
if(err!==null || result===null || result.user===undefined) {
resolve(null)
}else {
if (result.user === null) {
const readBrutUser = () => {
return new Promise((resolve, reject) => {
db.findOne({ "user": { $exists: true } }, (err, result) => {
if (err !== null || result === null || result.user === undefined) {
resolve(null)
}
else {
resolve(result.user)
}
}})});
}
export const createGeolocatedAccount=(user)=>{
return queryData(user,memberActionUrl)
}
export const createUserAccount=(user)=>{
return queryData(user,memberActionUrl)
} else {
if (result.user === null) { resolve(null) }
else
resolve(result)
};
})
});
}
export const acceptDemandAdhesion=(data)=>{
return queryData({"tag":"member","type":"activeSupervisor","code":data.code_membre,"phone":data.phone},memberActionUrl)
}
export const deleteUser=async (data)=>{
return queryData({"tag":"member","type":"deleteAgent","code":data.code_membre,"phone":data.phone},memberActionUrl)
}
export const listDemandAdhesion=async ()=>{
const user=await readUser();
const items=await queryData({"type":"list_demande_adhesion","tag":"member","codeparrain":user.code_membre},memberActionUrl)
return items;
}
export const categoryChild=async (code)=>{
const codes=await queryData({"type":"get_category_child","tag":"member","codeparrain":code},memberActionUrl)
export const readUser = () => {
return new Promise((resolve, reject) => {
db.findOne({ "user": { $exists: true } }, async (err, result) => {
if (err !== null || result === null || result.user === undefined) {
resolve(null)
} else {
if (result.user === null) {
resolve(null)
}
else {
return codes;
resolve(result.user)
}
}
})
});
}
export const getListCountriesActive=async ()=>{
const countries=await queryData({"tag":"avail_countries"},networkActionUrl);
return countries;
export const createGeolocatedAccount = (user) => {
return queryData(user, memberActionUrl)
}
export const createUserAccount = (user) => {
return queryData(user, memberActionUrl)
}
export const acceptDemandAdhesion = (data) => {
return queryData({ "tag": "member", "type": "activeSupervisor", "code": data.code_membre, "phone": data.phone }, memberActionUrl)
}
export const deleteUser = async (data) => {
return queryData({ "tag": "member", "type": "deleteAgent", "code": data.code_membre, "phone": data.phone }, memberActionUrl)
}
export const listDemandAdhesion = async () => {
const user = await readUser();
const items = await queryData({ "type": "list_demande_adhesion", "tag": "member", "codeparrain": user.code_membre }, memberActionUrl)
return items;
}
export const categoryChild = async (code) => {
const codes = await queryData({ "type": "get_category_child", "tag": "member", "codeparrain": code }, memberActionUrl)
return codes;
}
export const getListCountriesActive = async () => {
const countries = await queryData({ "tag": "avail_countries" }, networkActionUrl);
return countries;
}
export const getCountryNetwork=(country)=>{
console.warn(country)
return queryData({"tag":'listnetworkscountryindicatif', 'indicatif':country},networkActionUrl)
export const getCountryNetwork = (country) => {
console.warn(country)
return queryData({ "tag": 'listnetworkscountryindicatif', 'indicatif': country }, networkActionUrl)
}
export const getTownInformationName=(town)=>{
return queryData({"tag":"town_information_name","name":town},locationActionUrl);
export const getTownInformationName = (town) => {
return queryData({ "tag": "town_information_name", "name": town }, locationActionUrl);
}
export const generateAgentGeo=async (newPhone)=>{
const user=await readUser();
const items=await queryData({"type":"generateNetworkAgentForGeo","tag":"member","code_parrain":user.code_membre,'phone':newPhone},memberActionUrl)
return items;
export const generateAgentGeo = async (newPhone) => {
const user = await readUser();
const items = await queryData({ "type": "generateNetworkAgentForGeo", "tag": "member", "code_parrain": user.code_membre, 'phone': newPhone }, memberActionUrl)
return items;
}
export const AssignAgentGeo=async (codeValidation,phone)=>{
const user=await readUser();
const items=await queryData({"type":"assignNetworkAgentToGeo","tag":"member","agentId":user.agentId,'code_parrain':codeValidation,"phone":phone},memberActionUrl)
return items;
export const AssignAgentGeo = async (codeValidation, phone) => {
const user = await readUser();
const items = await queryData({ "type": "assignNetworkAgentToGeo", "tag": "member", "agentId": user.agentId, 'code_parrain': codeValidation, "phone": phone }, memberActionUrl)
return items;
}

View File

@ -2,13 +2,13 @@ export const isDebugMode = false
//base url test
//const baseUrl="https://ilink-app.com/mobilebackendbeta"
//base url production
//const baseUrl = "https://ilink-app.com/mobilebackend"
const baseUrl = "https://ilink-app.com/mobilebackend"
//base url agent
//const baseUrl="https://ilink-app.com/mobilebackendtest2"
//base url agent test
const baseUrl = "https://ilink-app.com/mobilebackendtest"
//const baseUrl = "https://ilink-app.com/mobilebackendtest"
export const adhesionUrl = baseUrl + '/interacted/LoginAction.php';
export const memberActionUrl = baseUrl + '/interacted/MembersAction.php';