From 793ef4a1fa8ef42b3b8311a23f770902366d99dd Mon Sep 17 00:00:00 2001 From: Vincent BRIDIER Date: Fri, 30 Dec 2022 10:02:07 +0100 Subject: [PATCH] add MainColor --- ComApp/src/App.js | 70 +++++++++++-------- ComApp/src/App/Store/Reducers/AppReducer.js | 5 +- ComApp/src/App/Views/ContactDetailsScreen.js | 37 +++++----- ComApp/src/App/Views/ContactScreen.js | 25 +++---- ComApp/src/App/Views/DirectoriesScreen.js | 4 +- ComApp/src/App/Views/HomeScreen.js | 9 ++- ComApp/src/App/Views/LoginScreen.js | 3 +- ComApp/src/App/Views/OnlyVideosScreen.js | 3 +- ComApp/src/App/Views/SearchScreen.js | 3 +- ComApp/src/App/Views/SyncScreen.js | 4 +- ComApp/src/App/Views/VideoScreen.js | 14 +++- ComApp/src/Resources/CommonStyles.js | 24 +++---- ComApp/src/Resources/Styles/ContactStyle.js | 4 +- .../src/Resources/Styles/DirectoriesStyle.js | 1 - .../src/Resources/Styles/NavigationStyle.js | 2 - .../src/Resources/Styles/OnlyVideosStyle.js | 1 - ComApp/src/Resources/Styles/SearchStyle.js | 1 - ComApp/src/Views/ContactDetails.js | 14 ++-- ComApp/src/Views/ContactDetails_MC.js | 14 ++-- ComApp/src/Views/ContactDetails_RHD.js | 24 +++---- 20 files changed, 142 insertions(+), 120 deletions(-) diff --git a/ComApp/src/App.js b/ComApp/src/App.js index 49afa7e..225cd9e 100644 --- a/ComApp/src/App.js +++ b/ComApp/src/App.js @@ -13,6 +13,8 @@ import FlashMessage, { showMessage } from 'react-native-flash-message'; import * as SplashScreen from 'expo-splash-screen'; // i18n import i18n from "./I18n"; +// FileSytem +import * as FileSystem from 'expo-file-system'; // Controllers import SyncController from './App/Controllers/SyncController'; // Views @@ -28,6 +30,8 @@ import ContactScreen from './App/Views/ContactScreen'; import ContactDetailsScreen from './App/Views/ContactDetailsScreen'; import SearchScreen from "./App/Views/SearchScreen"; import MySpaceScreen from './App/Views/MySpaceScreen'; +// Style +import styles from './Resources/Styles/NavigationStyle'; // END V2 // V2 //SplashScreen.preventAutoHideAsync(); //Keep @@ -44,7 +48,8 @@ class App extends React.Component { isSetup: false, isLogged: false, searchTxt: '', - sendEmail: '' + sendEmail: '', + mainColor: '' }; componentDidMount() { @@ -63,6 +68,7 @@ class App extends React.Component { 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") } @@ -77,7 +83,7 @@ class App extends React.Component { name="InstallScreen" component={InstallScreen} options={(navigation, route) => ({ - headerTitle: () => this.LogoTitle(navigation, i18n.t('install.installation')), + headerTitle: () => this.LogoTitle(navigation, i18n.t('install.installation'), false), headerRight: () => ( ({ - headerTitle: () => this.LogoTitle(navigation, i18n.t('global.login')), + headerTitle: () => this.LogoTitle(navigation, i18n.t('global.login'), false), headerRight: () => ( ( - this.setState({ searchTxt: text })} /> - { + this.setState({ searchTxt: text })} + /> + { if (this.state.searchTxt.length > 0) { navigation.navigation.navigate('SearchScreen', { needle: this.state.searchTxt, @@ -189,8 +202,8 @@ class App extends React.Component { headerTitle: () => this.LogoTitle(navigation, i18n.t('global.videos')), headerRight: () => ( - this.setState({ searchTxt: text })} /> - { + this.setState({ searchTxt: text })} /> + { if (this.state.searchTxt.length > 0) { navigation.navigation.navigate('SearchScreen', { needle: this.state.searchTxt, @@ -270,14 +283,25 @@ class App extends React.Component { ); } - LogoTitle(navigation, title) { + LogoTitle(navigation, title, wantBtn = true) { return ( - { navigation.navigation.navigate('HomeScreen') }}> - + { + if (wantBtn) { + navigation.navigation.navigate('HomeScreen') + } + }}> + {this.state.isSetup ? ( + + ) : ( + + )} {title} @@ -287,8 +311,8 @@ class App extends React.Component { SendEmail() { return ( - this.setState({ sendEmail: text })} /> - { + this.setState({ sendEmail: text })} /> + { if (this.state.sendEmail.length > 0) { if (Helpers.isEmailValid(this.state.sendEmail)) { const email = { @@ -342,20 +366,4 @@ class App extends React.Component { } -const styles = StyleSheet.create({ - searchInput: { - borderWidth: 1, - borderColor: '#ea4f52', - width: 200, - paddingLeft: 20, - }, - btnSearch: { - width: 50, - height: 50, - alignItems: 'center', - justifyContent: 'center', - backgroundColor: '#ea4f52' - } -}); - export default App; diff --git a/ComApp/src/App/Store/Reducers/AppReducer.js b/ComApp/src/App/Store/Reducers/AppReducer.js index b2eb8ba..53115e2 100644 --- a/ComApp/src/App/Store/Reducers/AppReducer.js +++ b/ComApp/src/App/Store/Reducers/AppReducer.js @@ -11,6 +11,7 @@ const initialState = { currentOpenedDoc: {}, ShowIsActive: 0, HomeBtns: {}, + mainColor: '#ea4f52' }; const reducer = (state = initialState, action) => { @@ -18,11 +19,13 @@ const reducer = (state = initialState, action) => { switch (action.type) { case 'INIT': let ShowIsActive = Setting.get('ShowIsActive'); + let MainColor = Setting.get('MainColor'); saved = Setting.get('isSetup'); return { ...state, isSetup: saved === undefined ? false : saved.value === "true" ? true : false, - ShowIsActive: ShowIsActive === undefined ? false : ShowIsActive.value + ShowIsActive: ShowIsActive === undefined ? false : ShowIsActive.value, + mainColor: MainColor === undefined ? initialState.mainColor : MainColor === false ? initialState.mainColor : MainColor.value }; case 'INIT_HOME_BTNS': { let HomeFolders = Setting.get('HomeFolders'); diff --git a/ComApp/src/App/Views/ContactDetailsScreen.js b/ComApp/src/App/Views/ContactDetailsScreen.js index 2244625..a551884 100644 --- a/ComApp/src/App/Views/ContactDetailsScreen.js +++ b/ComApp/src/App/Views/ContactDetailsScreen.js @@ -34,6 +34,7 @@ function mapStateToProps(state) { return { contacts: state.contacts, currentUser: state.app.currentUser, + mainColor: state.app.mainColor }; } @@ -361,7 +362,7 @@ class ContactDetailsScreen extends React.Component { justifyContent: 'center', }}> this.updateContactType('client')} /> this.updateContactType('prospect')} /> this.setState({ p1: !this.state.p1 })} containerStyle={styles.clearCheckbox} /> this.setState({ p2: !this.state.p2 })} containerStyle={styles.clearCheckbox} /> this.setState({ p3: !this.state.p3 })} containerStyle={styles.clearCheckbox} /> this.setState({ p4: !this.state.p4 })} @@ -550,7 +551,7 @@ class ContactDetailsScreen extends React.Component { this.setState({ selectedIndex: index })} @@ -602,13 +603,13 @@ class ContactDetailsScreen extends React.Component { this.setState({ showNewVisit: true })}> - + {this.state.visits.length > 0 && ( this.deleteVisit()}> - + )} @@ -641,10 +642,10 @@ class ContactDetailsScreen extends React.Component { {this.state.action === 'add' && ( <> -