2022-09-28 18:08:39 +02:00
|
|
|
import React from 'react';
|
2023-01-03 16:53:23 +01:00
|
|
|
// Sentry
|
2023-08-22 10:32:40 +02:00
|
|
|
import * as Sentry from '@sentry/react-native';
|
2022-12-28 13:27:14 +01:00
|
|
|
// Redux
|
2022-10-04 19:02:39 +02:00
|
|
|
import { Provider } from 'react-redux';
|
2023-01-04 17:20:42 +01:00
|
|
|
import { initDocuments } from './App/Store/Actions/documents';
|
2023-08-22 10:32:40 +02:00
|
|
|
import { store } from './App/Store/ConfigureStore';
|
2022-12-28 16:32:30 +01:00
|
|
|
// Deps
|
|
|
|
|
import { NavigationContainer } from '@react-navigation/native';
|
|
|
|
|
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
|
|
|
import * as SplashScreen from 'expo-splash-screen';
|
2023-08-22 10:32:40 +02:00
|
|
|
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';
|
2023-01-04 10:10:25 +01:00
|
|
|
// Application infos
|
|
|
|
|
import * as Application from 'expo-application';
|
2022-12-28 13:27:14 +01:00
|
|
|
// i18n
|
2023-08-22 10:32:40 +02:00
|
|
|
import i18n from './I18n';
|
2022-12-30 10:02:07 +01:00
|
|
|
// FileSytem
|
|
|
|
|
import * as FileSystem from 'expo-file-system';
|
2022-12-28 13:27:14 +01:00
|
|
|
// Views
|
2023-08-22 10:32:40 +02:00
|
|
|
import ContactDetailsScreen from './App/Views/ContactDetailsScreen';
|
|
|
|
|
import ContactScreen from './App/Views/ContactScreen';
|
|
|
|
|
import DirectoriesScreen from './App/Views/DirectoriesScreen';
|
|
|
|
|
import HomeScreen from './App/Views/HomeScreen';
|
2022-12-28 13:27:14 +01:00
|
|
|
import InstallScreen from './App/Views/InstallScreen';
|
|
|
|
|
import LoginScreen from './App/Views/LoginScreen';
|
2023-08-22 10:32:40 +02:00
|
|
|
import MySpaceScreen from './App/Views/MySpaceScreen';
|
|
|
|
|
import OnlyVideosScreen from './App/Views/OnlyVideosScreen';
|
2022-12-29 12:44:26 +01:00
|
|
|
import PDFScreen from './App/Views/PDFScreen';
|
2023-08-22 10:32:40 +02:00
|
|
|
import SearchScreen from './App/Views/SearchScreen';
|
|
|
|
|
import SyncScreen from './App/Views/SyncScreen';
|
2022-12-29 15:25:30 +01:00
|
|
|
import VideoScreen from './App/Views/VideoScreen';
|
2022-12-30 10:02:07 +01:00
|
|
|
// Style
|
|
|
|
|
import styles from './Resources/Styles/NavigationStyle';
|
2023-01-03 16:53:23 +01:00
|
|
|
// Controllers
|
|
|
|
|
import SyncController from './App/Controllers/SyncController';
|
|
|
|
|
|
|
|
|
|
Sentry.init({
|
2023-08-22 10:32:40 +02:00
|
|
|
dsn: 'https://ab87e8d840324f41873c95b06903b0bf@o4504314935640064.ingest.sentry.io/4504441255886848',
|
2023-01-03 16:53:23 +01:00
|
|
|
});
|
|
|
|
|
|
2023-08-22 10:32:40 +02:00
|
|
|
Sentry.setContext('app', {
|
|
|
|
|
boUrl: SyncController.getUrlBo(),
|
2023-01-03 16:53:23 +01:00
|
|
|
});
|
2023-01-03 12:55:28 +01:00
|
|
|
|
|
|
|
|
SplashScreen.preventAutoHideAsync(); //Keep
|
2022-10-04 19:02:39 +02:00
|
|
|
|
2022-12-28 17:53:43 +01:00
|
|
|
store.dispatch({ type: 'INIT' });
|
2022-12-28 13:27:14 +01:00
|
|
|
store.dispatch({ type: 'INIT_LOCALE' });
|
2022-10-06 16:25:15 +02:00
|
|
|
store.dispatch({ type: 'INIT_USERS' });
|
2022-12-28 16:32:30 +01:00
|
|
|
|
2022-12-28 13:27:14 +01:00
|
|
|
const Stack = createNativeStackNavigator();
|
2022-10-06 16:25:15 +02:00
|
|
|
|
|
|
|
|
class App extends React.Component {
|
2022-10-04 19:02:39 +02:00
|
|
|
state = {
|
2022-12-28 16:32:30 +01:00
|
|
|
isSetup: false,
|
|
|
|
|
isLogged: false,
|
2022-10-04 19:02:39 +02:00
|
|
|
searchTxt: '',
|
2022-12-30 10:02:07 +01:00
|
|
|
sendEmail: '',
|
2023-01-03 16:14:37 +01:00
|
|
|
mainColor: '',
|
2023-08-22 10:32:40 +02:00
|
|
|
drawerRef: React.createRef(),
|
2022-10-04 19:02:39 +02:00
|
|
|
};
|
|
|
|
|
|
2022-12-28 16:32:30 +01:00
|
|
|
componentDidMount() {
|
2022-10-10 11:51:31 +02:00
|
|
|
const unsubscribe = store.subscribe(this.handleChange.bind(this));
|
2022-12-28 16:32:30 +01:00
|
|
|
this.setState({
|
|
|
|
|
isSetup: store.getState().app.isSetup,
|
|
|
|
|
isLogged: store.getState().app.logged,
|
2023-08-22 10:32:40 +02:00
|
|
|
mainColor: store.getState().app.mainColor,
|
2022-12-28 16:32:30 +01:00
|
|
|
});
|
2022-10-10 11:51:31 +02:00
|
|
|
}
|
|
|
|
|
|
2022-12-28 16:32:30 +01:00
|
|
|
handleChange() {
|
|
|
|
|
this.setState({
|
|
|
|
|
isSetup: store.getState().app.isSetup,
|
|
|
|
|
isLogged: store.getState().app.logged,
|
2023-08-22 10:32:40 +02:00
|
|
|
mainColor: store.getState().app.mainColor,
|
2022-12-28 16:32:30 +01:00
|
|
|
}); // to force re-rendering
|
2023-08-22 10:32:40 +02:00
|
|
|
console.log('state changed');
|
2022-10-10 11:51:31 +02:00
|
|
|
}
|
|
|
|
|
|
2023-01-03 16:14:37 +01:00
|
|
|
navigationView = () => (
|
|
|
|
|
<View style={styles.drawer.container}>
|
|
|
|
|
<View>
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={() => {
|
|
|
|
|
this.state.drawerRef.current.closeDrawer();
|
|
|
|
|
store.dispatch({ type: 'EDIT_LOCALE' });
|
2023-08-22 10:32:40 +02:00
|
|
|
store.dispatch(
|
|
|
|
|
initDocuments(
|
|
|
|
|
store.getState().locale.locale,
|
|
|
|
|
store.getState().directories.global,
|
|
|
|
|
),
|
|
|
|
|
);
|
2023-01-03 16:14:37 +01:00
|
|
|
}}
|
|
|
|
|
style={styles.drawer.btn}>
|
|
|
|
|
<Image source={this.renderFlag()} style={{ width: 25, height: 25 }} />
|
2023-08-22 10:32:40 +02:00
|
|
|
<Text style={styles.drawer.btnText}>
|
|
|
|
|
{i18n.t('global.change_lang')}
|
|
|
|
|
</Text>
|
2023-01-03 16:14:37 +01:00
|
|
|
</TouchableOpacity>
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={() => {
|
|
|
|
|
this.state.drawerRef.current.closeDrawer();
|
2023-08-22 10:32:40 +02:00
|
|
|
navigate('SyncScreen');
|
2023-01-03 16:14:37 +01:00
|
|
|
}}
|
|
|
|
|
style={styles.drawer.btn}>
|
|
|
|
|
<Icon name="sync-alt" size={20} />
|
|
|
|
|
<Text style={styles.drawer.btnText}>{i18n.t('global.sync')}</Text>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={() => {
|
|
|
|
|
this.state.drawerRef.current.closeDrawer();
|
|
|
|
|
store.dispatch({ type: 'SET_CURRENT_USER', data: false });
|
|
|
|
|
}}
|
|
|
|
|
style={styles.drawer.btn}>
|
|
|
|
|
<Icon name="sign-out-alt" size={20} />
|
|
|
|
|
<Text style={styles.drawer.btnText}>{i18n.t('global.logout')}</Text>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
</View>
|
2023-01-04 10:10:25 +01:00
|
|
|
<View>
|
2023-08-22 10:32:40 +02:00
|
|
|
<Text style={{ marginBottom: 10 }}>
|
|
|
|
|
Version : {Application.nativeApplicationVersion}
|
|
|
|
|
</Text>
|
2023-01-04 10:10:25 +01:00
|
|
|
<Button
|
|
|
|
|
title={i18n.t('global.close')}
|
|
|
|
|
color={this.state.mainColor}
|
|
|
|
|
onPress={() => this.state.drawerRef.current.closeDrawer()}
|
|
|
|
|
/>
|
|
|
|
|
</View>
|
2023-01-03 16:14:37 +01:00
|
|
|
</View>
|
|
|
|
|
);
|
|
|
|
|
|
2022-10-06 16:25:15 +02:00
|
|
|
render() {
|
2022-10-10 11:51:31 +02:00
|
|
|
return (
|
|
|
|
|
<Provider store={store}>
|
2023-01-03 16:14:37 +01:00
|
|
|
<NavigationContainer ref={navigationRef}>
|
|
|
|
|
<DrawerLayoutAndroid
|
|
|
|
|
ref={this.state.drawerRef}
|
|
|
|
|
drawerWidth={300}
|
2023-08-22 10:32:40 +02:00
|
|
|
drawerPosition={'right'}
|
2023-01-03 16:14:37 +01:00
|
|
|
drawerLockMode={'locked-open'}
|
2023-08-22 10:32:40 +02:00
|
|
|
renderNavigationView={this.navigationView}>
|
|
|
|
|
<Stack.Navigator initialRouteName="HomeScreen">
|
|
|
|
|
{this.state.isSetup === false && (
|
|
|
|
|
<Stack.Screen
|
|
|
|
|
name="InstallScreen"
|
|
|
|
|
component={InstallScreen}
|
|
|
|
|
options={(navigation, route) => ({
|
|
|
|
|
headerTitle: () =>
|
|
|
|
|
this.LogoTitle(
|
|
|
|
|
navigation,
|
|
|
|
|
i18n.t('install.installation'),
|
|
|
|
|
false,
|
|
|
|
|
),
|
|
|
|
|
headerRight: () => (
|
|
|
|
|
<View
|
|
|
|
|
style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={() => {
|
|
|
|
|
store.dispatch({ type: 'EDIT_LOCALE' });
|
|
|
|
|
}}
|
|
|
|
|
style={{ marginRight: 15 }}>
|
|
|
|
|
<Image
|
|
|
|
|
source={this.renderFlag()}
|
|
|
|
|
style={{ width: 25, height: 25 }}
|
|
|
|
|
/>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
</View>
|
|
|
|
|
),
|
|
|
|
|
})}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
{this.state.isLogged === false ? (
|
|
|
|
|
<Stack.Screen
|
|
|
|
|
name="LoginScreen"
|
|
|
|
|
component={LoginScreen}
|
|
|
|
|
options={(navigation, route) => ({
|
|
|
|
|
headerTitle: () =>
|
|
|
|
|
this.LogoTitle(navigation, i18n.t('global.login'), false),
|
|
|
|
|
headerRight: () => (
|
|
|
|
|
<View
|
|
|
|
|
style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={() => {
|
|
|
|
|
store.dispatch({ type: 'EDIT_LOCALE' });
|
|
|
|
|
}}
|
|
|
|
|
style={{ marginRight: 15 }}>
|
|
|
|
|
<Image
|
|
|
|
|
source={this.renderFlag()}
|
|
|
|
|
style={{ width: 25, height: 25 }}
|
|
|
|
|
/>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
</View>
|
|
|
|
|
),
|
|
|
|
|
})}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
<Stack.Screen
|
|
|
|
|
name="HomeScreen"
|
|
|
|
|
component={HomeScreen}
|
|
|
|
|
options={(navigation, route) => ({
|
|
|
|
|
headerTitle: () =>
|
|
|
|
|
this.LogoTitle(navigation, i18n.t('global.home')),
|
|
|
|
|
headerRight: () => (
|
|
|
|
|
<View
|
|
|
|
|
style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
|
|
|
<View style={{ flexDirection: 'row', marginRight: 50 }}>
|
|
|
|
|
<TextInput
|
|
|
|
|
style={{
|
|
|
|
|
...styles.searchInput,
|
|
|
|
|
borderColor: this.state.mainColor,
|
|
|
|
|
}}
|
|
|
|
|
placeholder={i18n.t('global.search')}
|
|
|
|
|
value={this.state.searchTxt}
|
|
|
|
|
onChangeText={text =>
|
|
|
|
|
this.setState({ searchTxt: text })
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
style={{
|
|
|
|
|
...styles.btnSearch,
|
|
|
|
|
backgroundColor: this.state.mainColor,
|
|
|
|
|
}}
|
|
|
|
|
onPress={() => {
|
|
|
|
|
if (this.state.searchTxt.length > 0) {
|
|
|
|
|
navigation.navigation.navigate('SearchScreen', {
|
|
|
|
|
needle: this.state.searchTxt,
|
|
|
|
|
onlyVideos: false,
|
|
|
|
|
});
|
|
|
|
|
this.setState({ searchTxt: '' });
|
|
|
|
|
}
|
|
|
|
|
}}>
|
|
|
|
|
<Icon name={'search'} size={20} color={'white'} />
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
</View>
|
|
|
|
|
{store.getState().app.ShowIsActive === '1' && (
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={() =>
|
|
|
|
|
navigation.navigation.navigate('MySpaceScreen')
|
|
|
|
|
}
|
|
|
|
|
style={{ marginRight: 25 }}>
|
|
|
|
|
<Icon name="user-circle" size={25} />
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
)}
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={() =>
|
|
|
|
|
navigation.navigation.navigate('ContactScreen', {
|
|
|
|
|
action: 'add',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
style={{ marginRight: 25 }}>
|
|
|
|
|
<Icon name="user-plus" size={20} />
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={() => {
|
|
|
|
|
this.state.drawerRef.current.openDrawer();
|
|
|
|
|
}}
|
|
|
|
|
style={{ marginRight: 25 }}>
|
|
|
|
|
<Icon name="sliders-h" size={20} />
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
</View>
|
|
|
|
|
),
|
|
|
|
|
})}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2022-12-28 13:27:14 +01:00
|
|
|
<Stack.Screen
|
2023-08-22 10:32:40 +02:00
|
|
|
name="SyncScreen"
|
|
|
|
|
component={SyncScreen}
|
|
|
|
|
initialParams={{ forceSync: false }}
|
2022-12-28 13:27:14 +01:00
|
|
|
options={(navigation, route) => ({
|
2023-08-22 10:32:40 +02:00
|
|
|
headerTitle: () =>
|
|
|
|
|
this.LogoTitle(
|
|
|
|
|
navigation,
|
|
|
|
|
i18n.t('global.synchronization'),
|
|
|
|
|
),
|
2022-12-28 13:27:14 +01:00
|
|
|
})}
|
|
|
|
|
/>
|
2022-10-10 11:51:31 +02:00
|
|
|
<Stack.Screen
|
2023-08-22 10:32:40 +02:00
|
|
|
name="DirectoriesScreen"
|
|
|
|
|
component={DirectoriesScreen}
|
2022-10-10 11:51:31 +02:00
|
|
|
options={(navigation, route) => ({
|
2023-08-22 10:32:40 +02:00
|
|
|
headerTitle: () =>
|
|
|
|
|
this.LogoTitle(navigation, i18n.t('app.folders')),
|
2022-10-10 11:51:31 +02:00
|
|
|
})}
|
|
|
|
|
/>
|
2023-08-22 10:32:40 +02:00
|
|
|
<Stack.Screen
|
|
|
|
|
name="OnlyVideosScreen"
|
|
|
|
|
component={OnlyVideosScreen}
|
2022-10-06 16:25:15 +02:00
|
|
|
options={(navigation, route) => ({
|
2023-08-22 10:32:40 +02:00
|
|
|
headerTitle: () =>
|
|
|
|
|
this.LogoTitle(navigation, i18n.t('global.videos')),
|
2022-10-06 16:25:15 +02:00
|
|
|
headerRight: () => (
|
2023-08-22 10:32:40 +02:00
|
|
|
<View style={{ flexDirection: 'row', marginRight: 5 }}>
|
|
|
|
|
<TextInput
|
|
|
|
|
style={{
|
|
|
|
|
...styles.searchInput,
|
|
|
|
|
borderColor: this.state.mainColor,
|
|
|
|
|
}}
|
|
|
|
|
placeholder={i18n.t('global.search')}
|
|
|
|
|
value={this.state.searchTxt}
|
|
|
|
|
onChangeText={text =>
|
|
|
|
|
this.setState({ searchTxt: text })
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
style={{
|
|
|
|
|
...styles.btnSearch,
|
|
|
|
|
backgroundColor: this.state.mainColor,
|
|
|
|
|
}}
|
|
|
|
|
onPress={() => {
|
2022-10-06 16:25:15 +02:00
|
|
|
if (this.state.searchTxt.length > 0) {
|
|
|
|
|
navigation.navigation.navigate('SearchScreen', {
|
|
|
|
|
needle: this.state.searchTxt,
|
2023-08-22 10:32:40 +02:00
|
|
|
onlyVideos: true,
|
2022-10-06 16:25:15 +02:00
|
|
|
});
|
|
|
|
|
this.setState({ searchTxt: '' });
|
|
|
|
|
}
|
|
|
|
|
}}>
|
2023-08-22 10:32:40 +02:00
|
|
|
<Icon name={'search'} size={20} color={'white'} />
|
2022-10-06 16:25:15 +02:00
|
|
|
</TouchableOpacity>
|
2023-08-22 10:32:40 +02:00
|
|
|
</View>
|
|
|
|
|
),
|
|
|
|
|
})}
|
|
|
|
|
/>
|
|
|
|
|
<Stack.Screen
|
|
|
|
|
name="VideoScreen"
|
|
|
|
|
component={VideoScreen}
|
|
|
|
|
options={(navigation, route) => ({
|
|
|
|
|
headerTitle: () =>
|
|
|
|
|
this.LogoTitle(navigation, i18n.t('app.video')),
|
|
|
|
|
headerRight: () => this.SendEmail(),
|
|
|
|
|
orientation: 'landscape',
|
|
|
|
|
})}
|
|
|
|
|
/>
|
|
|
|
|
<Stack.Screen
|
|
|
|
|
name="PDFScreen"
|
|
|
|
|
component={PDFScreen}
|
|
|
|
|
options={(navigation, route) => ({
|
|
|
|
|
headerTitle: () => this.LogoTitle(navigation, 'PDF'),
|
|
|
|
|
headerRight: () => this.SendEmail(),
|
|
|
|
|
})}
|
|
|
|
|
/>
|
|
|
|
|
<Stack.Screen
|
|
|
|
|
name="ContactScreen"
|
|
|
|
|
component={ContactScreen}
|
|
|
|
|
options={(navigation, route) => ({
|
|
|
|
|
headerTitle: () =>
|
|
|
|
|
this.LogoTitle(navigation, i18n.t('global.contacts')),
|
|
|
|
|
})}
|
|
|
|
|
initialParams={{ contactAdded: false }}
|
|
|
|
|
/>
|
|
|
|
|
<Stack.Screen
|
|
|
|
|
name="ContactDetailsScreen"
|
|
|
|
|
component={ContactDetailsScreen}
|
|
|
|
|
options={(navigation, route) => ({
|
|
|
|
|
headerTitle: () =>
|
|
|
|
|
this.LogoTitle(navigation, i18n.t('app.contact_details')),
|
|
|
|
|
})}
|
|
|
|
|
/>
|
|
|
|
|
<Stack.Screen
|
|
|
|
|
name="SearchScreen"
|
|
|
|
|
component={SearchScreen}
|
|
|
|
|
options={(navigation, route) => ({
|
|
|
|
|
headerTitle: () =>
|
|
|
|
|
this.LogoTitle(navigation, i18n.t('app.results_search')),
|
|
|
|
|
})}
|
|
|
|
|
/>
|
|
|
|
|
<Stack.Screen
|
|
|
|
|
name="MySpaceScreen"
|
|
|
|
|
component={MySpaceScreen}
|
|
|
|
|
options={(navigation, route) => ({
|
|
|
|
|
headerTitle: () =>
|
|
|
|
|
this.LogoTitle(navigation, i18n.t('app.my_space')),
|
|
|
|
|
headerRight: () => (
|
|
|
|
|
<View
|
|
|
|
|
style={{ flexDirection: 'row', alignItems: 'center' }}>
|
2022-10-06 16:25:15 +02:00
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={() => {
|
2023-08-22 10:32:40 +02:00
|
|
|
const folder = store
|
|
|
|
|
.getState()
|
|
|
|
|
.directories.treeview.filter(tmp => tmp.id === 1);
|
|
|
|
|
navigation.navigation.navigate('DirectoriesScreen', {
|
|
|
|
|
folder: folder,
|
|
|
|
|
});
|
2022-10-06 16:25:15 +02:00
|
|
|
}}
|
2023-08-22 10:32:40 +02:00
|
|
|
style={{ marginRight: 15 }}>
|
|
|
|
|
<Icon name="briefcase" size={20} />
|
2022-10-06 16:25:15 +02:00
|
|
|
</TouchableOpacity>
|
|
|
|
|
</View>
|
2022-10-10 11:51:31 +02:00
|
|
|
),
|
2022-10-06 16:25:15 +02:00
|
|
|
})}
|
2023-08-22 10:32:40 +02:00
|
|
|
/>
|
|
|
|
|
</Stack.Navigator>
|
2023-01-03 16:14:37 +01:00
|
|
|
<FlashMessage position="top" />
|
|
|
|
|
</DrawerLayoutAndroid>
|
2022-10-10 11:51:31 +02:00
|
|
|
</NavigationContainer>
|
|
|
|
|
</Provider>
|
|
|
|
|
);
|
2022-10-06 16:25:15 +02:00
|
|
|
}
|
2022-12-28 13:27:14 +01:00
|
|
|
|
2022-12-30 10:02:07 +01:00
|
|
|
LogoTitle(navigation, title, wantBtn = true) {
|
2022-12-28 16:32:30 +01:00
|
|
|
return (
|
|
|
|
|
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
2023-08-22 10:32:40 +02:00
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={() => {
|
|
|
|
|
if (wantBtn) {
|
|
|
|
|
navigation.navigation.navigate('HomeScreen');
|
|
|
|
|
}
|
|
|
|
|
}}>
|
2022-12-30 10:02:07 +01:00
|
|
|
{this.state.isSetup ? (
|
|
|
|
|
<Image
|
|
|
|
|
style={{ width: 100, height: 50, resizeMode: 'stretch' }}
|
2023-08-22 10:32:40 +02:00
|
|
|
source={{
|
|
|
|
|
uri: FileSystem.documentDirectory + 'RectangleLogo.png',
|
|
|
|
|
}}
|
2022-12-30 10:02:07 +01:00
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
<Image
|
|
|
|
|
style={{ width: 100, height: 50, resizeMode: 'stretch' }}
|
2023-08-22 10:32:40 +02:00
|
|
|
source={require('./Resources/assets/img/logo.png')}
|
2022-12-30 10:02:07 +01:00
|
|
|
/>
|
|
|
|
|
)}
|
2022-12-29 19:22:49 +01:00
|
|
|
</TouchableOpacity>
|
2022-12-28 16:32:30 +01:00
|
|
|
<Text style={{ marginLeft: 10, fontSize: 18 }}>{title}</Text>
|
|
|
|
|
</View>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SendEmail() {
|
|
|
|
|
return (
|
2023-08-22 10:32:40 +02:00
|
|
|
<View
|
|
|
|
|
style={{ flexDirection: 'row', alignItems: 'center', marginRight: 10 }}>
|
|
|
|
|
<TextInput
|
|
|
|
|
style={{ ...styles.searchInput, borderColor: this.state.mainColor }}
|
|
|
|
|
placeholder={i18n.t('global.email')}
|
|
|
|
|
value={this.state.sendEmail}
|
|
|
|
|
onChangeText={text => this.setState({ sendEmail: text })}
|
|
|
|
|
/>
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
style={{ ...styles.btnSearch, backgroundColor: this.state.mainColor }}
|
|
|
|
|
onPress={() => {
|
|
|
|
|
if (this.state.sendEmail.length > 0) {
|
|
|
|
|
if (Helpers.isEmailValid(this.state.sendEmail)) {
|
|
|
|
|
const email = {
|
|
|
|
|
email: this.state.sendEmail,
|
|
|
|
|
subject: i18n.t('app.file_sharing'),
|
|
|
|
|
message: '',
|
|
|
|
|
documents: JSON.stringify([
|
|
|
|
|
store.getState().currentOpenedDoc,
|
|
|
|
|
]),
|
|
|
|
|
user_id: store.getState().currentUser.id,
|
|
|
|
|
};
|
|
|
|
|
store.dispatch({ type: 'SEND_BROCHURE', data: email });
|
|
|
|
|
showMessage({
|
|
|
|
|
message: i18n.t('global.message_sent') + '.',
|
|
|
|
|
description:
|
|
|
|
|
i18n.t('global.message_will_be_sent_after_sync') + '.',
|
|
|
|
|
type: 'success',
|
|
|
|
|
duration: 1500,
|
|
|
|
|
});
|
|
|
|
|
this.setState({ sendEmail: '' });
|
|
|
|
|
} else {
|
|
|
|
|
Alert.alert(
|
|
|
|
|
i18n.t('global.warning') + ' !',
|
|
|
|
|
i18n.t('error.invalid_email_address') + '.',
|
|
|
|
|
[{ text: 'OK' }],
|
|
|
|
|
{ cancelable: false },
|
|
|
|
|
);
|
|
|
|
|
}
|
2022-12-28 16:32:30 +01:00
|
|
|
}
|
2023-08-22 10:32:40 +02:00
|
|
|
}}>
|
2022-12-28 16:32:30 +01:00
|
|
|
<Icon name={'paper-plane'} size={20} color={'white'} />
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
</View>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-28 13:27:14 +01:00
|
|
|
renderFlag() {
|
|
|
|
|
let flag;
|
|
|
|
|
switch (store.getState().locale.locale) {
|
2023-08-22 10:32:40 +02:00
|
|
|
case 'fr':
|
2022-12-28 13:27:14 +01:00
|
|
|
flag = require('./assets/img/flags/fr.png');
|
|
|
|
|
break;
|
2023-08-22 10:32:40 +02:00
|
|
|
case 'en':
|
2022-12-28 13:27:14 +01:00
|
|
|
flag = require('./assets/img/flags/en.png');
|
|
|
|
|
break;
|
2023-08-22 10:32:40 +02:00
|
|
|
case 'de':
|
2022-12-28 13:27:14 +01:00
|
|
|
flag = require('./assets/img/flags/de.png');
|
|
|
|
|
break;
|
2023-08-22 10:32:40 +02:00
|
|
|
case 'es':
|
2022-12-28 13:27:14 +01:00
|
|
|
flag = require('./assets/img/flags/es.png');
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return flag;
|
|
|
|
|
}
|
2022-10-10 11:51:31 +02:00
|
|
|
}
|
2022-10-07 18:27:54 +02:00
|
|
|
|
2023-01-03 16:53:23 +01:00
|
|
|
export default Sentry.wrap(App);
|