@sumaris-net/ngx-components 2.4.65 → 2.4.67

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.
@@ -21678,10 +21678,16 @@ class GeolocationUtils {
21678
21678
  // If capacitor : throw error (cannot fallback to browser geolocation, because of browser security limitation)
21679
21679
  if (platform.is('capacitor')) {
21680
21680
  console.error(`[geolocation-utils] Cannot get current geo location, using Capacitor: ${err?.message || ''} (code=${err?.code || 'null'})`);
21681
- const permissions = await Geolocation.checkPermissions();
21682
- const permissionStatus = permissions?.coarseLocation || permissions?.location;
21683
- if (permissionStatus === 'denied') {
21684
- throw { ...err, code: GeolocationPositionError.PERMISSION_DENIED };
21681
+ try {
21682
+ const permissions = await Geolocation.checkPermissions();
21683
+ console.error(`[geolocation-utils] Permissions: ${JSON.stringify(permissions)})`);
21684
+ const permissionDenied = (permissions?.coarseLocation || permissions?.location) === 'denied'
21685
+ || (err?.message?.indexOf('Location permission was denied') !== -1);
21686
+ if (permissionDenied)
21687
+ throw { ...err, code: GeolocationPositionError.PERMISSION_DENIED };
21688
+ }
21689
+ catch (e2) {
21690
+ console.error(`[geolocation-utils] Error while calling checkPermissions(): ${err?.message || ''}`);
21685
21691
  }
21686
21692
  throw err;
21687
21693
  }