update to external apis

This commit is contained in:
Mohamed Nouffer
2022-10-19 08:53:17 +05:30
parent 8e30ee6ba7
commit 2d9f7a9633
13 changed files with 209 additions and 50 deletions

View File

@ -16,6 +16,7 @@ import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/services/action_service.dart';
import 'package:rogapp/services/destination_service.dart';
import 'package:rogapp/services/external_service.dart';
import 'package:rogapp/services/maxtrix_service.dart';
import 'package:rogapp/services/reacking_service.dart';
import 'package:rogapp/utils/database_helper.dart';
@ -72,7 +73,6 @@ class DestinationController extends GetxController {
}
else{
//finish rogiain
//is_in_rog.value = true;
if (rogaining_counted.value && distance <=250){
Get.toNamed(AppPages.CAMERA_PAGE);
}
@ -130,6 +130,8 @@ class DestinationController extends GetxController {
for(final d in destinations){
print("-----loc_id- ${d.location_id}----");
if(!checking_in)
{
checking_in = true;
@ -142,6 +144,10 @@ class DestinationController extends GetxController {
double rad = value!.checkin_radious ?? double.infinity;
bool auto_checkin = value.auto_checkin == 0 ? false : true;
print("-----rogaining_counted---${rogaining_counted.value}-----");
print("-----is_in_rog---${is_in_rog}-----");
print("-----dist is ---${dist}-----");
if(d.cp != -1 && is_in_rog == true){
rogaining_counted.value == true;
}
@ -215,24 +221,25 @@ class DestinationController extends GetxController {
}
void makeCheckin(Destination destination, bool action) async {
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${action}@@@@@@@@@@@");
// print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${action}@@@@@@@@@@@");
DatabaseHelper db = DatabaseHelper.instance;
int res = await db.updateAction(destination, action);
List<Destination> ddd = await db.getDestinationByLatLon(destination.lat!, destination.lon!);
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ddddd ${ddd[0].checkedin} @@@@@@@@@@@");
// print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ddddd ${ddd[0].checkedin} @@@@@@@@@@@");
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${res}@@@@@@@@@@@");
// print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${res}@@@@@@@@@@@");
PopulateDestinations();
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ after populating ${res} @@@@@@@@@@@");
print("---- database update resulr ------ res : ${res}-------");
// print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ after populating ${res} @@@@@@@@@@@");
// print("---- database update resulr ------ res : ${res}-------");
/// post to NATNAT
if(indexController.currentUser.length > 0){
String cp_num = destination.cp.toString();
String team_name = indexController.currentUser[0]['user']['group'];
ActionService.postCheckin(cp_num, team_name).then((value){
print('------- NATNAT RES ${value} ------------');
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){
print("------Ext service check point ${value} ------");
});
}
}