import React from 'react'; // Sentry import * as Sentry from '@sentry/react-native'; // Redux import { Provider } from 'react-redux'; import { initDocuments } from './App/Store/Actions/documents'; import { store } from './App/Store/ConfigureStore'; // Deps import { NavigationContainer } from '@react-navigation/native'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; import * as SplashScreen from 'expo-splash-screen'; import { Alert, Button, DrawerLayoutAndroid, Image, Text, TextInput, TouchableOpacity, View, } from 'react-native'; import FlashMessage, { showMessage } from 'react-native-flash-message'; import 'react-native-gesture-handler'; import Icon from 'react-native-vector-icons/FontAwesome5'; import { navigate, navigationRef } from './Navigation'; // Application infos import * as Application from 'expo-application'; // i18n import i18n from './I18n'; // FileSytem import * as FileSystem from 'expo-file-system'; // Views import ContactDetailsScreen from './App/Views/ContactDetailsScreen'; import ContactScreen from './App/Views/ContactScreen'; import DirectoriesScreen from './App/Views/DirectoriesScreen'; import HomeScreen from './App/Views/HomeScreen'; import InstallScreen from './App/Views/InstallScreen'; import LoginScreen from './App/Views/LoginScreen'; import MySpaceScreen from './App/Views/MySpaceScreen'; import OnlyVideosScreen from './App/Views/OnlyVideosScreen'; import PDFScreen from './App/Views/PDFScreen'; import SearchScreen from './App/Views/SearchScreen'; import SyncScreen from './App/Views/SyncScreen'; import VideoScreen from './App/Views/VideoScreen'; // Style import styles from './Resources/Styles/NavigationStyle'; // Controllers import SyncController from './App/Controllers/SyncController'; Sentry.init({ dsn: 'https://ab87e8d840324f41873c95b06903b0bf@o4504314935640064.ingest.sentry.io/4504441255886848', }); Sentry.setContext('app', { boUrl: SyncController.getUrlBo(), }); SplashScreen.preventAutoHideAsync(); //Keep store.dispatch({ type: 'INIT' }); store.dispatch({ type: 'INIT_LOCALE' }); store.dispatch({ type: 'INIT_USERS' }); const Stack = createNativeStackNavigator(); class App extends React.Component { state = { isSetup: false, isLogged: false, searchTxt: '', sendEmail: '', mainColor: '', drawerRef: React.createRef(), }; componentDidMount() { const unsubscribe = store.subscribe(this.handleChange.bind(this)); this.setState({ isSetup: store.getState().app.isSetup, isLogged: store.getState().app.logged, mainColor: store.getState().app.mainColor, }); } handleChange() { this.setState({ isSetup: store.getState().app.isSetup, isLogged: store.getState().app.logged, mainColor: store.getState().app.mainColor, }); // to force re-rendering console.log('state changed'); } navigationView = () => ( { this.state.drawerRef.current.closeDrawer(); store.dispatch({ type: 'EDIT_LOCALE' }); store.dispatch( initDocuments( store.getState().locale.locale, store.getState().directories.global, ), ); }} style={styles.drawer.btn}> {i18n.t('global.change_lang')} { this.state.drawerRef.current.closeDrawer(); navigate('SyncScreen'); }} style={styles.drawer.btn}> {i18n.t('global.sync')} { this.state.drawerRef.current.closeDrawer(); store.dispatch({ type: 'SET_CURRENT_USER', data: false }); }} style={styles.drawer.btn}> {i18n.t('global.logout')} Version : {Application.nativeApplicationVersion}