update forced checkin for start point and nearbt start points

This commit is contained in:
2023-11-15 16:27:28 +05:30
parent e8d65ba725
commit 85b8c4705f
3 changed files with 45 additions and 8 deletions

View File

@ -667,6 +667,29 @@ class DestinationController extends GetxController {
super.onInit();
}
int getForcedChckinDistance(Destination dest) {
int _retValue = 100;
if (dest.cp == -1) {
return 500;
}
Destination? ds;
for (Destination d in destinations) {
if (d.cp == -1) {
ds = d;
}
}
if (ds != null) {
var distance = const Distance();
double distanceToDest = distance.as(LengthUnit.Meter,
LatLng(dest.lat!, dest.lon!), LatLng(ds.lat!, ds.lon!));
if (distanceToDest <= 500) {
return 500;
}
}
return _retValue;
}
readUserToken() async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
indexController.userToken = prefs.getString("user_token");