From 9987b243f73751ab83a59baa7ee06eb1ba6733e3 Mon Sep 17 00:00:00 2001 From: Mohamed Nouffer Date: Wed, 2 Nov 2022 22:47:49 +0530 Subject: [PATCH] update for GPS fix --- .../destination/destination_controller.dart | 23 ++++++++----------- lib/services/external_service.dart | 5 ++-- lib/widgets/bottom_sheet_new.dart | 4 ++++ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index 2df14a7..d4d2dc5 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -100,10 +100,9 @@ class DestinationController extends GetxController { void startTimerLocation(GeoJsonFeature fs, double distance) { print("---- in startTimer ----"); - chekcs = 0; + //skip_gps = true; double checkin_radious = fs.properties!['checkin_radius'] ?? double.infinity; if(checkin_radious >= distance){ - chekcs = 1; indexController.currentFeature.clear(); Destination d = festuretoDestination(fs); for(Destination de in destinations){ @@ -116,9 +115,6 @@ class DestinationController extends GetxController { print("---- before calling startTimer ----"); startTimer(d, distance); } - if(chekcs == 0){ - skip_gps = false; - } } void startTimer(Destination d, double distance) async { @@ -164,13 +160,13 @@ class DestinationController extends GetxController { else { print("----- in location popup checkin cp - ${d.cp}----"); - chekcs = 1; + chekcs = 2; //is_in_checkin.value = true; showModalBottomSheet(context: Get.context!, isScrollControlled: true, builder:((context) => BottomSheetNew()) ).whenComplete((){ skip_gps = false; - chekcs = 0; + chekcs =0; is_in_checkin.value = false; }); } @@ -191,7 +187,7 @@ class DestinationController extends GetxController { else{ // ask for checkin if(d.hidden_location != null && d.hidden_location ==true && is_in_rog.value == true && d.cp != -1){ - chekcs = 1; + chekcs = 3; is_in_checkin.value = true; showModalBottomSheet(context: Get.context!, isScrollControlled: true, builder:((context) => CameraPage()) @@ -202,7 +198,7 @@ class DestinationController extends GetxController { }); } else if(is_in_rog.value == true && d.cp != -1){ - chekcs = 1; + chekcs = 4; is_in_checkin.value = true; showModalBottomSheet(context: Get.context!, isScrollControlled: true, builder:((context) => BottomSheetNew()) @@ -224,7 +220,7 @@ class DestinationController extends GetxController { if(is_at_goal.value == false && rogaining_counted.value){ //goal print("---- in goal -----"); - chekcs = 1; + chekcs = 5; is_at_goal.value = true; showModalBottomSheet(context: Get.context!, isScrollControlled: true, builder:((context) => CameraPage()) @@ -237,7 +233,7 @@ class DestinationController extends GetxController { else if(is_in_rog.value == false){ //start print("---- in start -----"); - chekcs = 1; + chekcs = 6; is_at_start.value = true; showModalBottomSheet(context: Get.context!, isScrollControlled: true, builder:((context) => BottomSheetNew()) @@ -253,7 +249,6 @@ class DestinationController extends GetxController { if(chekcs == 0){ skip_gps = false; } - skip_gps = false; } // void startTimer2(Destination d, double distance) { @@ -468,7 +463,7 @@ class DestinationController extends GetxController { is_in_rog.value = true; } - void makeCheckin(Destination destination, bool action) async { + void makeCheckin(Destination destination, bool action, {String imageurl = ""}) async { // print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${action}@@@@@@@@@@@"); DatabaseHelper db = DatabaseHelper.instance; List ddd = await db.getDestinationByLatLon(destination.lat!, destination.lon!); @@ -485,7 +480,7 @@ class DestinationController extends GetxController { int cp_num = int.parse(destination.cp!.toString()); String _team = indexController.currentUser[0]["user"]["team_name"]; String _event_code = indexController.currentUser[0]["user"]["event_code"]; - ExternalService().makeCheckpoint(_team, cp_num, _event_code).then((value){ + ExternalService().makeCheckpoint(_team, cp_num, _event_code, imageurl).then((value){ print("------Ext service check point ${value} ------"); }); } diff --git a/lib/services/external_service.dart b/lib/services/external_service.dart index d774e48..aa766a3 100644 --- a/lib/services/external_service.dart +++ b/lib/services/external_service.dart @@ -37,7 +37,7 @@ class ExternalService { return _res; } - Future> makeCheckpoint(String teamname, int cp, String eventcode) async { + Future> makeCheckpoint(String teamname, int cp, String eventcode, String imageurl) async { Map _res = {}; String url = 'https://natnats.mobilous.com/checkin_from_rogapp'; //print('---- toekn is ${token} -----'); @@ -49,7 +49,8 @@ class ExternalService { body: jsonEncode({ 'team_name': teamname, 'cp_number': cp.toString(), - 'event_code': eventcode + 'event_code': eventcode, + 'image': imageurl }), ); diff --git a/lib/widgets/bottom_sheet_new.dart b/lib/widgets/bottom_sheet_new.dart index ab90b9e..65f4096 100644 --- a/lib/widgets/bottom_sheet_new.dart +++ b/lib/widgets/bottom_sheet_new.dart @@ -284,6 +284,7 @@ class BottomSheetNew extends GetView { ); } + // show add location details SingleChildScrollView detailsSheet(BuildContext context) { return SingleChildScrollView( @@ -438,6 +439,9 @@ class BottomSheetNew extends GetView { ); } + + + Future wantToGo(BuildContext context)async { bool _selected = false;