12/1/1
This commit is contained in:
@@ -75,16 +75,41 @@ class LocationController extends GetxController {
|
||||
isActive = Get.find<HomeCaptainController>().isActive;
|
||||
|
||||
if (isActive) {
|
||||
if (double.parse(totalPoints) > -3000) {
|
||||
if (double.parse(totalPoints) > -300) {
|
||||
await getLocation();
|
||||
print(
|
||||
'Latitude: ${myLocation.latitude}, Longitude: ${myLocation.longitude}');
|
||||
|
||||
// Determine the area based on current location
|
||||
// Determine the area
|
||||
String area =
|
||||
getLocationArea(myLocation.latitude, myLocation.longitude);
|
||||
print('Determined Area: $area');
|
||||
|
||||
String endpoint;
|
||||
|
||||
switch (area) {
|
||||
case 'Cairo':
|
||||
print('Area matched: Cairo');
|
||||
box.write(BoxName.serverChosen, AppLink.seferCairoServer);
|
||||
endpoint = AppLink.addCarsLocationCairoEndpoint;
|
||||
break;
|
||||
case 'Giza':
|
||||
print('Area matched: Giza');
|
||||
box.write(BoxName.serverChosen, AppLink.seferGizaServer);
|
||||
endpoint = AppLink.addCarsLocationGizaEndpoint;
|
||||
break;
|
||||
case 'Alexandria':
|
||||
print('Area matched: Alexandria');
|
||||
box.write(
|
||||
BoxName.serverChosen, AppLink.seferAlexandriaServer);
|
||||
endpoint = AppLink.addCarsLocationAlexandriaEndpoint;
|
||||
break;
|
||||
default:
|
||||
print('Unknown location area. Fallback to Cairo');
|
||||
endpoint = AppLink.addCarsLocationCairoEndpoint;
|
||||
box.write(BoxName.serverChosen, AppLink.seferCairoServer);
|
||||
}
|
||||
Log.print('Final Endpoint: $endpoint');
|
||||
switch (area) {
|
||||
case 'Cairo':
|
||||
box.write(BoxName.serverChosen, AppLink.seferCairoServer);
|
||||
|
||||
Reference in New Issue
Block a user