only hide location if there were 5 empty scans

This commit is contained in:
Laura Klünder 2018-12-27 16:06:44 +01:00
parent f70ed3922d
commit 3f2fb2cf69

View file

@ -1356,8 +1356,7 @@ c3nav = {
} }
}, },
_last_wifi_scant: 0, _no_wifi_count: 0,
_wifi_scan_results: function(data) { _wifi_scan_results: function(data) {
data = JSON.parse(data); data = JSON.parse(data);
@ -1381,9 +1380,19 @@ c3nav = {
} }
if (!data.length) { if (!data.length) {
c3nav._set_user_location(null); if (!c3nav._hasLocationPermission) {
c3nav._set_user_location(null);
} else {
if (c3nav._no_wifi_count > 5) {
c3nav._no_wifi_count = 0;
c3nav._set_user_location(null);
} else {
c3nav._no_wifi_count++;
}
}
return; return;
} }
c3nav._no_wifi_count = 0;
$.post({ $.post({
url: '/api/routing/locate/', url: '/api/routing/locate/',