feat: Delete store.ldc.fr deps + remove useless MySpace feature

This commit is contained in:
Vincent BRIDIER 2025-09-04 20:30:20 +02:00
parent 564e30ce07
commit 3d41a78dad
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
13 changed files with 15 additions and 225 deletions

View file

@ -1,5 +1,12 @@
# CHANGELOG
## 4.0.0
### Évolution - 4.0.0
- Delete store.ldc.fr dependance
- Remove useless MySpace feature
## 3.2.1
### Évolution - 3.2.1

View file

@ -139,7 +139,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "3.2.1"
versionName "4.0.0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
if (isNewArchitectureEnabled()) {

View file

@ -36,7 +36,6 @@ import DirectoriesScreen from './App/Views/DirectoriesScreen';
import HomeScreen from './App/Views/HomeScreen';
import InstallScreen from './App/Views/InstallScreen';
import LoginScreen from './App/Views/LoginScreen';
import MySpaceScreen from './App/Views/MySpaceScreen';
import OnlyVideosScreen from './App/Views/OnlyVideosScreen';
import PDFScreen from './App/Views/PDFScreen';
import SearchScreen from './App/Views/SearchScreen';
@ -246,15 +245,6 @@ class App extends React.Component {
<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', {
@ -378,31 +368,6 @@ class App extends React.Component {
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' }}>
<TouchableOpacity
onPress={() => {
const folder = store
.getState()
.directories.treeview.filter(tmp => tmp.id === 1);
navigation.navigation.navigate('DirectoriesScreen', {
folder: folder,
});
}}
style={{ marginRight: 15 }}>
<Icon name="briefcase" size={20} />
</TouchableOpacity>
</View>
),
})}
/>
</Stack.Navigator>
<FlashMessage position="top" />
</DrawerLayoutAndroid>

View file

@ -3,8 +3,6 @@
import axios from 'axios';
// Network Infos
import NetInfo from '@react-native-community/netinfo';
// Application infos
import * as Application from 'expo-application';
// Database
import { Contact, Document, SendBrochure, Setting } from '../../Database';
import { ContactData } from '../Models/Contact';
@ -20,32 +18,10 @@ class SyncController {
return test.value;
}
getAppStoreUUID() {
const test = Setting.get('AppStoreUUID');
if (test === null) {
return 'noset';
}
return test.value;
}
async checkConnection() {
return NetInfo.fetch();
}
async getVersion() {
return axios({
method: 'GET',
// * version
url: this.getUrlBo() + '/api/version',
responseType: 'json',
params: {
token: api_token,
app_uuid: this.getAppStoreUUID(),
app_version: Application.nativeApplicationVersion,
},
});
}
async getUsers() {
return axios({
method: 'GET',
@ -179,24 +155,6 @@ class SyncController {
Document.update({ id: id, updated_at: date.toString() }, true);
}
updateVersion(version) {
const localVersion = Setting.get('version');
if (localVersion === null) {
Setting.add({ key: 'version', value: version });
} else {
Setting.update({ id: localVersion.id, key: 'version', value: version });
}
}
updateShowIsActive(value) {
const local = Setting.get('ShowIsActive');
if (local === null) {
Setting.add({ key: 'ShowIsActive', value: value });
} else {
Setting.update({ id: local.id, key: 'ShowIsActive', value: value });
}
}
/**
* @param {number} app_user_id
* @returns
@ -229,36 +187,6 @@ class SyncController {
return false;
}
needSync(callback) {
NetInfo.fetch().then(state => {
if (state.isConnected) {
axios({
method: 'get',
url: this.getUrlBo() + '/version',
responseType: 'json',
params: {
token: api_token,
},
})
.then(response => {
const localVersion = Setting.get('version');
if (
localVersion === null ||
localVersion.value !== response.data.version
) {
return callback();
}
return false;
})
.catch(function (error) {
console.error(error);
});
}
return false;
});
return false;
}
setInstalled(remove = false) {
if (remove) {
Setting.delete('installed');

View file

@ -7,10 +7,8 @@ const initialState = {
locale: 'fr',
currentUser: {},
logged: false,
syncVersion: 0,
forceSync: false,
currentOpenedDoc: {},
ShowIsActive: 0,
HomeBtns: {},
mainColor: '#D4021D',
};
@ -19,14 +17,12 @@ const reducer = (state = initialState, action) => {
let saved;
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 ? ShowIsActive?.value : false,
mainColor:
MainColor === undefined
? initialState.mainColor
@ -101,17 +97,6 @@ const reducer = (state = initialState, action) => {
...state,
currentOpenedDoc: action.data,
};
case 'UPDATE_VERSION':
return {
...state,
syncVersion: action.data,
};
case 'UPDATE_SHOW_IS_ACTIVE':
SyncController.updateShowIsActive(action.data);
return {
...state,
ShowIsActive: action.data,
};
case 'SEND_BROCHURE':
SendBrochure.add(action.data);
return state;

View file

@ -21,8 +21,6 @@ import styles from '../../Resources/Styles/HomeStyle';
import i18n from '../../I18n';
// FileSytem
import * as FileSystem from 'expo-file-system';
// NetInfo
import NetInfo from '@react-native-community/netinfo';
// Controller
import SyncController from '../Controllers/SyncController';
@ -63,19 +61,6 @@ class HomeScreen extends React.Component {
SplashScreen.hideAsync();
}
unsubscribe() {
NetInfo.addEventListener(state => {
if (state.isConnected === true) {
let seconds =
Math.abs(new Date(this.state.lastSyncCall) - Date.now()) / 1000;
if (seconds > 30) {
this.setState({ lastSyncCall: Date.now() });
SyncController.needSync(this.openSync.bind(this));
}
}
});
}
openSync() {
this.props.navigation.navigate('SyncScreen', { forceSync: true });
}

View file

@ -140,7 +140,6 @@ class InstallScreen extends React.Component {
_.forEach(response.data.datas, function (value, key) {
switch (key) {
case 'MainColor':
case 'AppStoreUUID':
Setting.upsert({ key: key, value: value });
break;
case 'SquaredLogo':

View file

@ -235,7 +235,6 @@ class LoginScreen extends React.Component {
_.forEach(response.data.datas, function (value, key) {
switch (key) {
case 'MainColor':
case 'AppStoreUUID':
Setting.upsert({ key: key, value: value });
break;
case 'SquaredLogo':

View file

@ -1,24 +0,0 @@
import React from 'react';
import { Text, View } from 'react-native';
// Redux
import { connect } from 'react-redux';
// Style
import styles from '../../Resources/Styles/MySpaceStyle';
function mapStateToProps(state) {
return {
documents: state.app.documents,
};
}
class MySpaceScreen extends React.Component {
render() {
return (
<View style={styles.container}>
<Text>Mon Espace</Text>
</View>
);
}
}
export default connect(mapStateToProps)(MySpaceScreen);

View file

@ -30,7 +30,6 @@ 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,
@ -47,17 +46,7 @@ const mapDispatchToProps = dispatch => {
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,
}),
initBtns: () => dispatch({ type: 'INIT_HOME_BTNS' })
};
};
@ -68,7 +57,6 @@ class SyncScreen extends React.Component {
downloadProgress: 0,
downloadingFile: false,
processing: false,
newApp: false,
forced: false,
};
@ -159,20 +147,6 @@ class SyncScreen extends React.Component {
return;
}
this.setState({ processing: true });
// * --- getVersion
const resVersion = await getCall(
SyncController.getVersion().then(res => {
return res.data;
}),
);
if (errorStatus) {
return false;
}
this.props.updateVersion(resVersion.version);
this.props.updateShowIsActive(resVersion.ShowIsActive);
this.setState({ newApp: resVersion.newApp });
// * --- getUsers
this.setState({
progress: 0.1,
@ -322,7 +296,6 @@ class SyncScreen extends React.Component {
}
downloadDocuments(docs, toDelete) {
const version = this.props.syncVersion;
this.getToDL(docs, 0).then(toDownload => {
if (toDownload.length > 0) {
this.setState({ progress: 0.6 });
@ -330,7 +303,7 @@ class SyncScreen extends React.Component {
this.download(toDownload, docProgress, 0).then(status => {
if (status === true) {
this.deleteFile(toDelete, 0).then(delStatus => {
this.finishSync(version);
this.finishSync();
});
} else {
this.setState({
@ -341,7 +314,7 @@ class SyncScreen extends React.Component {
} else {
this.deleteFile(toDelete, 0).then(status => {
this.setState({ progress: 1 });
this.finishSync(version);
this.finishSync();
});
}
});
@ -445,7 +418,7 @@ class SyncScreen extends React.Component {
}
}
finishSync(version) {
finishSync() {
this.props.init();
this.props.initUsers();
this.props.initContact(this.props.currentUser);
@ -455,34 +428,10 @@ class SyncScreen extends React.Component {
if (this.state.forced) {
SyncController.setInstalled();
}
SyncController.updateVersion(version);
this.setState({
txtStep: i18n.t('sync_s.update_completed') + '.',
processing: false,
});
if (this.state.newApp === true) {
const appUUID = SyncController.getAppStoreUUID();
const url = 'https://store.ldc.fr' + '/app/' + appUUID;
Alert.alert(
'LDC Store',
i18n.t('sync_s.new_app_version'),
[
{
text: i18n.t('global.cancel'),
onPress: () => console.debug('Cancel Pressed'),
style: 'cancel',
},
{
text: i18n.t('sync_s.open_store'),
onPress: () =>
Linking.openURL(url).catch(err =>
console.error('An error occurred', err),
),
},
],
{ cancelable: false },
);
}
}
/**

View file

@ -48,8 +48,7 @@
"folders": "Ordner",
"video": "Video",
"contact_details": "Kontaktdaten",
"results_search": "Suchergebnisse",
"my_space": "Mein Raum"
"results_search": "Suchergebnisse"
},
"login_s": {
"username": "Benutzername",

View file

@ -48,8 +48,7 @@
"folders": "Folders",
"video": "Video",
"contact_details": "Contact information",
"results_search": "Search results",
"my_space": "Personal Dashboard"
"results_search": "Search results"
},
"login_s": {
"username": "Username",

View file

@ -47,8 +47,7 @@
"folders": "Dossiers",
"video": "Vidéo",
"contact_details": "Détails du contact",
"results_search": "Résultat(s) de votre recherche",
"my_space": "Mon espace"
"results_search": "Résultat(s) de votre recherche"
},
"login_s": {
"username": "Identifiant",