Near Me: surface raw geolocation error text on-screen for diagnosis
Append the underlying native/browser error message to the failure toast (and log it) with a 12s duration, so the exact failure reason is visible on-device without needing adb. This lets us distinguish OS Location-off, provider-unavailable, timeout, and plugin errors at a glance. Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
This commit is contained in:
parent
700ebee17e
commit
8870a3e07f
1 changed files with 20 additions and 7 deletions
|
|
@ -639,6 +639,12 @@ export default function MapPage() {
|
|||
setNearMeLoading(false);
|
||||
const kind = err instanceof GeolocationError ? err.kind : 'unavailable';
|
||||
|
||||
// Raw diagnostic text so we can see exactly what failed on-device
|
||||
// (no adb needed). Shown appended to the toast + logged.
|
||||
const rawMsg = err instanceof Error ? err.message : String(err);
|
||||
console.warn('[NearMe] geolocation failed:', kind, rawMsg, err);
|
||||
const diag = rawMsg ? ` [${rawMsg}]` : '';
|
||||
|
||||
if (kind === 'denied') {
|
||||
setNearMeError('denied');
|
||||
if (isNativeGeolocation()) {
|
||||
|
|
@ -646,8 +652,10 @@ export default function MapPage() {
|
|||
toast({
|
||||
title: 'Location permission needed',
|
||||
description:
|
||||
'Allow location for SkateSpots in your device Settings → Apps → SkateSpots → Permissions, then tap Near Me again.',
|
||||
'Allow location for SkateSpots in your device Settings → Apps → SkateSpots → Permissions, then tap Near Me again.' +
|
||||
diag,
|
||||
variant: 'destructive',
|
||||
duration: 12000,
|
||||
});
|
||||
} else {
|
||||
// Web: show the browser re-enable help sheet.
|
||||
|
|
@ -657,19 +665,24 @@ export default function MapPage() {
|
|||
setNearMeError('timeout');
|
||||
toast({
|
||||
title: 'Location timed out',
|
||||
description: isNativeGeolocation()
|
||||
? "Couldn't get a location fix. Make sure Location/GPS is turned on in your phone's quick settings, then tap Near Me again."
|
||||
: 'Could not get your location in time. Check your signal and try again.',
|
||||
description:
|
||||
(isNativeGeolocation()
|
||||
? "Couldn't get a location fix. Make sure Location/GPS is turned on in your phone's quick settings, then tap Near Me again."
|
||||
: 'Could not get your location in time. Check your signal and try again.') + diag,
|
||||
variant: 'destructive',
|
||||
duration: 12000,
|
||||
});
|
||||
} else {
|
||||
setNearMeError('unavailable');
|
||||
toast({
|
||||
title: 'Location unavailable',
|
||||
description: isNativeGeolocation()
|
||||
? 'Turn on Location/GPS in your phone settings, allow location for SkateSpots (Settings → Apps → SkateSpots → Permissions), then try again.'
|
||||
: 'Your location could not be determined. Make sure location services are enabled.',
|
||||
description:
|
||||
(isNativeGeolocation()
|
||||
? 'Turn on Location/GPS in your phone settings, allow location for SkateSpots (Settings → Apps → SkateSpots → Permissions), then try again.'
|
||||
: 'Your location could not be determined. Make sure location services are enabled.') +
|
||||
diag,
|
||||
variant: 'destructive',
|
||||
duration: 12000,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue