MOBILE-2159 geolocation: Improve error message when permission is denied
parent
3d17c2cf03
commit
2846e6838a
|
@ -117,9 +117,19 @@ export class AddonModDataFieldLatlongComponent extends AddonModDataFieldPluginCo
|
||||||
this.form.controls['f_' + this.field.id + '_0'].setValue(result.coords.latitude);
|
this.form.controls['f_' + this.field.id + '_0'].setValue(result.coords.latitude);
|
||||||
this.form.controls['f_' + this.field.id + '_1'].setValue(result.coords.longitude);
|
this.form.controls['f_' + this.field.id + '_1'].setValue(result.coords.longitude);
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
|
if (this.isPositionError(error) && error.code === error.PERMISSION_DENIED) {
|
||||||
|
this.domUtils.showErrorModal('addon.mod_data.locationpermissiondenied', true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.domUtils.showErrorModalDefault(error, 'Error getting location');
|
this.domUtils.showErrorModalDefault(error, 'Error getting location');
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
modal.dismiss();
|
modal.dismiss();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected isPositionError(error?: any): error is PositionError {
|
||||||
|
return error && 'code' in error && 'PERMISSION_DENIED' in error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
"foundrecords": "Found records: {{$a.num}}/{{$a.max}} (<a href=\"{{$a.reseturl}}\">Reset filters</a>)",
|
"foundrecords": "Found records: {{$a.num}}/{{$a.max}} (<a href=\"{{$a.reseturl}}\">Reset filters</a>)",
|
||||||
"gettinglocation": "Getting location",
|
"gettinglocation": "Getting location",
|
||||||
"latlongboth": "Both latitude and longitude are required.",
|
"latlongboth": "Both latitude and longitude are required.",
|
||||||
|
"locationpermissiondenied": "Permission to access your location has been denied.",
|
||||||
"menuchoose": "Choose...",
|
"menuchoose": "Choose...",
|
||||||
"modulenameplural": "Databases",
|
"modulenameplural": "Databases",
|
||||||
"more": "More",
|
"more": "More",
|
||||||
|
|
|
@ -501,6 +501,7 @@
|
||||||
"addon.mod_data.foundrecords": "Found records: {{$a.num}}/{{$a.max}} (<a href=\"{{$a.reseturl}}\">Reset filters</a>)",
|
"addon.mod_data.foundrecords": "Found records: {{$a.num}}/{{$a.max}} (<a href=\"{{$a.reseturl}}\">Reset filters</a>)",
|
||||||
"addon.mod_data.gettinglocation": "Getting location",
|
"addon.mod_data.gettinglocation": "Getting location",
|
||||||
"addon.mod_data.latlongboth": "Both latitude and longitude are required.",
|
"addon.mod_data.latlongboth": "Both latitude and longitude are required.",
|
||||||
|
"addon.mod_data.locationpermissiondenied": "Permission to access your location has been denied.",
|
||||||
"addon.mod_data.menuchoose": "Choose...",
|
"addon.mod_data.menuchoose": "Choose...",
|
||||||
"addon.mod_data.modulenameplural": "Databases",
|
"addon.mod_data.modulenameplural": "Databases",
|
||||||
"addon.mod_data.more": "More",
|
"addon.mod_data.more": "More",
|
||||||
|
|
Loading…
Reference in New Issue