MOBILE-3565 services: Fix geolocation service linting

main
Pau Ferrer Ocaña 2020-10-08 14:04:38 +02:00
parent c7b1cd0081
commit 0327d78561
1 changed files with 3 additions and 5 deletions

View File

@ -70,7 +70,7 @@ export class CoreGeolocationProvider {
} }
if (!CoreApp.instance.isIOS()) { if (!CoreApp.instance.isIOS()) {
await Diagnostic.instance.switchToLocationSettings(); Diagnostic.instance.switchToLocationSettings();
await CoreApp.instance.waitForResume(30000); await CoreApp.instance.waitForResume(30000);
locationEnabled = await Diagnostic.instance.isLocationEnabled(); locationEnabled = await Diagnostic.instance.isLocationEnabled();
@ -91,8 +91,7 @@ export class CoreGeolocationProvider {
const authorizationStatus = await Diagnostic.instance.getLocationAuthorizationStatus(); const authorizationStatus = await Diagnostic.instance.getLocationAuthorizationStatus();
switch (authorizationStatus) { switch (authorizationStatus) {
// This constant is hard-coded because it is not declared in @ionic-native/diagnostic v4. case Diagnostic.instance.permissionStatus.DENIED_ONCE:
case 'DENIED_ONCE':
if (failOnDeniedOnce) { if (failOnDeniedOnce) {
throw new CoreGeolocationError(CoreGeolocationErrorReason.PermissionDenied); throw new CoreGeolocationError(CoreGeolocationErrorReason.PermissionDenied);
} }
@ -107,7 +106,6 @@ export class CoreGeolocationProvider {
case Diagnostic.instance.permissionStatus.GRANTED_WHEN_IN_USE: case Diagnostic.instance.permissionStatus.GRANTED_WHEN_IN_USE:
// Location is authorized. // Location is authorized.
return; return;
case Diagnostic.instance.permissionStatus.DENIED:
default: default:
throw new CoreGeolocationError(CoreGeolocationErrorReason.PermissionDenied); throw new CoreGeolocationError(CoreGeolocationErrorReason.PermissionDenied);
} }
@ -133,7 +131,7 @@ export enum CoreGeolocationErrorReason {
export class CoreGeolocationError extends CoreError { export class CoreGeolocationError extends CoreError {
readonly reason: CoreGeolocationErrorReason; reason: CoreGeolocationErrorReason;
constructor(reason: CoreGeolocationErrorReason) { constructor(reason: CoreGeolocationErrorReason) {
super(`GeolocationError: ${reason}`); super(`GeolocationError: ${reason}`);