import React from 'react'; import { Alert, Button, Linking, Text, View } from 'react-native'; // Redux import { connect } from 'react-redux'; import { initContact } from '../Store/Actions/contacts'; import { initDirectories } from '../Store/Actions/directories'; import { initDocuments } from '../Store/Actions/documents'; // Sentry import * as Sentry from '@sentry/react-native'; // Style import styles from '../../Resources/Styles/SyncStyle'; // Translations import i18n from '../../I18n'; // Controller import SyncController from '../Controllers/SyncController'; // Progress import * as Progress from 'react-native-progress'; // Database import { Contact, Directory, Document, SendBrochure, User, } from '../../Database'; // FileSytem import * as FileSystem from 'expo-file-system'; function mapStateToProps(state) { return { syncVersion: state.app.syncVersion, currentUser: state.app.currentUser, locale: state.locale.locale, mainColor: state.app.mainColor, directories: state.directories, }; } const mapDispatchToProps = dispatch => { return { init: () => dispatch({ type: 'INIT' }), initUsers: () => dispatch({ type: 'INIT_USERS' }), initDirectories: (lang, user) => dispatch(initDirectories(lang, user)), initDocuments: (lang, directories) => dispatch(initDocuments(lang, directories)), initContact: currentUser => dispatch(initContact(currentUser)), initBtns: () => dispatch({ type: 'INIT_HOME_BTNS' }), updateVersion: version => dispatch({ type: 'UPDATE_VERSION', data: version, }), updateShowIsActive: value => dispatch({ type: 'UPDATE_SHOW_IS_ACTIVE', data: value, }), }; }; class SyncScreen extends React.Component { state = { progress: 0, txtStep: '', downloadProgress: 0, downloadingFile: false, processing: false, newApp: false, forced: false, }; componentDidMount() { const { forceSync } = this.props.route.params; if (forceSync === true) { this.setState({ forced: true }); this.sync(); } } render() { const fileProgress = this.fileProgress(); return (