@capacitor/geolocation 8.2.1-next.1 → 8.2.2

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/README.md CHANGED
@@ -25,7 +25,7 @@ location in the background. As a result, Apple requires you to include a
25
25
  prompt won’t appear to users, you can safely use the same description string as for
26
26
  `NSLocationWhenInUseUsageDescription`.
27
27
 
28
- :::info
28
+ :::
29
29
 
30
30
  Read about [Configuring `Info.plist`](https://capacitorjs.com/docs/ios/configuration#configuring-infoplist) in the [iOS Guide](https://capacitorjs.com/docs/ios) for more information on setting iOS permissions in Xcode
31
31
 
@@ -46,7 +46,7 @@ The first two permissions ask for location data, both fine and coarse, and the l
46
46
 
47
47
  If you only require approximate location (variable accuracy but usually around 2 kilometers), you may just declare `ACCESS_COARSE_LOCATION` and `<uses-feature`, and use `enableHighAccuracy=false` when requesting location
48
48
 
49
- :::note
49
+ :::
50
50
 
51
51
  Read about [Setting Permissions](https://capacitorjs.com/docs/android/configuration#setting-permissions) in the [Android Guide](https://capacitorjs.com/docs/android) for more information on setting Android permissions.
52
52
 
@@ -27,7 +27,9 @@ buildscript {
27
27
  }
28
28
 
29
29
  apply plugin: 'com.android.library'
30
- apply plugin: 'kotlin-android'
30
+ if (project.extensions.findByName('kotlin') == null) {
31
+ apply plugin: 'kotlin-android'
32
+ }
31
33
  if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
32
34
  apply plugin: 'io.github.gradle-nexus.publish-plugin'
33
35
  apply from: file('../scripts/android/publish-root.gradle')
@@ -81,7 +83,7 @@ dependencies {
81
83
  implementation project(':capacitor-android')
82
84
  }
83
85
 
84
- implementation("io.ionic.libs:iongeolocation-android:2.2.1")
86
+ implementation("io.ionic.libs:iongeolocation-android:2.2.2")
85
87
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
86
88
 
87
89
  implementation 'com.google.code.gson:gson:2.13.2'
@@ -130,7 +130,8 @@ private extension GeolocationPlugin {
130
130
 
131
131
  switch status {
132
132
  case .denied:
133
- self.onLocationPermissionNotGranted(error: .permissionDenied)
133
+ let error: GeolocationError = self.locationService?.areLocationServicesEnabled() == false ? .locationServicesDisabled : .permissionDenied
134
+ self.onLocationPermissionNotGranted(error: error)
134
135
  case .notDetermined:
135
136
  self.requestLocationAuthorisation(type: .whenInUse)
136
137
  case .restricted:
@@ -149,6 +150,9 @@ private extension GeolocationPlugin {
149
150
  locationCancellable = locationService?.currentLocationPublisher
150
151
  .catch { [weak self] error -> AnyPublisher<IONGLOCPositionModel, Never> in
151
152
  print("An error was found while retrieving the location: \(error)")
153
+ // A failure terminates this subscription; re-bind or later callbacks are dropped. RMET-5383
154
+ self?.locationInitialized = false
155
+ self?.bindLocationPublisher()
152
156
 
153
157
  if case IONGLOCLocationError.locationUnavailable = error {
154
158
  print("Location unavailable (likely due to backgrounding). Keeping watch callbacks alive.")
@@ -233,7 +237,12 @@ private extension GeolocationPlugin {
233
237
 
234
238
  switch locationService?.authorisationStatus {
235
239
  case .authorisedAlways, .authorisedWhenInUse: onLocationPermissionGranted()
236
- case .denied: callbackManager?.sendError(.permissionDenied)
240
+ case .denied:
241
+ if locationService?.areLocationServicesEnabled() == false {
242
+ callbackManager?.sendError(.locationServicesDisabled)
243
+ } else {
244
+ callbackManager?.sendError(.permissionDenied)
245
+ }
237
246
  case .restricted: callbackManager?.sendError(.permissionRestricted)
238
247
  default: break
239
248
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/geolocation",
3
- "version": "8.2.1-next.1",
3
+ "version": "8.2.2",
4
4
  "description": "The Geolocation API provides simple methods for getting and tracking the current position of the device using GPS, along with altitude, heading, and speed information if available.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",