resolving issue about focus on map at first loading
This commit is contained in:
parent
483283a574
commit
2d41abca6b
File diff suppressed because one or more lines are too long
|
@ -6,8 +6,10 @@
|
||||||
"start": "node node_modules/react-native/local-cli/cli.js start",
|
"start": "node node_modules/react-native/local-cli/cli.js start",
|
||||||
"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 && cd ..",
|
"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 && 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 .."
|
"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",
|
||||||
|
"start-emulator": "emulator -avd Nexus_6P_API_29 -dns-server 8.8.8.8",
|
||||||
|
"run-android": "cd android && ./gradlew clean && cd .. && react-native run-android"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-native-community/viewpager": "^3.3.0",
|
"@react-native-community/viewpager": "^3.3.0",
|
||||||
|
|
|
@ -172,13 +172,14 @@ class Home extends BaseScreen {
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
this.componentDidAppear();
|
||||||
|
|
||||||
this.componentDidAppear()
|
|
||||||
});
|
});
|
||||||
this.blurListener = navigation.addListener("didBlur", (payload) => {
|
this.blurListener = navigation.addListener("didBlur", (payload) => {
|
||||||
this.componentDidDisappear()
|
this.componentDidDisappear()
|
||||||
})
|
})
|
||||||
this._retrieveData()
|
this._retrieveData()
|
||||||
|
|
||||||
//this.toggleSlidingUp(false)
|
//this.toggleSlidingUp(false)
|
||||||
if (this.props.coordinate) return;
|
if (this.props.coordinate) return;
|
||||||
|
|
||||||
|
@ -196,6 +197,7 @@ class Home extends BaseScreen {
|
||||||
)
|
)
|
||||||
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
||||||
readUser().then((user) => {
|
readUser().then((user) => {
|
||||||
|
console.log("MAP READY");
|
||||||
if (user) {
|
if (user) {
|
||||||
if (user.category !== undefined && user.category !== null) {
|
if (user.category !== undefined && user.category !== null) {
|
||||||
const myPosition = {
|
const myPosition = {
|
||||||
|
@ -227,7 +229,7 @@ class Home extends BaseScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.getPosition()
|
this.getPosition();
|
||||||
this.watchLocation();
|
this.watchLocation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -417,8 +419,6 @@ class Home extends BaseScreen {
|
||||||
if (i.code === shortcountry) {
|
if (i.code === shortcountry) {
|
||||||
this.setState({ indicatif: i.dial_code })
|
this.setState({ indicatif: i.dial_code })
|
||||||
this.getNetworks(i.dial_code)
|
this.getNetworks(i.dial_code)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,6 +524,7 @@ class Home extends BaseScreen {
|
||||||
readUser().then((user) => {
|
readUser().then((user) => {
|
||||||
if (user) {
|
if (user) {
|
||||||
if (user.category) {
|
if (user.category) {
|
||||||
|
|
||||||
this.setState({ user: user })
|
this.setState({ user: user })
|
||||||
this.setState({ network: user.network });
|
this.setState({ network: user.network });
|
||||||
|
|
||||||
|
@ -538,11 +539,10 @@ class Home extends BaseScreen {
|
||||||
latitudeDelta: 0.03,
|
latitudeDelta: 0.03,
|
||||||
longitudeDelta: 0.01,
|
longitudeDelta: 0.01,
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ myPosition: myPosition });
|
this.setState({ myPosition: myPosition });
|
||||||
|
this.refocusMap(false);
|
||||||
}
|
}
|
||||||
if (this.state.myPosition)
|
|
||||||
this.refocusMap()
|
|
||||||
/*if (Platform.OS === 'android') {
|
/*if (Platform.OS === 'android') {
|
||||||
// this.requestCameraPermission();
|
// this.requestCameraPermission();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1182,10 +1182,12 @@ class Home extends BaseScreen {
|
||||||
lang={this.state.lang}
|
lang={this.state.lang}
|
||||||
myPosition={this.state.myPosition}
|
myPosition={this.state.myPosition}
|
||||||
onMapReady={() => {
|
onMapReady={() => {
|
||||||
|
|
||||||
readUser().then((user) => {
|
readUser().then((user) => {
|
||||||
if (user) {
|
if (user) {
|
||||||
this.setState({ user: user })
|
this.setState({ user: user })
|
||||||
this.setState({ network: user.network });
|
this.setState({ network: user.network });
|
||||||
|
|
||||||
if (user.category) {
|
if (user.category) {
|
||||||
this.setState({ loadingDialog: false })
|
this.setState({ loadingDialog: false })
|
||||||
if (user.category !== "geolocated") {
|
if (user.category !== "geolocated") {
|
||||||
|
@ -1376,33 +1378,8 @@ class Home extends BaseScreen {
|
||||||
myNetwork={this.state.myNetwork}
|
myNetwork={this.state.myNetwork}
|
||||||
lang={this.state.lang}
|
lang={this.state.lang}
|
||||||
myPosition={this.state.myPosition}
|
myPosition={this.state.myPosition}
|
||||||
onMapReady={() => {
|
onMapReady={Platform.OS === 'android' ? this.onMapReady : null}
|
||||||
readUser().then((user) => {
|
onLayout={Platform.OS === 'ios' ? this.onMapReady : null}
|
||||||
if (user) {
|
|
||||||
this.setState({ user: user })
|
|
||||||
this.setState({ network: user.network });
|
|
||||||
if (user.category) {
|
|
||||||
this.setState({ loadingDialog: false })
|
|
||||||
if (user.category !== "geolocated") {
|
|
||||||
this.showMyMembers();
|
|
||||||
} else {
|
|
||||||
if (myPosition.latitude <= 0 && myPosition.longitude <= 0) {
|
|
||||||
this.props.navigation.push(route.updateinfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (Platform.OS === 'android') {
|
|
||||||
this.requestCameraPermission();
|
|
||||||
} else {
|
|
||||||
this.getPosition();
|
|
||||||
this.watchLocation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}}
|
|
||||||
needRoad={this.state.needRoad}
|
needRoad={this.state.needRoad}
|
||||||
onNeedRoadReady={(data) => {
|
onNeedRoadReady={(data) => {
|
||||||
this.setState({ showProgress: false })
|
this.setState({ showProgress: false })
|
||||||
|
@ -1426,6 +1403,55 @@ class Home extends BaseScreen {
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMapReady = () => {
|
||||||
|
|
||||||
|
readUser().then((user) => {
|
||||||
|
if (user) {
|
||||||
|
this.setState({ user: user })
|
||||||
|
this.setState({ network: user.network });
|
||||||
|
|
||||||
|
const myPosition = {
|
||||||
|
latitude: parseFloat(user.latitude),
|
||||||
|
longitude: parseFloat(user.longitude)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mapRef.animateCamera({
|
||||||
|
center: {
|
||||||
|
latitude: myPosition.latitude,
|
||||||
|
longitude: myPosition.longitude
|
||||||
|
},
|
||||||
|
pitch: 0,
|
||||||
|
heading: 0,
|
||||||
|
altitude: 5,
|
||||||
|
|
||||||
|
zoom: 12
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
if (user.category) {
|
||||||
|
this.setState({ loadingDialog: false })
|
||||||
|
if (user.category !== "geolocated") {
|
||||||
|
this.showMyMembers();
|
||||||
|
} else {
|
||||||
|
if (myPosition.latitude <= 0 && myPosition.longitude <= 0) {
|
||||||
|
this.props.navigation.push(route.updateinfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Platform.OS === 'android') {
|
||||||
|
this.requestCameraPermission();
|
||||||
|
} else {
|
||||||
|
this.getPosition();
|
||||||
|
this.watchLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error.message)
|
||||||
|
});
|
||||||
|
}
|
||||||
renderTutoOldHome() {
|
renderTutoOldHome() {
|
||||||
return (<View style={{ flex: 1 }}>
|
return (<View style={{ flex: 1 }}>
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,8 @@ class IMap extends PureComponent {
|
||||||
isNeedUserFocus: PropTypes.bool,
|
isNeedUserFocus: PropTypes.bool,
|
||||||
onNeedRoadReady: PropTypes.func,
|
onNeedRoadReady: PropTypes.func,
|
||||||
onNeedRoadError: PropTypes.func,
|
onNeedRoadError: PropTypes.func,
|
||||||
onMapReady: PropTypes.func
|
onMapReady: PropTypes.func,
|
||||||
|
onLayout: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
@ -73,6 +74,7 @@ class IMap extends PureComponent {
|
||||||
mapType={typeMap}
|
mapType={typeMap}
|
||||||
ref={(re) => this.mapview = re}
|
ref={(re) => this.mapview = re}
|
||||||
onMapReady={this.props.onMapReady}
|
onMapReady={this.props.onMapReady}
|
||||||
|
onLayout={this.props.onLayout}
|
||||||
onRegionChangeComplete={(re) => { this.onRegionChangeOver(re) }}>
|
onRegionChangeComplete={(re) => { this.onRegionChangeOver(re) }}>
|
||||||
{this.state.markers.map((item, index) => {
|
{this.state.markers.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React,{Component,PureComponent} from 'react';
|
import React, { Component, PureComponent } from 'react';
|
||||||
import MapView,{Marker,MarkerAnimated,Callout,AnimatedRegion} from "react-native-maps"
|
import MapView, { Marker, MarkerAnimated, Callout, AnimatedRegion } from "react-native-maps"
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
|
@ -10,34 +10,33 @@ import {
|
||||||
Platform,
|
Platform,
|
||||||
Text,
|
Text,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
const userposi=require('./../../datas/img/png/user_place.png');
|
const userposi = require('./../../datas/img/png/user_place.png');
|
||||||
const mnetwork=require('./../../datas/img/png/home_network.png');
|
const mnetwork = require('./../../datas/img/png/home_network.png');
|
||||||
const othernetwork=require('./../../datas/img/png/other_net.png');
|
const othernetwork = require('./../../datas/img/png/other_net.png');
|
||||||
class IMarker extends PureComponent
|
class IMarker extends PureComponent {
|
||||||
{
|
constructor(props) {
|
||||||
constructor(props){
|
|
||||||
super(props)
|
super(props)
|
||||||
const data=this.props.data
|
const data = this.props.data
|
||||||
this.state={
|
this.state = {
|
||||||
animation:new Animated.Value(0),
|
animation: new Animated.Value(0),
|
||||||
subanimation:new Animated.Value(0),
|
subanimation: new Animated.Value(0),
|
||||||
coordinate:{
|
coordinate: {
|
||||||
longitude: parseFloat(data.longitude),
|
longitude: parseFloat(data.longitude),
|
||||||
latitude: parseFloat(data.latitude),
|
latitude: parseFloat(data.latitude),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
const duration = 500
|
const duration = 500
|
||||||
const oldCoord={
|
const oldCoord = {
|
||||||
longitude: parseFloat(this.props.data.longitude),
|
longitude: parseFloat(this.props.data.longitude),
|
||||||
latitude: parseFloat(this.props.data.latitude),
|
latitude: parseFloat(this.props.data.latitude),
|
||||||
}
|
}
|
||||||
const coord={
|
const coord = {
|
||||||
longitude: parseFloat(nextProps.data.longitude),
|
longitude: parseFloat(nextProps.data.longitude),
|
||||||
latitude: parseFloat(nextProps.data.latitude),
|
latitude: parseFloat(nextProps.data.latitude),
|
||||||
}
|
}
|
||||||
if (oldCoord.longitude!==coord.longitude || oldCoord.latitude!==coord.latitude) {
|
if (oldCoord.longitude !== coord.longitude || oldCoord.latitude !== coord.latitude) {
|
||||||
if (Platform.OS === 'android') {
|
if (Platform.OS === 'android') {
|
||||||
if (this.markerRef) {
|
if (this.markerRef) {
|
||||||
this.markerRef._component.animateMarkerToCoordinate(
|
this.markerRef._component.animateMarkerToCoordinate(
|
||||||
|
@ -53,31 +52,31 @@ class IMarker extends PureComponent
|
||||||
*/}
|
*/}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
startAnimation(){
|
startAnimation() {
|
||||||
const initialValue=0
|
const initialValue = 0
|
||||||
const finalValue=1
|
const finalValue = 1
|
||||||
this.state.animation.setValue(initialValue); //Step 3
|
this.state.animation.setValue(initialValue); //Step 3
|
||||||
Animated.timing( //Step 4
|
Animated.timing( //Step 4
|
||||||
this.state.animation,
|
this.state.animation,
|
||||||
{
|
{
|
||||||
toValue: finalValue,
|
toValue: finalValue,
|
||||||
duration:500,
|
duration: 500,
|
||||||
easing: Easing.linear(),
|
easing: Easing.linear(),
|
||||||
useNativeDriver:true
|
useNativeDriver: true
|
||||||
}
|
}
|
||||||
).start();
|
).start();
|
||||||
}
|
}
|
||||||
handleViewRef = ref => this.view = ref;
|
handleViewRef = ref => this.view = ref;
|
||||||
render() {
|
render() {
|
||||||
const {data,network,isSelected}=this.props;
|
const { data, network, isSelected } = this.props;
|
||||||
const color=isSelected?"#F48FB1A0":"transparent"
|
const color = isSelected ? "#F48FB1A0" : "transparent"
|
||||||
const colorSup=isSelected?"#F06292A0":"transparent"
|
const colorSup = isSelected ? "#F06292A0" : "transparent"
|
||||||
const display=isSelected?"block":"none";
|
const display = isSelected ? "block" : "none";
|
||||||
if(data.longitude && data.latitude){
|
if (data.longitude && data.latitude) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Marker.Animated
|
<Marker.Animated
|
||||||
coordinate={this.state.coordinate.longitude?this.state.coordinate:{longitude:data.longitude,latitude:data.latitude}}
|
coordinate={this.state.coordinate.longitude ? this.state.coordinate : { longitude: data.longitude, latitude: data.latitude }}
|
||||||
|
|
||||||
id={data.id}
|
id={data.id}
|
||||||
title={this.props.title}
|
title={this.props.title}
|
||||||
|
@ -94,10 +93,10 @@ class IMarker extends PureComponent
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (<View/>)
|
return (<View />)
|
||||||
|
|
||||||
}
|
}
|
||||||
error(erro){
|
error(erro) {
|
||||||
console.log("on error render image");
|
console.log("on error render image");
|
||||||
console.log(erro);
|
console.log(erro);
|
||||||
}
|
}
|
||||||
|
@ -108,32 +107,32 @@ class IMarker extends PureComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot: SS): void {
|
componentDidUpdate(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot: SS): void {
|
||||||
if(this.props.isUser)
|
if (this.props.isUser)
|
||||||
if(this.markerRef && this.props.isNeedFocus){
|
if (this.markerRef && this.props.isNeedFocus) {
|
||||||
this.markerRef._component.showCallout()
|
this.markerRef._component.showCallout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getImage(data) {
|
getImage(data) {
|
||||||
const {isUser,network}=this.props;
|
const { isUser, network } = this.props;
|
||||||
if(isUser){
|
if (isUser) {
|
||||||
return userposi
|
return userposi
|
||||||
}else if(network && data.network===network.name){
|
} else if (network && data.network === network.name) {
|
||||||
return mnetwork
|
return mnetwork
|
||||||
}
|
}
|
||||||
return othernetwork
|
return othernetwork
|
||||||
}
|
}
|
||||||
|
|
||||||
getIcon(data) {
|
getIcon(data) {
|
||||||
const {isSelected}=this.props
|
const { isSelected } = this.props
|
||||||
return isSelected ? (
|
return isSelected ? (
|
||||||
<Animated.View style={{
|
<Animated.View style={{
|
||||||
width:32,
|
width: 32,
|
||||||
height:32,
|
height: 32,
|
||||||
justifyContent:'center',
|
justifyContent: 'center',
|
||||||
alignItems:'center',
|
alignItems: 'center',
|
||||||
borderRadius:16,
|
borderRadius: 16,
|
||||||
backgroundColor:isSelected?"#81D4FAA0":"transparent",
|
backgroundColor: isSelected ? "#81D4FAA0" : "transparent",
|
||||||
transform: [
|
transform: [
|
||||||
{
|
{
|
||||||
scaleX: this.animatedValue.interpolate({
|
scaleX: this.animatedValue.interpolate({
|
||||||
|
@ -144,40 +143,40 @@ class IMarker extends PureComponent
|
||||||
{
|
{
|
||||||
scaleY: this.animatedValue.interpolate({
|
scaleY: this.animatedValue.interpolate({
|
||||||
inputRange: [0, 1],
|
inputRange: [0, 1],
|
||||||
outputRange: [1,32]
|
outputRange: [1, 32]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}}>
|
}}>
|
||||||
<Image style={{alignSelf: 'center'}} source={this.getImage(data)}/>
|
<Image style={{ alignSelf: 'center' }} source={this.getImage(data)} />
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
) : (<Image style={{alignSelf: 'center'}} source={this.getImage(data)}/>);
|
) : (<Image style={{ alignSelf: 'center' }} source={this.getImage(data)} />);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
startLoopSelectedAnimation() {
|
startLoopSelectedAnimation() {
|
||||||
const initialValue=0
|
const initialValue = 0
|
||||||
const finalValue=1
|
const finalValue = 1
|
||||||
this.state.animation.setValue(initialValue); //Step 3
|
this.state.animation.setValue(initialValue); //Step 3
|
||||||
Animated.loop(Animated.timing( //Step 4
|
Animated.loop(Animated.timing( //Step 4
|
||||||
this.state.subanimation,
|
this.state.subanimation,
|
||||||
{
|
{
|
||||||
toValue: finalValue,
|
toValue: finalValue,
|
||||||
duration:1000,
|
duration: 1000,
|
||||||
easing: Easing.linear(),
|
easing: Easing.linear(),
|
||||||
useNativeDriver:true
|
useNativeDriver: true
|
||||||
}
|
}
|
||||||
),{iteration:-1}).start();
|
), { iteration: -1 }).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex:1,
|
flex: 1,
|
||||||
width:52,
|
width: 52,
|
||||||
height:52
|
height: 52
|
||||||
},
|
},
|
||||||
ring:{
|
ring: {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -236,7 +236,8 @@ export class LoginUi extends Component {
|
||||||
}
|
}
|
||||||
for (let i of country) {
|
for (let i of country) {
|
||||||
if (i.code === shortcountry) {
|
if (i.code === shortcountry) {
|
||||||
this.setState({ indicatif: i.dial_code, enterPhone: i.dial_code })
|
this.setState({ indicatif: i.dial_code, enterPhone: i.dial_code });
|
||||||
|
console.log("DIAL CODE", i.dial_code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
"HELP": "Help",
|
"HELP": "Help",
|
||||||
"SIMPLE_USER": "Simple User",
|
"SIMPLE_USER": "Simple User",
|
||||||
"ABOUT": "About us",
|
"ABOUT": "About us",
|
||||||
|
"ACTION_TREAT_DEMAND": "Treat demand",
|
||||||
"ABOUT_TEXT": "iLink is an application that will facilitate your financial transactions near your location, and give you multiservice points near you.",
|
"ABOUT_TEXT": "iLink is an application that will facilitate your financial transactions near your location, and give you multiservice points near you.",
|
||||||
"GEOLOCATED_USER": "Geo located user",
|
"GEOLOCATED_USER": "Geo located user",
|
||||||
"SUPERVISOR": "Supervisor",
|
"SUPERVISOR": "Supervisor",
|
||||||
|
@ -103,7 +104,8 @@
|
||||||
"ERROR_FILTER_TEXT": "Problem encountered while filtering.",
|
"ERROR_FILTER_TEXT": "Problem encountered while filtering.",
|
||||||
"YOUR_THERE": "You are here",
|
"YOUR_THERE": "You are here",
|
||||||
"FILTER": "Filter",
|
"FILTER": "Filter",
|
||||||
"QUIT": "Quitter",
|
"QUIT": "Quit",
|
||||||
|
"QUIT_": "Quit",
|
||||||
"APP_FULLNAME": "Ilink World",
|
"APP_FULLNAME": "Ilink World",
|
||||||
"GUIDE_TITLE": "Welcome to the Guide of",
|
"GUIDE_TITLE": "Welcome to the Guide of",
|
||||||
"GUIDE_USER_SIMPLE": "Guide for a user",
|
"GUIDE_USER_SIMPLE": "Guide for a user",
|
||||||
|
@ -187,6 +189,7 @@
|
||||||
"SEARCH": "Search",
|
"SEARCH": "Search",
|
||||||
"SEE_VIDEO": "Watch the video",
|
"SEE_VIDEO": "Watch the video",
|
||||||
"SEE_TUTO": "See the tutorial",
|
"SEE_TUTO": "See the tutorial",
|
||||||
|
"SELECT_NETWORK": "Select your",
|
||||||
"DELETE": "Delete",
|
"DELETE": "Delete",
|
||||||
"FREE": "Available",
|
"FREE": "Available",
|
||||||
"SAVED": "Registered",
|
"SAVED": "Registered",
|
||||||
|
@ -246,6 +249,8 @@
|
||||||
"TEXT_UPDATE_POSITION_FAILED_2": "Unable to retrieve your location",
|
"TEXT_UPDATE_POSITION_FAILED_2": "Unable to retrieve your location",
|
||||||
"TITLE_ERROR_SURVENU": "An error has occurred!",
|
"TITLE_ERROR_SURVENU": "An error has occurred!",
|
||||||
"TITLE_PROBLE_COME": "A problem has been encountered",
|
"TITLE_PROBLE_COME": "A problem has been encountered",
|
||||||
|
"TITLE_SUPPRESS_CONFIRM": "Confirm deletion",
|
||||||
|
"TEXT_SUPPRESS_CONFIRM": "Do you really want to delete this user ?",
|
||||||
"TEXT_ERROR_START_APPLICATION": "An error occurred while starting iLink World, please restart iLink World",
|
"TEXT_ERROR_START_APPLICATION": "An error occurred while starting iLink World, please restart iLink World",
|
||||||
"TEXT_UNABLE_TO_GET_YOUR_POSITION": "Unable to retrieve your location, please make sure your GPS is enabled and restart iLink World",
|
"TEXT_UNABLE_TO_GET_YOUR_POSITION": "Unable to retrieve your location, please make sure your GPS is enabled and restart iLink World",
|
||||||
"RESTART": "REPEAT",
|
"RESTART": "REPEAT",
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
"HELP": "Aide",
|
"HELP": "Aide",
|
||||||
"SIMPLE_USER": "Utilisateur simple",
|
"SIMPLE_USER": "Utilisateur simple",
|
||||||
"ABOUT": "A Propos",
|
"ABOUT": "A Propos",
|
||||||
|
"ACTION_TREAT_DEMAND": "Traiter la demande",
|
||||||
"ABOUT_TEXT": "iLink est une application qui facilitera vos transactions financières près de votre position, et vous donne les points multiservices prêt de chez vous.",
|
"ABOUT_TEXT": "iLink est une application qui facilitera vos transactions financières près de votre position, et vous donne les points multiservices prêt de chez vous.",
|
||||||
"GEOLOCATED_USER": "Utilisateur géo-localisé",
|
"GEOLOCATED_USER": "Utilisateur géo-localisé",
|
||||||
"SUPERVISOR": "Superviseur",
|
"SUPERVISOR": "Superviseur",
|
||||||
|
@ -104,6 +105,7 @@
|
||||||
"YOUR_THERE": "Vous êtes ici",
|
"YOUR_THERE": "Vous êtes ici",
|
||||||
"FILTER": "Filtrer",
|
"FILTER": "Filtrer",
|
||||||
"QUIT": "Quitter",
|
"QUIT": "Quitter",
|
||||||
|
"QUIT_": "Quitter",
|
||||||
"APP_FULLNAME": "Ilink World",
|
"APP_FULLNAME": "Ilink World",
|
||||||
"GUIDE_TITLE": "Bienvenue dans le Guide de",
|
"GUIDE_TITLE": "Bienvenue dans le Guide de",
|
||||||
"GUIDE_USER_SIMPLE": "Guide pour un utilisateur",
|
"GUIDE_USER_SIMPLE": "Guide pour un utilisateur",
|
||||||
|
@ -187,6 +189,7 @@
|
||||||
"SEARCH": "Rechercher",
|
"SEARCH": "Rechercher",
|
||||||
"SEE_VIDEO": "Voir la vidéo",
|
"SEE_VIDEO": "Voir la vidéo",
|
||||||
"SEE_TUTO": "Voir le tutoriel",
|
"SEE_TUTO": "Voir le tutoriel",
|
||||||
|
"SELECT_NETWORK": "Sélectionner votre réseau",
|
||||||
"DELETE": "Supprimer",
|
"DELETE": "Supprimer",
|
||||||
"FREE": "disponibles",
|
"FREE": "disponibles",
|
||||||
"SAVED": "enregistrés",
|
"SAVED": "enregistrés",
|
||||||
|
@ -246,6 +249,8 @@
|
||||||
"TEXT_UPDATE_POSITION_FAILED_2": "Impossible de recuperer votre position",
|
"TEXT_UPDATE_POSITION_FAILED_2": "Impossible de recuperer votre position",
|
||||||
"TITLE_ERROR_SURVENU": "Une erreur est survenue !",
|
"TITLE_ERROR_SURVENU": "Une erreur est survenue !",
|
||||||
"TITLE_PROBLE_COME": "Un problème a été rencontré",
|
"TITLE_PROBLE_COME": "Un problème a été rencontré",
|
||||||
|
"TITLE_SUPPRESS_CONFIRM": "Confirmation de suppression",
|
||||||
|
"TEXT_SUPPRESS_CONFIRM": "Voulez vous vraiment supprimer cet utilisateur ?",
|
||||||
"TEXT_ERROR_START_APPLICATION": "Une erreur est survenue au démarrage de iLink World. Veuillez relancer iLink World",
|
"TEXT_ERROR_START_APPLICATION": "Une erreur est survenue au démarrage de iLink World. Veuillez relancer iLink World",
|
||||||
"TEXT_UNABLE_TO_GET_YOUR_POSITION": "Impossible de recupérez votre position. Veuillez verifier que votre GPS est activé et relancez iLink World",
|
"TEXT_UNABLE_TO_GET_YOUR_POSITION": "Impossible de recupérez votre position. Veuillez verifier que votre GPS est activé et relancez iLink World",
|
||||||
"RESTART": "RECOMMENCER",
|
"RESTART": "RECOMMENCER",
|
||||||
|
|
|
@ -5,11 +5,11 @@ export const isDebugMode = false
|
||||||
const baseUrl = "https://ilink-app.com/mobilebackend"
|
const baseUrl = "https://ilink-app.com/mobilebackend"
|
||||||
|
|
||||||
//base url agent
|
//base url agent
|
||||||
//const baseUrl="https://ilink-app.com/mobilebackendtest2"
|
//const baseUrl = "https://ilink-app.com/mobilebackendtest2"
|
||||||
|
|
||||||
//base url agent test
|
//base url agent test
|
||||||
//const baseUrl = "https://ilink-app.com/mobilebackendtest"
|
//const baseUrl = "https://ilink-app.com/mobilebackendtest"
|
||||||
|
//
|
||||||
export const adhesionUrl = baseUrl + '/interacted/LoginAction.php';
|
export const adhesionUrl = baseUrl + '/interacted/LoginAction.php';
|
||||||
export const memberActionUrl = baseUrl + '/interacted/MembersAction.php';
|
export const memberActionUrl = baseUrl + '/interacted/MembersAction.php';
|
||||||
export const networkActionUrl = baseUrl + '/interacted/NetworkAction.php';
|
export const networkActionUrl = baseUrl + '/interacted/NetworkAction.php';
|
||||||
|
|
|
@ -1,70 +1,74 @@
|
||||||
|
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
var db=require('./persistences/db.js');
|
var db = require('./persistences/db.js');
|
||||||
import I18n from 'react-native-i18n'
|
import I18n from 'react-native-i18n'
|
||||||
import {readUser} from './AuthApi'
|
import { readUser } from './AuthApi'
|
||||||
import {isDebugMode,MARKER_URL} from "./IlinkConstants";
|
import { isDebugMode, MARKER_URL } from "./IlinkConstants";
|
||||||
|
|
||||||
let GEOCODDING_URL="https://maps.googleapis.com/maps/api/geocode/json"
|
let GEOCODDING_URL = "https://maps.googleapis.com/maps/api/geocode/json"
|
||||||
let API_KEY="AIzaSyAYOEp-Pckvc3TwOIulCICokKgmp14rGHI"
|
let API_KEY = "AIzaSyAYOEp-Pckvc3TwOIulCICokKgmp14rGHI"
|
||||||
export const getLocalMarkers=()=> {
|
export const getLocalMarkers = () => {
|
||||||
return db.markers.get_all()
|
return db.markers.get_all()
|
||||||
}
|
}
|
||||||
export const getMakersFrom=function(country){
|
export const getMakersFrom = function (country) {
|
||||||
let tag={tag:'location',type:'all',country:country}
|
let tag = { tag: 'location', type: 'all', country: country }
|
||||||
return timeout(15000,queryMap(tag))
|
return timeout(15000, queryMap(tag))
|
||||||
}
|
}
|
||||||
function timeout(ms, promise) {
|
function timeout(ms, promise) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
reject(new Error(I18n.t("TEXT_NETWORK_UNABLE")))
|
reject(new Error(I18n.t("TEXT_NETWORK_UNABLE")))
|
||||||
}, ms)
|
}, ms)
|
||||||
promise.then(resolve, reject)
|
promise.then(resolve, reject)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
export const loadMarkers=(position,reseau,distance,page)=>{
|
export const loadMarkers = (position, reseau, distance, page) => {
|
||||||
return readUser().then((users)=>{
|
return readUser().then((users) => {
|
||||||
let user=users;
|
let user = users;
|
||||||
if(user!==undefined){
|
if (user !== undefined) {
|
||||||
let tag={tag:'location',type:'around',
|
let tag = {
|
||||||
page:page,
|
tag: 'location', type: 'around',
|
||||||
id:user.id,position:position,network:reseau,distance:distance}
|
page: page,
|
||||||
|
id: user.id, position: position, network: reseau, distance: distance
|
||||||
|
}
|
||||||
return queryMap(tag)
|
return queryMap(tag)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const loadGroupeAgent=(member_code)=>{
|
export const loadGroupeAgent = (member_code) => {
|
||||||
let data={tag:'location',type:'all_network',codeparrain:member_code}
|
let data = { tag: 'location', type: 'all_network', codeparrain: member_code }
|
||||||
return queryMap(data)
|
return queryMap(data)
|
||||||
}
|
}
|
||||||
export const loadNetwork=(network,userid)=>{
|
export const loadNetwork = (network, userid) => {
|
||||||
let data={tag:'location' ,type:"all_network_point",id:userid,network:network}
|
let data = { tag: 'location', type: "all_network_point", id: userid, network: network }
|
||||||
return queryMap(data)
|
return queryMap(data)
|
||||||
}
|
}
|
||||||
export const getPositionInformation= async (position)=>{
|
export const getPositionInformation = async (position) => {
|
||||||
let url=GEOCODDING_URL.concat('?latlng='+position.latitude+","+position.longitude+'&key='+API_KEY);
|
let url = GEOCODDING_URL.concat('?latlng=' + position.latitude + "," + position.longitude + '&key=' + API_KEY);
|
||||||
const data=fetch(url,{ method: 'GET',
|
const data = fetch(url, {
|
||||||
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},})
|
},
|
||||||
.then((response)=>response.json())
|
})
|
||||||
.then((responseJson)=>
|
.then((response) => response.json())
|
||||||
|
.then((responseJson) =>
|
||||||
responseJson
|
responseJson
|
||||||
).catch((error)=>{
|
).catch((error) => {
|
||||||
console.log("error get position")
|
console.log("error get position")
|
||||||
console.log(error)
|
console.log(error)
|
||||||
});
|
});
|
||||||
|
|
||||||
console.warn("freud",data);
|
console.warn("freud", data);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
const queryMap= async (data)=>{
|
const queryMap = async (data) => {
|
||||||
data['lang']=I18n.currentLocale()
|
data['lang'] = I18n.currentLocale()
|
||||||
data["test"]=isDebugMode
|
data["test"] = isDebugMode
|
||||||
let response=await fetch(MARKER_URL,{
|
let response = await fetch(MARKER_URL, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
|
@ -73,14 +77,14 @@ const queryMap= async (data)=>{
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
|
|
||||||
});
|
});
|
||||||
let responseText=await response.text()
|
let responseText = await response.text()
|
||||||
console.log("response= "+responseText)
|
//console.log("response= " + responseText)
|
||||||
try{
|
try {
|
||||||
let responseJson=JSON.parse(responseText)
|
let responseJson = JSON.parse(responseText)
|
||||||
return responseJson;
|
return responseJson;
|
||||||
}catch(e){
|
} catch (e) {
|
||||||
console.log("erreur="+responseText)
|
//console.log("erreur=" + responseText)
|
||||||
console.log(response)
|
//console.log(response)
|
||||||
throw new Error("Erreur lors de la conversion en json")
|
throw new Error("Erreur lors de la conversion en json")
|
||||||
}
|
}
|
||||||
throw new Error("Erreur lors de la conversion en json")
|
throw new Error("Erreur lors de la conversion en json")
|
||||||
|
|
|
@ -1,39 +1,37 @@
|
||||||
import {db} from './db';
|
import { db } from './db';
|
||||||
import {AsyncStorage} from 'react-native';
|
import { AsyncStorage } from 'react-native';
|
||||||
|
|
||||||
export default class Configuration{
|
export default class Configuration {
|
||||||
|
|
||||||
constructor(){
|
constructor() {
|
||||||
|
|
||||||
}
|
}
|
||||||
async getCurrentLangue(){
|
async getCurrentLangue() {
|
||||||
const da=await _getData()
|
const da = await _getData()
|
||||||
if(da)resolve(da)
|
if (da) resolve(da)
|
||||||
else reject(da)
|
else reject(da)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCurrentPasValue(){
|
async getCurrentPasValue() {
|
||||||
const pasObject=await this._getPasData()
|
const pasObject = await this._getPasData()
|
||||||
if(pasObject){
|
if (pasObject) {
|
||||||
return pasObject.valeur_int;
|
return pasObject.valeur_int;
|
||||||
}else return pasObject;
|
} else return pasObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCurrentPubValue(){
|
async getCurrentPubValue() {
|
||||||
const pasObject=await this._getPubData()
|
const pasObject = await this._getPubData()
|
||||||
console.warn(pasObject)
|
console.warn(pasObject)
|
||||||
if(pasObject){
|
if (pasObject) {
|
||||||
return pasObject.valeur_bool;
|
return pasObject.valeur_bool;
|
||||||
}else return pasObject;
|
} else return pasObject;
|
||||||
}
|
}
|
||||||
async setPubActive(data){
|
async setPubActive(data) {
|
||||||
try {
|
try {
|
||||||
if(data.pub){
|
if (data.pub) {
|
||||||
await AsyncStorage.setItem('pubObject', JSON.stringify(data.pub));
|
await AsyncStorage.setItem('pubObject', JSON.stringify(data.pub));
|
||||||
db.update({"configuration.pub":{$exists:true}},{configuration:{pub:data.pub}},{upsert:true},(err,num,upsert)=>{
|
db.update({ "configuration.pub": { $exists: true } }, { configuration: { pub: data.pub } }, { upsert: true }, (err, num, upsert) => {
|
||||||
console.log([err,num,upsert])
|
console.log([err, num, upsert])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -41,48 +39,48 @@ export default class Configuration{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
_getPubData(){
|
_getPubData() {
|
||||||
return new Promise(async (resolve,reject)=>{
|
return new Promise(async (resolve, reject) => {
|
||||||
|
|
||||||
try{
|
try {
|
||||||
const ty=await AsyncStorage.getItem('pubObject')
|
const ty = await AsyncStorage.getItem('pubObject')
|
||||||
resolve(JSON.parse(ty))
|
resolve(JSON.parse(ty))
|
||||||
} catch(err){
|
} catch (err) {
|
||||||
reject(err)
|
reject(err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
setCurrentLangue(lang){
|
setCurrentLangue(lang) {
|
||||||
this._storeData(lang)
|
this._storeData(lang)
|
||||||
db.update({"configuration.lang":{$exists:true}},{configuration:{lang:lang}},{upsert:true},(err,num,upsert)=>{
|
db.update({ "configuration.lang": { $exists: true } }, { configuration: { lang: lang } }, { upsert: true }, (err, num, upsert) => {
|
||||||
console.log([err,num,upsert])
|
console.log([err, num, upsert])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
setCurrentPas=async (pas)=>{
|
setCurrentPas = async (pas) => {
|
||||||
try {
|
try {
|
||||||
await AsyncStorage.setItem('@config:pasObject', JSON.stringify(pas.pas));
|
await AsyncStorage.setItem('@config:pasObject', JSON.stringify(pas.pas));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn(error)
|
console.warn(error)
|
||||||
}
|
}
|
||||||
db.update({"configuration.pas":{$exists:true}},{configuration:{pas:pas.pas}},{upsert:true},(err,num,upsert)=>{
|
db.update({ "configuration.pas": { $exists: true } }, { configuration: { pas: pas.pas } }, { upsert: true }, (err, num, upsert) => {
|
||||||
console.log([err,num,upsert])
|
console.log([err, num, upsert])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
_getPasData= ()=>{
|
_getPasData = () => {
|
||||||
return new Promise(async (resolve,reject)=>{
|
return new Promise(async (resolve, reject) => {
|
||||||
|
|
||||||
try{
|
try {
|
||||||
const ty=await AsyncStorage.getItem('@config:pasObject')
|
const ty = await AsyncStorage.getItem('@config:pasObject')
|
||||||
resolve(JSON.parse(ty))
|
resolve(JSON.parse(ty))
|
||||||
} catch(err){
|
} catch (err) {
|
||||||
reject(err)
|
reject(err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
_storeData = async (lang) => {
|
_storeData = async (lang) => {
|
||||||
try {
|
try {
|
||||||
await AsyncStorage.setItem('@config:lang', lang.value);
|
await AsyncStorage.setItem('@config:lang', lang.value);
|
||||||
|
@ -90,17 +88,17 @@ export default class Configuration{
|
||||||
console.warn(error)
|
console.warn(error)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
_getData= ()=>{
|
_getData = () => {
|
||||||
return new Promise(async (resolve,reject)=>{
|
return new Promise(async (resolve, reject) => {
|
||||||
|
|
||||||
try{
|
try {
|
||||||
const ty=await AsyncStorage.getItem('@config:lang')
|
const ty = await AsyncStorage.getItem('@config:lang')
|
||||||
resolve(ty)
|
resolve(ty)
|
||||||
} catch(err){
|
} catch (err) {
|
||||||
reject(err)
|
reject(err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue