From 64c324d30ab2dbd31fa7f20078dd2adaf93feb32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Thu, 31 Aug 2023 13:29:17 +0200 Subject: [PATCH] Sync users if possible on login screen (prevent reinstalling app to sync new users) --- ComApp/src/App/Views/LoginScreen.js | 41 ++++++++++++++++++++++++++--- ComApp/src/App/Views/SyncScreen.js | 2 +- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/ComApp/src/App/Views/LoginScreen.js b/ComApp/src/App/Views/LoginScreen.js index f44d302..eb0d15b 100644 --- a/ComApp/src/App/Views/LoginScreen.js +++ b/ComApp/src/App/Views/LoginScreen.js @@ -22,7 +22,8 @@ import * as FileSystem from 'expo-file-system'; // Controller import LoginController from '../Controllers/LoginController'; // Database -import { Setting } from '../../Database'; +import { Setting, User } from '../../Database'; +import InstallController from '../Controllers/InstallController'; import SyncController from '../Controllers/SyncController'; function mapStateToProps(state) { @@ -42,6 +43,7 @@ const mapDispatchToProps = dispatch => { class LoginScreen extends React.Component { state = { + syncWorking: false, login: '', password: '', }; @@ -51,6 +53,7 @@ class LoginScreen extends React.Component { this.props.setCurrentUser(false); } SplashScreen.hideAsync(); + this.syncUsersIfPossibleAsync(); } render() { @@ -83,11 +86,12 @@ class LoginScreen extends React.Component { autoCorrect={false} />