mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
Pebble: In the geolocation override, fail if the position is too old.
The previous logic was wrong as it was calling success every time. Further checks must be added for some watchfaces.
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
navigator.geolocation.getCurrentPosition = function(success, failure) { //override because default implementation requires GPS permission
|
||||
success(JSON.parse(GBjs.getCurrentPosition()));
|
||||
failure({ code: 2, message: "POSITION_UNAVAILABLE"});
|
||||
navigator.geolocation.getCurrentPosition = function(success, failure, options) { //override because default implementation requires GPS permission
|
||||
geoposition = JSON.parse(GBjs.getCurrentPosition());
|
||||
|
||||
if(options && options.maximumAge && geoposition.timestamp < Date.now() - options.maximumAge) {
|
||||
failure({ code: 2, message: "POSITION_UNAVAILABLE"});
|
||||
} else {
|
||||
success();
|
||||
}
|
||||
}
|
||||
|
||||
if (window.Storage){
|
||||
|
Reference in New Issue
Block a user