fixed timer issue

This commit is contained in:
2023-11-27 14:57:25 +05:30
parent 13e07b007a
commit 44cb728fab
10 changed files with 38 additions and 30 deletions

View File

@ -284,7 +284,7 @@ class CameraPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
print("---- photos ${destination.photos} ----");
//print("---- photos ${destination.photos} ----");
if (buyPointPhoto == true) {
//print("--- buy point camera ${destination.toString()}");
return BuyPointCamera(destination: destination);

View File

@ -37,7 +37,8 @@ class DestinationController extends GetxController {
double currentLat = 0.0;
double currentLon = 0.0;
bool gps_push_started = false;
static bool gps_push_started = false;
static bool game_started = false;
bool skip_10s = false;
@ -125,7 +126,7 @@ class DestinationController extends GetxController {
}
Future<void> startTimer(Destination d, double distance) async {
print("=== passed dest is ${d.location_id} ${d.checkedin} ====");
//print("=== passed dest is ${d.location_id} ${d.checkedin} ====");
skipGps = true;
//print("---- in startTimer ----");
@ -514,11 +515,12 @@ class DestinationController extends GetxController {
is_checkin: isCheckin,
created_at: DateTime.now().millisecondsSinceEpoch);
var res = await db.insertGps(gps_data);
print("==gps res == ${res}");
//print("==gps res == ${res}");
}
Future<void> checkForCheckin() async {
print("--- Start of checkForCheckin function ---");
//print("--- Start of checkForCheckin function ---");
game_started = true;
try {
//print("--- 000 ---- $skip_gps----");
@ -587,15 +589,17 @@ class DestinationController extends GetxController {
}
Future<void> pushGPStoServer() async {
// print(
// "^^^^^^^^ ${DateFormat('kk:mm:ss \n EEE d MMM').format(DateTime.now())}");
try {
await Future.delayed(const Duration(minutes: 5));
gps_push_started = true;
ExternalService().pushGPS();
} catch (e) {
//print("An error occurred: $e");
await pushGPStoServer();
//await pushGPStoServer();
} finally {
//print("--- End of pushGPStoServer function, calling recursively ---");
await Future.delayed(const Duration(seconds: 5 * 60));
await pushGPStoServer();
}
}
@ -702,7 +706,9 @@ class DestinationController extends GetxController {
Future<void> startGame() async {
//print("------ starting game ------");
await checkForCheckin();
if (game_started == false) {
await checkForCheckin();
}
}
@override
@ -718,13 +724,13 @@ class DestinationController extends GetxController {
Destination des = festuretoDestination(gfs);
print("=== gfs == ${des.toMap()}");
//print("=== gfs == ${des.toMap()}");
double distanceToDest = double.infinity;
var distance = const Distance();
distanceToDest = distance.as(LengthUnit.Meter,
LatLng(currentLat, currentLon), LatLng(des.lat!, des.lon!));
print("==== dist==${distanceToDest}");
//print("==== dist==${distanceToDest}");
return distanceToDest;
}
@ -744,7 +750,7 @@ class DestinationController extends GetxController {
if (distanceToDest <= 500) {
return 500;
}
print("==== forced dist ==${distanceToDest}");
//print("==== forced dist ==${distanceToDest}");
return _retValue;
}

View File

@ -38,7 +38,7 @@ class _GpsPageState extends State<GpsPage> {
var data = await db.getGPSData(team_name, event_code);
gpsData.value = data;
print("--- gps data ${data} ----");
//print("--- gps data ${data} ----");
}
Widget getMarkerShape(GpsData i) {

View File

@ -268,7 +268,7 @@ class IndexController extends GetxController {
} else {
rogMode.value = 1;
}
print('--- c rog mode --- ${rogMode.value}');
//print('--- c rog mode --- ${rogMode.value}');
Get.toNamed(AppPages.INDEX);
}