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 * @flow
*/ */
import React, {Component} from 'react'; import React, { Component } from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native'; import { Platform, StyleSheet, Text, View, YellowBox } from 'react-native';
import { createSwitchNavigator, createStackNavigator,createDrawerNavigator, createAppContainer,createBottomTabNavigator } from 'react-navigation'; import { createSwitchNavigator, createStackNavigator, createDrawerNavigator, createAppContainer, createBottomTabNavigator } from 'react-navigation';
import Connect from "./screens/login/Connect"; import Connect from "./screens/login/Connect";
import SplashScreen from "./screens/splashscreen/SplashScreen"; import SplashScreen from "./screens/splashscreen/SplashScreen";
import HelpMenu from "./screens/help/HelpMenu"; import HelpMenu from "./screens/help/HelpMenu";
@ -48,9 +48,11 @@ const instructions = Platform.select({
}); });
type Props = {}; type Props = {};
const theme=require("./utils/theme") const theme = require("./utils/theme")
class HomeScreen extends Component<Props> { class HomeScreen extends Component<Props> {
render() { render() {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.welcome}>Welcome to iLink World!</Text> <Text style={styles.welcome}>Welcome to iLink World!</Text>
@ -60,42 +62,45 @@ class HomeScreen extends Component<Props> {
); );
} }
} }
const AuthStack=createStackNavigator({ const AuthStack = createStackNavigator({
login:Connect, login: Connect,
helpMenu:HelpMenu, helpMenu: HelpMenu,
help:Help, help: Help,
forgottenpass:ForgottenPassword, forgottenpass: ForgottenPassword,
typeaccountcreate:TypeChoiser, typeaccountcreate: TypeChoiser,
simpleusercreate:createAccount, simpleusercreate: createAccount,
step2:CreateUserStep2, step2: CreateUserStep2,
activateaccout:ActivateAccount activateaccout: ActivateAccount
},{ }, {
headerMode: 'none' headerMode: 'none'
}) })
const AppStack=createDrawerNavigator({sta:createStackNavigator({ const AppStack = createDrawerNavigator({
home:Home, sta: createStackNavigator({
home: Home,
/* filtre:Filter, /* filtre:Filter,
network:Networks,*/ network:Networks,*/
useraccount:{ useraccount: {
screen:UserAccount, screen: UserAccount,
navigationOptions: { navigationOptions: {
}, },
}, },
notificationview:Notifications, notificationview: Notifications,
configuration:Configurations, configuration: Configurations,
about:About about: About
})},{contentComponent:OptionsMenu,headerMode: 'none',contentOptions:{activeTintColor: theme.accent}}) })
const AppAgentStack=createDrawerNavigator({sta:createStackNavigator({ }, { contentComponent: OptionsMenu, headerMode: 'none', contentOptions: { activeTintColor: theme.accent } })
home:Home, const AppAgentStack = createDrawerNavigator({
useraccount:UserAccount, sta: createStackNavigator({
home: Home,
useraccount: UserAccount,
Historique: Historique:
{ {
screen: createBottomTabNavigator({myDemand: MyHistory}, { screen: createBottomTabNavigator({ myDemand: MyHistory }, {
headerMode: "none", headerMode: "none",
header:null, header: null,
headerTitle:null, headerTitle: null,
headerTitle: I18n.t('CREDIT_MANAGE'), headerTitle: I18n.t('CREDIT_MANAGE'),
tabBarOptions: { tabBarOptions: {
labelStyle: { labelStyle: {
@ -105,9 +110,9 @@ const AppAgentStack=createDrawerNavigator({sta:createStackNavigator({
} }
}), }),
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
header:null, header: null,
headerMode:'none', headerMode: 'none',
headerTitle:null, headerTitle: null,
activeColor: '#f0edf6', activeColor: '#f0edf6',
inactiveColor: '#3e2465', inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' }, barStyle: { backgroundColor: '#694fad' },
@ -121,36 +126,42 @@ const AppAgentStack=createDrawerNavigator({sta:createStackNavigator({
}), }),
}, },
historyItemDetails:HistoryItemDetails, historyItemDetails: HistoryItemDetails,
creditrequest:HistoryRequester, creditrequest: HistoryRequester,
addNetwork:AddNetwork, addNetwork: AddNetwork,
updateinformation:UpdateInformations, updateinformation: UpdateInformations,
notificationview:Notifications, notificationview: Notifications,
configuration:Configurations, configuration: Configurations,
about:About about: About
})},{contentComponent:OptionsMenu, })
backBehavior:"none", }, {
lazy:false, contentComponent: OptionsMenu,
headerMode: 'none',contentOptions:{activeTintColor:theme.accent}}) backBehavior: "none",
const AppAdministratorStack=createDrawerNavigator({sta:createStackNavigator({ lazy: false,
home:Home, headerMode: 'none', contentOptions: { activeTintColor: theme.accent }
useraccount:UserAccount, })
Historique:{ const AppAdministratorStack = createDrawerNavigator({
screen:createBottomTabNavigator({ sta: createStackNavigator({
myDemand:MyHistory,OthersDemand:MyHistory}, { home: Home,
headerMode:"none", useraccount: UserAccount,
header:null, Historique: {
headerTitle:null, screen: createBottomTabNavigator({
title:I18n.t('CREDIT_MANAGE'), myDemand: MyHistory, OthersDemand: MyHistory
}, {
headerMode: "none",
header: null,
headerTitle: null,
title: I18n.t('CREDIT_MANAGE'),
tabBarOptions: { tabBarOptions: {
labelStyle: { labelStyle: {
fontSize: 13, fontSize: 13,
}, },
}}), }
}),
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
header:null, header: null,
headerMode:'none', headerMode: 'none',
headerTitle:null, headerTitle: null,
activeColor: '#f0edf6', activeColor: '#f0edf6',
inactiveColor: '#3e2465', inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' }, barStyle: { backgroundColor: '#694fad' },
@ -163,38 +174,43 @@ const AppAdministratorStack=createDrawerNavigator({sta:createStackNavigator({
/>) />)
}), }),
}, },
creditrequest:HistoryRequester, creditrequest: HistoryRequester,
historyItemDetails:HistoryItemDetails, historyItemDetails: HistoryItemDetails,
superviseurgroup:SuperViseurGroupeHome, superviseurgroup: SuperViseurGroupeHome,
notificationview:Notifications, notificationview: Notifications,
configuration:Configurations, configuration: Configurations,
about:About about: About
})}, })
{contentComponent:OptionsMenu, },
backBehavior:"none", {
headerMode: 'none'}) contentComponent: OptionsMenu,
const AppSuperAdministrator=createDrawerNavigator({sta:createStackNavigator({ backBehavior: "none",
home:Home, headerMode: 'none'
useraccount:UserAccount, })
Historique:{ const AppSuperAdministrator = createDrawerNavigator({
screen:createBottomTabNavigator({OthersDemand:MyHistory}, { sta: createStackNavigator({
headerMode:"none", home: Home,
header:null, useraccount: UserAccount,
headerTitle:null, Historique: {
title:I18n.t('CREDIT_MANAGE'), screen: createBottomTabNavigator({ OthersDemand: MyHistory }, {
headerMode: "none",
header: null,
headerTitle: null,
title: I18n.t('CREDIT_MANAGE'),
tabBarOptions: { tabBarOptions: {
labelStyle: { labelStyle: {
fontSize: 13, fontSize: 13,
fontWeight:"bold" fontWeight: "bold"
}, },
}}), }
}),
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
title: I18n.t('CREDIT_MANAGE'), title: I18n.t('CREDIT_MANAGE'),
headerMode:"none", headerMode: "none",
header:null, header: null,
headerTitle:null, headerTitle: null,
drawerIcon: ({ tintColor }) => ( drawerIcon: ({ tintColor }) => (
<Icon <Icon
name={'credit-card'} name={'credit-card'}
@ -202,26 +218,29 @@ const AppSuperAdministrator=createDrawerNavigator({sta:createStackNavigator({
/>) />)
}), }),
}, },
creditrequest:HistoryRequester, creditrequest: HistoryRequester,
historyItemDetails:HistoryItemDetails, historyItemDetails: HistoryItemDetails,
superviseurgroup:SuperViseurGroupeHome, superviseurgroup: SuperViseurGroupeHome,
notificationview:Notifications, notificationview: Notifications,
configuration:Configurations, configuration: Configurations,
about:About about: About
})},{contentComponent:OptionsMenu, })
backBehavior:"none", }, {
headerMode: 'none'}) contentComponent: OptionsMenu,
export const AppNavigator =createSwitchNavigator({ backBehavior: "none",
headerMode: 'none'
})
export const AppNavigator = createSwitchNavigator({
first: { first: {
screen: SplashScreen screen: SplashScreen
}, },
App:AppStack, App: AppStack,
AgentApp:AppAgentStack, AgentApp: AppAgentStack,
adminApp:AppAdministratorStack, adminApp: AppAdministratorStack,
supAdminApp:AppSuperAdministrator, supAdminApp: AppSuperAdministrator,
Auth:AuthStack Auth: AuthStack
},{ }, {
initialRouteName: 'first' initialRouteName: 'first'
}); });
const AppContainer = createAppContainer(AppNavigator); const AppContainer = createAppContainer(AppNavigator);

216
App.js
View File

@ -6,9 +6,9 @@
* @flow * @flow
*/ */
import React, {Component} from 'react'; import React, { Component } from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native'; import { Platform, StyleSheet, Text, View, YellowBox } from 'react-native';
import { createSwitchNavigator, createStackNavigator,createDrawerNavigator, createAppContainer,createBottomTabNavigator } from 'react-navigation'; import { createSwitchNavigator, createStackNavigator, createDrawerNavigator, createAppContainer, createBottomTabNavigator } from 'react-navigation';
import Connect from "./screens/login/Connect"; import Connect from "./screens/login/Connect";
import SplashScreen from "./screens/splashscreen/SplashScreen"; import SplashScreen from "./screens/splashscreen/SplashScreen";
import HelpMenu from "./screens/help/HelpMenu"; import HelpMenu from "./screens/help/HelpMenu";
@ -48,9 +48,12 @@ const instructions = Platform.select({
}); });
type Props = {}; type Props = {};
const theme=require("./utils/theme") const theme = require("./utils/theme")
class HomeScreen extends Component<Props> { class HomeScreen extends Component<Props> {
render() { render() {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.welcome}>Welcome to iLink World!</Text> <Text style={styles.welcome}>Welcome to iLink World!</Text>
@ -59,43 +62,48 @@ class HomeScreen extends Component<Props> {
</View> </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({ const AppStack = createDrawerNavigator({
home:Home, sta: createStackNavigator({
home: Home,
/* filtre:Filter, /* filtre:Filter,
network:Networks,*/ network:Networks,*/
useraccount:{ useraccount: {
screen:UserAccount, screen: UserAccount,
navigationOptions: { navigationOptions: {
}, },
}, },
notificationview:Notifications, notificationview: Notifications,
configuration:Configurations, configuration: Configurations,
about:About about: About
})},{contentComponent:OptionsMenu,headerMode: 'none',contentOptions:{activeTintColor: theme.accent}}) })
const AppAgentStack=createDrawerNavigator({sta:createStackNavigator({ }, { contentComponent: OptionsMenu, headerMode: 'none', contentOptions: { activeTintColor: theme.accent } })
home:Home, const AppAgentStack = createDrawerNavigator({
useraccount:UserAccount, sta: createStackNavigator({
home: Home,
useraccount: UserAccount,
Historique: Historique:
{ {
screen: createBottomTabNavigator({myDemand: MyHistory}, { screen: createBottomTabNavigator({ myDemand: MyHistory }, {
headerMode: "none", headerMode: "none",
header:null, header: null,
headerTitle:null, headerTitle: null,
headerTitle: I18n.t('CREDIT_MANAGE'), headerTitle: I18n.t('CREDIT_MANAGE'),
tabBarOptions: { tabBarOptions: {
labelStyle: { labelStyle: {
@ -105,9 +113,9 @@ const AppAgentStack=createDrawerNavigator({sta:createStackNavigator({
} }
}), }),
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
header:null, header: null,
headerMode:'none', headerMode: 'none',
headerTitle:null, headerTitle: null,
activeColor: '#f0edf6', activeColor: '#f0edf6',
inactiveColor: '#3e2465', inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' }, barStyle: { backgroundColor: '#694fad' },
@ -121,36 +129,42 @@ const AppAgentStack=createDrawerNavigator({sta:createStackNavigator({
}), }),
}, },
historyItemDetails:HistoryItemDetails, historyItemDetails: HistoryItemDetails,
creditrequest:HistoryRequester, creditrequest: HistoryRequester,
addNetwork:AddNetwork, addNetwork: AddNetwork,
updateinformation:UpdateInformations, updateinformation: UpdateInformations,
notificationview:Notifications, notificationview: Notifications,
configuration:Configurations, configuration: Configurations,
about:About about: About
})},{contentComponent:OptionsMenu, })
backBehavior:"none", }, {
lazy:false, contentComponent: OptionsMenu,
headerMode: 'none',contentOptions:{activeTintColor:theme.accent}}) backBehavior: "none",
const AppAdministratorStack=createDrawerNavigator({sta:createStackNavigator({ lazy: false,
home:Home, headerMode: 'none', contentOptions: { activeTintColor: theme.accent }
useraccount:UserAccount, })
Historique:{ const AppAdministratorStack = createDrawerNavigator({
screen:createBottomTabNavigator({ sta: createStackNavigator({
myDemand:MyHistory,OthersDemand:MyHistory}, { home: Home,
headerMode:"none", useraccount: UserAccount,
header:null, Historique: {
headerTitle:null, screen: createBottomTabNavigator({
title:I18n.t('CREDIT_MANAGE'), myDemand: MyHistory, OthersDemand: MyHistory
}, {
headerMode: "none",
header: null,
headerTitle: null,
title: I18n.t('CREDIT_MANAGE'),
tabBarOptions: { tabBarOptions: {
labelStyle: { labelStyle: {
fontSize: 13, fontSize: 13,
}, },
}}), }
}),
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
header:null, header: null,
headerMode:'none', headerMode: 'none',
headerTitle:null, headerTitle: null,
activeColor: '#f0edf6', activeColor: '#f0edf6',
inactiveColor: '#3e2465', inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' }, barStyle: { backgroundColor: '#694fad' },
@ -163,38 +177,43 @@ const AppAdministratorStack=createDrawerNavigator({sta:createStackNavigator({
/>) />)
}), }),
}, },
creditrequest:HistoryRequester, creditrequest: HistoryRequester,
historyItemDetails:HistoryItemDetails, historyItemDetails: HistoryItemDetails,
superviseurgroup:SuperViseurGroupeHome, superviseurgroup: SuperViseurGroupeHome,
notificationview:Notifications, notificationview: Notifications,
configuration:Configurations, configuration: Configurations,
about:About about: About
})}, })
{contentComponent:OptionsMenu, },
backBehavior:"none", {
headerMode: 'none'}) contentComponent: OptionsMenu,
const AppSuperAdministrator=createDrawerNavigator({sta:createStackNavigator({ backBehavior: "none",
home:Home, headerMode: 'none'
useraccount:UserAccount, })
Historique:{ const AppSuperAdministrator = createDrawerNavigator({
screen:createBottomTabNavigator({OthersDemand:MyHistory}, { sta: createStackNavigator({
headerMode:"none", home: Home,
header:null, useraccount: UserAccount,
headerTitle:null, Historique: {
title:I18n.t('CREDIT_MANAGE'), screen: createBottomTabNavigator({ OthersDemand: MyHistory }, {
headerMode: "none",
header: null,
headerTitle: null,
title: I18n.t('CREDIT_MANAGE'),
tabBarOptions: { tabBarOptions: {
labelStyle: { labelStyle: {
fontSize: 13, fontSize: 13,
fontWeight:"bold" fontWeight: "bold"
}, },
}}), }
}),
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
title: I18n.t('CREDIT_MANAGE'), title: I18n.t('CREDIT_MANAGE'),
headerMode:"none", headerMode: "none",
header:null, header: null,
headerTitle:null, headerTitle: null,
drawerIcon: ({ tintColor }) => ( drawerIcon: ({ tintColor }) => (
<Icon <Icon
name={'credit-card'} name={'credit-card'}
@ -202,26 +221,29 @@ const AppSuperAdministrator=createDrawerNavigator({sta:createStackNavigator({
/>) />)
}), }),
}, },
creditrequest:HistoryRequester, creditrequest: HistoryRequester,
historyItemDetails:HistoryItemDetails, historyItemDetails: HistoryItemDetails,
superviseurgroup:SuperViseurGroupeHome, superviseurgroup: SuperViseurGroupeHome,
notificationview:Notifications, notificationview: Notifications,
configuration:Configurations, configuration: Configurations,
about:About about: About
})},{contentComponent:OptionsMenu, })
backBehavior:"none", }, {
headerMode: 'none'}) contentComponent: OptionsMenu,
export const AppNavigator =createSwitchNavigator({ backBehavior: "none",
headerMode: 'none'
})
export const AppNavigator = createSwitchNavigator({
first: { first: {
screen: SplashScreen screen: SplashScreen
}, },
App:AppStack, App: AppStack,
AgentApp:AppAgentStack, AgentApp: AppAgentStack,
adminApp:AppAdministratorStack, adminApp: AppAdministratorStack,
supAdminApp:AppSuperAdministrator, supAdminApp: AppSuperAdministrator,
Auth:AuthStack Auth: AuthStack
},{ }, {
initialRouteName: 'first' initialRouteName: 'first'
}); });
const AppContainer = createAppContainer(AppNavigator); const AppContainer = createAppContainer(AppNavigator);

View File

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

View File

@ -1,19 +1,32 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <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.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 <application
android:name=".MainApplication" android:name=".MainApplication"
android:label="@string/app_name" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round" android:label="@string/app_name"
android:allowBackup="false" android:largeHeap="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCz4B9uUu3gkuu78Sf72gPWZ3t_qKqf5zg" />
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

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.app.Application;
import android.content.Context; 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 !", "WELCOME": "Welcome to iLink World !",
"HELP": "Help", "HELP": "Help",
"SIMPLE_USER": "Simple User", "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", "GEOLOCATED_USER": "Geo located user",
"SUPERVISOR": "Supervisor", "SUPERVISOR": "Supervisor",
"AGENT": "Agent", "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", "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", "OR_BIG": "OR",
"FOR_NUMB": "For the ", "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", "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_FOR_CREDIT": "Apply for credit",
"ASK_CREDIT": "Credit applications", "ASK_CREDIT": "Credit applications",
@ -26,14 +29,15 @@
"ASK_FOR_SUPERVISOR1": "Ask to become a supervisor", "ASK_FOR_SUPERVISOR1": "Ask to become a supervisor",
"CREDIT_ASK_FROM_MEMBERS": "Credit requests from your members", "CREDIT_ASK_FROM_MEMBERS": "Credit requests from your members",
"ASK_MEMBERS": "Membership applications", "ASK_MEMBERS": "Membership applications",
"MY_ACCOUNT": "Mon compte", "MY_ACCOUNT": "My account",
"THE_ACCOUNT": "Le compte ", "THE_ACCOUNT": "Account ",
"NO_GEO_POINT_CODE": "You have no free geolocated point", "NO_GEO_POINT_CODE": "You have no free geolocated point",
"NO_DEMAND_ADHESION": "You have no membership request", "NO_DEMAND_ADHESION": "You have no membership request",
"ACTIVATED": "has been activated", "ACTIVATED": "has been activated",
"CREDIT_MANAGE": "Credit Management", "CREDIT_MANAGE": "Credit Management",
"GROUP_MANAGE": "Group Management", "GROUP_MANAGE": "Group Management",
"NOTIFICATIONS": "Notification", "NOTIFICATIONS": "Notification",
"NO_NOTIFICATION": "You haven't any notification",
"CONFIGURATIONS": "Configuration", "CONFIGURATIONS": "Configuration",
"LOGOUT": "Sign Out", "LOGOUT": "Sign Out",
"HINT_HOME_SEARCH": " Find a place, neighborhood or city ", "HINT_HOME_SEARCH": " Find a place, neighborhood or city ",
@ -176,6 +180,8 @@
"SEARCH_20": "20 km", "SEARCH_20": "20 km",
"SEARCH_25": "25 km", "SEARCH_25": "25 km",
"SEARCH": "Search", "SEARCH": "Search",
"SEE_VIDEO": "Watch the video",
"SEE_TUTO": "See the tutorial",
"DELETE": "Delete", "DELETE": "Delete",
"FREE": "Available", "FREE": "Available",
"SAVED": "Registered", "SAVED": "Registered",
@ -195,12 +201,14 @@
"PHONE_TRANSACTION": "Transaction number", "PHONE_TRANSACTION": "Transaction number",
"DEMAND_TEXT_FIRST_PART": "made a request for", "DEMAND_TEXT_FIRST_PART": "made a request for",
"REQUEST_SEND": "Request Sent", "REQUEST_SEND": "Request Sent",
"DEMAND_RECEIVE": "Requests received",
"TO_": "credit to", "TO_": "credit to",
"DEMAND_SEND_SUCCESFUL": "Your request has been sent successfully!", "DEMAND_SEND_SUCCESFUL": "Your request has been sent successfully!",
"SAVE_HISTORY": "Save history", "SAVE_HISTORY": "Save history",
"MAKE_REQUEST": "Make a request", "MAKE_REQUEST": "Make a request",
"DATE_WRONG": "The end date can not be earlier than the start date", "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", "EMPTY_LIST_REQUEST": "No request",
"MEMBER_LIST": "List of members", "MEMBER_LIST": "List of members",
"FREE_CODE_LIST": "List of available codes", "FREE_CODE_LIST": "List of available codes",

View File

@ -1,7 +1,9 @@
{ {
"WELCOME": "Bienvenue sur iLink World !", "WELCOME": "Bienvenue sur iLink World !",
"HELP": "Aide à l'utilisation", "HELP": "Aide",
"SIMPLE_USER": "Utilisateur simple", "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é", "GEOLOCATED_USER": "Utilisateur géo-localisé",
"SUPERVISOR": "Superviseur", "SUPERVISOR": "Superviseur",
"AGENT": "Agent", "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", "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", "OR_BIG": "OU",
"FOR_NUMB": "Pour le ", "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", "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_FOR_CREDIT": "Demander du crédit",
"ASK_CREDIT": "Demandes de crédit", "ASK_CREDIT": "Demandes de crédit",
@ -34,6 +37,7 @@
"CREDIT_MANAGE": "Gestion de credit", "CREDIT_MANAGE": "Gestion de credit",
"GROUP_MANAGE": "Gestion du groupe", "GROUP_MANAGE": "Gestion du groupe",
"NOTIFICATIONS": "Notification", "NOTIFICATIONS": "Notification",
"NO_NOTIFICATION": "Vous n'avez aucune notification",
"CONFIGURATIONS": "Configuration", "CONFIGURATIONS": "Configuration",
"LOGOUT": "Déconnexion", "LOGOUT": "Déconnexion",
"HINT_HOME_SEARCH": " Chercher un lieu, quartier ou ville ", "HINT_HOME_SEARCH": " Chercher un lieu, quartier ou ville ",
@ -176,6 +180,8 @@
"SEARCH_20": "20 km", "SEARCH_20": "20 km",
"SEARCH_25": "25 km", "SEARCH_25": "25 km",
"SEARCH": "Rechercher", "SEARCH": "Rechercher",
"SEE_VIDEO": "Voir la vidéo",
"SEE_TUTO": "Voir le tutoriel",
"DELETE": "Supprimer", "DELETE": "Supprimer",
"FREE": "disponibles", "FREE": "disponibles",
"SAVED": "enregistrés", "SAVED": "enregistrés",
@ -195,12 +201,14 @@
"PHONE_TRANSACTION": "Numéro de transaction", "PHONE_TRANSACTION": "Numéro de transaction",
"DEMAND_TEXT_FIRST_PART": "a effectué une demande de ", "DEMAND_TEXT_FIRST_PART": "a effectué une demande de ",
"DEMANDE_SEND": " Demande Envoyée", "DEMANDE_SEND": " Demande Envoyée",
"DEMAND_RECEIVE": "Demandes reçues",
"TO_": " crédit auprès de ", "TO_": " crédit auprès de ",
"DEMAND_SEND_SUCCESFUL": "Votre demande a été envoyée avec succès !", "DEMAND_SEND_SUCCESFUL": "Votre demande a été envoyée avec succès !",
"SAVE_HISTORY": "Enregistrer l'historique", "SAVE_HISTORY": "Enregistrer l'historique",
"MAKE_REQUEST": "Faire une demande", "MAKE_REQUEST": "Faire une demande",
"DATE_WRONG": "La date de fin ne peut être antérieure à la date de début", "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", "EMPTY_LIST_REQUEST": "Aucune demande",
"MEMBER_LIST": "Liste des membres", "MEMBER_LIST": "Liste des membres",
"FREE_CODE_LIST": "Liste des codes disponibles", "FREE_CODE_LIST": "Liste des codes disponibles",

View File

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

View File

@ -3,7 +3,9 @@
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. --> <!-- 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> </style>
</resources> </resources>

View File

@ -2,8 +2,12 @@
* @format * @format
*/ */
import {AppRegistry} from 'react-native'; import { AppRegistry, YellowBox } from 'react-native';
import App from './App'; 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); AppRegistry.registerComponent(appName, () => App);

View File

@ -1,12 +1,12 @@
import React,{Component} from 'react' import React, { Component } from 'react'
import {StyleSheet,Text,View} from 'react-native' import { StyleSheet, Text, View } from 'react-native'
export const theme=require('./../utils/theme.json') export const theme = require('./../utils/theme.json')
export default class BaseScreen extends Component{ export default class BaseScreen extends Component {
constructor(props,needToCloseDrawer:Boolean=false){ constructor(props, needToCloseDrawer) {
super(props) super(props)
if(needToCloseDrawer){ if (needToCloseDrawer) {
/* this.props.navigator.toggleDrawer({ /* this.props.navigator.toggleDrawer({
side: 'left', // the side of the drawer since you can have two, 'left' / 'right' 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 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>
<View style={{ flex: 3 }}> <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 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>
<View style={{ flexDirection: "row", flex: 0.3, width: responsiveWidth(95), height: responsiveHeight(100), justifyContent: "space-between", alignItems: "stretch" }}> <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> <Text style={{ color: "white", fontWeight: "bold" }}>Version 1.0.0</Text>

View File

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

View File

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

View File

@ -1,24 +1,24 @@
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 ActionButton from 'react-native-action-button';
import Icon from 'react-native-vector-icons/Ionicons'; 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 {HistoryListItem} from '../history-request/HistoryItem'; import { HistoryListItem } from '../history-request/HistoryItem';
export class ListOptions extends Component{ export class ListOptions extends Component {
render () { render() {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<HistoryListItem <HistoryListItem
style={styles.listbackground}/> style={styles.listbackground} />
<ActionButton> <ActionButton>
<ActionButton.Item buttonColor='#9b59b6' title="Faire une demande" onPress={() => console.log("notes tapped!")}> <ActionButton.Item buttonColor='#9b59b6' title="Faire une demande" onPress={() => console.log("notes tapped!")}>
<Icon name="md-create" style={styles.actionButtonIcon} /> <Icon name="md-create" style={styles.actionButtonIcon} />
</ActionButton.Item> </ActionButton.Item>
<ActionButton.Item buttonColor='#3498db' title="Enregistrer l'historique" onPress={() => {}}> <ActionButton.Item buttonColor='#3498db' title="Enregistrer l'historique" onPress={() => { }}>
<Icon name="md-save" style={styles.actionButtonIcon} /> <Icon name="md-save" style={styles.actionButtonIcon} />
</ActionButton.Item> </ActionButton.Item>
</ActionButton> </ActionButton>
@ -26,18 +26,18 @@ export class ListOptions extends Component{
) )
} }
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
}, },
backgroundd_drawer:{ backgroundd_drawer: {
backgroundColor:'#000', backgroundColor: '#000',
}, },
listbackground:{ listbackground: {
}, },
actionButtonIcon: { actionButtonIcon: {
fontSize: 20, fontSize: 20,
@ -54,5 +54,4 @@ export class ListOptions extends Component{
color: '#333333', color: '#333333',
marginBottom: 5, marginBottom: 5,
}, },
}); });

View File

@ -15,7 +15,7 @@ require("./../../utils/Translations");
import I18n from 'react-native-i18n' import I18n from 'react-native-i18n'
const route = require('./../../route.json') const route = require('./../../route.json')
import LottieView from 'lottie-react-native'; // if you have "esModuleInterop": true 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' import { Card, CardTitle, CardContent, CardAction, CardButton, CardImage } from 'react-native-material-cards'
let moment = require('moment-timezone'); 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 PropTypes from 'prop-types';
import {StyleSheet,Text,View,FlatList,TouchableOpacity,SectionList,RefreshControl} from 'react-native'; import { StyleSheet, Text, View, FlatList, TouchableOpacity, SectionList, RefreshControl } from 'react-native';
import {responsiveFontSize,responsiveWidth,responsiveHeight} from 'react-native-responsive-dimensions'; import { responsiveFontSize, responsiveWidth, responsiveHeight } from 'react-native-responsive-dimensions';
import {convertDateToHumanText} from './../../utils/DateUtils'; import { convertDateToHumanText } from './../../utils/DateUtils';
import Icon from 'react-native-vector-icons/FontAwesome5'; import Icon from 'react-native-vector-icons/FontAwesome5';
var moment=require('moment-timezone') var moment = require('moment-timezone')
const momentJS=require('moment') const momentJS = require('moment')
import I18n from "react-native-i18n" import I18n from "react-native-i18n"
import 'moment/locale/fr' import 'moment/locale/fr'
@ -16,41 +16,41 @@ import 'moment/locale/en-ie'
import 'moment/locale/en-il' import 'moment/locale/en-il'
import 'moment/locale/en-nz' import 'moment/locale/en-nz'
let route=require('./../../route.json'); let route = require('./../../route.json');
var theme=require('./../../utils/theme.json'); var theme = require('./../../utils/theme.json');
export class HistoryItem extends React.Component{ export class HistoryItem extends React.Component {
constructor(props){ constructor(props) {
super(props); super(props);
this.state=this.initState(); this.state = this.initState();
} }
initState(){ initState() {
var textTitle=' Transaction '+this.props.selfData.id; 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_')+' '; 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; textDescription += this.props.selfData.reseau;
var today=new Date(); var today = new Date();
var l=this.props.selfData.date_creation; var l = this.props.selfData.date_creation;
let t=this.props.selfData.status; let t = this.props.selfData.status;
moment.locale(I18n.locale) moment.locale(I18n.locale)
var re= moment.tz(this.props.selfData.date_creation,'Etc/GMT+0').format(); var re = moment.tz(this.props.selfData.date_creation, 'Etc/GMT+0').format();
re=moment(re) re = moment(re)
return { return {
title:textTitle, title: textTitle,
description:textDescription, description: textDescription,
status:this.props.selfData.status==='1'?I18n.t('TREAT'):I18n.t('NO_TREAT'), status: this.props.selfData.status === '1' ? I18n.t('TREAT') : I18n.t('NO_TREAT'),
time:re.fromNow(), time: re.fromNow(),
navigator:this.props.navigator, navigator: this.props.navigator,
type:t, type: t,
colorstate:t==='1'?'green':'red' colorstate: t === '1' ? 'green' : 'red'
} }
}; };
render(){ render() {
return ( return (
<TouchableOpacity onPress={()=> <TouchableOpacity onPress={() =>
this.props.navigator.navigate(route.historyItemDetails, this.props.navigator.navigate(route.historyItemDetails,
{item:this.props.selfData} { item: this.props.selfData }
)}> )}>
<View style={style.content}> <View style={style.content}>
@ -61,12 +61,12 @@ export class HistoryItem extends React.Component{
fontWeight: 'bold', fontWeight: 'bold',
marginLeft: 20, marginLeft: 20,
marginBottom: 10, marginBottom: 10,
color:this.state.colorstate, color: this.state.colorstate,
}}>{this.state.status}</Text> }}>{this.state.status}</Text>
<Text style={style.time}>{this.state.time}</Text> <Text style={style.time}>{this.state.time}</Text>
</View> </View>
<View style={style.bottomSeparator}/> <View style={style.bottomSeparator} />
</View> </View>
</TouchableOpacity> </TouchableOpacity>
@ -75,42 +75,44 @@ export class HistoryItem extends React.Component{
} }
} }
export class HistoryItemSectionned extends PureComponent{ export class HistoryItemSectionned extends PureComponent {
_keyExtractor = (item, index) => item.id; _keyExtractor = (item, index) => item.id;
_renderItem = ({item}) => ( _renderItem = ({ item }) => (
<HistoryItem <HistoryItem
navigator={this.props.navigator} navigator={this.props.navigator}
selfData={item} selfData={item}
/> />
); );
constructor(props){ constructor(props) {
super(props); super(props);
this.state=this.initState(); this.state = this.initState();
} }
render() { render() {
return ( return (
<SectionList <SectionList
sections={[ sections={[
{title:'Demande traité',type:0,data:this.state.treat,size:this.state.conservetreat.length,expandState:this.state.istreatexpand}, { 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} { 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}}) => ( renderSectionHeader={({ section: { title, type, data, size, expandState } }) => (
<TouchableOpacity onPress={()=>this.onPressedHeader(type)} style={{ <TouchableOpacity onPress={() => this.onPressedHeader(type)} style={{
backgroundColor:theme.accent, backgroundColor: theme.accent,
justifyContent:'center', justifyContent: 'center',
alignItems:'center', alignItems: 'center',
flexDirection:'row',flex:1,height:70,width:responsiveWidth(100)}}> flexDirection: 'row', flex: 1, height: 70, width: responsiveWidth(100)
<View style={{
height:70,
justifyContent:'center',
flex:1,
width:responsiveWidth(100),
}}> }}>
<Text style={{fontWeight: 'bold', <View style={{
marginLeft:20, height: 70,
fontSize:20, justifyContent: 'center',
color:'white' flex: 1,
width: responsiveWidth(100),
}}>
<Text style={{
fontWeight: 'bold',
marginLeft: 20,
fontSize: 20,
color: 'white'
}}>{title}</Text> }}>{title}</Text>
<Text style={{ <Text style={{
fontWeight: 'bold', fontWeight: 'bold',
@ -119,7 +121,7 @@ export class HistoryItemSectionned extends PureComponent{
color: 'white' color: 'white'
}}>{size} demande(s)</Text> }}>{size} demande(s)</Text>
</View> </View>
<Icon name={expandState?'sort-up':'sort-down'} size={30} color={'white'} style={{marginRight:20}}/> <Icon name={expandState ? 'sort-up' : 'sort-down'} size={30} color={'white'} style={{ marginRight: 20 }} />
</TouchableOpacity> </TouchableOpacity>
)} )}
style={style.listStyle} style={style.listStyle}
@ -129,46 +131,46 @@ export class HistoryItemSectionned extends PureComponent{
/> />
); );
} }
onPressedHeader(type){ onPressedHeader(type) {
if(type===0){ if (type === 0) {
this.setState({istreatexpand:!this.state.istreatexpand,treat:this.state.istreatexpand?[]:this.state.conservetreat}) this.setState({ istreatexpand: !this.state.istreatexpand, treat: this.state.istreatexpand ? [] : this.state.conservetreat })
}else{ } else {
this.setState({isuntreatexpand:!this.state.isuntreatexpand,untreat:this.state.isuntreatexpand?[]:this.state.conserveuntreat}) this.setState({ isuntreatexpand: !this.state.isuntreatexpand, untreat: this.state.isuntreatexpand ? [] : this.state.conserveuntreat })
} }
} }
initState(){ initState() {
let data=this.props.list let data = this.props.list
return { return {
conservetreat: data.filter(item=>item.statut===I18n.t('TREAT')), conservetreat: data.filter(item => item.statut === I18n.t('TREAT')),
treat: data.filter(item=>item.statut===I18n.t('TREAT')), treat: data.filter(item => item.statut === I18n.t('TREAT')),
istreatexpand:true, istreatexpand: true,
conserveuntreat: data.filter(item=>item.statut!==I18n.t('TREAT')), conserveuntreat: data.filter(item => item.statut !== I18n.t('TREAT')),
untreat: data.filter(item=>item.statut!==I18n.t('TREAT')), untreat: data.filter(item => item.statut !== I18n.t('TREAT')),
isuntreatexpand:true isuntreatexpand: true
} }
} }
} }
export class HistoryListItem extends React.Component{ export class HistoryListItem extends React.Component {
_keyExtractor = (item, index) => item.id; _keyExtractor = (item, index) => item.id;
_onPressItem = (id: string) => { _onPressItem = (id: string) => {
}; };
_renderItem = ({item}) => ( _renderItem = ({ item }) => (
<HistoryItem <HistoryItem
navigator={this.props.navigator} navigator={this.props.navigator}
selfData={item} selfData={item}
/> />
); );
constructor(props){ constructor(props) {
super(props); super(props);
this.state=this.initState(); this.state = this.initState();
} }
initState(){ initState() {
return { return {
refreshing:false, refreshing: false,
} }
} }
render() { render() {
@ -182,7 +184,7 @@ export class HistoryListItem extends React.Component{
refreshControl={ refreshControl={
<RefreshControl <RefreshControl
refreshing={this.props.isRefreshing} refreshing={this.props.isRefreshing}
colors={[theme.primary,theme.purpleLight,theme.reddeconnect,theme.accentLight]} colors={[theme.primary, theme.purpleLight, theme.reddeconnect, theme.accentLight]}
onRefresh={this.props.refreshing} onRefresh={this.props.refreshing}
/> />
} }
@ -190,56 +192,56 @@ export class HistoryListItem extends React.Component{
); );
} }
_onRefresh(){ _onRefresh() {
this.setState({refreshing:true}) this.setState({ refreshing: true })
setTimeout(()=>{this.setState({refreshing:false})},5000); setTimeout(() => { this.setState({ refreshing: false }) }, 5000);
} }
} }
const style=StyleSheet.create({ const style = StyleSheet.create({
content:{ content: {
width:responsiveWidth(100), width: responsiveWidth(100),
borderBottomColor: '#FFFFFF', borderBottomColor: '#FFFFFF',
flex:1, flex: 1,
flexDirection: 'column', flexDirection: 'column',
paddingTop: 10, paddingTop: 10,
}, },
listStyle:{ listStyle: {
backgroundColor:'white' backgroundColor: 'white'
}, },
bottomSeparator:{ bottomSeparator: {
width:responsiveWidth(100), width: responsiveWidth(100),
height:5, height: 5,
justifyContent:'center', justifyContent: 'center',
alignSelf: 'center', alignSelf: 'center',
backgroundColor:'#EEE', backgroundColor: '#EEE',
}, },
title:{ title: {
color:'#000', color: '#000',
paddingLeft: 10, paddingLeft: 10,
fontSize:responsiveFontSize(2.2) fontSize: responsiveFontSize(2.2)
}, },
description:{ description: {
fontSize:responsiveFontSize(1.8), fontSize: responsiveFontSize(1.8),
color:'#4f5b62', color: '#4f5b62',
paddingLeft: 10, paddingLeft: 10,
}, },
timeContent:{ timeContent: {
justifyContent:'space-between', justifyContent: 'space-between',
flex:1, flex: 1,
marginTop: 10, marginTop: 10,
marginBottom: 5, marginBottom: 5,
flexDirection:'row', flexDirection: 'row',
}, },
time:{ time: {
fontWeight: 'bold', fontWeight: 'bold',
marginRight: 20, marginRight: 20,
marginBottom: 10, marginBottom: 10,
color:theme.accent, color: theme.accent,
}, },
treat:{ treat: {
}, },
}); });

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -7,26 +7,26 @@
*/ */
import React, {Component} from 'react'; import React, { Component } from 'react';
import {Platform, StyleSheet,Alert,FlatList, Text, View,TouchableOpacity,Linking} from 'react-native'; import { Platform, StyleSheet, Alert, FlatList, Text, View, TouchableOpacity, Linking } from 'react-native';
import ActionButton from 'react-native-action-button'; import ActionButton from 'react-native-action-button';
import Icon from 'react-native-vector-icons/Ionicons'; 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 HeaderMenu from './HeaderMenu';
import {historiques as histo,first,useraccount,notification,configurations} from './../../route.json'; import { historiques as histo, first, useraccount, notification, configurations } from './../../route.json';
import {primary,primaryDarkAdvanced} from './../../utils/theme.json'; import { primary, primaryDarkAdvanced } from './../../utils/theme.json';
import {readUser,disconnect} from './../../webservice/AuthApi'; import { readUser, disconnect } from './../../webservice/AuthApi';
import I18n from 'react-native-i18n' import I18n from 'react-native-i18n'
const route=require("./../../route.json") const route = require("./../../route.json")
require('./../../utils/Translations') require('./../../utils/Translations')
var DBEvents = require('react-native-db-models').DBEvents var DBEvents = require('react-native-db-models').DBEvents
type Props = {}; type Props = {};
let theme=require('./../../utils/theme.json') let theme = require('./../../utils/theme.json')
import Button from 'apsl-react-native-button' import Button from 'apsl-react-native-button'
import {IlinkEmitter} from "./../../utils/events" import { IlinkEmitter } from "./../../utils/events"
import { DrawerItems, SafeAreaView } from 'react-navigation'; import { DrawerItems, SafeAreaView } from 'react-navigation';
import DeviceInfo from "react-native-device-info" import DeviceInfo from "react-native-device-info"
import AppContainer, {AppNavigator} from "../../App"; import AppContainer, { AppNavigator } from "../../App";
import Configuration from "../../webservice/persistences/Configuration"; import Configuration from "../../webservice/persistences/Configuration";
import { ScrollView } from 'react-native-gesture-handler'; import { ScrollView } from 'react-native-gesture-handler';
@ -36,27 +36,28 @@ export default class OptionsMenu extends Component<Props> {
statusBarColor: primaryDarkAdvanced, statusBarColor: primaryDarkAdvanced,
}; };
commandeListe commandeListe
constructor(props){ constructor(props) {
super(props); super(props);
this.state=this.initState(); this.state = this.initState();
IlinkEmitter.on("menuLink", this.onMenuNavigationEvent.bind(this)) IlinkEmitter.on("menuLink", this.onMenuNavigationEvent.bind(this))
IlinkEmitter.on("userconnect", this.onUserConnect.bind(this)) IlinkEmitter.on("userconnect", this.onUserConnect.bind(this))
IlinkEmitter.on("userdisconnect", this.hideSideMenu.bind(this)) IlinkEmitter.on("userdisconnect", this.hideSideMenu.bind(this))
IlinkEmitter.on("langueChange", this.updateLangue.bind(this)) IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
this.configuration=new Configuration(); this.configuration = new Configuration();
} }
retrieveAndroidInformation() { retrieveAndroidInformation() {
this.configuration._getData().then((lang)=>{ this.configuration._getData().then((lang) => {
if(lang){ if (lang) {
I18n.locale=lang I18n.locale = lang
readUser().then((result) => { readUser().then((result) => {
setTimeout(() => { setTimeout(() => {
this.updateUser(result); this.updateUser(result);
}, 3000)}) }, 3000)
}else{ })
let code= DeviceInfo.getDeviceLocale(); } else {
I18n.locale=code.toLowerCase() let code = DeviceInfo.getDeviceLocale();
I18n.locale = code.toLowerCase()
readUser().then((result) => { readUser().then((result) => {
setTimeout(() => { setTimeout(() => {
this.updateUser(result); this.updateUser(result);
@ -65,9 +66,9 @@ export default class OptionsMenu extends Component<Props> {
this.props.navigation.navigate("Auth") this.props.navigation.navigate("Auth")
}); });
} }
}).catch((e)=>{ }).catch((e) => {
let code=DeviceInfo.getDeviceLocale() let code = DeviceInfo.getDeviceLocale()
I18n.locale=code.toLowerCase() I18n.locale = code.toLowerCase()
readUser().then((result) => { readUser().then((result) => {
setTimeout(() => { setTimeout(() => {
this.updateUser(result); this.updateUser(result);
@ -82,21 +83,21 @@ export default class OptionsMenu extends Component<Props> {
return "" return ""
} }
componentDidMount() { componentDidMount() {
const items=this.props.navigation.router.childRouters.sta.childRouters; const items = this.props.navigation.router.childRouters.sta.childRouters;
// items.filter((item)=>item.) // items.filter((item)=>item.)
this.setState({items:items}) this.setState({ items: items })
this.retrieveAndroidInformation() this.retrieveAndroidInformation()
} }
updateLangue(){ updateLangue() {
this.setState({lang:"change"}) this.setState({ lang: "change" })
this.forceUpdate() this.forceUpdate()
} }
componentWillUnmount() { componentWillUnmount() {
} }
onMenuNavigationEvent(menuOption){ onMenuNavigationEvent(menuOption) {
/* Navigation.mergeOptions(this.props.componentId,{ /* Navigation.mergeOptions(this.props.componentId,{
sideMenu: { sideMenu: {
left: { left: {
@ -134,44 +135,44 @@ export default class OptionsMenu extends Component<Props> {
} }
});*/ });*/
} }
initState(){ initState() {
return { return {
user:null, user: null,
menu:[], menu: [],
currentId:0, currentId: 0,
} }
} }
getGeolocatedUserMenu(){ getGeolocatedUserMenu() {
return [ return [
{title:I18n.t('MAP'),id:0,key:0,icon:'md-map',active:true} { 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('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('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('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('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('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
,{title:I18n.t('CONFIGURATIONS'),id:4,icon:'md-settings',active:false}] , { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
} }
getSuperUserMenu(){ getSuperUserMenu() {
return [ return [
{title:I18n.t('MAP'),id:0,key:0,icon:'md-map',active:true} { 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('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('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('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('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
,{title:I18n.t('CONFIGURATIONS'),id:4,icon:'md-settings',active:false}] , { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
} }
getHyperUsermenu() { getHyperUsermenu() {
return [ return [
{title:I18n.t('MAP'),id:0,key:0,icon:'md-map',active:true} { 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('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('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('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('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
,{title:I18n.t('CONFIGURATIONS'),id:4,icon:'md-settings',active:false}] , { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
} }
updateUser(user){ updateUser(user) {
let menu=[]; let menu = [];
if(user!==undefined) { if (user !== undefined) {
/* Navigation.mergeOptions("drawer", { /* Navigation.mergeOptions("drawer", {
sideMenu: { sideMenu: {
left: { left: {
@ -180,45 +181,45 @@ export default class OptionsMenu extends Component<Props> {
} }
} }
});*/ });*/
if(user.category!==undefined) { if (user.category !== undefined) {
switch(user.category){ switch (user.category) {
case "geolocated": case "geolocated":
menu=this.getGeolocatedUserMenu(); menu = this.getGeolocatedUserMenu();
break; break;
case "super": case "super":
menu = this.getSuperUserMenu(); menu = this.getSuperUserMenu();
break; break;
case "hyper": case "hyper":
menu=this.getHyperUsermenu(); menu = this.getHyperUsermenu();
break; break;
} }
}else } else {
{
menu = this.getUserMenu(); menu = this.getUserMenu();
} }
} }
this.setState({user: user, menu: menu}); this.setState({ user: user, menu: menu });
} }
getUserMenu(){ getUserMenu() {
return [ return [
{title:I18n.t('MAP'),id:0,key:0,icon:'md-map',active:true} { 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('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('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
,{title:I18n.t('CONFIGURATIONS'),id:4,icon:'md-settings',active:false}] , { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
} }
_renderItem = (item) =>{ _renderItem = (item) => {
if(item==="creditrequest" || item==='historyItemDetails' || item==='filter' || item==='networks'){ if (item === "creditrequest" || item === 'historyItemDetails' || item === 'filter' || item === 'networks') {
return null return null
}else{ } else {
const color= this.state.currentId===item.id?theme.accent:"grey" const color = this.state.currentId === item.id ? theme.accent : "grey"
return ( return (
<TouchableOpacity onPress={() => { <TouchableOpacity onPress={() => {
this.props.navigation.toggleDrawer(); this.props.navigation.toggleDrawer();
this.setState({currentId:item.id}) this.setState({ currentId: item.id })
this.props.navigation.navigate(item)}} this.props.navigation.navigate(item)
}}
> >
<View <View
style={items.content} style={items.content}
@ -228,25 +229,27 @@ export default class OptionsMenu extends Component<Props> {
size={32} size={32}
/> />
<Text style={{ <Text style={{
marginLeft:20, marginLeft: 20,
fontSize:16, fontSize: 16,
}}>{this.getNameItems(item)} }}>{this.getNameItems(item)}
</Text> </Text>
</View></TouchableOpacity>)}}; </View></TouchableOpacity>)
_onPress=((item)=>{ }
};
_onPress = ((item) => {
this.setState({currentId:item.id}) this.setState({ currentId: item.id })
let current=this.state.menu.filter((item)=>{return item.active})[0] let current = this.state.menu.filter((item) => { return item.active })[0]
current.active=false; current.active = false;
item.active=true; item.active = true;
let newMenu=[]; let newMenu = [];
this.state.menu.forEach(function (it) { this.state.menu.forEach(function (it) {
if(it.id===current.id)newMenu.push(current) if (it.id === current.id) newMenu.push(current)
else if(it.id===item.id)newMenu.push(item) else if (it.id === item.id) newMenu.push(item)
else newMenu.push(it) else newMenu.push(it)
} }
) )
this.setState({menu:newMenu}) this.setState({ menu: newMenu })
/* switch(item.id){ /* switch(item.id){
case 2: case 2:
Navigation.push(route.stackRoot,{ Navigation.push(route.stackRoot,{
@ -391,58 +394,58 @@ export default class OptionsMenu extends Component<Props> {
} }
}) })
*/ }); */ });
getNameItems(item){ getNameItems(item) {
let icon=item let icon = item
switch (item) { switch (item) {
case "home":icon=I18n.t('MAP') case "home": icon = I18n.t('MAP')
break break
case 'useraccount':icon=I18n.t('MY_ACCOUNT') case 'useraccount': icon = I18n.t('MY_ACCOUNT')
break break
case 'Historique':icon=I18n.t('CREDIT_MANAGE') case 'Historique': icon = I18n.t('CREDIT_MANAGE')
break break
case "superviseurgroup":icon=I18n.t('GROUP_MANAGE') case "superviseurgroup": icon = I18n.t('GROUP_MANAGE')
break break
case "updateinformation":icon=I18n.t("CHANGE_INFORMATION") case "updateinformation": icon = I18n.t("CHANGE_INFORMATION")
break break
case 'notificationview':icon=I18n.t('NOTIFICATIONS') case 'notificationview': icon = I18n.t('NOTIFICATIONS')
break break
case 'configuration':icon=I18n.t('CONFIGURATIONS') case 'configuration': icon = I18n.t('CONFIGURATIONS')
break; break;
case 'addNetwork':icon=I18n.t('ADD_NETWORK') case 'addNetwork': icon = I18n.t('ADD_NETWORK')
break break
case 'about':icon=I18n.t('ABOUT_') case 'about': icon = I18n.t('ABOUT')
} }
return icon; return icon;
} }
getIcon(item){ getIcon(item) {
let icon="md-map" let icon = "md-map"
switch (item) { switch (item) {
case "home":icon="md-map" case "home": icon = "md-map"
break break
case 'useraccount':icon="md-person" case 'useraccount': icon = "md-person"
break break
case 'Historique':icon="md-card" case 'Historique': icon = "md-card"
break break
case "superviseurgroup":icon="md-people" case "superviseurgroup": icon = "md-people"
break break
case 'notificationview':icon="md-notifications"; case 'notificationview': icon = "md-notifications";
break break
case "updateinformation":icon="md-people" case "updateinformation": icon = "md-people"
break break
case 'configuration':icon='md-settings' case 'configuration': icon = 'md-settings'
break; break;
case 'addNetwork':icon="md-people" case 'addNetwork': icon = "md-people"
break break
case 'about':icon='md-contacts'; case 'about': icon = 'md-contacts';
break; break;
} }
return icon; return icon;
} }
render () { render() {
var name=this.state.user?this.state.user.firstname:""; var name = this.state.user ? this.state.user.firstname : "";
const surname=this.state.user? this.state.user.lastname:""; const surname = this.state.user ? this.state.user.lastname : "";
if(!this.state.lang && this.state.lang!=="change") if (!this.state.lang && this.state.lang !== "change")
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View <View
@ -450,13 +453,14 @@ export default class OptionsMenu extends Component<Props> {
> >
<Text style={styles.headerTitle}>{name}</Text> <Text style={styles.headerTitle}>{name}</Text>
<Text style={styles.headerTitle}>{surname}</Text> <Text style={styles.headerTitle}>{surname}</Text>
<Text style={styles.headerPhone}>{this.state.user?""+this.state.user.phone:""}</Text> <Text style={styles.headerPhone}>{this.state.user ? "" + this.state.user.phone : ""}</Text>
</View> </View>
<ScrollView style={{flex:1,height:responsiveHeight(40) <ScrollView style={{
flex: 1, height: responsiveHeight(40)
}} > }} >
<SafeAreaView forceInset={{ top: 'always', horizontal: 'never' }}> <SafeAreaView forceInset={{ top: 'always', horizontal: 'never' }}>
{ {
this.state.items && Object.keys(this.state.items).map((item,key)=>{ this.state.items && Object.keys(this.state.items).map((item, key) => {
return this._renderItem(item) return this._renderItem(item)
}) })
} }
@ -465,35 +469,37 @@ export default class OptionsMenu extends Component<Props> {
<Button <Button
textStyle={styles.btntext} textStyle={styles.btntext}
style={styles.btnDeconnect} style={styles.btnDeconnect}
onPress={()=>this.userDeconnect()} onPress={() => this.userDeconnect()}
>{I18n.t('DISCONNEXION')}</Button> >{I18n.t('DISCONNEXION')}</Button>
</View> </View>
) )
else { else {
setTimeout(() => this.setState({lang: ""}), 500) setTimeout(() => this.setState({ lang: "" }), 500)
return (<View/>) return (<View />)
} }
} }
userDeconnect(){ userDeconnect() {
Alert.alert( Alert.alert(
I18n.t('DISCONNEXION'), I18n.t('DISCONNEXION'),
I18n.t('DISCONNEXION_TEXT'), I18n.t('DISCONNEXION_TEXT'),
[ [
{}, {},
{text: I18n.t('NO'), onPress: () => console.log('Cancel Pressed'), style: 'cancel'}, { text: I18n.t('NO'), onPress: () => console.log('Cancel Pressed'), style: 'cancel' },
{text: I18n.t('YES'), onPress: () =>{ {
disconnect().then(()=>{ text: I18n.t('YES'), onPress: () => {
disconnect().then(() => {
IlinkEmitter.emit("userdisconnect"); IlinkEmitter.emit("userdisconnect");
this.props.navigation.navigate("Auth") this.props.navigation.navigate("Auth")
}) })
}}, }
},
], ],
{ cancelable: false } { cancelable: false }
) )
} }
watchUser() { watchUser() {
readUser().then((user)=> { readUser().then((user) => {
if(user.id!==this.state.user.id) { if (user.id !== this.state.user.id) {
if (user !== null && user !== undefined) { if (user !== null && user !== undefined) {
this.updateUser(user); this.updateUser(user);
} }
@ -502,64 +508,64 @@ export default class OptionsMenu extends Component<Props> {
} }
} }
const items=StyleSheet.create({ const items = StyleSheet.create({
content:{ content: {
width:responsiveWidth(100), width: responsiveWidth(100),
height:50, height: 50,
paddingLeft: 20, paddingLeft: 20,
flexDirection:'row', flexDirection: 'row',
alignItems:'center' alignItems: 'center'
}, },
itemText:{ itemText: {
color:'#000000', color: '#000000',
marginLeft:20, marginLeft: 20,
fontSize:responsiveFontSize(2), fontSize: responsiveFontSize(2),
} }
}); });
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
backgroundColor:"white", backgroundColor: "white",
}, },
btnDeconnect:{ btnDeconnect: {
borderColor:"transparent", borderColor: "transparent",
marginLeft:20, marginLeft: 20,
marginRight:20, marginRight: 20,
backgroundColor:theme.accent backgroundColor: theme.accent
}, },
btntext:{ btntext: {
color:"white", color: "white",
fontSize:17, fontSize: 17,
fontWeight:"bold" fontWeight: "bold"
}, },
headerTitle:{ headerTitle: {
fontSize:14, fontSize: 14,
marginBottom:5, marginBottom: 5,
color:"white", color: "white",
fontWeight: 'bold', fontWeight: 'bold',
}, },
headerPhone:{ headerPhone: {
fontSize:12, fontSize: 12,
marginBottom: 20, marginBottom: 20,
color:"white", color: "white",
justifyContent:'flex-end' justifyContent: 'flex-end'
}, },
listMenu: { listMenu: {
paddingTop: 15, paddingTop: 15,
}, },
headercontent:{ headercontent: {
height:responsiveHeight(30), height: responsiveHeight(30),
backgroundColor:primary, backgroundColor: primary,
justifyContent: 'flex-end', justifyContent: 'flex-end',
alignItems: 'flex-start', alignItems: 'flex-start',
paddingLeft:20 paddingLeft: 20
}, },
backgroundd_drawer:{ backgroundd_drawer: {
backgroundColor:'#000', backgroundColor: '#000',
}, },
listbackground:{ listbackground: {
}, },
actionButtonIcon: { actionButtonIcon: {
fontSize: 20, fontSize: 20,

View File

@ -7,26 +7,26 @@
*/ */
import React, {Component} from 'react'; import React, { Component } from 'react';
import {Platform, StyleSheet,Alert,FlatList, Text, View,TouchableOpacity,Linking} from 'react-native'; import { Platform, StyleSheet, Alert, FlatList, Text, View, TouchableOpacity, Linking } from 'react-native';
import ActionButton from 'react-native-action-button'; import ActionButton from 'react-native-action-button';
import Icon from 'react-native-vector-icons/Ionicons'; 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 HeaderMenu from './HeaderMenu';
import {historiques as histo,first,useraccount,notification,configurations} from './../../route.json'; import { historiques as histo, first, useraccount, notification, configurations } from './../../route.json';
import {primary,primaryDarkAdvanced} from './../../utils/theme.json'; import { primary, primaryDarkAdvanced } from './../../utils/theme.json';
import {readUser,disconnect} from './../../webservice/AuthApi'; import { readUser, disconnect } from './../../webservice/AuthApi';
import I18n from 'react-native-i18n' import I18n from 'react-native-i18n'
const route=require("./../../route.json") const route = require("./../../route.json")
require('./../../utils/Translations') require('./../../utils/Translations')
var DBEvents = require('react-native-db-models').DBEvents var DBEvents = require('react-native-db-models').DBEvents
type Props = {}; type Props = {};
let theme=require('./../../utils/theme.json') let theme = require('./../../utils/theme.json')
import Button from 'apsl-react-native-button' import Button from 'apsl-react-native-button'
import {IlinkEmitter} from "./../../utils/events" import { IlinkEmitter } from "./../../utils/events"
import { DrawerItems, SafeAreaView } from 'react-navigation'; import { DrawerItems, SafeAreaView } from 'react-navigation';
import RNDeviceInformation from "fm-react-native-device-info" import RNDeviceInformation from "fm-react-native-device-info"
import AppContainer, {AppNavigator} from "../../App"; import AppContainer, { AppNavigator } from "../../App";
import Configuration from "../../webservice/persistences/Configuration"; import Configuration from "../../webservice/persistences/Configuration";
export default class OptionsMenu extends Component<Props> { export default class OptionsMenu extends Component<Props> {
@ -35,27 +35,28 @@ export default class OptionsMenu extends Component<Props> {
statusBarColor: primaryDarkAdvanced, statusBarColor: primaryDarkAdvanced,
}; };
commandeListe commandeListe
constructor(props){ constructor(props) {
super(props); super(props);
this.state=this.initState(); this.state = this.initState();
IlinkEmitter.on("menuLink", this.onMenuNavigationEvent.bind(this)) IlinkEmitter.on("menuLink", this.onMenuNavigationEvent.bind(this))
IlinkEmitter.on("userconnect", this.onUserConnect.bind(this)) IlinkEmitter.on("userconnect", this.onUserConnect.bind(this))
IlinkEmitter.on("userdisconnect", this.hideSideMenu.bind(this)) IlinkEmitter.on("userdisconnect", this.hideSideMenu.bind(this))
IlinkEmitter.on("langueChange", this.updateLangue.bind(this)) IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
this.configuration=new Configuration(); this.configuration = new Configuration();
} }
retrieveAndroidInformation() { retrieveAndroidInformation() {
this.configuration._getData().then((lang)=>{ this.configuration._getData().then((lang) => {
if(lang){ if (lang) {
I18n.locale=lang I18n.locale = lang
readUser().then((result) => { readUser().then((result) => {
setTimeout(() => { setTimeout(() => {
this.updateUser(result); this.updateUser(result);
}, 3000)}) }, 3000)
}else{ })
RNDeviceInformation.getDeviceCountryCode().then((code)=> { } else {
I18n.locale=code.toLowerCase() RNDeviceInformation.getDeviceCountryCode().then((code) => {
I18n.locale = code.toLowerCase()
readUser().then((result) => { readUser().then((result) => {
setTimeout(() => { setTimeout(() => {
this.updateUser(result); this.updateUser(result);
@ -65,9 +66,9 @@ export default class OptionsMenu extends Component<Props> {
}); });
}) })
} }
}).catch((e)=>{ }).catch((e) => {
RNDeviceInformation.getDeviceCountryCode().then((code)=> { RNDeviceInformation.getDeviceCountryCode().then((code) => {
I18n.locale=code.toLowerCase() I18n.locale = code.toLowerCase()
readUser().then((result) => { readUser().then((result) => {
setTimeout(() => { setTimeout(() => {
this.updateUser(result); this.updateUser(result);
@ -82,21 +83,21 @@ export default class OptionsMenu extends Component<Props> {
return "" return ""
} }
componentDidMount() { componentDidMount() {
const items=this.props.navigation.router.childRouters.sta.childRouters; const items = this.props.navigation.router.childRouters.sta.childRouters;
// items.filter((item)=>item.) // items.filter((item)=>item.)
this.setState({items:items}) this.setState({ items: items })
this.retrieveAndroidInformation() this.retrieveAndroidInformation()
} }
updateLangue(){ updateLangue() {
this.setState({lang:"change"}) this.setState({ lang: "change" })
this.forceUpdate() this.forceUpdate()
} }
componentWillUnmount() { componentWillUnmount() {
} }
onMenuNavigationEvent(menuOption){ onMenuNavigationEvent(menuOption) {
/* Navigation.mergeOptions(this.props.componentId,{ /* Navigation.mergeOptions(this.props.componentId,{
sideMenu: { sideMenu: {
left: { left: {
@ -134,44 +135,44 @@ export default class OptionsMenu extends Component<Props> {
} }
});*/ });*/
} }
initState(){ initState() {
return { return {
user:null, user: null,
menu:[], menu: [],
currentId:0, currentId: 0,
} }
} }
getGeolocatedUserMenu(){ getGeolocatedUserMenu() {
return [ return [
{title:I18n.t('MAP'),id:0,key:0,icon:'md-map',active:true} { 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('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('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('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('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('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
,{title:I18n.t('CONFIGURATIONS'),id:4,icon:'md-settings',active:false}] , { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
} }
getSuperUserMenu(){ getSuperUserMenu() {
return [ return [
{title:I18n.t('MAP'),id:0,key:0,icon:'md-map',active:true} { 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('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('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('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('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
,{title:I18n.t('CONFIGURATIONS'),id:4,icon:'md-settings',active:false}] , { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
} }
getHyperUsermenu() { getHyperUsermenu() {
return [ return [
{title:I18n.t('MAP'),id:0,key:0,icon:'md-map',active:true} { 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('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('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('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('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
,{title:I18n.t('CONFIGURATIONS'),id:4,icon:'md-settings',active:false}] , { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
} }
updateUser(user){ updateUser(user) {
let menu=[]; let menu = [];
if(user!==undefined) { if (user !== undefined) {
/* Navigation.mergeOptions("drawer", { /* Navigation.mergeOptions("drawer", {
sideMenu: { sideMenu: {
left: { left: {
@ -180,45 +181,45 @@ export default class OptionsMenu extends Component<Props> {
} }
} }
});*/ });*/
if(user.category!==undefined) { if (user.category !== undefined) {
switch(user.category){ switch (user.category) {
case "geolocated": case "geolocated":
menu=this.getGeolocatedUserMenu(); menu = this.getGeolocatedUserMenu();
break; break;
case "super": case "super":
menu = this.getSuperUserMenu(); menu = this.getSuperUserMenu();
break; break;
case "hyper": case "hyper":
menu=this.getHyperUsermenu(); menu = this.getHyperUsermenu();
break; break;
} }
}else } else {
{
menu = this.getUserMenu(); menu = this.getUserMenu();
} }
} }
this.setState({user: user, menu: menu}); this.setState({ user: user, menu: menu });
} }
getUserMenu(){ getUserMenu() {
return [ return [
{title:I18n.t('MAP'),id:0,key:0,icon:'md-map',active:true} { 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('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('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
,{title:I18n.t('CONFIGURATIONS'),id:4,icon:'md-settings',active:false}] , { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
} }
_renderItem = (item) =>{ _renderItem = (item) => {
if(item==="creditrequest" || item==='historyItemDetails' || item==='filter' || item==='networks'){ if (item === "creditrequest" || item === 'historyItemDetails' || item === 'filter' || item === 'networks') {
return null return null
}else{ } else {
const color= this.state.currentId===item.id?theme.accent:"grey" const color = this.state.currentId === item.id ? theme.accent : "grey"
return ( return (
<TouchableOpacity onPress={() => { <TouchableOpacity onPress={() => {
this.props.navigation.toggleDrawer(); this.props.navigation.toggleDrawer();
this.setState({currentId:item.id}) this.setState({ currentId: item.id })
this.props.navigation.navigate(item)}} this.props.navigation.navigate(item)
}}
> >
<View <View
style={items.content} style={items.content}
@ -228,25 +229,27 @@ export default class OptionsMenu extends Component<Props> {
size={32} size={32}
/> />
<Text style={{ <Text style={{
marginLeft:20, marginLeft: 20,
fontSize:16, fontSize: 16,
}}>{this.getNameItems(item)} }}>{this.getNameItems(item)}
</Text> </Text>
</View></TouchableOpacity>)}}; </View></TouchableOpacity>)
_onPress=((item)=>{ }
};
_onPress = ((item) => {
this.setState({currentId:item.id}) this.setState({ currentId: item.id })
let current=this.state.menu.filter((item)=>{return item.active})[0] let current = this.state.menu.filter((item) => { return item.active })[0]
current.active=false; current.active = false;
item.active=true; item.active = true;
let newMenu=[]; let newMenu = [];
this.state.menu.forEach(function (it) { this.state.menu.forEach(function (it) {
if(it.id===current.id)newMenu.push(current) if (it.id === current.id) newMenu.push(current)
else if(it.id===item.id)newMenu.push(item) else if (it.id === item.id) newMenu.push(item)
else newMenu.push(it) else newMenu.push(it)
} }
) )
this.setState({menu:newMenu}) this.setState({ menu: newMenu })
/* switch(item.id){ /* switch(item.id){
case 2: case 2:
Navigation.push(route.stackRoot,{ Navigation.push(route.stackRoot,{
@ -391,58 +394,58 @@ export default class OptionsMenu extends Component<Props> {
} }
}) })
*/ }); */ });
getNameItems(item){ getNameItems(item) {
let icon=item let icon = item
switch (item) { switch (item) {
case "home":icon=I18n.t('MAP') case "home": icon = I18n.t('MAP')
break break
case 'useraccount':icon=I18n.t('MY_ACCOUNT') case 'useraccount': icon = I18n.t('MY_ACCOUNT')
break break
case 'Historique':icon=I18n.t('CREDIT_MANAGE') case 'Historique': icon = I18n.t('CREDIT_MANAGE')
break break
case "superviseurgroup":icon=I18n.t('GROUP_MANAGE') case "superviseurgroup": icon = I18n.t('GROUP_MANAGE')
break break
case "updateinformation":icon=I18n.t("CHANGE_INFORMATION") case "updateinformation": icon = I18n.t("CHANGE_INFORMATION")
break break
case 'notificationview':icon=I18n.t('NOTIFICATIONS') case 'notificationview': icon = I18n.t('NOTIFICATIONS')
break break
case 'configuration':icon=I18n.t('CONFIGURATIONS') case 'configuration': icon = I18n.t('CONFIGURATIONS')
break; break;
case 'addNetwork':icon=I18n.t('ADD_NETWORK') case 'addNetwork': icon = I18n.t('ADD_NETWORK')
break break
case 'about':icon=I18n.t('ABOUT_') case 'about': icon = I18n.t('ABOUT_')
} }
return icon; return icon;
} }
getIcon(item){ getIcon(item) {
let icon="md-map" let icon = "md-map"
switch (item) { switch (item) {
case "home":icon="md-map" case "home": icon = "md-map"
break break
case 'useraccount':icon="md-person" case 'useraccount': icon = "md-person"
break break
case 'Historique':icon="md-card" case 'Historique': icon = "md-card"
break break
case "superviseurgroup":icon="md-people" case "superviseurgroup": icon = "md-people"
break break
case 'notificationview':icon="md-notifications"; case 'notificationview': icon = "md-notifications";
break break
case "updateinformation":icon="md-people" case "updateinformation": icon = "md-people"
break break
case 'configuration':icon='md-settings' case 'configuration': icon = 'md-settings'
break; break;
case 'addNetwork':icon="md-people" case 'addNetwork': icon = "md-people"
break break
case 'about':icon='md-contacts'; case 'about': icon = 'md-contacts';
break; break;
} }
return icon; return icon;
} }
render () { render() {
var name=this.state.user?this.state.user.firstname:""; var name = this.state.user ? this.state.user.firstname : "";
const surname=this.state.user? this.state.user.lastname:""; const surname = this.state.user ? this.state.user.lastname : "";
if(!this.state.lang && this.state.lang!=="change") if (!this.state.lang && this.state.lang !== "change")
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View <View
@ -450,12 +453,13 @@ export default class OptionsMenu extends Component<Props> {
> >
<Text style={styles.headerTitle}>{name}</Text> <Text style={styles.headerTitle}>{name}</Text>
<Text style={styles.headerTitle}>{surname}</Text> <Text style={styles.headerTitle}>{surname}</Text>
<Text style={styles.headerPhone}>{this.state.user?""+this.state.user.phone:""}</Text> <Text style={styles.headerPhone}>{this.state.user ? "" + this.state.user.phone : ""}</Text>
</View> </View>
<SafeAreaView style={{flex:1, <SafeAreaView style={{
flex: 1,
}} forceInset={{ top: 'always', horizontal: 'never' }}> }} forceInset={{ top: 'always', horizontal: 'never' }}>
{ {
this.state.items && Object.keys(this.state.items).map((item,key)=>{ this.state.items && Object.keys(this.state.items).map((item, key) => {
return this._renderItem(item) return this._renderItem(item)
}) })
} }
@ -463,35 +467,37 @@ export default class OptionsMenu extends Component<Props> {
<Button <Button
textStyle={styles.btntext} textStyle={styles.btntext}
style={styles.btnDeconnect} style={styles.btnDeconnect}
onPress={()=>this.userDeconnect()} onPress={() => this.userDeconnect()}
>{I18n.t('DISCONNEXION')}</Button> >{I18n.t('DISCONNEXION')}</Button>
</View> </View>
) )
else { else {
setTimeout(() => this.setState({lang: ""}), 500) setTimeout(() => this.setState({ lang: "" }), 500)
return (<View/>) return (<View />)
} }
} }
userDeconnect(){ userDeconnect() {
Alert.alert( Alert.alert(
I18n.t('DISCONNEXION'), I18n.t('DISCONNEXION'),
I18n.t('DISCONNEXION_TEXT'), I18n.t('DISCONNEXION_TEXT'),
[ [
{}, {},
{text: I18n.t('NO'), onPress: () => console.log('Cancel Pressed'), style: 'cancel'}, { text: I18n.t('NO'), onPress: () => console.log('Cancel Pressed'), style: 'cancel' },
{text: I18n.t('YES'), onPress: () =>{ {
disconnect().then(()=>{ text: I18n.t('YES'), onPress: () => {
disconnect().then(() => {
IlinkEmitter.emit("userdisconnect"); IlinkEmitter.emit("userdisconnect");
this.props.navigation.navigate("Auth") this.props.navigation.navigate("Auth")
}) })
}}, }
},
], ],
{ cancelable: false } { cancelable: false }
) )
} }
watchUser() { watchUser() {
readUser().then((user)=> { readUser().then((user) => {
if(user.id!==this.state.user.id) { if (user.id !== this.state.user.id) {
if (user !== null && user !== undefined) { if (user !== null && user !== undefined) {
this.updateUser(user); this.updateUser(user);
} }
@ -500,64 +506,64 @@ export default class OptionsMenu extends Component<Props> {
} }
} }
const items=StyleSheet.create({ const items = StyleSheet.create({
content:{ content: {
width:responsiveWidth(100), width: responsiveWidth(100),
height:50, height: 50,
paddingLeft: 20, paddingLeft: 20,
flexDirection:'row', flexDirection: 'row',
alignItems:'center' alignItems: 'center'
}, },
itemText:{ itemText: {
color:'#000000', color: '#000000',
marginLeft:20, marginLeft: 20,
fontSize:responsiveFontSize(2), fontSize: responsiveFontSize(2),
} }
}); });
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
backgroundColor:"white", backgroundColor: "white",
}, },
btnDeconnect:{ btnDeconnect: {
borderColor:"transparent", borderColor: "transparent",
marginLeft:20, marginLeft: 20,
marginRight:20, marginRight: 20,
backgroundColor:theme.accent backgroundColor: theme.accent
}, },
btntext:{ btntext: {
color:"white", color: "white",
fontSize:17, fontSize: 17,
fontWeight:"bold" fontWeight: "bold"
}, },
headerTitle:{ headerTitle: {
fontSize:14, fontSize: 14,
marginBottom:5, marginBottom: 5,
color:"white", color: "white",
fontWeight: 'bold', fontWeight: 'bold',
}, },
headerPhone:{ headerPhone: {
fontSize:12, fontSize: 12,
marginBottom: 20, marginBottom: 20,
color:"white", color: "white",
justifyContent:'flex-end' justifyContent: 'flex-end'
}, },
listMenu: { listMenu: {
paddingTop: 15, paddingTop: 15,
}, },
headercontent:{ headercontent: {
height:responsiveHeight(30), height: responsiveHeight(30),
backgroundColor:primary, backgroundColor: primary,
justifyContent: 'flex-end', justifyContent: 'flex-end',
alignItems: 'flex-start', alignItems: 'flex-start',
paddingLeft:20 paddingLeft: 20
}, },
backgroundd_drawer:{ backgroundd_drawer: {
backgroundColor:'#000', backgroundColor: '#000',
}, },
listbackground:{ listbackground: {
}, },
actionButtonIcon: { actionButtonIcon: {
fontSize: 20, fontSize: 20,

View File

@ -1,14 +1,14 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { import {
StyleSheet, View, Text, Image, ProgressBarAndroid, StyleSheet, View, Text, Image, ProgressBarAndroid,
TouchableNativeFeedback,TouchableOpacity, TouchableNativeFeedback, TouchableOpacity,
PermissionsAndroid, NativeModules, StatusBar, Platform,Animated PermissionsAndroid, NativeModules, StatusBar, Platform, Animated
} from 'react-native'; } 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' import I18n from 'react-native-i18n'
const theme=require('./../../utils/theme.json'); const theme = require('./../../utils/theme.json');
const route=require('./../../route.json'); const route = require('./../../route.json');
import {readUser,getPasObject,getPubActiveObject} from '../../webservice/AuthApi'; import { readUser, getPasObject, getPubActiveObject } from '../../webservice/AuthApi';
import { Bubbles, DoubleBounce, Bars, Pulse } from 'react-native-loader'; import { Bubbles, DoubleBounce, Bars, Pulse } from 'react-native-loader';
import Configuration from "../../webservice/persistences/Configuration"; import Configuration from "../../webservice/persistences/Configuration";
import '../ads/InterticielAds' import '../ads/InterticielAds'
@ -17,12 +17,12 @@ import LottieView from 'lottie-react-native'; // if you have "esModuleInterop":
import InterticielAds from '../ads/InterticielAds'; import InterticielAds from '../ads/InterticielAds';
import Overlay from 'react-native-elements' import Overlay from 'react-native-elements'
import DeviceInfo from 'react-native-device-info'; import DeviceInfo from 'react-native-device-info';
export default class SplashScreen extends Component{ export default class SplashScreen extends Component {
static navigatorStyle = { static navigatorStyle = {
drawUnderNavBar: true, drawUnderNavBar: true,
navBarHidden:true, navBarHidden: true,
drawUnderStatusBar: false, drawUnderStatusBar: false,
statusBarHidden: true, statusBarHidden: false,
statusBarTextColorScheme: 'light', statusBarTextColorScheme: 'light',
}; };
static options(passProps) { static options(passProps) {
@ -30,7 +30,7 @@ export default class SplashScreen extends Component{
statusBar: { statusBar: {
visible: false, visible: false,
style: 'light' | 'dark', style: 'light' | 'dark',
drawBehind:true drawBehind: true
}, },
topBar: { topBar: {
title: { title: {
@ -45,32 +45,32 @@ export default class SplashScreen extends Component{
// //
constructor(props){ constructor(props) {
super(props); super(props);
this.state={ this.state = {
} }
}; };
workUserResult(result){ workUserResult(result) {
var way=""; var way = "";
var way2=""; var way2 = "";
if(result===null || result===undefined ){ if (result === null || result === undefined) {
way="Auth" way = "Auth"
way2=route.first way2 = route.first
}else{ } else {
if(!result.category) if (!result.category)
way="App" way = "App"
else { else {
switch (result.category) { switch (result.category) {
case 'geolocated':way="AgentApp" case 'geolocated': way = "AgentApp"
break; break;
case 'super':way="adminApp" case 'super': way = "adminApp"
break break
default: default:
way="supAdminApp" way = "supAdminApp"
} }
} }
way2=route.login way2 = route.login
} }
this.props.navigation.navigate(way) this.props.navigation.navigate(way)
@ -95,15 +95,15 @@ export default class SplashScreen extends Component{
});*/ });*/
} }
componentDidMount(){ componentDidMount() {
try { try {
this.requestCameraPermission() this.requestCameraPermission()
}catch (e){ } catch (e) {
console.log(e) console.log(e)
} }
this.config=new Configuration(); this.config = new Configuration();
this.retrieveAndroidInformation() this.retrieveAndroidInformation()
setTimeout(()=>this.bounce(),500) setTimeout(() => this.bounce(), 500)
this.bounce() this.bounce()
} }
@ -130,20 +130,20 @@ export default class SplashScreen extends Component{
} }
handleViewRef = ref => this.view = ref; handleViewRef = ref => this.view = ref;
bounce = () => this.view.transition({ translateX: 0},{ translateX: 700},5000); bounce = () => this.view.transition({ translateX: 0 }, { translateX: 700 }, 5000);
render(){ render() {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<StatusBar <StatusBar
translucent={true} translucent={true}
/> />
<Image style={styles.logo} source={require('./../../datas/img/icon3up.png')}/> <Image style={styles.logo} source={require('./../../datas/img/icon3up.png')} />
<View style={{flexDirection:'row'}}> <View style={{ flexDirection: 'row' }}>
<Image style={styles.logo} source={require('./../../datas/img/iconsub3.png')}/> <Image style={styles.logo} source={require('./../../datas/img/iconsub3.png')} />
<Animatable.View <Animatable.View
style={{width:responsiveWidth(90),height:92,backgroundColor:theme.primary,position:'absolute',zIndex:100}} style={{ width: responsiveWidth(90), height: 92, backgroundColor: theme.primary, position: 'absolute', zIndex: 100 }}
ref={this.handleViewRef}> ref={this.handleViewRef}>
</Animatable.View> </Animatable.View>
@ -166,33 +166,34 @@ export default class SplashScreen extends Component{
} }
retrieveAndroidInformation() { retrieveAndroidInformation() {
getPasObject().then((data)=>{ getPasObject().then((data) => {
console.warn(data); console.warn(data);
this.config.setCurrentPas(data) this.config.setCurrentPas(data)
}) })
this.config._getData().then((lang)=>{ this.config._getData().then((lang) => {
if(lang){ if (lang) {
I18n.locale=lang I18n.locale = lang
readUser().then((result) => { readUser().then((result) => {
console.warn(result) console.warn(result)
if(result){ if (result) {
getPubActiveObject(result['country_id']).then((data)=>{ getPubActiveObject(result['country_id']).then((data) => {
console.warn(data) console.warn(data)
this.config.setPubActive(data); this.config.setPubActive(data);
}) })
} }
setTimeout(() => { setTimeout(() => {
this.workUserResult(result) this.workUserResult(result)
}, 3000)}) }, 3000)
}else{ })
} else {
const code = DeviceInfo.getDeviceLocale(); const code = DeviceInfo.getDeviceLocale();
console.warn(code) console.warn(code)
I18n.locale=code.toLowerCase() I18n.locale = code.toLowerCase()
readUser().then((result) => { readUser().then((result) => {
console.warn(result) console.warn(result)
if(result){ if (result) {
getPubActiveObject(result['country_id']).then((data)=>{ getPubActiveObject(result['country_id']).then((data) => {
console.warn(data) console.warn(data)
this.config.setPubActive(data); this.config.setPubActive(data);
}) })
@ -205,12 +206,12 @@ export default class SplashScreen extends Component{
}); });
} }
}).catch((e)=>{ }).catch((e) => {
console.warn(e.message) console.warn(e.message)
DeviceInfo.getDeviceLocale().then((code)=> { DeviceInfo.getDeviceLocale().then((code) => {
console.warn(code) console.warn(code)
I18n.locale=code.toLowerCase() I18n.locale = code.toLowerCase()
readUser().then((result) => { readUser().then((result) => {
setTimeout(() => { setTimeout(() => {
this.workUserResult(result) this.workUserResult(result)
@ -225,33 +226,33 @@ export default class SplashScreen extends Component{
return "" return ""
} }
} }
const styles=StyleSheet.create({ const styles = StyleSheet.create({
container:{ container: {
flex:1, flex: 1,
backgroundColor: theme.primary, backgroundColor: theme.primary,
justifyContent:'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
}, },
logoContaner:{ logoContaner: {
flexDirection: 'row', flexDirection: 'row',
marginTop: responsiveHeight(20), marginTop: responsiveHeight(20),
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
}, },
logo:{ logo: {
width:responsiveWidth(90), width: responsiveWidth(90),
resizeMode:'contain' resizeMode: 'contain'
}, },
lottie: { lottie: {
width: 48 width: 48
, ,
height: 64 height: 64
}, },
title:{ title: {
fontSize:responsiveFontSize(4), fontSize: responsiveFontSize(4),
alignSelf: 'center', alignSelf: 'center',
fontWeight:'bold', fontWeight: 'bold',
color:'white', color: 'white',
}, },
}) })

View File

@ -2,6 +2,8 @@
"WELCOME": "Welcome to iLink World !", "WELCOME": "Welcome to iLink World !",
"HELP": "Help", "HELP": "Help",
"SIMPLE_USER": "Simple User", "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", "GEOLOCATED_USER": "Geo located user",
"SUPERVISOR": "Supervisor", "SUPERVISOR": "Supervisor",
"AGENT": "Agent", "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", "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", "OR_BIG": "OR",
"FOR_NUMB": "For the ", "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", "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_FOR_CREDIT": "Apply for credit",
"ASK_CREDIT": "Credit applications", "ASK_CREDIT": "Credit applications",
@ -26,14 +29,15 @@
"ASK_FOR_SUPERVISOR1": "Ask to become a supervisor", "ASK_FOR_SUPERVISOR1": "Ask to become a supervisor",
"CREDIT_ASK_FROM_MEMBERS": "Credit requests from your members", "CREDIT_ASK_FROM_MEMBERS": "Credit requests from your members",
"ASK_MEMBERS": "Membership applications", "ASK_MEMBERS": "Membership applications",
"MY_ACCOUNT": "Mon compte", "MY_ACCOUNT": "My account",
"THE_ACCOUNT": "Le compte ", "THE_ACCOUNT": "Account ",
"NO_GEO_POINT_CODE": "You have no free geolocated point", "NO_GEO_POINT_CODE": "You have no free geolocated point",
"NO_DEMAND_ADHESION": "You have no membership request", "NO_DEMAND_ADHESION": "You have no membership request",
"ACTIVATED": "has been activated", "ACTIVATED": "has been activated",
"CREDIT_MANAGE": "Credit Management", "CREDIT_MANAGE": "Credit Management",
"GROUP_MANAGE": "Group Management", "GROUP_MANAGE": "Group Management",
"NOTIFICATIONS": "Notification", "NOTIFICATIONS": "Notification",
"NO_NOTIFICATION": "You haven't any notification",
"CONFIGURATIONS": "Configuration", "CONFIGURATIONS": "Configuration",
"LOGOUT": "Sign Out", "LOGOUT": "Sign Out",
"HINT_HOME_SEARCH": " Find a place, neighborhood or city ", "HINT_HOME_SEARCH": " Find a place, neighborhood or city ",
@ -55,6 +59,7 @@
"CREDIT": "Credit", "CREDIT": "Credit",
"NEXT": "Next", "NEXT": "Next",
"SPONSOR_CODE": "Sponsor Code", "SPONSOR_CODE": "Sponsor Code",
"SOLDE_UNVAIBLE": "solde unavailable",
"TEXT_BIG_CREATE_AGENT_1": "Register as Agent", "TEXT_BIG_CREATE_AGENT_1": "Register as Agent",
"EMAIL": "Email", "EMAIL": "Email",
"COUNTRY": "Country", "COUNTRY": "Country",
@ -176,6 +181,8 @@
"SEARCH_20": "20 km", "SEARCH_20": "20 km",
"SEARCH_25": "25 km", "SEARCH_25": "25 km",
"SEARCH": "Search", "SEARCH": "Search",
"SEE_VIDEO": "Watch the video",
"SEE_TUTO": "See the tutorial",
"DELETE": "Delete", "DELETE": "Delete",
"FREE": "Available", "FREE": "Available",
"SAVED": "Registered", "SAVED": "Registered",
@ -195,12 +202,14 @@
"PHONE_TRANSACTION": "Transaction number", "PHONE_TRANSACTION": "Transaction number",
"DEMAND_TEXT_FIRST_PART": "made a request for", "DEMAND_TEXT_FIRST_PART": "made a request for",
"REQUEST_SEND": "Request Sent", "REQUEST_SEND": "Request Sent",
"DEMAND_RECEIVE": "Requests received",
"TO_": "credit to", "TO_": "credit to",
"DEMAND_SEND_SUCCESFUL": "Your request has been sent successfully!", "DEMAND_SEND_SUCCESFUL": "Your request has been sent successfully!",
"SAVE_HISTORY": "Save history", "SAVE_HISTORY": "Save history",
"MAKE_REQUEST": "Make a request", "MAKE_REQUEST": "Make a request",
"DATE_WRONG": "The end date can not be earlier than the start date", "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", "EMPTY_LIST_REQUEST": "No request",
"MEMBER_LIST": "List of members", "MEMBER_LIST": "List of members",
"FREE_CODE_LIST": "List of available codes", "FREE_CODE_LIST": "List of available codes",

View File

@ -1,7 +1,9 @@
{ {
"WELCOME": "Bienvenue sur iLink World !", "WELCOME": "Bienvenue sur iLink World !",
"HELP": "Aide à l'utilisation", "HELP": "Aide",
"SIMPLE_USER": "Utilisateur simple", "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é", "GEOLOCATED_USER": "Utilisateur géo-localisé",
"SUPERVISOR": "Superviseur", "SUPERVISOR": "Superviseur",
"AGENT": "Agent", "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", "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", "OR_BIG": "OU",
"FOR_NUMB": "Pour le ", "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", "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_FOR_CREDIT": "Demander du crédit",
"ASK_CREDIT": "Demandes de crédit", "ASK_CREDIT": "Demandes de crédit",
@ -34,6 +37,7 @@
"CREDIT_MANAGE": "Gestion de credit", "CREDIT_MANAGE": "Gestion de credit",
"GROUP_MANAGE": "Gestion du groupe", "GROUP_MANAGE": "Gestion du groupe",
"NOTIFICATIONS": "Notification", "NOTIFICATIONS": "Notification",
"NO_NOTIFICATION": "Vous n'avez aucune notification",
"CONFIGURATIONS": "Configuration", "CONFIGURATIONS": "Configuration",
"LOGOUT": "Déconnexion", "LOGOUT": "Déconnexion",
"HINT_HOME_SEARCH": " Chercher un lieu, quartier ou ville ", "HINT_HOME_SEARCH": " Chercher un lieu, quartier ou ville ",
@ -55,6 +59,7 @@
"CREDIT": "Crédit", "CREDIT": "Crédit",
"NEXT": "Suivant", "NEXT": "Suivant",
"SPONSOR_CODE": "Code parrain", "SPONSOR_CODE": "Code parrain",
"SOLDE_UNVAIBLE": "solde non disponible",
"TEXT_BIG_CREATE_AGENT_1": "Inscrivez-vous en comme Agent", "TEXT_BIG_CREATE_AGENT_1": "Inscrivez-vous en comme Agent",
"EMAIL": "Email", "EMAIL": "Email",
"COUNTRY": "Pays", "COUNTRY": "Pays",
@ -176,6 +181,8 @@
"SEARCH_20": "20 km", "SEARCH_20": "20 km",
"SEARCH_25": "25 km", "SEARCH_25": "25 km",
"SEARCH": "Rechercher", "SEARCH": "Rechercher",
"SEE_VIDEO": "Voir la vidéo",
"SEE_TUTO": "Voir le tutoriel",
"DELETE": "Supprimer", "DELETE": "Supprimer",
"FREE": "disponibles", "FREE": "disponibles",
"SAVED": "enregistrés", "SAVED": "enregistrés",
@ -195,12 +202,14 @@
"PHONE_TRANSACTION": "Numéro de transaction", "PHONE_TRANSACTION": "Numéro de transaction",
"DEMAND_TEXT_FIRST_PART": "a effectué une demande de ", "DEMAND_TEXT_FIRST_PART": "a effectué une demande de ",
"DEMANDE_SEND": " Demande Envoyée", "DEMANDE_SEND": " Demande Envoyée",
"DEMAND_RECEIVE": "Demandes reçues",
"TO_": " crédit auprès de ", "TO_": " crédit auprès de ",
"DEMAND_SEND_SUCCESFUL": "Votre demande a été envoyée avec succès !", "DEMAND_SEND_SUCCESFUL": "Votre demande a été envoyée avec succès !",
"SAVE_HISTORY": "Enregistrer l'historique", "SAVE_HISTORY": "Enregistrer l'historique",
"MAKE_REQUEST": "Faire une demande", "MAKE_REQUEST": "Faire une demande",
"DATE_WRONG": "La date de fin ne peut être antérieure à la date de début", "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", "EMPTY_LIST_REQUEST": "Aucune demande",
"MEMBER_LIST": "Liste des membres", "MEMBER_LIST": "Liste des membres",
"FREE_CODE_LIST": "Liste des codes disponibles", "FREE_CODE_LIST": "Liste des codes disponibles",

View File

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

View File

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