expo-location 15.2.0 → 15.3.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,20 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 15.3.0 — 2023-06-13
14
+
15
+ ### 📚 3rd party library updates
16
+
17
+ - Updated `com.google.android.gms:play-services-location` to `21.0.1` and `io.nlopez.smartlocation:library` to `3.3.3` ([#22468](https://github.com/expo/expo/pull/22468) by [@josephyanks](https://github.com/josephyanks))
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
22
+
23
+ ### 💡 Others
24
+
25
+ - On Android, removed use of deprecated `LocationRequest` constructor and replaced with `LocationRequest.Builder`. ([#22653](https://github.com/expo/expo/pull/22653) by [@alanjhughes](https://github.com/alanjhughes))
26
+
13
27
  ## 15.2.0 — 2023-05-08
14
28
 
15
29
  _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 = '15.2.0'
6
+ version = '15.3.0'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -35,19 +35,11 @@ buildscript {
35
35
  }
36
36
  }
37
37
 
38
- // Creating sources with comments
39
- task androidSourcesJar(type: Jar) {
40
- classifier = 'sources'
41
- from android.sourceSets.main.java.srcDirs
42
- }
43
-
44
38
  afterEvaluate {
45
39
  publishing {
46
40
  publications {
47
41
  release(MavenPublication) {
48
42
  from components.release
49
- // Add additional sourcesJar to artifacts
50
- artifact(androidSourcesJar)
51
43
  }
52
44
  }
53
45
  repositories {
@@ -70,23 +62,29 @@ android {
70
62
  jvmTarget = JavaVersion.VERSION_11.majorVersion
71
63
  }
72
64
 
65
+ namespace "expo.modules.location"
73
66
  defaultConfig {
74
67
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
68
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
76
69
  versionCode 29
77
- versionName "15.2.0"
70
+ versionName "15.3.0"
78
71
  }
79
72
  lintOptions {
80
73
  abortOnError false
81
74
  }
75
+ publishing {
76
+ singleVariant("release") {
77
+ withSourcesJar()
78
+ }
79
+ }
82
80
  }
83
81
 
84
82
  dependencies {
85
83
  implementation project(':expo-modules-core')
86
84
 
87
- api 'com.google.android.gms:play-services-location:16.0.0'
85
+ api 'com.google.android.gms:play-services-location:21.0.1'
88
86
 
89
- api('io.nlopez.smartlocation:library:3.2.11') {
87
+ api('io.nlopez.smartlocation:library:3.3.3') {
90
88
  transitive = false
91
89
  }
92
90
 
@@ -1,6 +1,4 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="expo.modules.location">
3
-
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
4
2
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
5
3
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
6
4
  <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
@@ -119,16 +119,15 @@ public class LocationHelpers {
119
119
  return heading;
120
120
  }
121
121
 
122
- public static LocationRequest prepareLocationRequest(Map<String, Object> options) {
122
+ public static LocationRequest.Builder 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
- .setFastestInterval(locationParams.getInterval())
128
- .setInterval(locationParams.getInterval())
129
- .setMaxWaitTime(locationParams.getInterval())
130
- .setSmallestDisplacement(locationParams.getDistance())
131
- .setPriority(mapAccuracyToPriority(accuracy));
126
+ return new LocationRequest.Builder(locationParams.getInterval())
127
+ .setMinUpdateIntervalMillis(locationParams.getInterval())
128
+ .setMaxUpdateDelayMillis(locationParams.getInterval())
129
+ .setMinUpdateDistanceMeters(locationParams.getDistance())
130
+ .setPriority(mapAccuracyToPriority(accuracy));
132
131
  }
133
132
 
134
133
  public static LocationParams mapOptionsToLocationParams(Map<String, Object> options) {
@@ -147,14 +146,14 @@ public class LocationHelpers {
147
146
  return locationParamsBuilder.build();
148
147
  }
149
148
 
150
- static void requestSingleLocation(final LocationModule locationModule, final LocationRequest locationRequest, final Promise promise) {
149
+ static void requestSingleLocation(final LocationModule locationModule, final LocationRequest.Builder locationRequest, final Promise promise) {
151
150
  // we want just one update
152
- locationRequest.setNumUpdates(1);
151
+ locationRequest.setMaxUpdates(1);
153
152
 
154
- locationModule.requestLocationUpdates(locationRequest, null, new LocationRequestCallbacks() {
153
+ locationModule.requestLocationUpdates(locationRequest.build(), null, new LocationRequestCallbacks() {
155
154
  @Override
156
155
  public void onLocationChanged(Location location) {
157
- promise.resolve(LocationHelpers.locationToBundle(location, Bundle.class));
156
+ promise.resolve(LocationHelpers.locationToBundle(location, Bundle.class));
158
157
  }
159
158
 
160
159
  @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 locationRequest = LocationHelpers.prepareLocationRequest(options);
278
+ final LocationRequest.Builder builder = 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, locationRequest, promise);
288
+ LocationHelpers.requestSingleLocation(this, builder, promise);
289
289
  } else {
290
290
  // Pending requests can ask the user to turn on improved accuracy mode in user's settings.
291
- addPendingLocationRequest(locationRequest, resultCode -> {
291
+ addPendingLocationRequest(builder.build(), resultCode -> {
292
292
  if (resultCode == Activity.RESULT_OK) {
293
- LocationHelpers.requestSingleLocation(LocationModule.this, locationRequest, promise);
293
+ LocationHelpers.requestSingleLocation(LocationModule.this, builder, 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 locationRequest = LocationHelpers.prepareLocationRequest(options);
339
+ final LocationRequest.Builder 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, watchId, promise);
343
+ LocationHelpers.requestContinuousUpdates(this, locationRequest.build(), 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, resultCode -> {
346
+ addPendingLocationRequest(locationRequest.build(), resultCode -> {
347
347
  if (resultCode == Activity.RESULT_OK) {
348
- LocationHelpers.requestContinuousUpdates(LocationModule.this, locationRequest, watchId, promise);
348
+ LocationHelpers.requestContinuousUpdates(LocationModule.this, locationRequest.build(), 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 locationRequest = LocationHelpers.prepareLocationRequest(new HashMap<>());
446
+ LocationRequest.Builder locationRequest = LocationHelpers.prepareLocationRequest(new HashMap<>());
447
447
 
448
- addPendingLocationRequest(locationRequest, resultCode -> {
448
+ addPendingLocationRequest(locationRequest.build(), 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()).build();
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": "15.2.0",
3
+ "version": "15.3.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": "4ba50c428c8369bb6b3a51a860d4898ad4ccbe78"
47
+ "gitHead": "3ccd2edee9cbfed217557675cb50f0ba5e55a9e4"
48
48
  }