expo-location 16.0.0 → 16.1.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 CHANGED
@@ -10,6 +10,12 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 16.1.0 — 2023-07-13
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - 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))
18
+
13
19
  ## 16.0.0 — 2023-06-21
14
20
 
15
21
  _This version does not introduce any user-facing changes._
@@ -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.0.0'
6
+ version = '16.1.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.0.0"
70
+ versionName "16.1.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:21.0.1'
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.Builder prepareLocationRequest(Map<String, Object> options) {
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.Builder(locationParams.getInterval())
127
- .setMinUpdateIntervalMillis(locationParams.getInterval())
128
- .setMaxUpdateDelayMillis(locationParams.getInterval())
129
- .setMinUpdateDistanceMeters(locationParams.getDistance())
130
- .setPriority(mapAccuracyToPriority(accuracy));
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.Builder locationRequest, final Promise promise) {
150
+ static void requestSingleLocation(final LocationModule locationModule, final LocationRequest locationRequest, final Promise promise) {
150
151
  // we want just one update
151
- locationRequest.setMaxUpdates(1);
152
+ locationRequest.setNumUpdates(1);
152
153
 
153
- locationModule.requestLocationUpdates(locationRequest.build(), null, new LocationRequestCallbacks() {
154
+ locationModule.requestLocationUpdates(locationRequest, null, new LocationRequestCallbacks() {
154
155
  @Override
155
156
  public void onLocationChanged(Location location) {
156
- promise.resolve(LocationHelpers.locationToBundle(location, Bundle.class));
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.Builder builder = LocationHelpers.prepareLocationRequest(options);
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, builder, promise);
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(builder.build(), resultCode -> {
291
+ addPendingLocationRequest(locationRequest, resultCode -> {
292
292
  if (resultCode == Activity.RESULT_OK) {
293
- LocationHelpers.requestSingleLocation(LocationModule.this, builder, promise);
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.Builder locationRequest = LocationHelpers.prepareLocationRequest(options);
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.build(), watchId, promise);
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.build(), resultCode -> {
346
+ addPendingLocationRequest(locationRequest, resultCode -> {
347
347
  if (resultCode == Activity.RESULT_OK) {
348
- LocationHelpers.requestContinuousUpdates(LocationModule.this, locationRequest.build(), watchId, promise);
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.Builder locationRequest = LocationHelpers.prepareLocationRequest(new HashMap<>());
446
+ LocationRequest locationRequest = LocationHelpers.prepareLocationRequest(new HashMap<>());
447
447
 
448
- addPendingLocationRequest(locationRequest.build(), resultCode -> {
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()).build();
184
+ mLocationRequest = LocationHelpers.prepareLocationRequest(mTask.getOptions());
185
185
  mPendingIntent = preparePendingIntent();
186
186
 
187
187
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-location",
3
- "version": "16.0.0",
3
+ "version": "16.1.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": "fa5ecca8251986b9f197cc14074eec0ab6dfb6db"
47
+ "gitHead": "091c7777c1cc1298826b0a5c2c35e0e201d083ed"
48
48
  }