|
@@ -10,18 +10,12 @@ import TextView from '../../../components/TextView';
|
|
|
import LocationEnabler from 'react-native-location-enabler';
|
|
import LocationEnabler from 'react-native-location-enabler';
|
|
|
|
|
|
|
|
//global.hasPermission = false;
|
|
//global.hasPermission = false;
|
|
|
-const {
|
|
|
|
|
- PRIORITIES: { HIGH_ACCURACY },
|
|
|
|
|
- addListener,
|
|
|
|
|
- checkSettings,
|
|
|
|
|
- requestResolutionSettings
|
|
|
|
|
-} = LocationEnabler;
|
|
|
|
|
|
|
|
|
|
class LocationListener {
|
|
class LocationListener {
|
|
|
constructor() {
|
|
constructor() {
|
|
|
this.listener = undefined;
|
|
this.listener = undefined;
|
|
|
this.config = {
|
|
this.config = {
|
|
|
- priority: HIGH_ACCURACY, // default BALANCED_POWER_ACCURACY
|
|
|
|
|
|
|
+ priority: LocationEnabler.PRIORITIES.HIGH_ACCURACY, // default BALANCED_POWER_ACCURACY
|
|
|
alwaysShow: false, // default false
|
|
alwaysShow: false, // default false
|
|
|
needBle: false // default false
|
|
needBle: false // default false
|
|
|
};
|
|
};
|
|
@@ -29,12 +23,12 @@ class LocationListener {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
addListener() {
|
|
addListener() {
|
|
|
- this.listener = addListener(({ locationEnabled }) => {
|
|
|
|
|
|
|
+ this.listener = LocationEnabler.addListener(({ locationEnabled }) => {
|
|
|
if (!locationEnabled) {
|
|
if (!locationEnabled) {
|
|
|
console.log("status: " + this.status + "," + locationEnabled);
|
|
console.log("status: " + this.status + "," + locationEnabled);
|
|
|
if (this.status != locationEnabled) {
|
|
if (this.status != locationEnabled) {
|
|
|
this.status = locationEnabled;
|
|
this.status = locationEnabled;
|
|
|
- requestResolutionSettings(this.config);
|
|
|
|
|
|
|
+ LocationEnabler.requestResolutionSettings(this.config);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -48,7 +42,7 @@ class LocationListener {
|
|
|
|
|
|
|
|
check() {
|
|
check() {
|
|
|
this.status = undefined;
|
|
this.status = undefined;
|
|
|
- checkSettings(this.config)
|
|
|
|
|
|
|
+ LocationEnabler.checkSettings(this.config)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|