added game status
This commit is contained in:
@ -14,6 +14,7 @@ import 'package:rogapp/model/gps_data.dart';
|
||||
import 'package:rogapp/pages/camera/camera_page.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/DatabaseService.dart';
|
||||
import 'package:rogapp/services/destination_service.dart';
|
||||
import 'package:rogapp/services/external_service.dart';
|
||||
import 'package:rogapp/services/location_service.dart';
|
||||
@ -77,6 +78,7 @@ class DestinationController extends GetxController {
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
final LocationController locationController = Get.put(LocationController());
|
||||
final DatabaseService dbService = DatabaseService();
|
||||
|
||||
int _start = 0;
|
||||
int chekcs = 0;
|
||||
@ -433,6 +435,7 @@ class DestinationController extends GetxController {
|
||||
lastGoalAt = DateTime.fromMicrosecondsSinceEpoch(latgoal);
|
||||
//print("===== last goal : $last_goal_at =====");
|
||||
}
|
||||
dbService.updateDatabase();
|
||||
}
|
||||
|
||||
void deleteAllDestinations() {
|
||||
@ -564,6 +567,7 @@ class DestinationController extends GetxController {
|
||||
|
||||
Future<void> checkForCheckin() async {
|
||||
//print("--- Start of checkForCheckin function ---");
|
||||
dbService.updateDatabase();
|
||||
await Future.delayed(const Duration(milliseconds: 3000));
|
||||
game_started = true;
|
||||
|
||||
@ -718,15 +722,16 @@ class DestinationController extends GetxController {
|
||||
// print("------Ext service check point $value ------");
|
||||
});
|
||||
}
|
||||
dbService.updateDatabase();
|
||||
}
|
||||
|
||||
Future<void> removeCheckin(int cp) {
|
||||
dbService.updateDatabase();
|
||||
return ExternalService().removeCheckin(cp);
|
||||
}
|
||||
|
||||
Future<void> startGame() async {
|
||||
//print("------ starting game ------");
|
||||
|
||||
if (game_started == false) {
|
||||
await checkForCheckin();
|
||||
}
|
||||
@ -776,6 +781,9 @@ class DestinationController extends GetxController {
|
||||
}
|
||||
|
||||
double distanceToStart() {
|
||||
if (indexController.locations.isEmpty) {
|
||||
return 1000000000;
|
||||
}
|
||||
//print("=== gfs len == ${indexController.locations[0].collection.length}");
|
||||
double distanceToDest = double.infinity;
|
||||
if (indexController.locations[0].features.isEmpty) {
|
||||
@ -959,6 +967,7 @@ class DestinationController extends GetxController {
|
||||
db.deleteDestination(d.location_id!).then((value) {
|
||||
populateDestinations();
|
||||
});
|
||||
dbService.updateDatabase();
|
||||
}
|
||||
|
||||
void deleteDBDestinations() {
|
||||
@ -966,6 +975,7 @@ class DestinationController extends GetxController {
|
||||
db.deleteAllDestinations().then((value) {
|
||||
populateDestinations();
|
||||
});
|
||||
dbService.updateDatabase();
|
||||
}
|
||||
|
||||
// ---------- database ------------------///
|
||||
@ -988,6 +998,7 @@ class DestinationController extends GetxController {
|
||||
});
|
||||
}
|
||||
});
|
||||
dbService.updateDatabase();
|
||||
}
|
||||
|
||||
void toggleSelection(Destination dest) async {
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/model/gps_data.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/DatabaseService.dart';
|
||||
import 'package:rogapp/utils/database_gps.dart';
|
||||
import 'package:rogapp/utils/database_helper.dart';
|
||||
import 'package:rogapp/widgets/list_widget.dart';
|
||||
import 'package:rogapp/widgets/map_widget.dart';
|
||||
|
||||
@ -25,6 +28,13 @@ class IndexPage extends GetView<IndexController> {
|
||||
appBar: AppBar(
|
||||
title: Text("add_location".tr),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
DatabaseService ds = DatabaseService();
|
||||
ds.updateDatabase();
|
||||
},
|
||||
icon: const Icon(Icons.ten_k_sharp)),
|
||||
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
// GpsDatabaseHelper db = GpsDatabaseHelper.instance;
|
||||
|
||||
Reference in New Issue
Block a user