import React from 'react'; import { View, Button, Alert, Text } from 'react-native'; // Redux import { connect } from 'react-redux'; import { initDirectories } from '../Store/Actions/directories'; import { initContact } from '../Store/Actions/contacts'; // 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 { User, Contact, Directory, Document } 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 }; } const mapDispatchToProps = dispatch => { return { init: () => dispatch({ type: 'INIT' }), initUsers: () => dispatch({ type: 'INIT_USERS' }), initDirectories: (lang, user) => dispatch(initDirectories(lang, user)), 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 (