Correction de bugs

This commit is contained in:
Brice 2020-11-20 18:06:19 +01:00
parent 0a1c1f896a
commit 4a574e9a6f
24 changed files with 4256 additions and 4079 deletions

801
App.js
View File

@ -6,12 +6,17 @@
* @flow * @flow
*/ */
import React, { Component } from 'react'; import React from 'react';
import { ActionSheetProvider, connectActionSheet } from '@expo/react-native-action-sheet' import {ActionSheetProvider} from '@expo/react-native-action-sheet'
import { Platform, StyleSheet, Text, View, YellowBox, AsyncStorage } from 'react-native'; import {AsyncStorage, Platform, StyleSheet} from 'react-native';
import { createAppContainer, HeaderBackButton, createSwitchNavigator, createStackNavigator, createBottomTabNavigator, createDrawerNavigator } from 'react-navigation'; import {
createAppContainer,
createBottomTabNavigator,
createDrawerNavigator,
createStackNavigator,
createSwitchNavigator
} from 'react-navigation';
import OneSignal from 'react-native-onesignal'; import OneSignal from 'react-native-onesignal';
import _ from 'lodash';
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";
@ -26,8 +31,6 @@ import ActivateAccount from "./screens/login/ActivateAccount";
import Notifications from "./screens/notifications/Notifications"; import Notifications from "./screens/notifications/Notifications";
import About from "./screens/configurations/About"; import About from "./screens/configurations/About";
import Configurations from "./screens/configurations/Configurations"; import Configurations from "./screens/configurations/Configurations";
import History from './screens/history-request/History'
import OptionsMenu from "./screens/optionMenu/OptionsMenu"; import OptionsMenu from "./screens/optionMenu/OptionsMenu";
import Home from "./screens/home/Home"; import Home from "./screens/home/Home";
import HistoryItemDetails from "./screens/history-request/HistoryItemDetails"; import HistoryItemDetails from "./screens/history-request/HistoryItemDetails";
@ -36,18 +39,13 @@ import HistoryRequester from "./screens/history-request/HistoryRequester";
import AddNetwork from "./screens/account/AddNetwork"; import AddNetwork from "./screens/account/AddNetwork";
import MyHistory from "./screens/history-request/MyHistory"; import MyHistory from "./screens/history-request/MyHistory";
import Icon from "react-native-vector-icons/FontAwesome5"; import Icon from "react-native-vector-icons/FontAwesome5";
import { Appbar } from 'react-native-paper';
import IconWithBadge from "./screens/IconWithBadge"
import I18n from "react-native-i18n"; import I18n from "react-native-i18n";
import Filter from './screens/home/Filter';
import { createMaterialBottomTabNavigator } from 'react-navigation-material-bottom-tabs';
import WalletDetail from './screens/wallet/WalletDetail'; import WalletDetail from './screens/wallet/WalletDetail';
import WalletSelect from './screens/wallet/WalletSelect'; import WalletSelect from './screens/wallet/WalletSelect';
import { PersistGate } from 'redux-persist/integration/react'; import {PersistGate} from 'redux-persist/integration/react';
import { store, persistor } from './redux/store'; import {persistor, store} from './redux/store';
import { Provider, connect } from 'react-redux'; import {Provider} from 'react-redux';
import WalletDepot from './screens/wallet/WalletDepot'; import WalletDepot from './screens/wallet/WalletDepot';
import WalletRetrait from './screens/wallet/WalletRetrait'; import WalletRetrait from './screens/wallet/WalletRetrait';
import CreateIdentification from './screens/identification/createIdentification'; import CreateIdentification from './screens/identification/createIdentification';
@ -73,10 +71,8 @@ import EnvoieCashVersCarteAgent from './screens/wallet/agent/EnvoieCashVersCarte
import EnvoiCashVersCashAgent from './screens/wallet/agent/EnvoiCashVersCashAgent'; import EnvoiCashVersCashAgent from './screens/wallet/agent/EnvoiCashVersCashAgent';
import ModifyIdentificationUser from './screens/identification/ModifyIdentificationUser'; import ModifyIdentificationUser from './screens/identification/ModifyIdentificationUser';
import CreateGroupNanoCredit from './screens/nano-credit/CreateGroupNanoCredit'; import CreateGroupNanoCredit from './screens/nano-credit/CreateGroupNanoCredit';
import { bindActionCreators } from 'redux';
import DemandValidationGroup from './screens/nano-credit/DemandGroupNanoCredit'; import DemandValidationGroup from './screens/nano-credit/DemandGroupNanoCredit';
import DemandGroupNanoCreditDetail from './screens/nano-credit/DemandGroupNanoCreditDetail'; import DemandGroupNanoCreditDetail from './screens/nano-credit/DemandGroupNanoCreditDetail';
import NavigationService from './utils/NavigationService';
import AdhererGroupNanoCredit from './screens/nano-credit/AdhererGroupNanoCredit'; import AdhererGroupNanoCredit from './screens/nano-credit/AdhererGroupNanoCredit';
import MyNanoCreditGroup from './screens/nano-credit/MyNanoCreditGroup'; import MyNanoCreditGroup from './screens/nano-credit/MyNanoCreditGroup';
import AskNanoCredit from './screens/nano-credit/AskNanoCredit'; import AskNanoCredit from './screens/nano-credit/AskNanoCredit';
@ -84,479 +80,484 @@ import RefundNanoCreditUser from './screens/nano-credit/RefundNanoCreditUser';
import CautionNanoCreditAgent from './screens/nano-credit/CautionNanoCreditAgent'; import CautionNanoCreditAgent from './screens/nano-credit/CautionNanoCreditAgent';
import EpargnerArgentUser from './screens/nano-credit/EpargnerArgentUser'; import EpargnerArgentUser from './screens/nano-credit/EpargnerArgentUser';
import CasserEpargneUser from './screens/nano-credit/CasserEpargneUser'; import CasserEpargneUser from './screens/nano-credit/CasserEpargneUser';
import { IlinkEmitter } from './utils/events'; import {IlinkEmitter} from './utils/events';
import { fromBottom, fromLeft, zoomIn } from 'react-navigation-transitions';
import { readUser } from './webservice/AuthApi';
import EnvoieWalletToBankAgent from "./screens/wallet/agent/EnvoieWalletToBankAgent"; import EnvoieWalletToBankAgent from "./screens/wallet/agent/EnvoieWalletToBankAgent";
const instructions = Platform.select({ const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu', ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android: android:
'Double tap R on your keyboard to reload,\n' + 'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu', 'Shake or press menu button for dev menu',
}); });
const theme = require("./utils/theme") const theme = require("./utils/theme")
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({ const AppStack = createDrawerNavigator({
sta: createStackNavigator({ sta: createStackNavigator({
home: Home, home: Home,
/* filtre:Filter, /* filtre:Filter,
network:Networks,*/ network:Networks,*/
useraccount: { useraccount: {
screen: UserAccount, screen: UserAccount,
navigationOptions: { navigationOptions: {},
}, },
}, walletSelect: WalletSelect,
walletSelect: WalletSelect, createIdentificationUser: CreateIdentificationUser,
createIdentificationUser: CreateIdentificationUser, modifyIdentificationUser: ModifyIdentificationUser,
modifyIdentificationUser: ModifyIdentificationUser, notificationview: Notifications,
notificationview: Notifications, configuration: Configurations,
configuration: Configurations, about: About,
about: About, walletDetailUser: WalletDetailUser,
walletDetailUser: WalletDetailUser, walletOptionSelect: WalletOptionSelect,
walletOptionSelect: WalletOptionSelect, operateurOptionSelect: OperateurOptionSelect,
operateurOptionSelect: OperateurOptionSelect, operateurOptionSelect: OperateurOptionSelect,
operateurOptionSelect: OperateurOptionSelect, paiementFacture: PaiementFacture,
paiementFacture: PaiementFacture, envoieWalletToWalletUser: EnvoieWalletToWalletUser,
envoieWalletToWalletUser: EnvoieWalletToWalletUser, envoieWalletToCashUser: EnvoieWalletToCashUser,
envoieWalletToCashUser: EnvoieWalletToCashUser, envoieWalletToCardUser: EnvoieWalletToCardUser,
envoieWalletToCardUser: EnvoieWalletToCardUser, envoieWalletToBankUser: EnvoieWalletToBankUser,
envoieWalletToBankUser: EnvoieWalletToBankUser, retraitWalletVersCashUser: RetraitWalletVersCashUser,
retraitWalletVersCashUser: RetraitWalletVersCashUser, retraitCarteVersCashUser: RetraitCarteVersCashUser,
retraitCarteVersCashUser: RetraitCarteVersCashUser, retraitCarteVersWalletUser: RetraitCarteVersWalletUser,
retraitCarteVersWalletUser: RetraitCarteVersWalletUser, linkCard: LinkCard,
linkCard: LinkCard, epargnerArgentUser: EpargnerArgentUser,
epargnerArgentUser: EpargnerArgentUser, createGroupNanoCredit: CreateGroupNanoCredit,
createGroupNanoCredit: CreateGroupNanoCredit, groupNanoCredit: {
groupNanoCredit: { screen: createBottomTabNavigator({
screen: createBottomTabNavigator({ demandeValidationGroupe: {
demandeValidationGroupe: { screen: DemandValidationGroup,
screen: DemandValidationGroup, navigationOptions: {
navigationOptions: { tabBarLabel: I18n.t('DEMAND_VALIDATION_GROUP_RECEIVE'),
tabBarLabel: I18n.t('DEMAND_VALIDATION_GROUP_RECEIVE'), tabBarIcon: ({focused, horizontal, tintColor}) => {
tabBarIcon: ({ focused, horizontal, tintColor }) => { return (<Icon
return (<Icon size={20}
size={20} name={"users-cog"}
name={"users-cog"} color={focused ? tintColor : "grey"}
color={focused ? tintColor : "grey"} />)
/>) }
}
}
},
myNanoCreditGroup: {
screen: MyNanoCreditGroup,
navigationOptions: {
tabBarLabel: I18n.t('MY_GROUP'),
tabBarIcon: ({ focused, horizontal, tintColor }) => {
return (<Icon
size={20}
name={"users"}
color={focused ? tintColor : "grey"}
/>)
}
}
},
}, {
headerMode: "none",
header: null,
headerTitle: null,
title: I18n.t('MANAGE_GROUP'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
},
} }
}), },
navigationOptions: () => ({ myNanoCreditGroup: {
header: null, screen: MyNanoCreditGroup,
headerMode: 'none', navigationOptions: {
headerTitle: null, tabBarLabel: I18n.t('MY_GROUP'),
activeColor: '#f0edf6', tabBarIcon: ({focused, horizontal, tintColor}) => {
inactiveColor: '#3e2465', return (<Icon
barStyle: { backgroundColor: '#694fad' }, size={20}
name={"users"}
color={focused ? tintColor : "grey"}
/>)
}
}
},
}, {
headerMode: "none",
header: null,
headerTitle: null,
title: I18n.t('MANAGE_GROUP'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
},
}
}),
navigationOptions: () => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: {backgroundColor: '#694fad'},
drawerLabel: I18n.t('MANAGE_GROUP'), drawerLabel: I18n.t('MANAGE_GROUP'),
drawerIcon: ({ tintColor }) => ( drawerIcon: ({tintColor}) => (
<Icon <Icon
name={'account-multiple'} name={'account-multiple'}
size={24} size={24}
/>) />)
}), }),
}, },
demandeValidationGroupe: DemandGroupNanoCreditDetail, demandeValidationGroupe: DemandGroupNanoCreditDetail,
adhererGroupNanoCredit: AdhererGroupNanoCredit, adhererGroupNanoCredit: AdhererGroupNanoCredit,
askNanoCredit: AskNanoCredit, askNanoCredit: AskNanoCredit,
refundNanoCreditUser: RefundNanoCreditUser, refundNanoCreditUser: RefundNanoCreditUser,
casserEpargneUser: CasserEpargneUser casserEpargneUser: CasserEpargneUser
}) })
}, { }, {
contentComponent: OptionsMenu, contentComponent: OptionsMenu,
headerMode: 'none', headerMode: 'none',
contentOptions: { activeTintColor: theme.accent } contentOptions: {activeTintColor: theme.accent}
}) })
const AppAgentStack = createDrawerNavigator({ const AppAgentStack = createDrawerNavigator({
sta: createStackNavigator({ sta: createStackNavigator({
home: Home, home: Home,
useraccount: UserAccount, useraccount: UserAccount,
walletSelect: WalletSelect, walletSelect: WalletSelect,
createIdentification: CreateIdentification, createIdentification: CreateIdentification,
validateIdentification: ValidateIdentification, validateIdentification: ValidateIdentification,
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: {
fontSize: 13, fontSize: 13,
fontWeight: "bold" fontWeight: "bold"
}, },
} }
}), }),
navigationOptions: () => ({ navigationOptions: () => ({
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'},
/* headerLeft: (<HeaderBackButton />), */ /* headerLeft: (<HeaderBackButton />), */
drawerLabel: I18n.t('CREDIT_MANAGE'), drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => ( drawerIcon: ({tintColor}) => (
<Icon <Icon
name={'credit-card'} name={'credit-card'}
size={24} size={24}
/>) />)
}), }),
}, },
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,
walletDetail: WalletDetail, walletDetail: WalletDetail,
walletDepot: WalletDepot, walletDepot: WalletDepot,
walletRetrait: WalletRetrait, walletRetrait: WalletRetrait,
walletOptionSelect: WalletOptionSelect, walletOptionSelect: WalletOptionSelect,
operateurOptionSelect: OperateurOptionSelect, operateurOptionSelect: OperateurOptionSelect,
paiementFacture: PaiementFacture, paiementFacture: PaiementFacture,
retraitEnCashAgent: RetraitEnCashAgent, retraitEnCashAgent: RetraitEnCashAgent,
retraitCarteVersCashAgent: RetraitCarteVersCashAgent, retraitCarteVersCashAgent: RetraitCarteVersCashAgent,
envoieCashVersWalletAgent: EnvoieCashVersWalletAgent, envoieCashVersWalletAgent: EnvoieCashVersWalletAgent,
envoieCashVersAutreWalletAgent: EnvoieCashVersAutreWalletAgent, envoieCashVersAutreWalletAgent: EnvoieCashVersAutreWalletAgent,
envoieCashVersCarteAgent: EnvoieCashVersCarteAgent, envoieCashVersCarteAgent: EnvoieCashVersCarteAgent,
envoiCashVersCashAgent: EnvoiCashVersCashAgent, envoiCashVersCashAgent: EnvoiCashVersCashAgent,
envoieWalletToBankAgent: EnvoieWalletToBankAgent, envoieWalletToBankAgent: EnvoieWalletToBankAgent,
createGroupNanoCredit: CreateGroupNanoCredit, createGroupNanoCredit: CreateGroupNanoCredit,
cautionNanoCreditAgent: CautionNanoCreditAgent, cautionNanoCreditAgent: CautionNanoCreditAgent,
}) })
}, { }, {
contentComponent: OptionsMenu, contentComponent: OptionsMenu,
backBehavior: "none", backBehavior: "none",
lazy: false, lazy: false,
headerMode: 'none', contentOptions: { activeTintColor: theme.accent } headerMode: 'none', contentOptions: {activeTintColor: theme.accent}
}); });
const AppAdministratorStack = createDrawerNavigator({ const AppAdministratorStack = createDrawerNavigator({
sta: createStackNavigator({ sta: createStackNavigator({
home: Home, home: Home,
useraccount: UserAccount, useraccount: UserAccount,
walletSelect: WalletSelect, walletSelect: WalletSelect,
Historique: { Historique: {
screen: createBottomTabNavigator({ screen: createBottomTabNavigator({
myDemand: MyHistory, OthersDemand: MyHistory myDemand: MyHistory, OthersDemand: MyHistory
}, { }, {
headerMode: "none", headerMode: "none",
header: null, header: null,
headerTitle: null, headerTitle: null,
title: I18n.t('CREDIT_MANAGE'), title: I18n.t('CREDIT_MANAGE'),
tabBarOptions: { tabBarOptions: {
labelStyle: { labelStyle: {
fontSize: 13, fontSize: 13,
}, },
} }
}), }),
navigationOptions: () => ({ navigationOptions: () => ({
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'},
drawerLabel: I18n.t('CREDIT_MANAGE'), drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => ( drawerIcon: ({tintColor}) => (
<Icon <Icon
name={'credit-card'} name={'credit-card'}
size={24} size={24}
/>) />)
}), }),
}, },
creditrequest: HistoryRequester, creditrequest: HistoryRequester,
historyItemDetails: HistoryItemDetails, historyItemDetails: HistoryItemDetails,
superviseurgroup: SuperViseurGroupeHome, superviseurgroup: SuperViseurGroupeHome,
notificationview: Notifications, notificationview: Notifications,
configuration: Configurations, configuration: Configurations,
about: About, about: About,
walletDetail: WalletDetail, walletDetail: WalletDetail,
walletDepot: WalletDepot, walletDepot: WalletDepot,
walletRetrait: WalletRetrait walletRetrait: WalletRetrait
}) })
}, },
{ {
contentComponent: OptionsMenu, contentComponent: OptionsMenu,
backBehavior: "none", backBehavior: "none",
headerMode: 'none' headerMode: 'none'
}); });
const AppSuperAdministrator = createDrawerNavigator({ const AppSuperAdministrator = createDrawerNavigator({
sta: createStackNavigator({ sta: createStackNavigator({
home: Home, home: Home,
useraccount: UserAccount, useraccount: UserAccount,
walletSelect: WalletSelect, walletSelect: WalletSelect,
Historique: { Historique: {
screen: createBottomTabNavigator({ OthersDemand: MyHistory }, { screen: createBottomTabNavigator({OthersDemand: MyHistory}, {
headerMode: "none", headerMode: "none",
header: null, header: null,
headerTitle: null, headerTitle: null,
title: I18n.t('CREDIT_MANAGE'), title: I18n.t('CREDIT_MANAGE'),
tabBarOptions: { tabBarOptions: {
labelStyle: { labelStyle: {
fontSize: 13, fontSize: 13,
fontWeight: "bold" fontWeight: "bold"
}, },
} }
}), }),
navigationOptions: () => ({ navigationOptions: () => ({
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'}
size={24} size={24}
/>) />)
}), }),
}, },
creditrequest: HistoryRequester, creditrequest: HistoryRequester,
historyItemDetails: HistoryItemDetails, historyItemDetails: HistoryItemDetails,
superviseurgroup: SuperViseurGroupeHome, superviseurgroup: SuperViseurGroupeHome,
notificationview: Notifications, notificationview: Notifications,
configuration: Configurations, configuration: Configurations,
about: About, about: About,
walletDetail: WalletDetail, walletDetail: WalletDetail,
walletDepot: WalletDepot, walletDepot: WalletDepot,
walletRetrait: WalletRetrait walletRetrait: WalletRetrait
}) })
}, { }, {
contentComponent: OptionsMenu, contentComponent: OptionsMenu,
backBehavior: "none", backBehavior: "none",
headerMode: 'none' headerMode: 'none'
}); });
export const AppNavigator = createSwitchNavigator({ 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);
class App extends React.Component { class App extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
console.log("APP PROPS", this.props); console.log("APP PROPS", this.props);
global.appHasLoaded = false; global.appHasLoaded = false;
//Remove this method to stop OneSignal Debugging //Remove this method to stop OneSignal Debugging
OneSignal.setLogLevel(6, 0); OneSignal.setLogLevel(6, 0);
IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
// Replace 'YOUR_ONESIGNAL_APP_ID' with your OneSignal App ID.
OneSignal.init("e8e7251f-713d-4658-9510-86d877fa6a7c", {
kOSSettingsKeyAutoPrompt: false,
kOSSettingsKeyInAppLaunchURL: false,
kOSSettingsKeyInFocusDisplayOption: 2
});
OneSignal.inFocusDisplaying(2); // Controls what should happen if a notification is received while the app is open. 2 means that the notification will go directly to the device's notification center.
// Replace 'YOUR_ONESIGNAL_APP_ID' with your OneSignal App ID. // The promptForPushNotifications function code will show the iOS push notification prompt. We recommend removing the following code and instead using an In-App Message to prompt for notification permission (See step below)
OneSignal.init("e8e7251f-713d-4658-9510-86d877fa6a7c", { kOSSettingsKeyAutoPrompt: false, kOSSettingsKeyInAppLaunchURL: false, kOSSettingsKeyInFocusDisplayOption: 2 }); OneSignal.promptForPushNotificationsWithUserResponse(myiOSPromptCallback);
OneSignal.inFocusDisplaying(2); // Controls what should happen if a notification is received while the app is open. 2 means that the notification will go directly to the device's notification center.
// The promptForPushNotifications function code will show the iOS push notification prompt. We recommend removing the following code and instead using an In-App Message to prompt for notification permission (See step below) OneSignal.addEventListener('received', this.onReceived);
OneSignal.promptForPushNotificationsWithUserResponse(myiOSPromptCallback); OneSignal.addEventListener('opened', this.onOpened);
OneSignal.addEventListener('ids', this.onIds);
}
OneSignal.addEventListener('received', this.onReceived); updateLangue() {
OneSignal.addEventListener('opened', this.onOpened); this.forceUpdate()
OneSignal.addEventListener('ids', this.onIds); }
}
_getOneSignalIds = () => { _getOneSignalIds = () => {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {
const getElement = await AsyncStorage.getItem('@config:onesignalIds'); const getElement = await AsyncStorage.getItem('@config:onesignalIds');
resolve(getElement); resolve(getElement);
} catch (error) { } catch (error) {
reject(error); reject(error);
} }
}); });
} }
_saveOneSignalIds = async (ids) => { _saveOneSignalIds = async (ids) => {
try { try {
await AsyncStorage.setItem('@config:onesignalIds', ids); await AsyncStorage.setItem('@config:onesignalIds', ids);
} catch (error) { } catch (error) {
console.warn(error); console.warn(error);
} }
} }
goToScreen = (routeName, params, isReset = true) => { goToScreen = (routeName, params, isReset = true) => {
const { navigator } = this.refs; const {navigator} = this.refs;
if (typeof navigator !== 'undefined') { if (typeof navigator !== 'undefined') {
console.log("APP HAS LOADED", global.appHasLoaded); console.log("APP HAS LOADED", global.appHasLoaded);
if (global.appHasLoaded) { if (global.appHasLoaded) {
navigator.dispatch({ navigator.dispatch({
type: "Navigation/NAVIGATE", type: "Navigation/NAVIGATE",
routeName, routeName,
params params
}); });
/* readUser().then((result) => { /* readUser().then((result) => {
if (result === null || result === undefined) { if (result === null || result === undefined) {
console.warn("APP HAS LOADED NOTIFICATION PARAMS", params); console.warn("APP HAS LOADED NOTIFICATION PARAMS", params);
navigator.dispatch({ navigator.dispatch({
type: "Navigation/NAVIGATE", type: "Navigation/NAVIGATE",
routeName: "first", routeName: "first",
params: { routeName, params } params: { routeName, params }
}); });
} else { } else {
navigator.dispatch({ navigator.dispatch({
type: "Navigation/NAVIGATE", type: "Navigation/NAVIGATE",
routeName, routeName,
params params
}); });
} }
}); */ }); */
} else { } else {
navigator.dispatch({ navigator.dispatch({
type: "Navigation/NAVIGATE", type: "Navigation/NAVIGATE",
routeName: "first", routeName: "first",
params: { routeName, params } params: {routeName, params}
}); });
} }
} }
}; };
handleDeepLink = (openResult) => { handleDeepLink = (openResult) => {
const data = openResult.notification.payload.additionalData; const data = openResult.notification.payload.additionalData;
//const dataParse = data.replace("'", "\""); //const dataParse = data.replace("'", "\"");
console.warn("HANDLE DEEP LINK", data); console.warn("HANDLE DEEP LINK", data);
switch (data.screen) { switch (data.screen) {
case 'historyItemDetails': case 'historyItemDetails':
console.log("History Item"); console.log("History Item");
this.goToScreen(data.screen, { this.goToScreen(data.screen, {
item: data.data item: data.data
}); });
break; break;
default: default:
console.log("Not History Item"); console.log("Not History Item");
this.goToScreen(data.screen, { this.goToScreen(data.screen, {
id: data.data.id id: data.data.id
}); });
break; break;
} }
/* if (data && data.id) { /* if (data && data.id) {
this.goToScreen(data.screen, { this.goToScreen(data.screen, {
id: data.id, id: data.id,
goToScreen: this.goToScreen goToScreen: this.goToScreen
}); });
} else { } else {
console.log("notification is invalid data"); console.log("notification is invalid data");
} */ } */
}; };
componentWillUnmount() { componentWillUnmount() {
OneSignal.removeEventListener('received', this.onReceived); OneSignal.removeEventListener('received', this.onReceived);
OneSignal.removeEventListener('opened', this.onOpened); OneSignal.removeEventListener('opened', this.onOpened);
OneSignal.removeEventListener('ids', this.onIds); OneSignal.removeEventListener('ids', this.onIds);
} }
onReceived(notification) { onReceived(notification) {
console.log("Notification received: ", notification); console.log("Notification received: ", notification);
} }
onOpened = (openResult) => { onOpened = (openResult) => {
let data = openResult.notification.payload.additionalData; let data = openResult.notification.payload.additionalData;
this.handleDeepLink(openResult); this.handleDeepLink(openResult);
console.log('Message: ', openResult.notification.payload.body); console.log('Message: ', openResult.notification.payload.body);
console.log('Data: ', openResult.notification.payload.additionalData); console.log('Data: ', openResult.notification.payload.additionalData);
console.log('isActive: ', openResult.notification.isAppInFocus); console.log('isActive: ', openResult.notification.isAppInFocus);
console.log('openResult: ', openResult); console.log('openResult: ', openResult);
} }
render() { render() {
return ( return (
<Provider store={store}> <Provider store={store}>
<PersistGate persistor={persistor}> <PersistGate persistor={persistor}>
<ActionSheetProvider> <ActionSheetProvider>
<AppContainer ref="navigator" /> <AppContainer ref="navigator"/>
</ActionSheetProvider> </ActionSheetProvider>
</PersistGate> </PersistGate>
</Provider> </Provider>
); );
} }
} }
function myiOSPromptCallback(permission) { function myiOSPromptCallback(permission) {
// do something with permission value // do something with permission value
} }
export default App; export default App;
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
backgroundColor: '#F5FCFF', backgroundColor: '#F5FCFF',
}, },
welcome: { welcome: {
fontSize: 20, fontSize: 20,
textAlign: 'center', textAlign: 'center',
margin: 10, margin: 10,
}, },
instructions: { instructions: {
textAlign: 'center', textAlign: 'center',
color: '#333333', color: '#333333',
marginBottom: 5, marginBottom: 5,
}, },
}); });

File diff suppressed because one or more lines are too long

View File

@ -159,7 +159,9 @@
"DEPOSIT_TO_BANK": "Your Wallet to bank", "DEPOSIT_TO_BANK": "Your Wallet to bank",
"NANO_CREDIT": "Nano credit", "NANO_CREDIT": "Nano credit",
"NANO_CREDIT_LIST": "Nano credit list", "NANO_CREDIT_LIST": "Nano credit list",
"SAVINGS_LIST": "Savings list",
"NO_NANO_CREDIT": "No nano credit demand", "NO_NANO_CREDIT": "No nano credit demand",
"NO_SAVINGS": "No savings",
"NANO_CREDIT_DESCRIPTION": "Nano credit description", "NANO_CREDIT_DESCRIPTION": "Nano credit description",
"NANO_SANTE": "Nano health", "NANO_SANTE": "Nano health",
"NANO_SANTE_DESCRIPTION": "Nano health description", "NANO_SANTE_DESCRIPTION": "Nano health description",
@ -172,6 +174,8 @@
"CAUTION_CREDIT": "Caution credit demand", "CAUTION_CREDIT": "Caution credit demand",
"CAUTIONNEMENT_DONE": "Caution done", "CAUTIONNEMENT_DONE": "Caution done",
"ID_DEMAND": "Demand ID", "ID_DEMAND": "Demand ID",
"ID_SAVINGS": "Saving ID",
"NON_APPLICABLE": "Not applicable",
"DATE": "Date", "DATE": "Date",
"PAIEMENT_EAU_ELECTRICITY": "Water bill", "PAIEMENT_EAU_ELECTRICITY": "Water bill",
"PAIEMENT_ELECTRICITY": "Electricity bill", "PAIEMENT_ELECTRICITY": "Electricity bill",
@ -182,6 +186,7 @@
"DATE_REMBOURSEMENT_PREVU": "Expected refund date", "DATE_REMBOURSEMENT_PREVU": "Expected refund date",
"DATE_REMBOURSEMENT": "Refund date", "DATE_REMBOURSEMENT": "Refund date",
"AMOUNT_REFUND": "Amount reimbursed", "AMOUNT_REFUND": "Amount reimbursed",
"AMOUNT_WITHDRAWAL": "Amount withdrawal",
"AMOUNT_PARTIALLY_REFUND": "Amount partially refunded", "AMOUNT_PARTIALLY_REFUND": "Amount partially refunded",
"FINAL_DATE": "End date", "FINAL_DATE": "End date",
"CASSATION_DATE": "Cassation date", "CASSATION_DATE": "Cassation date",

View File

@ -166,7 +166,9 @@
"DEPOSIT_TO_BANK": "Votre Wallet vers banque", "DEPOSIT_TO_BANK": "Votre Wallet vers banque",
"NANO_CREDIT": "Nano crédit", "NANO_CREDIT": "Nano crédit",
"NANO_CREDIT_LIST": "Liste des nano crédit", "NANO_CREDIT_LIST": "Liste des nano crédit",
"SAVINGS_LIST": "Liste des épargnes",
"NO_NANO_CREDIT": "Aucune demande de nano crédit", "NO_NANO_CREDIT": "Aucune demande de nano crédit",
"NO_SAVINGS": "Aucune épargne",
"NANO_CREDIT_DESCRIPTION": "Nano crédit iLink", "NANO_CREDIT_DESCRIPTION": "Nano crédit iLink",
"NANO_SANTE": "Nano santé", "NANO_SANTE": "Nano santé",
"NANO_SANTE_DESCRIPTION": "Nano santé iLink", "NANO_SANTE_DESCRIPTION": "Nano santé iLink",
@ -179,16 +181,19 @@
"CAUTION_CREDIT": "Cautionner une demande de crédit", "CAUTION_CREDIT": "Cautionner une demande de crédit",
"CAUTIONNEMENT_DONE": "Cautionnement effectué", "CAUTIONNEMENT_DONE": "Cautionnement effectué",
"ID_DEMAND": "Identifiant de la demande", "ID_DEMAND": "Identifiant de la demande",
"ID_SAVINGS": "Identifiant de l'épargne",
"PAIEMENT_EAU": "Paiement eau", "PAIEMENT_EAU": "Paiement eau",
"PAIEMENT_ELECTRICITY": "Paiement électricité", "PAIEMENT_ELECTRICITY": "Paiement électricité",
"PAIEMENT_ECOLE": "Paiement école", "PAIEMENT_ECOLE": "Paiement école",
"PAIEMENT_CREDIT_TELEPHONIQUE": "Paiement crédit téléphonique", "PAIEMENT_CREDIT_TELEPHONIQUE": "Paiement crédit téléphonique",
"PAIEMENT_ABONNEMENT_TV": "Paiement abonnement TV", "PAIEMENT_ABONNEMENT_TV": "Paiement abonnement TV",
"NON_APPLICABLE": "Non applicable",
"DATE": "Date", "DATE": "Date",
"DEMAND_DATE": "Date de la demande", "DEMAND_DATE": "Date de la demande",
"DATE_REMBOURSEMENT_PREVU": "Date de remboursement prévu", "DATE_REMBOURSEMENT_PREVU": "Date de remboursement prévu",
"DATE_REMBOURSEMENT": "Date de remboursement", "DATE_REMBOURSEMENT": "Date de remboursement",
"AMOUNT_REFUND": "Montant remboursé", "AMOUNT_REFUND": "Montant remboursé",
"AMOUNT_WITHDRAWAL": "Montant retiré",
"AMOUNT_PARTIALLY_REFUND": "Montant partiellement remboursé", "AMOUNT_PARTIALLY_REFUND": "Montant partiellement remboursé",
"FINAL_DATE": "Date de fin", "FINAL_DATE": "Date de fin",
"CASSATION_DATE": "Date de cassation", "CASSATION_DATE": "Date de cassation",
@ -216,8 +221,8 @@
"DEPOSIT_TRANSACTION_HISTORY_DESCRIPTION": "Dépôt de", "DEPOSIT_TRANSACTION_HISTORY_DESCRIPTION": "Dépôt de",
"NO_WALLET_HISTORY": "Aucune transaction à ce jour", "NO_WALLET_HISTORY": "Aucune transaction à ce jour",
"DEMAND_SEND": "Demande envoyé", "DEMAND_SEND": "Demande envoyé",
"EPARGNE_DEPOSE": "Epargne déposé", "EPARGNE_DEPOSE": "Epargne déposée",
"BREAK_EPARGNE_DONE": "Epargne cassé avec succès", "BREAK_EPARGNE_DONE": "Epargne cassée avec succès",
"BREAK_EPARGNE": "Casser mon épargne", "BREAK_EPARGNE": "Casser mon épargne",
"ID_EPARGNE": "Identifiant de l'épargne", "ID_EPARGNE": "Identifiant de l'épargne",
"NO_DEMAND_CREATION_GROUP": "Aucune demande de création de groupe", "NO_DEMAND_CREATION_GROUP": "Aucune demande de création de groupe",

View File

@ -1,89 +1,90 @@
import React, { Component } from 'react' import React from 'react'
import { StyleSheet, Text, View, Alert, Platform, StatusBar } from 'react-native' import {Platform, StatusBar, StyleSheet, Text, View} from 'react-native'
import BaseScreen from "../BaseScreen"; import BaseScreen from "../BaseScreen";
import { responsiveWidth, responsiveHeight } from 'react-native-responsive-dimensions' import {responsiveWidth} from 'react-native-responsive-dimensions'
import { Dropdown } from 'react-native-material-dropdown' import {Dropdown} from 'react-native-material-dropdown'
import { disconnect } from './../../webservice/AuthApi' import I18n from 'react-native-i18n'
import Configuration from "../../webservice/persistences/Configuration";
import {IlinkEmitter} from "./../../utils/events"
import Icon from 'react-native-vector-icons/MaterialIcons';
import {SafeAreaView} from 'react-navigation';
const theme = require('./../../utils/theme.json'); const theme = require('./../../utils/theme.json');
const route = require('./../../route.json') const route = require('./../../route.json')
import I18n, { getLanguages } from 'react-native-i18n'
import Configuration from "../../webservice/persistences/Configuration";
import Button from "apsl-react-native-button"
require("./../../utils/Translations") require("./../../utils/Translations")
import { IlinkEmitter } from "./../../utils/events"
import { Header } from "react-native-elements";
import Icon from 'react-native-vector-icons/MaterialIcons';
import { SafeAreaView } from 'react-navigation';
export default class Configurations extends BaseScreen { 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) {
super(props, true)
this.state = this.initState()
this.configuration = new Configuration();
if (Platform.OS === 'android') {
SafeAreaView.setStatusBarHeight(StatusBar.currentHeight);
}
}
initState() { constructor(props) {
let language = []; super(props, true)
language.push({ name: I18n.t('langue.english'), value: 'en' }); this.state = this.initState()
language.push({ name: I18n.t('langue.french'), value: 'fr' }); this.configuration = new Configuration();
if (Platform.OS === 'android') {
SafeAreaView.setStatusBarHeight(StatusBar.currentHeight);
}
}
return { initState() {
languages: language let language = [];
} language.push({name: I18n.t('langue.english'), value: 'en'});
language.push({name: I18n.t('langue.french'), value: 'fr'});
} return {
render() { languages: language
console.log(this.state) }
return (<View style={styles.container}>
<View }
style={{
width: responsiveWidth(90), render() {
marginTop: 20, console.log(this.state)
alignSelf: 'center', return (<View style={styles.container}>
borderRadius: 10,
paddingLeft: 20, <View
paddingRight: 20, style={{
backgroundColor: 'white' width: responsiveWidth(90),
marginTop: 20,
alignSelf: 'center',
borderRadius: 10,
paddingLeft: 20,
paddingRight: 20,
backgroundColor: 'white'
}}
>
<Text style={{fontSize: 17,}}>{I18n.t("CHOOSE_LANGUAGE")}</Text>
<Dropdown
label={I18n.t("CHANGE_LANG_LABEL")}
data={this.state.languages}
onChangeText={(value, index, data) => {
I18n.locale = value
this.setState({language: value})
this.configuration.setCurrentLangue(data[index])
IlinkEmitter.emit('langueChange')
}} }}
valueExtractor={(value) => value.value}
labelExtractor={(value) => value.name}
/>
> </View>
</View>);
<Text style={{ fontSize: 17, }}>{I18n.t("CHOOSE_LANGUAGE")}</Text> }
<Dropdown
label={I18n.t("CHANGE_LANG_LABEL")}
data={this.state.languages}
onChangeText={(value, index, data) => {
I18n.locale = value
this.setState({ language: value })
this.configuration.setCurrentLangue(data[index])
IlinkEmitter.emit('langueChange')
}}
valueExtractor={(value) => value.value}
labelExtractor={(value) => value.name}
/>
</View>
</View>);
}
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
backgroundColor: 'white', backgroundColor: 'white',
}, },
}) })

View File

@ -123,7 +123,7 @@ export default class SuperViseurGroupeHome extends BaseScreen {
} }
}) })
IlinkEmitter.on("langueChange", this.updateLangue.bind(this)) IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb"; this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale); moment.locale(this.currentLocale);
} }

View File

@ -4,20 +4,17 @@ import {responsiveFontSize, responsiveWidth} from 'react-native-responsive-dimen
import Icon from 'react-native-vector-icons/FontAwesome5'; import Icon from 'react-native-vector-icons/FontAwesome5';
import I18n from "react-native-i18n" import I18n from "react-native-i18n"
import 'moment/locale/fr' import 'moment/locale/fr';
import 'moment/locale/es-us' import 'moment/locale/es-us';
import 'moment/locale/en-au' import 'moment/locale/en-au';
import 'moment/locale/en-ca' import 'moment/locale/en-ca';
import 'moment/locale/en-ie' 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';
import 'moment/locale/en-gb'
import DeviceInfo from 'react-native-device-info'
import {Color} from '../../config/Color'; import {Color} from '../../config/Color';
var moment = require('moment-timezone') let moment = require('moment-timezone');
const momentJS = require('moment') const momentJS = require('moment');
let route = require('./../../route.json'); let route = require('./../../route.json');
var theme = require('./../../utils/theme.json'); var theme = require('./../../utils/theme.json');
@ -26,6 +23,9 @@ export class HistoryItem extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-us";
console.log("Current Locale item", this.currentLocale);
moment.locale(this.currentLocale);
this.state = this.initState(); this.state = this.initState();
} }
@ -75,8 +75,6 @@ export class HistoryItem extends React.Component {
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;
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale);
var re = moment.tz(this.props.selfData.date_creation, moment.tz.guess()).format(); var re = moment.tz(this.props.selfData.date_creation, moment.tz.guess()).format();
re = moment(re) re = moment(re)
return { return {
@ -134,6 +132,8 @@ export class HistoryItemSectionned extends PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = this.initState(); this.state = this.initState();
this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-us";
moment.locale(this.currentLocale);
} }
render() { render() {
@ -246,6 +246,8 @@ export class HistoryListItem extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = this.initState(); this.state = this.initState();
this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-us";
moment.locale(this.currentLocale);
} }
initState() { initState() {

View File

@ -6,7 +6,6 @@ import {responsiveWidth} from 'react-native-responsive-dimensions'
import Icons from 'react-native-vector-icons/Ionicons' import Icons from 'react-native-vector-icons/Ionicons'
import {readUser} from "../../webservice/AuthApi"; import {readUser} from "../../webservice/AuthApi";
import isNil from 'lodash/isNil'; import isNil from 'lodash/isNil';
import I18n from "react-native-i18n";
import {creditDemandResetReducer, treatCreditDemand} from '../../webservice/CreditTreatDemandApi'; import {creditDemandResetReducer, treatCreditDemand} from '../../webservice/CreditTreatDemandApi';
import {creditCancelResetReducer, treatCancelDemand} from '../../webservice/CreditCancelDemandeApi'; import {creditCancelResetReducer, treatCancelDemand} from '../../webservice/CreditCancelDemandeApi';
import {getAgentNetworksList} from "../../webservice/NetworkApi"; import {getAgentNetworksList} from "../../webservice/NetworkApi";
@ -16,11 +15,21 @@ import Toast from 'react-native-root-toast';
import {Color} from '../../config/Color' import {Color} from '../../config/Color'
import Dialog from "react-native-dialog"; import Dialog from "react-native-dialog";
import {FontWeight} from '../../config/typography' import {FontWeight} from '../../config/typography'
import DeviceInfo from 'react-native-device-info' import I18n from "react-native-i18n";
import 'moment/locale/fr';
import 'moment/locale/es-us';
import 'moment/locale/en-au';
import 'moment/locale/en-ca';
import 'moment/locale/en-ie';
import 'moment/locale/en-il';
import 'moment/locale/en-nz';
let moment = require('moment-timezone');
const momentJS = require('moment');
let typesta = 0; let typesta = 0;
let moment = require('moment-timezone')
var colorback = 'white' var colorback = 'white'
let theme = require('./../../utils/theme.json'); let theme = require('./../../utils/theme.json');
@ -52,7 +61,10 @@ class HistoryItemDetails extends Component {
} else { } else {
this.item = this.props.navigation.getParam("item", null).item; this.item = this.props.navigation.getParam("item", null).item;
} }
console.log('HISTORY ITEM PROPS', this.props);
this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-us";
moment.locale(this.currentLocale);
let sta = '' let sta = ''
if (this.item.status === '1') { if (this.item.status === '1') {
typesta = 1 typesta = 1
@ -87,9 +99,6 @@ class HistoryItemDetails extends Component {
this.setState({user: user, networks: networks.networks}) this.setState({user: user, networks: networks.networks})
}); });
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale);
} }
isNormalInteger = (str) => { isNormalInteger = (str) => {

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@ import {IlinkEmitter} from '../../utils/events';
import {readUser} from '../../webservice/AuthApi'; import {readUser} from '../../webservice/AuthApi';
import {getEpargneInProgressAction, getEpargneInProgressReset} from '../../webservice/NanoCreditApi'; import {getEpargneInProgressAction, getEpargneInProgressReset} from '../../webservice/NanoCreditApi';
import {casserEpargneUserAction, casserEpargneUserReset} from '../../webservice/user/NanoCreditApi'; import {casserEpargneUserAction, casserEpargneUserReset} from '../../webservice/user/NanoCreditApi';
import {cutStringWithoutDot, displayTransactionType, nanoCreditHistoryLabel} from "../../utils/UtilsFunction"; import {cutStringWithoutDot, nanoCreditHistoryLabel} from "../../utils/UtilsFunction";
import * as Utils from "../../utils/DeviceUtils"; import * as Utils from "../../utils/DeviceUtils";
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import thousands from "thousands"; import thousands from "thousands";
@ -195,16 +195,7 @@ class CasserEpargneUser extends Component {
<View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}> <View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
<View style={{flexDirection: 'row', marginTop: 10}}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>Type</Text> <Text style={[styles.body2]}>{I18n.t('ID_SAVINGS')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{I18n.t(displayTransactionType(this.state.historyItemDetail.type_historique))}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text>
</View> </View>
<View style={{flex: 1, alignItems: 'flex-end'}}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text <Text
@ -289,7 +280,7 @@ class CasserEpargneUser extends Component {
</View> </View>
<View style={{flex: 1, alignItems: 'flex-end'}}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_fin}</Text> style={[Typography.caption1, Color.grayColor]}>{ isEqual(this.state.historyItemDetail.type, 'SIMPLE') ? I18n.t('NON_APPLICABLE') : this.state.historyItemDetail.date_fin}</Text>
</View> </View>
</View> </View>
<View style={{flexDirection: 'row', marginTop: 10}}> <View style={{flexDirection: 'row', marginTop: 10}}>
@ -378,7 +369,7 @@ class CasserEpargneUser extends Component {
this.setState({displayModalHistory: true, historyItemDetail: item}) this.setState({displayModalHistory: true, historyItemDetail: item})
}} style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}> }} style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
{ {
Object.keys(omit(item, ['id', 'id_epargne', 'date_demande', 'date_fin', 'date_remboursement_prevu', 'date_validation', 'date_cassation', 'date_remboursement', 'id_demande', 'duree_mois', 'taxe', '', 'date_fin', 'date_cassation', 'id_user', 'id_network', 'user', 'partiellement_rembourse', 'user_phone', 'interet', 'date_remboursement_prevu', 'date_remboursement', 'id_wallet_agent', 'retrait_cash', 'codeParrain', 'agent', 'montant_rembourse', ''])).map((element, i) => ( Object.keys(omit(item, ['id', 'id_epargne', 'montant_retire', 'date_demande', 'date_fin', 'date_remboursement_prevu', 'date_validation', 'date_cassation', 'date_remboursement', 'id_demande', 'duree_mois', 'taxe', '', 'date_fin', 'date_cassation', 'id_user', 'id_network', 'user', 'partiellement_rembourse', 'user_phone', 'interet', 'date_remboursement_prevu', 'date_remboursement', 'id_wallet_agent', 'retrait_cash', 'codeParrain', 'agent', 'montant_rembourse', ''])).map((element, i) => (
<View style={{alignItems: 'center'}} key={i}> <View style={{alignItems: 'center'}} key={i}>
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}> <Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
@ -443,7 +434,7 @@ class CasserEpargneUser extends Component {
) : ) :
( (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'flex-start'}}> <View style={{flex: 1, justifyContent: 'center', alignItems: 'flex-start'}}>
<Text style={Typography.body1}>{I18n.t('NO_NANO_CREDIT')}</Text> <Text style={Typography.body1}>{I18n.t('NO_SAVINGS')}</Text>
</View> </View>
) )
) )

View File

@ -1,30 +1,19 @@
import React from 'react';
import React, { Component } from 'react';
import { import {
Alert, Animated,
Platform, AppState,
StyleSheet, Platform,
AppState, ProgressBarAndroid,
FlatList, StatusBar,
ProgressBarAndroid, StyleSheet,
TouchableOpacity, Text,
Text, TouchableOpacity,
View, View
Animated,
StatusBar
} from 'react-native'; } from 'react-native';
import ActionButton from 'react-native-action-button'; import ActionButton from 'react-native-action-button';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import { responsiveFontSize, responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'; import {responsiveFontSize, responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
import { HistoryListItem, HistoryItemSectionned } from '../history-request/HistoryItem'; import {readUser} from "../../webservice/AuthApi";
import { credrequester } from './../../route.json';
import { loadDemandeCredit, loadMyDemandeCredit } from './../../webservice/HistoryRequestApi';
import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
import BaseScreen from './../../screens/BaseScreen'
import Button from 'apsl-react-native-button'
import { readUser } from "../../webservice/AuthApi";
import Calendar from 'react-native-calendario';
let route = require('./../../route.json')
import 'moment'; import 'moment';
import 'moment/locale/fr' import 'moment/locale/fr'
import 'moment/locale/es-us' import 'moment/locale/es-us'
@ -35,457 +24,469 @@ import 'moment/locale/en-il'
import 'moment/locale/en-nz' import 'moment/locale/en-nz'
import 'moment/locale/en-gb' import 'moment/locale/en-gb'
import moment from 'moment-timezone'; import moment from 'moment-timezone';
import {accent, primary, primaryDark, purpleLight} from './../../utils/theme.json';
import I18n from 'react-native-i18n'
import {Appbar, Provider} from 'react-native-paper';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {getNanoCreditDemandsAction, getNanoCreditDemandsReset} from '../../webservice/user/NanoCreditApi';
import {IlinkEmitter} from '../../utils/events';
import {Typography} from '../../config/typography';
import {ScrollView} from 'react-native-gesture-handler';
import {Color} from '../../config/Color';
let route = require('./../../route.json')
let theme = require('./../../utils/theme.json') let theme = require('./../../utils/theme.json')
import { primary, primaryDark, accent, purpleLight, primaryLight } from './../../utils/theme.json';
import { PagerTabIndicator, PagerTitleIndicator, PagerDotIndicator } from 'react-native-best-viewpager'
var sortIcons; var sortIcons;
var sectionIcons; var sectionIcons;
import I18n from 'react-native-i18n'
require('./../../utils/Translations') require('./../../utils/Translations')
import { SinglePickerMaterialDialog } from 'react-native-material-dialog';
import { Header } from "react-native-elements";
import { withNavigationFocus } from "react-navigation";
import IconWithBadge from "../IconWithBadge";
import { Appbar, Paragraph, Menu, Divider, Provider } from 'react-native-paper';
import DeviceInfo from 'react-native-device-info'
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { getNanoCreditDemandsAction, getNanoCreditDemandsReset } from '../../webservice/user/NanoCreditApi';
import { IlinkEmitter } from '../../utils/events';
import { Typography } from '../../config/typography';
import { ScrollView } from 'react-native-gesture-handler';
import { Color } from '../../config/Color';
import { color } from 'react-native-reanimated';
class DemandValidationGroup extends React.Component { class DemandValidationGroup extends React.Component {
constructor(props) { constructor(props) {
super(props, true); super(props, true);
this.state = { this.state = {
user: {}, user: {},
conserve: [], conserve: [],
count: 0, count: 0,
translateAnim: new Animated.Value(0), translateAnim: new Animated.Value(0),
visibleMenu: false, visibleMenu: false,
appState: AppState.currentState, appState: AppState.currentState,
filter: false, filter: false,
sortIcons: null, sortIcons: null,
panelVisible: false, panelVisible: false,
filder_disable: true, filder_disable: true,
datestartformated: 'La date de debut', datestartformated: 'La date de debut',
dateendformated: 'La date de fin', dateendformated: 'La date de fin',
datestart: null, datestart: null,
dateend: null, dateend: null,
isLoaded: false, isLoaded: false,
isSectionned: false, isSectionned: false,
isDateTimePickerVisible: false, isDateTimePickerVisible: false,
isDateEndTimePickerVisible: false, isDateEndTimePickerVisible: false,
isDataSubmit: false, isDataSubmit: false,
position: 0 position: 0
}; };
readUser().then((user) => { readUser().then((user) => {
this.setState({ user: user }); this.setState({user: user});
this.props.getNanoCreditDemandsAction(user.id); this.props.getNanoCreditDemandsAction(user.id);
}); });
IlinkEmitter.on("langueChange", this.updateLangue.bind(this)); IlinkEmitter.on("langueChange", this.updateLangue.bind(this));
this.props.getNanoCreditDemandsReset(); this.props.getNanoCreditDemandsReset();
this.navigation = this.props.navigation this.navigation = this.props.navigation
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb"; this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
//moment.locale(this.currentLocale); moment.locale(this.currentLocale);
//IlinkEmitter.on('treatNanoGroupDemand', this.refreshData); //IlinkEmitter.on('treatNanoGroupDemand', this.refreshData);
}; };
static navigatorStyle = { static navigatorStyle = {
navBarBackgroundColor: primary, navBarBackgroundColor: primary,
statusBarColor: primaryDark, statusBarColor: primaryDark,
navBarTextColor: '#FFFFFF', navBarTextColor: '#FFFFFF',
navBarButtonColor: '#FFFFFF', navBarButtonColor: '#FFFFFF',
contextualMenuStatusBarColor: theme.accent, contextualMenuStatusBarColor: theme.accent,
contextualMenuBackgroundColor: theme.accentLight, contextualMenuBackgroundColor: theme.accentLight,
contextualMenuButtonsColor: '#ffffff' contextualMenuButtonsColor: '#ffffff'
}; };
updateLangue() { updateLangue() {
this.props.navigation.setParams({ name: I18n.t('WALLET') }) this.props.navigation.setParams({name: I18n.t('WALLET')})
this.forceUpdate() this.forceUpdate()
} }
componentDidMount() {
const { routeName } = this.navigation.state
this.setState({
position: routeName === "demandeValidationGroupe" ? 0
: routeName === "myNanoCreditGroup" ? 1
: 2
});
this.animateSlidingUp(false)
} componentDidMount() {
const {routeName} = this.navigation.state
this.setState({
position: routeName === "demandeValidationGroupe" ? 0
: routeName === "myNanoCreditGroup" ? 1
: 2
});
this.animateSlidingUp(false)
componentWillUnmount() { }
clearInterval(this.intervaller)
} componentWillUnmount() {
clearInterval(this.intervaller)
}
animateSlidingUp(state = false) { animateSlidingUp(state = false) {
const height = responsiveHeight(100) const height = responsiveHeight(100)
let initialValue = !state ? 0 : height, let initialValue = !state ? 0 : height,
finalValue = !state ? height : 0; finalValue = !state ? height : 0;
this.setState({ isSliding: state }) this.setState({isSliding: state})
this.state.translateAnim.setValue(initialValue); //Step 3 this.state.translateAnim.setValue(initialValue); //Step 3
Animated.timing( //Step 4 Animated.timing( //Step 4
this.state.translateAnim, this.state.translateAnim,
{ {
toValue: finalValue, toValue: finalValue,
duration: 500, duration: 500,
useNativeDriver: true, useNativeDriver: true,
} }
).start() ).start()
} }
_openMenu = () => this.setState({ visibleMenu: true }); _openMenu = () => this.setState({visibleMenu: true});
_closeMenu = () => this.setState({ visibleMenu: false }); _closeMenu = () => this.setState({visibleMenu: false});
getDemandTypeIcon = (type) => { getDemandTypeIcon = (type) => {
switch (type) { switch (type) {
case 'creation': return 'account-multiple-plus'; case 'creation':
case 'suppression': return 'account-multiple-minus'; return 'account-multiple-plus';
case 'adhesion': return 'account-multiple-check' case 'suppression':
case 'nano_credit': return 'cash' return 'account-multiple-minus';
default: return 'account-multiple' case 'adhesion':
} return 'account-multiple-check'
} case 'nano_credit':
return 'cash'
default:
return 'account-multiple'
}
}
getDemandTypeColor = (type) => { getDemandTypeColor = (type) => {
switch (type) { switch (type) {
case 'creation': return 'green'; case 'creation':
case 'suppression': return 'red'; return 'green';
case 'adhesion': return Color.primaryColor case 'suppression':
case 'nano_credit': return Color.primaryColor return 'red';
default: case 'adhesion':
return Color.primaryColor return Color.primaryColor
} case 'nano_credit':
} return Color.primaryColor
default:
return Color.primaryColor
}
}
renderDemandItem = (item) => { renderDemandItem = (item) => {
let dateFormat = moment.tz(item.date_creation_demande, moment.tz.guess()).format(); let dateFormat = moment.tz(item.date_creation_demande, moment.tz.guess()).format();
dateFormat = moment(dateFormat).fromNow(); dateFormat = moment(dateFormat).fromNow();
return ( return (
<TouchableOpacity onPress={() => { <TouchableOpacity onPress={() => {
this.props.navigation.push(route.demandGroupNanoCreditDetail, { this.props.navigation.push(route.demandGroupNanoCreditDetail, {
id: item.id id: item.id
}); });
}} }}
style={[styles.paymentItem]}> style={[styles.paymentItem]}>
<View style={{ flexDirection: 'row', alignItems: 'center', }}> <View style={{flexDirection: 'row', alignItems: 'center',}}>
<View style={styles.iconContent}> <View style={styles.iconContent}>
<Icon name={this.getDemandTypeIcon(item.type)} color={this.getDemandTypeColor(item.type)} size={35} /> <Icon name={this.getDemandTypeIcon(item.type)} color={this.getDemandTypeColor(item.type)}
</View> size={35}/>
</View> </View>
<View style={styles.content}> </View>
<View style={styles.content}>
<Text style={styles.title}>{item.nom}</Text> <Text style={styles.title}>{item.nom}</Text>
<Text style={styles.description}>{`${I18n.t('CREATOR')}: ${item.createur}`}</Text> <Text style={styles.description}>{`${I18n.t('CREATOR')}: ${item.createur}`}</Text>
{/* <Text style={styles.description}>{`Sponsor 1: ${item.sponsor1}`}</Text> {/* <Text style={styles.description}>{`Sponsor 1: ${item.sponsor1}`}</Text>
<Text style={styles.description}>{`Sponsor 2: ${item.sponsor2}`}</Text> <Text style={styles.description}>{`Sponsor 2: ${item.sponsor2}`}</Text>
<Text style={styles.description}>{`Sponsor 3: ${item.sponsor3}`}</Text> */} <Text style={styles.description}>{`Sponsor 3: ${item.sponsor3}`}</Text> */}
<View style={styles.timeContent}> <View style={styles.timeContent}>
<View style={{ alignContent: 'flex-start', flex: 1, flexDirection: 'row' }}> <View style={{alignContent: 'flex-start', flex: 1, flexDirection: 'row'}}>
<Text style={{ <Text style={{
fontWeight: 'bold', fontWeight: 'bold',
marginLeft: 20, marginLeft: 20,
marginBottom: 10, marginBottom: 10,
color: item.nombre_validation === 3 ? 'green' : 'red', color: item.nombre_validation === 3 ? 'green' : 'red',
}}> }}>
{item.nombre_validation === 3 ? I18n.t('VALIDATE') : I18n.t('NO_VALIDATE')} {item.nombre_validation === 3 ? I18n.t('VALIDATE') : I18n.t('NO_VALIDATE')}
{` (${item.nombre_validation} ${item.nombre_validation > 1 ? I18n.t('VALIDATIONS') : I18n.t('VALIDATION')})`} {` (${item.nombre_validation} ${item.nombre_validation > 1 ? I18n.t('VALIDATIONS') : I18n.t('VALIDATION')})`}
</Text> </Text>
</View> </View>
<View style={{ alignContent: 'flex-end', flex: 1, flexDirection: 'row' }}> <View style={{alignContent: 'flex-end', flex: 1, flexDirection: 'row'}}>
<Icon name="map-marker" style={[styles.descriptionIcon], { color: Color.accentColor, marginTop: 5 }} /> <Icon name="map-marker"
<Text style={styles.time}>{item.country}</Text> style={[styles.descriptionIcon], {color: Color.accentColor, marginTop: 5}}/>
<Text style={styles.time}>{item.country}</Text>
<Icon name="clock" style={[styles.descriptionIcon], { color: Color.accentColor, marginTop: 5 }} /> <Icon name="clock"
<Text style={styles.time}> {dateFormat}</Text> style={[styles.descriptionIcon], {color: Color.accentColor, marginTop: 5}}/>
</View> <Text style={styles.time}> {dateFormat}</Text>
</View>
</View>
</View> </View>
</TouchableOpacity>
)
}
rendeGetDemandsGroupResponse = () => { </View>
</TouchableOpacity>
)
}
const { resultGetDemandsGroup, errorGetDemandsGroup } = this.props; rendeGetDemandsGroupResponse = () => {
if (errorGetDemandsGroup !== null) { const {resultGetDemandsGroup, errorGetDemandsGroup} = this.props;
if (typeof errorGetDemandsGroup.data !== 'undefined') {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text style={Typography.body1}>{errorGetDemandsGroup.data.error}</Text>
</View>
)
}
else {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text style={Typography.body1}>{errorGetDemandsGroup}</Text>
</View>
)
}
}
if (resultGetDemandsGroup !== null) { if (errorGetDemandsGroup !== null) {
if (resultGetDemandsGroup.response !== null) { if (typeof errorGetDemandsGroup.data !== 'undefined') {
return ( return (
Array.isArray(resultGetDemandsGroup.response) && (resultGetDemandsGroup.response.length) > 0 ? <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
(<ScrollView style={{ flex: 1 }}> <Text style={Typography.body1}>{errorGetDemandsGroup.data.error}</Text>
{
resultGetDemandsGroup.response.map((item) => (
this.renderDemandItem(item)
))
}
</ScrollView>) :
(
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text style={Typography.body1}>{I18n.t('NO_DEMAND_CREATION_GROUP')}</Text>
</View>
)
)
}
}
}
renderLoader = () => {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
{Platform.OS === 'android'
?
(
<>
<ProgressBarAndroid />
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
) :
<>
<ActivityIndicator size="large" color={'#ccc'} />
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
}
</View>
)
}
printOptions() {
return (<ActionButton buttonColor={accent}>
<ActionButton.Item buttonColor={primary} title={I18n.t('CREATE_GROUP')}
onPress={() => {
this.props.navigation.push(route.createGroupNanoCredit);
}}
>
<Icon name="account-multiple-plus" style={styles.actionButtonIcon} />
</ActionButton.Item>
<ActionButton.Item buttonColor={purpleLight} title={I18n.t('JOIN_GROUP')}
onPress={() => {
this.props.navigation.push(route.adhererGroupNanoCredit);
}}
>
<Icon name="account-multiple" style={styles.actionButtonIcon} />
</ActionButton.Item>
</ActionButton>)
}
refreshData() {
this.props.getNanoCreditDemandsAction(this.state.user.id);
}
render() {
console.warn("POSITION", this.state.position);
return (
<Provider>
<View style={{ flex: 1 }}
>
<StatusBar
backgroundColor={theme.primaryDark}
barStyle="light-content"
translucent={false}
/>
<Appbar.Header dark={true} style={{ backgroundColor: theme.primary }}>
<Appbar.BackAction
onPress={() => { this.props.navigation.pop() }}
/>
<Appbar.Content
title={I18n.t('MANAGE_GROUP')}
subtitle={this.state.position === 0 ? I18n.t('VALIDATION_DEMAND') : I18n.t('DELETE_DEMAND')}
/>
<Appbar.Action icon="refresh" onPress={() => { this.refreshData() }} />
{/* <Appbar.Action icon="more-vert" onPress={() => { this._openMenu(); this.renderSliding(); }} /> */}
</Appbar.Header>
{this.state.position === 0 ?
this.props.loadingGetDemandsGroup ?
this.renderLoader() :
this.rendeGetDemandsGroupResponse()
: null}
{this.state.position === 0 && this.printOptions()}
</View> </View>
</Provider> )
); } else {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={Typography.body1}>{errorGetDemandsGroup}</Text>
</View>
)
}
}
} if (resultGetDemandsGroup !== null) {
if (resultGetDemandsGroup.response !== null) {
return (
Array.isArray(resultGetDemandsGroup.response) && (resultGetDemandsGroup.response.length) > 0 ?
(<ScrollView style={{flex: 1}}>
{
resultGetDemandsGroup.response.map((item) => (
this.renderDemandItem(item)
))
}
</ScrollView>) :
(
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={Typography.body1}>{I18n.t('NO_DEMAND_CREATION_GROUP')}</Text>
</View>
)
)
}
}
}
renderLoader = () => {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
{Platform.OS === 'android'
?
(
<>
<ProgressBarAndroid/>
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
) :
<>
<ActivityIndicator size="large" color={'#ccc'}/>
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
}
</View>
)
}
printOptions() {
return (<ActionButton buttonColor={accent}>
<ActionButton.Item buttonColor={primary} title={I18n.t('CREATE_GROUP')}
onPress={() => {
this.props.navigation.push(route.createGroupNanoCredit);
}}
>
<Icon name="account-multiple-plus" style={styles.actionButtonIcon}/>
</ActionButton.Item>
<ActionButton.Item buttonColor={purpleLight} title={I18n.t('JOIN_GROUP')}
onPress={() => {
this.props.navigation.push(route.adhererGroupNanoCredit);
}}
>
<Icon name="account-multiple" style={styles.actionButtonIcon}/>
</ActionButton.Item>
</ActionButton>)
}
refreshData() {
this.props.getNanoCreditDemandsAction(this.state.user.id);
}
render() {
console.warn("POSITION", this.state.position);
return (
<Provider>
<View style={{flex: 1}}
>
<StatusBar
backgroundColor={theme.primaryDark}
barStyle="light-content"
translucent={false}
/>
<Appbar.Header dark={true} style={{backgroundColor: theme.primary}}>
<Appbar.BackAction
onPress={() => {
this.props.navigation.pop()
}}
/>
<Appbar.Content
title={I18n.t('MANAGE_GROUP')}
subtitle={this.state.position === 0 ? I18n.t('VALIDATION_DEMAND') : I18n.t('DELETE_DEMAND')}
/>
<Appbar.Action icon="refresh" onPress={() => {
this.refreshData()
}}/>
{/* <Appbar.Action icon="more-vert" onPress={() => { this._openMenu(); this.renderSliding(); }} /> */}
</Appbar.Header>
{this.state.position === 0 ?
this.props.loadingGetDemandsGroup ?
this.renderLoader() :
this.rendeGetDemandsGroupResponse()
: null}
{this.state.position === 0 && this.printOptions()}
</View>
</Provider>
);
}
} }
const mapStateToProps = state => ({ const mapStateToProps = state => ({
loadingGetDemandsGroup: state.getDemandsGroupReducer.loading, loadingGetDemandsGroup: state.getDemandsGroupReducer.loading,
resultGetDemandsGroup: state.getDemandsGroupReducer.result, resultGetDemandsGroup: state.getDemandsGroupReducer.result,
errorGetDemandsGroup: state.getDemandsGroupReducer.error, errorGetDemandsGroup: state.getDemandsGroupReducer.error,
}); });
const mapDispatchToProps = dispatch => bindActionCreators({ const mapDispatchToProps = dispatch => bindActionCreators({
getNanoCreditDemandsAction: getNanoCreditDemandsAction, getNanoCreditDemandsAction: getNanoCreditDemandsAction,
getNanoCreditDemandsReset: getNanoCreditDemandsReset getNanoCreditDemandsReset: getNanoCreditDemandsReset
}, dispatch); }, dispatch);
export default connect(mapStateToProps, mapDispatchToProps)(DemandValidationGroup); export default connect(mapStateToProps, mapDispatchToProps)(DemandValidationGroup);
const styles = StyleSheet.create({ const styles = StyleSheet.create({
slidingup: { slidingup: {
position: "absolute", position: "absolute",
height: responsiveHeight(84), height: responsiveHeight(84),
bottom: 0, bottom: 0,
backgroundColor: 'white', backgroundColor: 'white',
width: responsiveWidth(100), width: responsiveWidth(100),
zIndex: 1000 zIndex: 1000
}, },
root: { root: {
flex: 1, flex: 1,
}, },
container: { container: {
flex: 1, flex: 1,
backgroundColor: 'white', backgroundColor: 'white',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
}, },
emptylist: { emptylist: {
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, height: 22,
height: 22, color: 'white',
color: 'white', },
}, descriptionIcon: {
descriptionIcon: { fontSize: 10,
fontSize: 10, height: 12,
height: 12, top: 10
top: 10 },
}, welcome: {
welcome: { fontSize: 20,
fontSize: 20, textAlign: 'center',
textAlign: 'center', margin: 10,
margin: 10, },
}, instructions: {
instructions: { textAlign: 'center',
textAlign: 'center', color: '#333333',
color: '#333333', marginBottom: 5,
marginBottom: 5, },
}, dateText: {
dateText: { marginTop: 20,
marginTop: 20, marginLeft: responsiveWidth(13),
marginLeft: responsiveWidth(13), marginBottom: 20,
marginBottom: 20, fontSize: 17,
fontSize: 17, },
}, titlecontent: {
titlecontent: { fontSize: 17,
fontSize: 17, marginLeft: responsiveWidth(10),
marginLeft: responsiveWidth(10),
color: 'black' color: 'black'
}, },
title: { title: {
fontSize: 20, fontSize: 20,
marginLeft: 20, marginLeft: 20,
marginTop: 20, marginTop: 20,
color: 'black', color: 'black',
fontWeight: 'bold' fontWeight: 'bold'
}, },
content: { content: {
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,
}, },
paymentItem: { paymentItem: {
flexDirection: "row", flexDirection: "row",
alignItems: "center", alignItems: "center",
justifyContent: "space-between", justifyContent: "space-between",
width: "100%", width: "100%",
borderBottomColor: '#EEE', borderBottomColor: '#EEE',
borderBottomWidth: 1 borderBottomWidth: 1
}, },
iconContent: { iconContent: {
width: 40, width: 40,
marginRight: 5, marginRight: 5,
alignItems: "center" alignItems: "center"
} }
}); });

View File

@ -75,7 +75,7 @@ class DemandGroupNanoCreditDetail extends Component {
isBtnModifyAmountEnabled: false, isBtnModifyAmountEnabled: false,
id: this.props.navigation.getParam("id", null) id: this.props.navigation.getParam("id", null)
} }
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb"; this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale); moment.locale(this.currentLocale);
this.props.getNanoCreditUniqueDemandsReset(); this.props.getNanoCreditUniqueDemandsReset();

View File

@ -82,7 +82,7 @@ class MyNanoCreditGroup extends Component {
isBtnModifyAmountEnabled: false, isBtnModifyAmountEnabled: false,
id: this.props.navigation.getParam("id", null) id: this.props.navigation.getParam("id", null)
} }
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb"; this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale); moment.locale(this.currentLocale);
this.props.createGroupReset(); this.props.createGroupReset();

View File

@ -52,7 +52,7 @@ class Notifications extends BaseScreen {
constructor(props) { constructor(props) {
super(props); super(props);
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb"; this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale); moment.locale(this.currentLocale);
} }

View File

@ -93,11 +93,11 @@ class OperateurOptionSelect extends Component {
redirectToRoute = (item) => { redirectToRoute = (item) => {
console.log("Redirection"); console.log("Item selected", item);
if (this.state.options.length > 0) { if (this.state.options.length > 0) {
this.props.navigation.push(this.state.options[0].screen, { this.props.navigation.push(this.state.options[0].screen, {
title: this.state.options[0].title, title: item.operator_name,
type: this.state.options[0].type type: this.state.options[0].type
}); });
} else { } else {

View File

@ -53,7 +53,7 @@ export default class PaiementFacture extends Component {
return I18n.t('IDENTIFIANT_ETUDIANT') return I18n.t('IDENTIFIANT_ETUDIANT')
case 'PAIEMENT_EAU': case 'PAIEMENT_EAU':
return I18n.t('NUMERO_ABONNE') return I18n.t('NUMERO_ABONNE')
case 'PAIEMENT_ELECTRICITE': case 'PAIEMENT_EAU_ELECTRICITE':
return I18n.t('NUMERO_ABONNE') return I18n.t('NUMERO_ABONNE')
case 'PAIEMENT_CREDIT_TELEPHONE': case 'PAIEMENT_CREDIT_TELEPHONE':
return I18n.t('PHONE_NUMBER') return I18n.t('PHONE_NUMBER')

File diff suppressed because it is too large Load Diff

View File

@ -94,7 +94,7 @@ class WalletDetailUser extends Component {
this.heightImageBanner = Utils.scaleWithPixel(250, 1); this.heightImageBanner = Utils.scaleWithPixel(250, 1);
this.marginTopBanner = this.heightImageBanner - this.state.heightHeader - 40; this.marginTopBanner = this.heightImageBanner - this.state.heightHeader - 40;
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb"; this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale); moment.locale(this.currentLocale);
IlinkEmitter.on("langueChange", this.updateLangue.bind(this)); IlinkEmitter.on("langueChange", this.updateLangue.bind(this));
IlinkEmitter.on("refreshWallet", this.refresh); IlinkEmitter.on("refreshWallet", this.refresh);

View File

@ -448,7 +448,7 @@ class WalletOptionSelect extends Component {
{ {
!isNil(this.state.user.category) ? !isNil(this.state.user.category) ?
Object.keys(omit(item, ['id', 'retrait_cash', 'type_historique', 'type_caution', 'id_demande', 'montant_rembourse', 'partiellement_rembourse', 'duree_mois', 'etat', 'interet', 'taxe', 'date_validation', 'date_remboursement_prevu', 'date_remboursement', 'id_user', 'id_wallet_agent', 'id_network', 'user', 'user_phone', 'agent', 'codeParrain'])).map((element, i) => ( Object.keys(omit(item, ['id', 'retrait_cash', 'montant_retire', 'type_historique', 'type_caution', 'id_demande', 'montant_rembourse', 'partiellement_rembourse', 'duree_mois', 'etat', 'interet', 'taxe', 'date_validation', 'date_remboursement_prevu', 'date_remboursement', 'id_user', 'id_wallet_agent', 'id_network', 'user', 'user_phone', 'agent', 'codeParrain'])).map((element, i) => (
<View style={{alignItems: 'center'}} key={i}> <View style={{alignItems: 'center'}} key={i}>
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}> <Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
@ -463,7 +463,7 @@ class WalletOptionSelect extends Component {
</View> </View>
)) ))
: :
Object.keys(omit(item, ['id', 'type', 'id_epargne', 'type_historique', 'date_demande', 'date_fin', 'date_remboursement_prevu', 'date_validation', 'date_cassation', 'date_remboursement', 'id_demande', 'duree_mois', 'taxe', '', 'date_fin', 'date_cassation', 'etat', 'id_user', 'id_network', 'user', 'partiellement_rembourse', 'user_phone', 'type_caution', 'interet', 'date_remboursement_prevu', 'date_remboursement', 'id_wallet_agent', 'retrait_cash', 'codeParrain', 'agent', 'montant_rembourse', ''])).map((element, i) => ( Object.keys(omit(item, ['id', 'type', 'montant_retire', 'id_epargne', 'type_historique', 'date_demande', 'date_fin', 'date_remboursement_prevu', 'date_validation', 'date_cassation', 'date_remboursement', 'id_demande', 'duree_mois', 'taxe', '', 'date_fin', 'date_cassation', 'etat', 'id_user', 'id_network', 'user', 'partiellement_rembourse', 'user_phone', 'type_caution', 'interet', 'date_remboursement_prevu', 'date_remboursement', 'id_wallet_agent', 'retrait_cash', 'codeParrain', 'agent', 'montant_rembourse', ''])).map((element, i) => (
<View style={{alignItems: 'center'}} key={i}> <View style={{alignItems: 'center'}} key={i}>
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}> <Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
@ -504,6 +504,15 @@ class WalletOptionSelect extends Component {
style={[Typography.caption1, Color.grayColor]}>{I18n.t(displayTransactionType(this.state.historyItemDetail.type_historique))}</Text> style={[Typography.caption1, Color.grayColor]}>{I18n.t(displayTransactionType(this.state.historyItemDetail.type_historique))}</Text>
</View> </View>
</View> </View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('CAUTION_TYPE')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.type_caution}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text> <Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text>
@ -636,11 +645,11 @@ class WalletOptionSelect extends Component {
</View> </View>
<View style={{flexDirection: 'row', marginTop: 10}}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text> <Text style={[styles.body2]}>{I18n.t('ID_SAVINGS')}</Text>
</View> </View>
<View style={{flex: 1, alignItems: 'flex-end'}}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.id_demande}</Text> style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.id_epargne}</Text>
</View> </View>
</View> </View>
<View style={{flexDirection: 'row', marginTop: 10}}> <View style={{flexDirection: 'row', marginTop: 10}}>
@ -679,6 +688,15 @@ class WalletOptionSelect extends Component {
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant + ' ' + this.state.wallet.currency_code}</Text> style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant + ' ' + this.state.wallet.currency_code}</Text>
</View> </View>
</View> </View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT_WITHDRAWAL')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant_retire + ' ' + this.state.wallet.currency_code}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text>
@ -712,7 +730,7 @@ class WalletOptionSelect extends Component {
</View> </View>
<View style={{flex: 1, alignItems: 'flex-end'}}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_fin}</Text> style={[Typography.caption1, Color.grayColor]}>{isEqual(this.state.historyItemDetail.type, 'SIMPLE') ? I18n.t('NON_APPLICABLE') : this.state.historyItemDetail.date_fin}</Text>
</View> </View>
</View> </View>
<View style={{flexDirection: 'row', marginTop: 10}}> <View style={{flexDirection: 'row', marginTop: 10}}>

View File

@ -373,11 +373,7 @@ export const optionRetraitUserScreen = {
screen: '', screen: '',
icon: 'credit-card', icon: 'credit-card',
title: 'WITHDRAWAL_BANK_TO_WALLET', title: 'WITHDRAWAL_BANK_TO_WALLET',
}, { }
screen: '',
icon: 'credit-card',
title: 'WITHDRAWAL_BANK_TO_CASH',
},
] ]
} }

View File

@ -161,6 +161,7 @@
"NANO_CREDIT_LIST": "Nano credit list", "NANO_CREDIT_LIST": "Nano credit list",
"SAVINGS_LIST": "Savings list", "SAVINGS_LIST": "Savings list",
"NO_NANO_CREDIT": "No nano credit demand", "NO_NANO_CREDIT": "No nano credit demand",
"NO_SAVINGS": "No savings",
"NANO_CREDIT_DESCRIPTION": "Nano credit description", "NANO_CREDIT_DESCRIPTION": "Nano credit description",
"NANO_SANTE": "Nano health", "NANO_SANTE": "Nano health",
"NANO_SANTE_DESCRIPTION": "Nano health description", "NANO_SANTE_DESCRIPTION": "Nano health description",
@ -173,8 +174,10 @@
"CAUTION_CREDIT": "Caution credit demand", "CAUTION_CREDIT": "Caution credit demand",
"CAUTIONNEMENT_DONE": "Caution done", "CAUTIONNEMENT_DONE": "Caution done",
"ID_DEMAND": "Demand ID", "ID_DEMAND": "Demand ID",
"ID_SAVINGS": "Saving ID",
"NON_APPLICABLE": "Not applicable",
"DATE": "Date", "DATE": "Date",
"PAIEMENT_EAU_ELECTRICITY": "Water bill", "PAIEMENT_EAU": "Water bill",
"PAIEMENT_ELECTRICITY": "Electricity bill", "PAIEMENT_ELECTRICITY": "Electricity bill",
"PAIEMENT_ECOLE": "School fees", "PAIEMENT_ECOLE": "School fees",
"PAIEMENT_CREDIT_TELEPHONIQUE": "Phone credit bills", "PAIEMENT_CREDIT_TELEPHONIQUE": "Phone credit bills",

View File

@ -168,6 +168,7 @@
"NANO_CREDIT_LIST": "Liste des nano crédit", "NANO_CREDIT_LIST": "Liste des nano crédit",
"SAVINGS_LIST": "Liste des épargnes", "SAVINGS_LIST": "Liste des épargnes",
"NO_NANO_CREDIT": "Aucune demande de nano crédit", "NO_NANO_CREDIT": "Aucune demande de nano crédit",
"NO_SAVINGS": "Aucune épargne",
"NANO_CREDIT_DESCRIPTION": "Nano crédit iLink", "NANO_CREDIT_DESCRIPTION": "Nano crédit iLink",
"NANO_SANTE": "Nano santé", "NANO_SANTE": "Nano santé",
"NANO_SANTE_DESCRIPTION": "Nano santé iLink", "NANO_SANTE_DESCRIPTION": "Nano santé iLink",
@ -180,11 +181,13 @@
"CAUTION_CREDIT": "Cautionner une demande de crédit", "CAUTION_CREDIT": "Cautionner une demande de crédit",
"CAUTIONNEMENT_DONE": "Cautionnement effectué", "CAUTIONNEMENT_DONE": "Cautionnement effectué",
"ID_DEMAND": "Identifiant de la demande", "ID_DEMAND": "Identifiant de la demande",
"ID_SAVINGS": "Identifiant de l'épargne",
"PAIEMENT_EAU": "Paiement eau", "PAIEMENT_EAU": "Paiement eau",
"PAIEMENT_ELECTRICITY": "Paiement électricité", "PAIEMENT_ELECTRICITY": "Paiement électricité",
"PAIEMENT_ECOLE": "Paiement école", "PAIEMENT_ECOLE": "Paiement école",
"PAIEMENT_CREDIT_TELEPHONIQUE": "Paiement crédit téléphonique", "PAIEMENT_CREDIT_TELEPHONIQUE": "Paiement crédit téléphonique",
"PAIEMENT_ABONNEMENT_TV": "Paiement abonnement TV", "PAIEMENT_ABONNEMENT_TV": "Paiement abonnement TV",
"NON_APPLICABLE": "Non applicable",
"DATE": "Date", "DATE": "Date",
"DEMAND_DATE": "Date de la demande", "DEMAND_DATE": "Date de la demande",
"DATE_REMBOURSEMENT_PREVU": "Date de remboursement prévu", "DATE_REMBOURSEMENT_PREVU": "Date de remboursement prévu",
@ -218,8 +221,8 @@
"DEPOSIT_TRANSACTION_HISTORY_DESCRIPTION": "Dépôt de", "DEPOSIT_TRANSACTION_HISTORY_DESCRIPTION": "Dépôt de",
"NO_WALLET_HISTORY": "Aucune transaction à ce jour", "NO_WALLET_HISTORY": "Aucune transaction à ce jour",
"DEMAND_SEND": "Demande envoyé", "DEMAND_SEND": "Demande envoyé",
"EPARGNE_DEPOSE": "Epargne déposé", "EPARGNE_DEPOSE": "Epargne déposée",
"BREAK_EPARGNE_DONE": "Epargne cassé avec succès", "BREAK_EPARGNE_DONE": "Epargne cassée avec succès",
"BREAK_EPARGNE": "Casser mon épargne", "BREAK_EPARGNE": "Casser mon épargne",
"ID_EPARGNE": "Identifiant de l'épargne", "ID_EPARGNE": "Identifiant de l'épargne",
"NO_DEMAND_CREATION_GROUP": "Aucune demande de création de groupe", "NO_DEMAND_CREATION_GROUP": "Aucune demande de création de groupe",

View File

@ -69,6 +69,7 @@ export const getNanoCreditAccount = testBaseUrl + '/walletService/groups/nanoCre
export const getNanoCreditUserHistoryUrl = testBaseUrl + '/walletService/groups/nanoCredit/all_demands'; export const getNanoCreditUserHistoryUrl = testBaseUrl + '/walletService/groups/nanoCredit/all_demands';
export const getNanoCreditAgentHistoryUrl = testBaseUrl + '/walletService/groups/nanoCredit/guarantee_demands'; export const getNanoCreditAgentHistoryUrl = testBaseUrl + '/walletService/groups/nanoCredit/guarantee_demands';
export const getHyperviseurHistoriqueUrl = testBaseUrl + '/walletService/wallets/all_hyper_history'; export const getHyperviseurHistoriqueUrl = testBaseUrl + '/walletService/wallets/all_hyper_history';
export const getSuperviseurHistoriqueUrl = testBaseUrl + '/walletService/wallets/all_super_history';
export const getBankUrl = testBaseUrl + '/walletService/wallets/users/operators/bank'; export const getBankUrl = testBaseUrl + '/walletService/wallets/users/operators/bank';
export const getHistoryNanoPendingCreditUrl = testBaseUrl + '/walletService/groups/nanoCredit/demands_in_progress'; export const getHistoryNanoPendingCreditUrl = testBaseUrl + '/walletService/groups/nanoCredit/demands_in_progress';
export const getHistoryEpargnePendingUrl = testBaseUrl + '/walletService/groups/nanoCredit/savings/demands_in_progress'; export const getHistoryEpargnePendingUrl = testBaseUrl + '/walletService/groups/nanoCredit/savings/demands_in_progress';

View File

@ -1,104 +1,109 @@
import { db } from './db'; import {db} from './db';
import { AsyncStorage } from 'react-native'; import {AsyncStorage} from 'react-native';
export default class Configuration { export default class Configuration {
constructor() { constructor() {
} }
async getCurrentLangue() {
const da = await _getData()
if (da) resolve(da)
else reject(da)
}
async getCurrentPasValue() { async getCurrentLangue() {
const pasObject = await this._getPasData() const da = await _getData()
if (pasObject) { if (da) resolve(da)
return pasObject.valeur_int; else reject(da)
} else return pasObject; }
}
async getCurrentPubValue() { async getCurrentPasValue() {
const pasObject = await this._getPubData() const pasObject = await this._getPasData()
console.warn(pasObject) if (pasObject) {
if (pasObject) { return pasObject.valeur_int;
return pasObject.valeur_bool; } else return pasObject;
} else return pasObject; }
}
async setPubActive(data) {
try {
if (data.pub) {
await AsyncStorage.setItem('pubObject', JSON.stringify(data.pub));
db.update({ "configuration.pub": { $exists: true } }, { configuration: { pub: data.pub } }, { upsert: true }, (err, num, upsert) => {
console.log([err, num, upsert])
})
}
} catch (error) {
console.warn(error)
}
} async getCurrentPubValue() {
_getPubData() { const pasObject = await this._getPubData()
return new Promise(async (resolve, reject) => { console.warn(pasObject)
if (pasObject) {
return pasObject.valeur_bool;
} else return pasObject;
}
try { async setPubActive(data) {
const ty = await AsyncStorage.getItem('pubObject') try {
resolve(JSON.parse(ty)) if (data.pub) {
} catch (err) { await AsyncStorage.setItem('pubObject', JSON.stringify(data.pub));
reject(err) db.update({"configuration.pub": {$exists: true}}, {configuration: {pub: data.pub}}, {upsert: true}, (err, num, upsert) => {
console.log([err, num, upsert])
})
}
} catch (error) {
console.warn(error)
}
} }
}) _getPubData() {
} return new Promise(async (resolve, reject) => {
setCurrentLangue(lang) {
this._storeData(lang)
db.update({ "configuration.lang": { $exists: true } }, { configuration: { lang: lang } }, { upsert: true }, (err, num, upsert) => {
console.log([err, num, upsert])
})
}
setCurrentPas = async (pas) => {
try {
await AsyncStorage.setItem('@config:pasObject', JSON.stringify(pas.pas));
} catch (error) {
console.warn(error)
}
db.update({ "configuration.pas": { $exists: true } }, { configuration: { pas: pas.pas } }, { upsert: true }, (err, num, upsert) => {
console.log([err, num, upsert])
})
}
_getPasData = () => {
return new Promise(async (resolve, reject) => {
try { try {
const ty = await AsyncStorage.getItem('@config:pasObject') const ty = await AsyncStorage.getItem('pubObject')
resolve(JSON.parse(ty)) resolve(JSON.parse(ty))
} catch (err) { } catch (err) {
reject(err) reject(err)
} }
}) })
} }
_storeData = async (lang) => {
try {
await AsyncStorage.setItem('@config:lang', lang.value);
} catch (error) {
console.warn(error)
}
};
_getData = () => {
return new Promise(async (resolve, reject) => {
try { setCurrentLangue(lang) {
const ty = await AsyncStorage.getItem('@config:lang') this._storeData(lang)
resolve(ty) db.update({"configuration.lang": {$exists: true}}, {configuration: {lang: lang}}, {upsert: true}, (err, num, upsert) => {
} catch (err) { console.log([err, num, upsert])
reject(err) })
}
} setCurrentPas = async (pas) => {
try {
await AsyncStorage.setItem('@config:pasObject', JSON.stringify(pas.pas));
} catch (error) {
console.warn(error)
}
db.update({"configuration.pas": {$exists: true}}, {configuration: {pas: pas.pas}}, {upsert: true}, (err, num, upsert) => {
console.log([err, num, upsert])
})
}
_getPasData = () => {
return new Promise(async (resolve, reject) => {
}) try {
} const ty = await AsyncStorage.getItem('@config:pasObject')
resolve(JSON.parse(ty))
} catch (err) {
reject(err)
}
})
}
_storeData = async (lang) => {
try {
await AsyncStorage.setItem('@config:lang', lang.value);
} catch (error) {
console.warn(error)
}
};
_getData = () => {
return new Promise(async (resolve, reject) => {
try {
const ty = await AsyncStorage.getItem('@config:lang')
resolve(ty)
} catch (err) {
reject(err)
}
})
}
} }