Before switching to release

This commit is contained in:
Brice Zele 2021-07-07 09:35:54 +01:00
parent 1062a79778
commit ff23733606
5 changed files with 2093 additions and 256 deletions

1
App.js
View File

@ -438,6 +438,7 @@ export default class App extends React.Component {
goToScreen = (routeName, params, isReset = true) => { goToScreen = (routeName, params, isReset = true) => {
const {navigator} = this.refs; const {navigator} = this.refs;
console.log("NAVIGATOR", navigator);
if (typeof navigator !== 'undefined') { if (typeof navigator !== 'undefined') {
console.log("APP HAS LOADED", global.appHasLoaded); console.log("APP HAS LOADED", global.appHasLoaded);
if (global.appHasLoaded) { if (global.appHasLoaded) {

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
"test": "jest", "test": "jest",
"postinstall": "node ./fix-android/android-release-fix.js", "postinstall": "node ./fix-android/android-release-fix.js",
"release-build": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/release/ && rm -rf ./android/app/src/main/res/drawable-* && rm -rf ./android/app/src/main/res/raw/* && cd ./android && ./gradlew assembleRelease -x bundleReleaseJsAndAssets && cd .. && adb install ./android/app/build/outputs/apk/release/app-release.apk", "release-build": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/release/ && rm -rf ./android/app/src/main/res/drawable-* && rm -rf ./android/app/src/main/res/raw/* && cd ./android && ./gradlew assembleRelease -x bundleReleaseJsAndAssets && cd .. && adb install ./android/app/build/outputs/apk/release/app-release.apk",
"debug-build": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res/ && cd ./android && ./gradlew assembleDebug && cd .. && adb install ./android/app/build/outputs/apk/debug/app-debug.apk", "debug-build": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res/ ; cd ./android ; sudo ./gradlew clean ; sudo ./gradlew assembleDebug ; cd .. && adb install ./android/app/build/outputs/apk/debug/app-debug.apk",
"start-emulator": "emulator -avd Nexus_5X_API_29 -dns-server 8.8.8.8", "start-emulator": "emulator -avd Nexus_5X_API_29 -dns-server 8.8.8.8",
"start-emulator-pixel": "emulator -avd Pixel_2_API_29 -dns-server 8.8.8.8", "start-emulator-pixel": "emulator -avd Pixel_2_API_29 -dns-server 8.8.8.8",
"run-debug": "cd android && ./gradlew clean && cd .. && react-native run-android", "run-debug": "cd android && ./gradlew clean && cd .. && react-native run-android",

View File

@ -1384,10 +1384,10 @@ class Home extends BaseScreen {
}} }}
/>*/ />*/
showInterticiel() { showInterticiel() {
return (<InterticielAds return (<InterticielAds
closeIntersticiel={() => this.setState({isPubShow: false})} closeIntersticiel={() => this.setState({isPubShow: false})}
navigation={this.props.navigation} navigation={this.props.navigation}
/>) />)
} }
renderBottomHome() { renderBottomHome() {
@ -1707,7 +1707,7 @@ class Home extends BaseScreen {
}} }}
/> />
{this.makeCardSearch()} {this.makeCardSearch()}
{this.showInterticiel()} {/*this.showInterticiel()*/}
{this.makeSlidingUp()} {this.makeSlidingUp()}
{this.makeDialogLoader()} {this.makeDialogLoader()}
{this.makeDistanceDialog()} {this.makeDistanceDialog()}

View File

@ -1,15 +1,16 @@
import React, { Component } from 'react'; import React, {Component} from 'react';
import { import {
StyleSheet, View, Text, Image, ProgressBarAndroid, StyleSheet, View, Text, Image, ProgressBarAndroid,
TouchableNativeFeedback, TouchableOpacity, TouchableNativeFeedback, TouchableOpacity,
PermissionsAndroid, NativeModules, StatusBar, Platform, Animated PermissionsAndroid, NativeModules, StatusBar, Platform, Animated
} from 'react-native'; } from 'react-native';
import { responsiveHeight, responsiveWidth, responsiveFontSize } from 'react-native-responsive-dimensions'; import {responsiveHeight, responsiveWidth, responsiveFontSize} from 'react-native-responsive-dimensions';
import I18n from 'react-native-i18n' import I18n from 'react-native-i18n'
const theme = require('./../../utils/theme.json'); const theme = require('./../../utils/theme.json');
const route = require('./../../route.json'); const route = require('./../../route.json');
import { readUser, getPasObject, getPubActiveObject } from '../../webservice/AuthApi'; import {readUser, getPasObject, getPubActiveObject} from '../../webservice/AuthApi';
import { Bubbles, DoubleBounce, Bars, Pulse } from 'react-native-loader'; import {Bubbles, DoubleBounce, Bars, Pulse} from 'react-native-loader';
import Configuration from "../../webservice/persistences/Configuration"; import Configuration from "../../webservice/persistences/Configuration";
import '../ads/InterticielAds' import '../ads/InterticielAds'
import * as Animatable from 'react-native-animatable'; import * as Animatable from 'react-native-animatable';
@ -17,264 +18,277 @@ import LottieView from 'lottie-react-native'; // if you have "esModuleInterop":
import InterticielAds from '../ads/InterticielAds'; import InterticielAds from '../ads/InterticielAds';
import Overlay from 'react-native-elements' import Overlay from 'react-native-elements'
import DeviceInfo from 'react-native-device-info'; import DeviceInfo from 'react-native-device-info';
export default class SplashScreen extends Component { export default class SplashScreen extends Component {
static navigatorStyle = { static navigatorStyle = {
drawUnderNavBar: true, drawUnderNavBar: true,
navBarHidden: true, navBarHidden: true,
drawUnderStatusBar: false, drawUnderStatusBar: false,
statusBarHidden: false, statusBarHidden: false,
statusBarTextColorScheme: 'light', statusBarTextColorScheme: 'light',
}; };
static options(passProps) {
return { static options(passProps) {
statusBar: { return {
visible: false, statusBar: {
style: 'light' | 'dark', visible: false,
drawBehind: true style: 'light' | 'dark',
}, drawBehind: true
topBar: { },
title: { topBar: {
text: 'My Screen' title: {
}, text: 'My Screen'
drawBehind: true, },
visible: false, drawBehind: true,
animate: false visible: false,
} animate: false
}; }
} };
}
// //
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {};
};
}
};
workUserResult(result) {
console.log("SPLASHSCREEN PROPS", this.props);
if (typeof this.props.navigation.state.params !== 'undefined') {
if (result === null || result === undefined) {
this.props.navigation.navigate("Auth");
} else {
switch (this.props.navigation.state.params.routeName) {
case 'historyItemDetails':
this.props.navigation.navigate(this.props.navigation.state.params.routeName, {
item: this.props.navigation.state.params.params
});
break;
default:
this.props.navigation.navigate(this.props.navigation.state.params.routeName, {
id: this.props.navigation.state.params.params.id
});
break;
}
}
} else {
var way = "";
var way2 = "";
if (result === null || result === undefined) {
way = "Auth"
way2 = route.first
} else {
if (!result.category)
way = "App"
else {
switch (result.category) {
case 'geolocated': way = "AgentApp"
break;
case 'super': way = "adminApp"
break
default:
way = "supAdminApp"
}
}
way2 = route.login
}
this.props.navigation.navigate(way)
}
/* Navigation.setStackRoot(route.stackRoot,
{ component: {
name: way,
}
workUserResult(result) {
console.log("SPLASHSCREEN PROPS", this.props);
if (typeof this.props.navigation.state.params !== 'undefined') {
if (result === null || result === undefined) {
this.props.navigation.navigate("Auth");
} else {
switch (this.props.navigation.state.params.routeName) {
case 'historyItemDetails':
this.props.navigation.navigate(this.props.navigation.state.params.routeName, {
item: this.props.navigation.state.params.params
});
break;
default:
this.props.navigation.navigate(this.props.navigation.state.params.routeName, {
id: this.props.navigation.state.params.params.id
});
break;
} }
); }
Navigation.showOverlay({
component: { } else {
name: route.intersticielAds, var way = "";
id:"interticiel", var way2 = "";
options: { if (result === null || result === undefined) {
overlay: { way = "Auth"
interceptTouchOutside: false way2 = route.first
} } else {
if (!result.category)
way = "App"
else {
switch (result.category) {
case 'geolocated':
way = "AgentApp"
break;
case 'super':
way = "adminApp"
break
default:
way = "supAdminApp"
} }
} }
});*/ way2 = route.login
}
console.log("SPLASHSCREEN PROPS WAY", way);
this.props.navigation.navigate(way)
}
} /* Navigation.setStackRoot(route.stackRoot,
componentDidMount() { { component: {
try { name: way,
this.requestCameraPermission() }
} catch (e) {
console.log(e)
}
this.config = new Configuration();
this.retrieveAndroidInformation()
setTimeout(() => this.bounce(), 500)
this.bounce()
}
async requestCameraPermission() { }
try { );
const granted = await PermissionsAndroid.request( Navigation.showOverlay({
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, component: {
{ name: route.intersticielAds,
'title': 'Cool Photo App Camera Permission', id:"interticiel",
'message': 'Cool Photo App needs access to your camera ' + options: {
'so you can take awesome pictures.' overlay: {
interceptTouchOutside: false
}
}
}
});*/
}
componentDidMount() {
try {
this.requestCameraPermission()
} catch (e) {
console.log(e)
}
this.config = new Configuration();
this.retrieveAndroidInformation()
setTimeout(() => this.bounce(), 500)
this.bounce()
}
async requestCameraPermission() {
try {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
{
'title': 'Cool Photo App Camera Permission',
'message': 'Cool Photo App needs access to your camera ' +
'so you can take awesome pictures.'
}
)
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
} else {
console.log("try get information else")
}
} catch (err) {
console.log("try get information error")
console.log(err)
}
}
handleViewRef = ref => this.view = ref;
bounce = () => this.view.transition({translateX: 0}, {translateX: 700}, 5000);
render() {
return (
<View style={styles.container}>
<StatusBar
translucent={true}
/>
<Image style={styles.logo} source={require('./../../datas/img/icon3up.png')}/>
<View style={{flexDirection: 'row'}}>
<Image style={styles.logo} source={require('./../../datas/img/iconsub3.png')}/>
<Animatable.View
style={{
width: responsiveWidth(90),
height: 92,
backgroundColor: theme.primary,
position: 'absolute',
zIndex: 100
}}
ref={this.handleViewRef}>
</Animatable.View>
</View>
</View>
)
}
retreiveIosInformation() {
readUser().then((result) => {
setTimeout(() => {
this.workUserResult(result)
}, 3000)
}).catch((e) => {
this.props.navigation.navigate("Auth")
});
return "";
}
retrieveAndroidInformation() {
getPasObject().then((data) => {
console.warn(data);
this.config.setCurrentPas(data)
})
this.config._getData().then((lang) => {
if (lang) {
I18n.locale = lang
readUser().then((result) => {
console.warn(result)
if (result) {
getPubActiveObject(result['country_id']).then((data) => {
console.warn(data)
this.config.setPubActive(data);
})
} }
) setTimeout(() => {
if (granted === PermissionsAndroid.RESULTS.GRANTED) { this.workUserResult(result)
}, 3000)
})
} else {
const code = DeviceInfo.getDeviceLocale();
console.warn(code)
I18n.locale = code.toLowerCase()
readUser().then((result) => {
console.warn(result)
if (result) {
getPubActiveObject(result['country_id']).then((data) => {
console.warn(data)
this.config.setPubActive(data);
})
}
setTimeout(() => {
this.workUserResult(result)
}, 3000)
}).catch((e) => {
this.setPubActive(data)
});
} else { }
console.log("try get information else") }).catch((e) => {
console.warn(e.message)
DeviceInfo.getDeviceLocale().then((code) => {
console.warn(code)
} I18n.locale = code.toLowerCase()
} catch (err) { readUser().then((result) => {
console.log("try get information error") setTimeout(() => {
console.log(err) this.workUserResult(result)
} }, 3000)
} }).catch((e) => {
handleViewRef = ref => this.view = ref; this.props.navigation.navigate("Auth")
});
})
bounce = () => this.view.transition({ translateX: 0 }, { translateX: 700 }, 5000); })
render() { return ""
}
return (
<View style={styles.container}>
<StatusBar
translucent={true}
/>
<Image style={styles.logo} source={require('./../../datas/img/icon3up.png')} />
<View style={{ flexDirection: 'row' }}>
<Image style={styles.logo} source={require('./../../datas/img/iconsub3.png')} />
<Animatable.View
style={{ width: responsiveWidth(90), height: 92, backgroundColor: theme.primary, position: 'absolute', zIndex: 100 }}
ref={this.handleViewRef}>
</Animatable.View>
</View>
</View>
)
}
retreiveIosInformation() {
readUser().then((result) => {
setTimeout(() => {
this.workUserResult(result)
}, 3000)
}).catch((e) => {
this.props.navigation.navigate("Auth")
});
return "";
}
retrieveAndroidInformation() {
getPasObject().then((data) => {
console.warn(data);
this.config.setCurrentPas(data)
})
this.config._getData().then((lang) => {
if (lang) {
I18n.locale = lang
readUser().then((result) => {
console.warn(result)
if (result) {
getPubActiveObject(result['country_id']).then((data) => {
console.warn(data)
this.config.setPubActive(data);
})
}
setTimeout(() => {
this.workUserResult(result)
}, 3000)
})
} else {
const code = DeviceInfo.getDeviceLocale();
console.warn(code)
I18n.locale = code.toLowerCase()
readUser().then((result) => {
console.warn(result)
if (result) {
getPubActiveObject(result['country_id']).then((data) => {
console.warn(data)
this.config.setPubActive(data);
})
}
setTimeout(() => {
this.workUserResult(result)
}, 3000)
}).catch((e) => {
this.setPubActive(data)
});
}
}).catch((e) => {
console.warn(e.message)
DeviceInfo.getDeviceLocale().then((code) => {
console.warn(code)
I18n.locale = code.toLowerCase()
readUser().then((result) => {
setTimeout(() => {
this.workUserResult(result)
}, 3000)
}).catch((e) => {
this.props.navigation.navigate("Auth")
});
})
})
return ""
}
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
backgroundColor: theme.primary, backgroundColor: theme.primary,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
}, },
logoContaner: { logoContaner: {
flexDirection: 'row', flexDirection: 'row',
marginTop: responsiveHeight(20), marginTop: responsiveHeight(20),
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
}, },
logo: { logo: {
width: responsiveWidth(90), width: responsiveWidth(90),
resizeMode: 'contain' resizeMode: 'contain'
}, },
lottie: { lottie: {
width: 48 width: 48
, ,
height: 64 height: 64
}, },
title: { title: {
fontSize: responsiveFontSize(4), fontSize: responsiveFontSize(4),
alignSelf: 'center', alignSelf: 'center',
fontWeight: 'bold', fontWeight: 'bold',
color: 'white', color: 'white',
}, },
}) })