This commit is contained in:
14Sandee
2023-12-06 14:47:35 +05:30
parent 4e0a6bc587
commit 68b53598af

View File

@@ -687,19 +687,23 @@ public abstract class AppUtil {
}
}
// radius is equal thus, checking for unit of the radius
String local_radius_unit = getPatientGeofenceRadiusUnit(context);
if (!remote_radius_unit.equals(local_radius_unit)) {
// remote radius units are different
// thus, should add geofence
return true;
}
// checking for lat lng
String[] local_lat_lng = getPatientLatLng(context);
if (data.lat != null && data.lng != null) {
if (!data.lat.equals(local_lat_lng[0]) || !data.lng.equals(local_lat_lng[1])) {
// remote lat lng has changed
// if (!data.lat.equals(local_lat_lng[0]) || !data.lng.equals(local_lat_lng[1])) {
// // remote lat lng has changed
// return true;
// }
// converting and comparing for precision
try {
if (Double.parseDouble(data.lat) != Double.parseDouble(local_lat_lng[0]) ||
Double.parseDouble(data.lng) != Double.parseDouble(local_lat_lng[1])) {
// remote lat lng has changed
return true;
}
} catch (Exception e) {
// meaning, local_lat_lng are null
return true;
}
}