expo-location 16.0.0 → 16.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/android/build.gradle +3 -3
- package/android/src/main/java/expo/modules/location/LocationHelpers.java +11 -10
- package/android/src/main/java/expo/modules/location/LocationModule.java +10 -10
- package/android/src/main/java/expo/modules/location/taskConsumers/LocationTaskConsumer.java +1 -1
- package/build/ExpoLocation.d.ts +1 -1
- package/build/ExpoLocation.d.ts.map +1 -1
- package/build/ExpoLocation.js +2 -2
- package/build/ExpoLocation.js.map +1 -1
- package/package.json +2 -2
- package/src/ExpoLocation.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 16.2.0 — 2023-07-28
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
17
|
+
## 16.1.0 - 2023-07-13
|
|
18
|
+
|
|
19
|
+
### 🐛 Bug fixes
|
|
20
|
+
|
|
21
|
+
- Downgrade play-services-location to 20.0.0 to support react-native-maps. ([#23501](https://github.com/expo/expo/pull/23501) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
|
22
|
+
|
|
13
23
|
## 16.0.0 — 2023-06-21
|
|
14
24
|
|
|
15
25
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '16.
|
|
6
|
+
version = '16.2.0'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
9
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
@@ -67,7 +67,7 @@ android {
|
|
|
67
67
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
68
68
|
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
69
69
|
versionCode 29
|
|
70
|
-
versionName "16.
|
|
70
|
+
versionName "16.2.0"
|
|
71
71
|
}
|
|
72
72
|
lintOptions {
|
|
73
73
|
abortOnError false
|
|
@@ -82,7 +82,7 @@ android {
|
|
|
82
82
|
dependencies {
|
|
83
83
|
implementation project(':expo-modules-core')
|
|
84
84
|
|
|
85
|
-
api 'com.google.android.gms:play-services-location:
|
|
85
|
+
api 'com.google.android.gms:play-services-location:20.0.0'
|
|
86
86
|
|
|
87
87
|
api('io.nlopez.smartlocation:library:3.3.3') {
|
|
88
88
|
transitive = false
|
|
@@ -119,15 +119,16 @@ public class LocationHelpers {
|
|
|
119
119
|
return heading;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
public static LocationRequest
|
|
122
|
+
public static LocationRequest prepareLocationRequest(Map<String, Object> options) {
|
|
123
123
|
LocationParams locationParams = LocationHelpers.mapOptionsToLocationParams(options);
|
|
124
124
|
int accuracy = LocationHelpers.getAccuracyFromOptions(options);
|
|
125
125
|
|
|
126
|
-
return new LocationRequest
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
return new LocationRequest()
|
|
127
|
+
.setFastestInterval(locationParams.getInterval())
|
|
128
|
+
.setInterval(locationParams.getInterval())
|
|
129
|
+
.setMaxWaitTime(locationParams.getInterval())
|
|
130
|
+
.setSmallestDisplacement(locationParams.getDistance())
|
|
131
|
+
.setPriority(mapAccuracyToPriority(accuracy));
|
|
131
132
|
}
|
|
132
133
|
|
|
133
134
|
public static LocationParams mapOptionsToLocationParams(Map<String, Object> options) {
|
|
@@ -146,14 +147,14 @@ public class LocationHelpers {
|
|
|
146
147
|
return locationParamsBuilder.build();
|
|
147
148
|
}
|
|
148
149
|
|
|
149
|
-
static void requestSingleLocation(final LocationModule locationModule, final LocationRequest
|
|
150
|
+
static void requestSingleLocation(final LocationModule locationModule, final LocationRequest locationRequest, final Promise promise) {
|
|
150
151
|
// we want just one update
|
|
151
|
-
locationRequest.
|
|
152
|
+
locationRequest.setNumUpdates(1);
|
|
152
153
|
|
|
153
|
-
locationModule.requestLocationUpdates(locationRequest
|
|
154
|
+
locationModule.requestLocationUpdates(locationRequest, null, new LocationRequestCallbacks() {
|
|
154
155
|
@Override
|
|
155
156
|
public void onLocationChanged(Location location) {
|
|
156
|
-
|
|
157
|
+
promise.resolve(LocationHelpers.locationToBundle(location, Bundle.class));
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
@Override
|
|
@@ -275,7 +275,7 @@ public class LocationModule extends ExportedModule implements LifecycleEventList
|
|
|
275
275
|
@ExpoMethod
|
|
276
276
|
public void getCurrentPositionAsync(final Map<String, Object> options, final Promise promise) {
|
|
277
277
|
// Read options
|
|
278
|
-
final LocationRequest
|
|
278
|
+
final LocationRequest locationRequest = LocationHelpers.prepareLocationRequest(options);
|
|
279
279
|
boolean showUserSettingsDialog = !options.containsKey(SHOW_USER_SETTINGS_DIALOG_KEY) || (boolean) options.get(SHOW_USER_SETTINGS_DIALOG_KEY);
|
|
280
280
|
|
|
281
281
|
// Check for permissions
|
|
@@ -285,12 +285,12 @@ public class LocationModule extends ExportedModule implements LifecycleEventList
|
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
if (LocationHelpers.hasNetworkProviderEnabled(mContext) || !showUserSettingsDialog) {
|
|
288
|
-
LocationHelpers.requestSingleLocation(this,
|
|
288
|
+
LocationHelpers.requestSingleLocation(this, locationRequest, promise);
|
|
289
289
|
} else {
|
|
290
290
|
// Pending requests can ask the user to turn on improved accuracy mode in user's settings.
|
|
291
|
-
addPendingLocationRequest(
|
|
291
|
+
addPendingLocationRequest(locationRequest, resultCode -> {
|
|
292
292
|
if (resultCode == Activity.RESULT_OK) {
|
|
293
|
-
LocationHelpers.requestSingleLocation(LocationModule.this,
|
|
293
|
+
LocationHelpers.requestSingleLocation(LocationModule.this, locationRequest, promise);
|
|
294
294
|
} else {
|
|
295
295
|
promise.reject(new LocationSettingsUnsatisfiedException());
|
|
296
296
|
}
|
|
@@ -336,16 +336,16 @@ public class LocationModule extends ExportedModule implements LifecycleEventList
|
|
|
336
336
|
return;
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
final LocationRequest
|
|
339
|
+
final LocationRequest locationRequest = LocationHelpers.prepareLocationRequest(options);
|
|
340
340
|
boolean showUserSettingsDialog = !options.containsKey(SHOW_USER_SETTINGS_DIALOG_KEY) || (boolean) options.get(SHOW_USER_SETTINGS_DIALOG_KEY);
|
|
341
341
|
|
|
342
342
|
if (LocationHelpers.hasNetworkProviderEnabled(mContext) || !showUserSettingsDialog) {
|
|
343
|
-
LocationHelpers.requestContinuousUpdates(this, locationRequest
|
|
343
|
+
LocationHelpers.requestContinuousUpdates(this, locationRequest, watchId, promise);
|
|
344
344
|
} else {
|
|
345
345
|
// Pending requests can ask the user to turn on improved accuracy mode in user's settings.
|
|
346
|
-
addPendingLocationRequest(locationRequest
|
|
346
|
+
addPendingLocationRequest(locationRequest, resultCode -> {
|
|
347
347
|
if (resultCode == Activity.RESULT_OK) {
|
|
348
|
-
LocationHelpers.requestContinuousUpdates(LocationModule.this, locationRequest
|
|
348
|
+
LocationHelpers.requestContinuousUpdates(LocationModule.this, locationRequest, watchId, promise);
|
|
349
349
|
} else {
|
|
350
350
|
promise.reject(new LocationSettingsUnsatisfiedException());
|
|
351
351
|
}
|
|
@@ -443,9 +443,9 @@ public class LocationModule extends ExportedModule implements LifecycleEventList
|
|
|
443
443
|
return;
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
LocationRequest
|
|
446
|
+
LocationRequest locationRequest = LocationHelpers.prepareLocationRequest(new HashMap<>());
|
|
447
447
|
|
|
448
|
-
addPendingLocationRequest(locationRequest
|
|
448
|
+
addPendingLocationRequest(locationRequest, resultCode -> {
|
|
449
449
|
if (resultCode == Activity.RESULT_OK) {
|
|
450
450
|
promise.resolve(null);
|
|
451
451
|
} else {
|
|
@@ -181,7 +181,7 @@ public class LocationTaskConsumer extends TaskConsumer implements TaskConsumerIn
|
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
mLocationRequest = LocationHelpers.prepareLocationRequest(mTask.getOptions())
|
|
184
|
+
mLocationRequest = LocationHelpers.prepareLocationRequest(mTask.getOptions());
|
|
185
185
|
mPendingIntent = preparePendingIntent();
|
|
186
186
|
|
|
187
187
|
try {
|
package/build/ExpoLocation.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoLocation.d.ts","sourceRoot":"","sources":["../src/ExpoLocation.ts"],"names":[],"mappings":";AACA,
|
|
1
|
+
{"version":3,"file":"ExpoLocation.d.ts","sourceRoot":"","sources":["../src/ExpoLocation.ts"],"names":[],"mappings":";AACA,wBAAmD"}
|
package/build/ExpoLocation.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default
|
|
1
|
+
import { requireNativeModule } from 'expo-modules-core';
|
|
2
|
+
export default requireNativeModule('ExpoLocation');
|
|
3
3
|
//# sourceMappingURL=ExpoLocation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoLocation.js","sourceRoot":"","sources":["../src/ExpoLocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ExpoLocation.js","sourceRoot":"","sources":["../src/ExpoLocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,eAAe,mBAAmB,CAAC,cAAc,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\nexport default requireNativeModule('ExpoLocation');\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-location",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.2.0",
|
|
4
4
|
"description": "Allows reading geolocation information from the device. Your app can poll for the current location or subscribe to location update events.",
|
|
5
5
|
"main": "build/Location.js",
|
|
6
6
|
"types": "build/Location.d.ts",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"expo": "*"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "663654577a7068c641b5e9474efbc502e3f334ea"
|
|
48
48
|
}
|
package/src/ExpoLocation.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default
|
|
1
|
+
import { requireNativeModule } from 'expo-modules-core';
|
|
2
|
+
export default requireNativeModule('ExpoLocation');
|