2019-06-16 13:09:54 +00:00
/ * *
* Sample React Native App
* https : //github.com/facebook/react-native
*
* @ format
* @ flow
* /
2020-11-20 17:06:19 +00:00
import React from 'react' ;
2023-04-21 06:23:36 +00:00
import { ActionSheetProvider } from '@expo/react-native-action-sheet' ;
2023-03-12 23:38:33 +00:00
import { AsyncStorage , Platform , StyleSheet , Text } from 'react-native' ;
2020-11-20 17:06:19 +00:00
import {
2023-04-21 06:23:36 +00:00
createAppContainer ,
createBottomTabNavigator ,
createDrawerNavigator ,
createStackNavigator ,
createSwitchNavigator ,
2020-11-20 17:06:19 +00:00
} from 'react-navigation' ;
2020-08-11 09:42:31 +00:00
import OneSignal from 'react-native-onesignal' ;
2023-04-21 06:23:36 +00:00
import Connect from './screens/login/Connect' ;
import SplashScreen from './screens/splashscreen/SplashScreen' ;
import HelpMenu from './screens/help/HelpMenu' ;
import Help from './screens/help/Help' ;
import ForgottenPassword from './screens/login/ForgottenPassword' ;
import TypeChoiser from './screens/login/TypeChoiser' ;
import CreateUserStep2 from './screens/login/createUserStep2' ;
import createAccount from './screens/login/createAccount' ;
import UpdateInformations from './screens/account/UpdateInformations' ;
import UserAccount from './screens/account/UserAccount' ;
import ActivateAccount from './screens/login/ActivateAccount' ;
import Notifications from './screens/notifications/Notifications' ;
import About from './screens/configurations/About' ;
import Configurations from './screens/configurations/Configurations' ;
import OptionsMenu from './screens/optionMenu/OptionsMenu' ;
import Home from './screens/home/Home' ;
import HistoryItemDetails from './screens/history-request/HistoryItemDetails' ;
import SuperViseurGroupeHome from './screens/groupes/SuperViseurGroupeHome' ;
import HistoryRequester from './screens/history-request/HistoryRequester' ;
import AddNetwork from './screens/account/AddNetwork' ;
import MyHistory from './screens/history-request/MyHistory' ;
import Icon from 'react-native-vector-icons/FontAwesome5' ;
import I18n from 'react-native-i18n' ;
2020-04-17 22:03:04 +00:00
import WalletDetail from './screens/wallet/WalletDetail' ;
import WalletSelect from './screens/wallet/WalletSelect' ;
2020-11-20 17:06:19 +00:00
import { PersistGate } from 'redux-persist/integration/react' ;
import { persistor , store } from './redux/store' ;
import { Provider } from 'react-redux' ;
2020-04-24 15:11:08 +00:00
import WalletDepot from './screens/wallet/WalletDepot' ;
import WalletRetrait from './screens/wallet/WalletRetrait' ;
2020-05-30 21:58:22 +00:00
import CreateIdentification from './screens/identification/createIdentification' ;
import WalletDetailUser from './screens/wallet/WalletDetailUser' ;
2020-06-02 09:05:50 +00:00
import WalletOptionSelect from './screens/wallet/WalletOptionSelect' ;
2020-06-10 03:10:45 +00:00
import ValidateIdentification from './screens/identification/validateIdentification' ;
2020-06-16 09:25:46 +00:00
import CreateIdentificationUser from './screens/identification/CreateIdentificationUser' ;
2020-06-18 05:38:10 +00:00
import OperateurOptionSelect from './screens/wallet/OperateurOptionSelect' ;
import PaiementFacture from './screens/wallet/PaiementFacture' ;
2020-06-23 08:55:19 +00:00
import EnvoieWalletToWalletUser from './screens/wallet/user/EnvoieWalletToWalletUser' ;
2020-06-23 10:28:52 +00:00
import EnvoieWalletToCashUser from './screens/wallet/user/EnvoieWalletToCash' ;
2020-07-02 14:35:00 +00:00
import LinkCard from './screens/wallet/user/LinkCard' ;
import EnvoieWalletToCardUser from './screens/wallet/user/EnvoieWalletToCardUser' ;
import EnvoieWalletToBankUser from './screens/wallet/user/EnvoieWalletToBankUser' ;
import RetraitWalletVersCashUser from './screens/wallet/user/RetraitWalletVersCashUser' ;
import RetraitCarteVersCashUser from './screens/wallet/user/RetraitCarteVersCashUser' ;
import RetraitCarteVersWalletUser from './screens/wallet/user/RetraitCarteVersWalletUser' ;
2020-07-04 17:38:39 +00:00
import RetraitEnCashAgent from './screens/wallet/agent/RetraitEnCashAgent' ;
import RetraitCarteVersCashAgent from './screens/wallet/agent/RetraitCarteVersCashAgent' ;
import EnvoieCashVersWalletAgent from './screens/wallet/agent/EnvoieCashVersWalletAgent' ;
import EnvoieCashVersAutreWalletAgent from './screens/wallet/agent/EnvoieCashVersAutreWalletAgent' ;
2020-07-08 19:01:56 +00:00
import EnvoieCashVersCarteAgent from './screens/wallet/agent/EnvoieCashVersCarteAgent' ;
import EnvoiCashVersCashAgent from './screens/wallet/agent/EnvoiCashVersCashAgent' ;
2020-08-11 09:42:31 +00:00
import ModifyIdentificationUser from './screens/identification/ModifyIdentificationUser' ;
import CreateGroupNanoCredit from './screens/nano-credit/CreateGroupNanoCredit' ;
import DemandValidationGroup from './screens/nano-credit/DemandGroupNanoCredit' ;
2020-08-13 07:23:23 +00:00
import DemandGroupNanoCreditDetail from './screens/nano-credit/DemandGroupNanoCreditDetail' ;
2020-08-19 06:25:24 +00:00
import AdhererGroupNanoCredit from './screens/nano-credit/AdhererGroupNanoCredit' ;
2020-08-23 21:41:29 +00:00
import MyNanoCreditGroup from './screens/nano-credit/MyNanoCreditGroup' ;
2020-08-27 20:04:51 +00:00
import AskNanoCredit from './screens/nano-credit/AskNanoCredit' ;
2020-09-07 16:10:48 +00:00
import RefundNanoCreditUser from './screens/nano-credit/RefundNanoCreditUser' ;
import CautionNanoCreditAgent from './screens/nano-credit/CautionNanoCreditAgent' ;
import EpargnerArgentUser from './screens/nano-credit/EpargnerArgentUser' ;
import CasserEpargneUser from './screens/nano-credit/CasserEpargneUser' ;
2020-11-20 17:06:19 +00:00
import { IlinkEmitter } from './utils/events' ;
2023-04-21 06:23:36 +00:00
import EnvoieWalletToBankAgent from './screens/wallet/agent/EnvoieWalletToBankAgent' ;
import ReattachAccountUser from './screens/wallet/user/ReattachAccountUser' ;
import InsuranceSubscriptionScreen from './screens/wallet/user/InsuranceSubscriptionScreen' ;
import AddBeneficiaryScreen from './screens/wallet/user/AddBeneficiaryScreen' ;
import ActivateBuySubscriptionScreen from './screens/wallet/user/ActivateBuySubscriptionScreen' ;
import SaisirFeuilleSoinScreen from './screens/wallet/agent/SaisirFeuilleSoinScreen' ;
import ValidateConsultationScreen from './screens/wallet/user/ValidateConsultationScreen' ;
import ValidateConsultationDetailScreen from './screens/wallet/user/ValidateConsultationDetailScreen' ;
import ExecuterPrescriptionScreen from './screens/wallet/agent/ExecuterPrescriptionScreen' ;
import ModifierFeuilleSoinScreen from './screens/wallet/agent/ModifierFeuilleSoinScreen' ;
import ModifierExecutionPrescriptionScreen from './screens/wallet/agent/ModifierExecutionPrescriptionScreen' ;
import HistoriqueNanoSanteUserScreen from './screens/wallet/user/HistoriqueNanoSanteUserScreen' ;
import DemandeAutorisationSoinScreen from './screens/wallet/user/DemandeAutorisationSoinScreen' ;
import DeleteBeneficiaryScreen from './screens/wallet/user/DeleteBeneficiaryScreen' ;
import StopSubscriptionScreen from './screens/wallet/user/StopSubscriptionScreen' ;
import RenewAssuranceScreen from './screens/wallet/user/RenewAssuranceScreen' ;
import WebviewScreen from './screens/WebviewScreen' ;
import HistoriqueNanoSanteAgentScreen from './screens/wallet/agent/HistoriqueNanoSanteAgentScreen' ;
import HistoriqueNanoSanteSuperHyperScreen from './screens/wallet/agent/HistoriqueNanoSanteSuperHyperScreen' ;
import PDFViewerScreen from './screens/PdfViewerScreen' ;
import UbaFormScreen from './screens/wallet/user/UbaForm' ;
2020-04-18 19:59:05 +00:00
2019-06-16 13:09:54 +00:00
const instructions = Platform . select ( {
2023-04-21 06:23:36 +00:00
ios : 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu' ,
android :
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu' ,
2019-06-16 13:09:54 +00:00
} ) ;
2023-04-21 06:23:36 +00:00
const theme = require ( './utils/theme' ) ;
2020-03-20 18:28:22 +00:00
2023-04-21 06:23:36 +00:00
const AuthStack = createStackNavigator (
{
2020-11-20 17:06:19 +00:00
login : Connect ,
helpMenu : HelpMenu ,
help : Help ,
forgottenpass : ForgottenPassword ,
typeaccountcreate : TypeChoiser ,
simpleusercreate : createAccount ,
step2 : CreateUserStep2 ,
2023-04-21 06:23:36 +00:00
activateaccout : ActivateAccount ,
} ,
{
headerMode : 'none' ,
} ,
) ;
const AppStack = createDrawerNavigator (
{
2020-11-20 17:06:19 +00:00
sta : createStackNavigator ( {
2023-04-21 06:23:36 +00:00
home : Home ,
/ * f i l t r e : F i l t e r ,
2020-11-20 17:06:19 +00:00
network : Networks , * /
2023-04-21 06:23:36 +00:00
useraccount : {
screen : UserAccount ,
navigationOptions : { } ,
} ,
walletSelect : WalletSelect ,
createIdentificationUser : CreateIdentificationUser ,
modifyIdentificationUser : ModifyIdentificationUser ,
notificationview : Notifications ,
configuration : Configurations ,
about : About ,
walletDetailUser : WalletDetailUser ,
walletOptionSelect : WalletOptionSelect ,
operateurOptionSelect : OperateurOptionSelect ,
paiementFacture : PaiementFacture ,
envoieWalletToWalletUser : EnvoieWalletToWalletUser ,
envoieWalletToCashUser : EnvoieWalletToCashUser ,
envoieWalletToCardUser : EnvoieWalletToCardUser ,
envoieWalletToBankUser : EnvoieWalletToBankUser ,
insuranceSubscriptionScreen : {
screen : InsuranceSubscriptionScreen ,
navigationOptions : ( ) => ( {
headerTitle : I18n . t ( 'SUBSCRIBE_ASSURANCE' ) ,
title : I18n . t ( 'SUBSCRIBE_ASSURANCE' ) ,
} ) ,
} ,
addBeneficiaryScreen : {
screen : AddBeneficiaryScreen ,
navigationOptions : ( ) => ( {
headerTitle : I18n . t ( 'ADD_SUBSCRIBE' ) ,
title : I18n . t ( 'ADD_SUBSCRIBE' ) ,
} ) ,
} ,
activateBuySubscriptionScreen : {
screen : ActivateBuySubscriptionScreen ,
navigationOptions : ( ) => ( {
headerTitle : I18n . t ( 'ACTIVATE_INSSURANCE' ) ,
title : I18n . t ( 'ACTIVATE_INSSURANCE' ) ,
} ) ,
} ,
renewAssuranceScreen : {
screen : RenewAssuranceScreen ,
navigationOptions : ( ) => ( {
headerTitle : I18n . t ( 'RENEW_INSSURANCE' ) ,
title : I18n . t ( 'RENEW_INSSURANCE' ) ,
} ) ,
} ,
deleteBeneficiaryScreen : {
screen : DeleteBeneficiaryScreen ,
navigationOptions : ( ) => ( {
headerTitle : I18n . t ( 'DELETE_SUBSCRIBE' ) ,
title : I18n . t ( 'DELETE_SUBSCRIBE' ) ,
} ) ,
} ,
stopSubscriptionScreen : {
screen : StopSubscriptionScreen ,
navigationOptions : ( ) => ( {
headerTitle : I18n . t ( 'STOP_SUBSCRIBE' ) ,
title : I18n . t ( 'STOP_SUBSCRIBE' ) ,
} ) ,
} ,
validateConsultationScreen : ValidateConsultationScreen ,
validateConsultationDetailScreen : ValidateConsultationDetailScreen ,
historiqueNanoSanteUserScreen : HistoriqueNanoSanteUserScreen ,
retraitWalletVersCashUser : RetraitWalletVersCashUser ,
retraitCarteVersCashUser : RetraitCarteVersCashUser ,
retraitCarteVersWalletUser : RetraitCarteVersWalletUser ,
linkCard : LinkCard ,
reattachAccountUser : ReattachAccountUser ,
epargnerArgentUser : EpargnerArgentUser ,
createGroupNanoCredit : CreateGroupNanoCredit ,
groupNanoCredit : {
screen : createBottomTabNavigator (
{
demandeValidationGroupe : {
screen : DemandValidationGroup ,
navigationOptions : {
tabBarLabel : I18n . t ( 'DEMAND_VALIDATION_GROUP_RECEIVE' ) ,
tabBarIcon : ( { focused , horizontal , tintColor } ) => {
return (
< Icon
size = { 20 }
name = { 'users-cog' }
color = { focused ? tintColor : 'grey' }
/ >
) ;
2020-11-20 17:06:19 +00:00
} ,
2023-04-21 06:23:36 +00:00
} ,
} ,
myNanoCreditGroup : {
screen : MyNanoCreditGroup ,
navigationOptions : {
tabBarLabel : I18n . t ( 'MY_GROUP' ) ,
tabBarIcon : ( { focused , horizontal , tintColor } ) => {
return (
2020-11-20 17:06:19 +00:00
< Icon
2023-04-21 06:23:36 +00:00
size = { 20 }
name = { 'users' }
color = { focused ? tintColor : 'grey' }
/ >
) ;
2023-03-12 23:38:33 +00:00
} ,
2023-04-21 06:23:36 +00:00
} ,
} ,
} ,
{
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' ) ,
drawerIcon : ( { tintColor } ) => (
< Icon name = { 'account-multiple' } size = { 24 } / >
) ,
} ) ,
} ,
demandeValidationGroupe : DemandGroupNanoCreditDetail ,
adhererGroupNanoCredit : AdhererGroupNanoCredit ,
askNanoCredit : AskNanoCredit ,
refundNanoCreditUser : RefundNanoCreditUser ,
casserEpargneUser : CasserEpargneUser ,
webviewScreen : WebviewScreen ,
PDFViewerScreen : PDFViewerScreen ,
ubaFormScreen : {
screen : UbaFormScreen ,
navigationOptions : ( ) => ( {
headerTitle : I18n . t ( 'ENREGISTREMENT_UBA' ) ,
title : I18n . t ( 'ENREGISTREMENT_UBA' ) ,
headerStyle : {
marginTop : 20 ,
} ,
} ) ,
} ,
} ) ,
} ,
{
2020-11-20 17:06:19 +00:00
contentComponent : OptionsMenu ,
headerMode : 'none' ,
2022-05-16 15:01:45 +00:00
contentOptions : { activeTintColor : theme . accent } ,
2023-04-21 06:23:36 +00:00
} ,
) ;
2020-04-11 22:33:59 +00:00
2023-04-21 06:23:36 +00:00
const AppAgentStack = createDrawerNavigator (
{
2020-11-20 17:06:19 +00:00
sta : createStackNavigator ( {
2023-04-21 06:23:36 +00:00
home : Home ,
useraccount : UserAccount ,
webviewScreen : WebviewScreen ,
walletSelect : WalletSelect ,
createIdentification : CreateIdentification ,
validateIdentification : ValidateIdentification ,
Historique : {
screen : createBottomTabNavigator (
{ myDemand : MyHistory } ,
{
headerMode : 'none' ,
header : null ,
headerTitle : I18n . t ( 'CREDIT_MANAGE' ) ,
tabBarOptions : {
labelStyle : {
fontSize : 13 ,
fontWeight : 'bold' ,
} ,
2020-11-20 17:06:19 +00:00
} ,
2023-04-21 06:23:36 +00:00
} ,
) ,
navigationOptions : ( ) => ( {
header : null ,
headerMode : 'none' ,
headerTitle : null ,
activeColor : '#f0edf6' ,
inactiveColor : '#3e2465' ,
barStyle : { backgroundColor : '#694fad' } ,
// headerLeft: <HeaderBackButton />,
drawerLabel : I18n . t ( 'CREDIT_MANAGE' ) ,
drawerIcon : ( { tintColor } ) => < Icon name = { 'credit-card' } size = { 24 } / > ,
} ) ,
} ,
historyItemDetails : HistoryItemDetails ,
creditrequest : HistoryRequester ,
saisirFeuilleSoinScreen : {
screen : SaisirFeuilleSoinScreen ,
navigationOptions : ( ) => ( {
headerTitle : I18n . t ( 'SAISIR_FEUILLE_SOIN' ) ,
title : I18n . t ( 'SAISIR_FEUILLE_SOIN' ) ,
headerStyle : {
marginTop : 20 ,
} ,
} ) ,
} ,
executerPrescriptionScreen : {
screen : ExecuterPrescriptionScreen ,
navigationOptions : ( ) => ( {
headerTitle : I18n . t ( 'EXECUTER_PRESCRIPTION' ) ,
title : I18n . t ( 'EXECUTER_PRESCRIPTION' ) ,
headerStyle : {
marginTop : 20 ,
} ,
} ) ,
} ,
modifierExecutionPrescriptionScreen : {
screen : ModifierExecutionPrescriptionScreen ,
navigationOptions : ( ) => ( {
headerTitle : I18n . t ( 'MODIFY_CONSULTATION' ) ,
title : I18n . t ( 'MODIFY_CONSULTATION' ) ,
headerStyle : {
marginTop : 20 ,
} ,
} ) ,
} ,
modifierFeuilleSoinScreen : {
screen : ModifierFeuilleSoinScreen ,
navigationOptions : ( ) => ( {
headerTitle : I18n . t ( 'MODIFY_EXECUTION' ) ,
title : I18n . t ( 'MODIFY_EXECUTION' ) ,
headerStyle : {
marginTop : 20 ,
} ,
} ) ,
} ,
demandeAutorisationSoinScreen : {
screen : DemandeAutorisationSoinScreen ,
navigationOptions : ( ) => ( {
headerTitle : I18n . t ( 'DEMAND_AUTORIZATION_HEALTH' ) ,
title : I18n . t ( 'DEMAND_AUTORIZATION_HEALTH' ) ,
headerStyle : {
marginTop : 20 ,
} ,
} ) ,
} ,
historiqueNanoSanteAgentScreen : {
screen : HistoriqueNanoSanteAgentScreen ,
navigationOptions : ( ) => ( {
headerTitle : I18n . t ( 'HISTORY' ) ,
title : I18n . t ( 'HISTORY' ) ,
headerStyle : {
marginTop : 20 ,
} ,
} ) ,
} ,
addNetwork : AddNetwork ,
updateinformation : UpdateInformations ,
notificationview : Notifications ,
configuration : Configurations ,
about : About ,
walletDetail : WalletDetail ,
walletDepot : WalletDepot ,
walletRetrait : WalletRetrait ,
walletOptionSelect : WalletOptionSelect ,
operateurOptionSelect : OperateurOptionSelect ,
paiementFacture : PaiementFacture ,
retraitEnCashAgent : RetraitEnCashAgent ,
retraitCarteVersCashAgent : RetraitCarteVersCashAgent ,
envoieCashVersWalletAgent : EnvoieCashVersWalletAgent ,
envoieCashVersAutreWalletAgent : EnvoieCashVersAutreWalletAgent ,
envoieCashVersCarteAgent : EnvoieCashVersCarteAgent ,
envoiCashVersCashAgent : EnvoiCashVersCashAgent ,
envoieWalletToBankAgent : EnvoieWalletToBankAgent ,
createGroupNanoCredit : CreateGroupNanoCredit ,
cautionNanoCreditAgent : CautionNanoCreditAgent ,
PDFViewerScreen : PDFViewerScreen ,
} ) ,
} ,
{
2020-11-20 17:06:19 +00:00
contentComponent : OptionsMenu ,
2023-04-21 06:23:36 +00:00
backBehavior : 'none' ,
2020-11-20 17:06:19 +00:00
lazy : false ,
2023-04-21 06:23:36 +00:00
headerMode : 'none' ,
contentOptions : { activeTintColor : theme . accent } ,
} ,
) ;
2020-03-20 18:28:22 +00:00
2023-04-21 06:23:36 +00:00
const AppAdministratorStack = createDrawerNavigator (
{
sta : createStackNavigator ( {
home : Home ,
useraccount : UserAccount ,
walletSelect : WalletSelect ,
Historique : {
screen : createBottomTabNavigator (
{
myDemand : MyHistory ,
OthersDemand : MyHistory ,
} ,
{
headerMode : 'none' ,
header : null ,
headerTitle : null ,
title : I18n . t ( 'CREDIT_MANAGE' ) ,
tabBarOptions : {
labelStyle : {
fontSize : 13 ,
} ,
2020-11-20 17:06:19 +00:00
} ,
2023-04-21 06:23:36 +00:00
} ,
) ,
navigationOptions : ( ) => ( {
header : null ,
headerMode : 'none' ,
headerTitle : null ,
activeColor : '#f0edf6' ,
inactiveColor : '#3e2465' ,
barStyle : { backgroundColor : '#694fad' } ,
drawerLabel : I18n . t ( 'CREDIT_MANAGE' ) ,
drawerIcon : ( { tintColor } ) => < Icon name = { 'credit-card' } size = { 24 } / > ,
} ) ,
} ,
creditrequest : HistoryRequester ,
historyItemDetails : HistoryItemDetails ,
superviseurgroup : SuperViseurGroupeHome ,
notificationview : Notifications ,
configuration : Configurations ,
about : About ,
walletDetail : WalletDetail ,
walletDepot : WalletDepot ,
walletRetrait : WalletRetrait ,
historiqueNanoSanteSuperHyperScreen : HistoriqueNanoSanteSuperHyperScreen ,
webviewScreen : WebviewScreen ,
PDFViewerScreen : PDFViewerScreen ,
} ) ,
} ,
{
contentComponent : OptionsMenu ,
backBehavior : 'none' ,
headerMode : 'none' ,
} ,
) ;
2020-08-11 09:42:31 +00:00
2023-04-21 06:23:36 +00:00
const AppSuperAdministrator = createDrawerNavigator (
{
2020-11-20 17:06:19 +00:00
sta : createStackNavigator ( {
2023-04-21 06:23:36 +00:00
home : Home ,
useraccount : UserAccount ,
walletSelect : WalletSelect ,
Historique : {
screen : createBottomTabNavigator (
{ OthersDemand : MyHistory } ,
{
headerMode : 'none' ,
header : null ,
headerTitle : null ,
title : I18n . t ( 'CREDIT_MANAGE' ) ,
tabBarOptions : {
labelStyle : {
fontSize : 13 ,
fontWeight : 'bold' ,
} ,
} ,
} ,
) ,
navigationOptions : ( ) => ( {
title : I18n . t ( 'CREDIT_MANAGE' ) ,
headerMode : 'none' ,
header : null ,
headerTitle : null ,
drawerIcon : ( { tintColor } ) => < Icon name = { 'credit-card' } size = { 24 } / > ,
} ) ,
} ,
creditrequest : HistoryRequester ,
historyItemDetails : HistoryItemDetails ,
superviseurgroup : SuperViseurGroupeHome ,
notificationview : Notifications ,
configuration : Configurations ,
about : About ,
walletDetail : WalletDetail ,
walletDepot : WalletDepot ,
walletRetrait : WalletRetrait ,
historiqueNanoSanteSuperHyperScreen : HistoriqueNanoSanteSuperHyperScreen ,
webviewScreen : WebviewScreen ,
PDFViewerScreen : PDFViewerScreen ,
} ) ,
} ,
{
2020-11-20 17:06:19 +00:00
contentComponent : OptionsMenu ,
2023-04-21 06:23:36 +00:00
backBehavior : 'none' ,
headerMode : 'none' ,
} ,
) ;
2020-08-11 09:42:31 +00:00
2023-04-21 06:23:36 +00:00
const AppNavigator = createSwitchNavigator (
{
2020-11-20 17:06:19 +00:00
first : {
2023-04-21 06:23:36 +00:00
screen : SplashScreen ,
2020-11-20 17:06:19 +00:00
} ,
App : AppStack ,
AgentApp : AppAgentStack ,
adminApp : AppAdministratorStack ,
supAdminApp : AppSuperAdministrator ,
2023-04-21 06:23:36 +00:00
Auth : AuthStack ,
} ,
{
initialRouteName : 'first' ,
} ,
) ;
2019-06-16 13:09:54 +00:00
const AppContainer = createAppContainer ( AppNavigator ) ;
2021-05-24 11:11:55 +00:00
export default class App extends React . Component {
2023-04-21 06:23:36 +00:00
constructor ( props ) {
super ( props ) ;
console . log ( 'APP PROPS' , this . props ) ;
global . appHasLoaded = false ;
//Remove this method to stop OneSignal Debugging
OneSignal . setLogLevel ( 6 , 0 ) ;
IlinkEmitter . on ( 'langueChange' , this . updateLangue . bind ( this ) ) ;
// Replace 'YOUR_ONESIGNAL_APP_ID' with your OneSignal App ID.
OneSignal . init ( 'ab02121a-ecec-424f-910a-2709ef85698d' , {
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.
// 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 . promptForPushNotificationsWithUserResponse ( myiOSPromptCallback ) ;
OneSignal . addEventListener ( 'received' , this . onReceived ) ;
OneSignal . addEventListener ( 'opened' , this . onOpened ) ;
OneSignal . addEventListener ( 'ids' , this . onIds ) ;
}
updateLangue ( ) {
this . forceUpdate ( ) ;
}
_getOneSignalIds = ( ) => {
return new Promise ( async ( resolve , reject ) => {
try {
const getElement = await AsyncStorage . getItem ( '@config:onesignalIds' ) ;
resolve ( getElement ) ;
} catch ( error ) {
reject ( error ) ;
}
} ) ;
} ;
2021-05-27 16:34:51 +00:00
2023-04-21 06:23:36 +00:00
_saveOneSignalIds = async ids => {
try {
await AsyncStorage . setItem ( '@config:onesignalIds' , ids ) ;
} catch ( error ) {
console . warn ( error ) ;
2020-11-20 17:06:19 +00:00
}
2023-04-21 06:23:36 +00:00
} ;
goToScreen = ( routeName , params , isReset = true ) => {
const { navigator } = this . refs ;
if ( typeof navigator !== 'undefined' ) {
console . log ( 'APP HAS LOADED' , global . appHasLoaded ) ;
if ( global . appHasLoaded ) {
navigator . dispatch ( {
type : 'Navigation/NAVIGATE' ,
routeName ,
params ,
2020-11-20 17:06:19 +00:00
} ) ;
2023-04-21 06:23:36 +00:00
/ * r e a d U s e r ( ) . t h e n ( ( r e s u l t ) = > {
2020-11-20 17:06:19 +00:00
if ( result === null || result === undefined ) {
console . warn ( "APP HAS LOADED NOTIFICATION PARAMS" , params ) ;
navigator . dispatch ( {
type : "Navigation/NAVIGATE" ,
routeName : "first" ,
params : { routeName , params }
} ) ;
} else {
navigator . dispatch ( {
type : "Navigation/NAVIGATE" ,
routeName ,
params
} ) ;
}
} ) ; * /
2023-04-21 06:23:36 +00:00
} else {
navigator . dispatch ( {
type : 'Navigation/NAVIGATE' ,
routeName : 'first' ,
params : { routeName , params } ,
} ) ;
}
}
} ;
handleDeepLink = openResult => {
const data = openResult . notification . payload . additionalData ;
//const dataParse = data.replace("'", "\"");
console . warn ( 'HANDLE DEEP LINK' , data ) ;
switch ( data . screen ) {
case 'historyItemDetails' :
console . log ( 'History Item' ) ;
this . goToScreen ( data . screen , {
item : data . data ,
} ) ;
break ;
2020-11-20 17:06:19 +00:00
2023-04-21 06:23:36 +00:00
default :
console . log ( 'Not History Item' ) ;
this . goToScreen ( data . screen , {
id : data . data . id ,
} ) ;
break ;
}
2020-11-20 17:06:19 +00:00
2023-04-21 06:23:36 +00:00
/ * i f ( d a t a & & d a t a . i d ) {
2020-11-20 17:06:19 +00:00
this . goToScreen ( data . screen , {
id : data . id ,
goToScreen : this . goToScreen
} ) ;
} else {
console . log ( "notification is invalid data" ) ;
} * /
2023-04-21 06:23:36 +00:00
} ;
componentWillUnmount ( ) {
OneSignal . removeEventListener ( 'received' , this . onReceived ) ;
OneSignal . removeEventListener ( 'opened' , this . onOpened ) ;
OneSignal . removeEventListener ( 'ids' , this . onIds ) ;
}
onReceived ( notification ) {
console . log ( 'Notification received: ' , notification ) ;
}
onOpened = openResult => {
let data = openResult . notification . payload . additionalData ;
this . handleDeepLink ( openResult ) ;
console . log ( 'Message: ' , openResult . notification . payload . body ) ;
console . log ( 'Data: ' , openResult . notification . payload . additionalData ) ;
console . log ( 'isActive: ' , openResult . notification . isAppInFocus ) ;
console . log ( 'openResult: ' , openResult ) ;
} ;
render ( ) {
return (
< Provider store = { store } >
< PersistGate persistor = { persistor } >
< ActionSheetProvider >
< AppContainer ref = "navigator" / >
< / A c t i o n S h e e t P r o v i d e r >
< / P e r s i s t G a t e >
< / P r o v i d e r >
) ;
}
2020-04-17 22:03:04 +00:00
}
2020-08-11 09:42:31 +00:00
function myiOSPromptCallback ( permission ) {
2023-04-21 06:23:36 +00:00
// do something with permission value
2020-08-11 09:42:31 +00:00
}
2019-06-16 13:09:54 +00:00
const styles = StyleSheet . create ( {
2023-04-21 06:23:36 +00:00
container : {
flex : 1 ,
justifyContent : 'center' ,
alignItems : 'center' ,
backgroundColor : '#F5FCFF' ,
} ,
welcome : {
fontSize : 20 ,
textAlign : 'center' ,
margin : 10 ,
} ,
instructions : {
textAlign : 'center' ,
color : '#333333' ,
marginBottom : 5 ,
} ,
2019-06-16 13:09:54 +00:00
} ) ;