From d16d97f64fe20c17b790ffa86d4ac415db630b91 Mon Sep 17 00:00:00 2001 From: Mohamed Nouffer Date: Sun, 30 Oct 2022 21:43:29 +0530 Subject: [PATCH] update to server location popup --- .gitignore | 91 ++-- assets/images/basic-walking.gif | Bin 0 -> 14154 bytes lib/main.dart | 1 + lib/model/destination.dart | 10 +- lib/pages/camera/camera_page.dart | 160 +++++-- .../destination/destination_controller.dart | 420 ++++++++++++++---- lib/pages/destination/destination_page.dart | 37 +- .../destination_map/destination_map_page.dart | 7 +- lib/pages/index/index_controller.dart | 10 - lib/pages/index/index_page.dart | 10 +- lib/services/location_service.dart | 1 + lib/utils/const.dart | 5 +- lib/utils/database_helper.dart | 13 +- lib/utils/string_values.dart | 22 +- lib/widgets/bottom_sheet_new.dart | 121 ++++- lib/widgets/destination_widget.dart | 32 +- lib/widgets/map_widget.dart | 1 + 17 files changed, 700 insertions(+), 241 deletions(-) create mode 100644 assets/images/basic-walking.gif diff --git a/.gitignore b/.gitignore index 8906afc..a1345d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,46 +1,45 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -**/ios/Flutter/.last_build_id -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -.packages -.pub-cache/ -.pub/ -/build/ - -# Web related -lib/generated_plugin_registrant.dart - -# Symbolication related -app.*.symbols - -# Obfuscation related -app.*.map.json - -# Android Studio will place build artifacts here -/android/app/debug -/android/app/profile -/android/app/release +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/assets/images/basic-walking.gif b/assets/images/basic-walking.gif new file mode 100644 index 0000000000000000000000000000000000000000..88259e4505c972b8e21083d56e4336b8a901944a GIT binary patch literal 14154 zcmZ|0Wn5JM8uh(r1_ovrU>FerL1~7RmJ){!>F(~5?ijj}?i{*9KuQ=oqy+>-LZw4g zZ2fcNIp;q2d0ssGvtR5Nzy0#N*SglawxY6vsF;-j;0;_-0@s(|^(_e43j+Cqz|8f7 zJuqVrT-gKp`M}KeJp)|LTptj$x3|yF&!3r@xw^W_xBvT^y}h7)zWvqpiU0qL@rp!U zUROs}T2o$tmk$EEKFRol07d{%0^Ae;5ugCL0s!F^18b_SQ;B1Jv+K!#2lu>>+jf9D zIE4HVlll0N1e`F5TNH7XEYVPe^c4M|O^f&IixG|0%bOqK$-O&$aqR5w|I%5vWw%+8 z;dy}bR;=ojyQ5?f`vY<}3rQn)orlp9l0NYdlH4LwpHOD`lB)X!MCCug`c+W`;u5Rv zka4Cd`2|2mgK-#;P0?D{Y>FJz)YJ|!sf~VMmmmqA0Ye~A6r4n|xvV@W-97~jg~1WK zZxPV?nsHCbO49`JgIUND0#ctlu@WJ<1wEGn!!KFRRO04mc>pLCw-UZZQC0x5Le1&x zgaOCEet!8JsfH6vOaTmS16Y|d9~?Vhz0vAQhNrO5%RA~gxfr6j&4x8s>{%Q6k;Rc=s?{0Y*fy1+ZfaD;mSVMBHrv`V&Pmvsx~Sb@ zyfevQAIH8?ckcx)cf3B0!QJYM1(`nKmN(*#t@hcseO6T^$Tni_PI1OewedRxS}!7( zgr^FAd7S^&r^#6;R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i(tW5Ca>tx)+z~iQj$!e8>{YF z%JF0oBt{2huC^4d%N@C=gC{OCfUA;t%xd(|Uv zo|NayK?8qi)VJp{mV9R)%azks4c`mBxy5F%bN|hioR?`01EmRwnjzwxahT9z>H%7b zg4(`zSCM)vZd)8xGO-=?lSgDd{-o_D)ULZ~GRJ>3Jx|xK`=$;q>C>V=b4q0>I5Teh zhwa-tdBhZz>54(}wpub93vkRs(SRGy679a%TLef99KMlQ7Ugybdq_AutWcMqJ_ zSftd-b?=!^vk|uBD1-0A09VoUJ_w?j|6$;>`oh^@Ba json) { @@ -70,7 +72,8 @@ class Destination { checkedin: checkin, cp: json['cp'], checkin_point: json['checkin_point'], - buy_point: json['buy_point'] + buy_point: json['buy_point'], + hidden_location: json['hidden_location'] ); } @@ -97,7 +100,8 @@ class Destination { 'checkedin': check, 'cp' : cp, 'checkin_point' : checkin_point, - 'buy_point' : buy_point + 'buy_point' : buy_point, + 'hidden_location' : hidden_location }; } diff --git a/lib/pages/camera/camera_page.dart b/lib/pages/camera/camera_page.dart index 6917780..b3146f0 100644 --- a/lib/pages/camera/camera_page.dart +++ b/lib/pages/camera/camera_page.dart @@ -19,38 +19,9 @@ class CameraPage extends StatelessWidget { } } - // void finishRog(){ - // destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, destination_id) - // } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text("finishing_rogaining".tr), - ), - body: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Center( - child: Obx(() => - Container( - width: MediaQuery.of(context).size.width, - height: 370, - decoration: BoxDecoration( - image: - DecorationImage( - image: getFinishImage(), - fit: BoxFit.cover - ) - ), - ), - ), - ), - ), - Row( + Widget getAction(BuildContext context){ + if(destinationController.is_at_goal.value && destinationController.is_in_rog.value){ + return Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ ElevatedButton( @@ -81,9 +52,12 @@ class CameraPage extends StatelessWidget { print("---called ext api ${value['status']} ------"); if(value['status'] == 'OK'){ Get.back(); + destinationController.skip_gps = false; Get.snackbar("goal_saved", "goal_added_successfuly"); + destinationController.resetRogaining(); } else{ + print("---- status ${value['status']} ---- "); Get.snackbar("goal_not_added", "please_try_again"); } }); @@ -93,9 +67,127 @@ class CameraPage extends StatelessWidget { Container() ) ], - ) - ], + ); + } + else{ + return ElevatedButton( + child: Text("Checking image"), + onPressed: (){ + Get.back(); + }, + ); + } + } + + // void finishRog(){ + // destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, destination_id) + // } + + @override + Widget build(BuildContext context) { + if(destinationController.is_at_goal.value){ + return Scaffold( + appBar: AppBar( + title: Text("finishing_rogaining".tr), ), + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Center( + child: Obx(() => + Container( + width: MediaQuery.of(context).size.width, + height: 370, + decoration: BoxDecoration( + image: + DecorationImage( + image: getFinishImage(), + fit: BoxFit.cover + ) + ), + ), + ), + ), + ), + getAction(context), + ], + ), + ); + } + else if(destinationController.rogaining_counted.value == true) { + return NotAtGoal(); + } + else { + return StartRogaining(); + } + + } +} + +class StartRogaining extends StatelessWidget { + StartRogaining({Key? key}) : super(key: key); + + DestinationController destinationController = Get.find(); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("Not started yet".tr,), + ), + body: Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text("You have not started rogaining yet.".tr, style: TextStyle(fontSize: 24)), + SizedBox(height: 40.0,), + ElevatedButton( + onPressed: (){ + Get.back(); + destinationController.skip_gps = false; + }, + child: Text("Back"), + ), + ], + ), + ), + ), + ); + } +} + +class NotAtGoal extends StatelessWidget { + NotAtGoal({Key? key}) : super(key: key); + + DestinationController destinationController = Get.find(); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("Not reached the goal yet".tr,), + ), + body: Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text("You have not reached the goal yet.".tr, style: TextStyle(fontSize: 24)), + SizedBox(height: 40.0,), + ElevatedButton( + onPressed: (){ + Get.back(); + destinationController.skip_gps = false; + }, + child: Text("Back"), + ), + ], + ), + ), + ), ); } } \ No newline at end of file diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index ca160af..e247e0f 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -12,6 +12,7 @@ import 'package:get/get.dart'; import 'package:latlong2/latlong.dart'; import 'package:rogapp/model/Rogaining.dart'; import 'package:rogapp/model/destination.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/action_service.dart'; @@ -20,6 +21,7 @@ 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'; +import 'package:rogapp/widgets/bottom_sheet_new.dart'; import 'dart:async'; import 'package:rogapp/widgets/bottom_sheet_widget.dart'; @@ -31,17 +33,19 @@ class DestinationController extends GetxController { var destinationCount = 0.obs; List destinations = [].obs; - List> destination_index_data = >[].obs; double current_lat = 0.0; double current_lon = 0.0; - List currentSelectedDestinations = [].obs; + List currentSelectedDestinations = [].obs; + var is_in_checkin = false.obs; var is_in_rog = false.obs; - List rogainings = [].obs; + var is_at_start = false.obs; + var is_at_goal = false.obs; + //List rogainings = [].obs; bool checking_in = false; - var isSelected = false.obs; + var is_gps_selected = true.obs; BuildContext? context; List gps = ["-- stating --"].obs; @@ -49,6 +53,8 @@ class DestinationController extends GetxController { var travelMode = 0.obs; + bool skip_gps = false; + Map matrix = {}; @@ -57,34 +63,284 @@ class DestinationController extends GetxController { final IndexController indexController = Get.find(); Timer? _timer; - int _start = 1; + int _start = 0; + int _chekcs = 0; var rogaining_counted = false.obs; - void startTimer(Destination d, double distance) { + Destination festuretoDestination(GeoJsonFeature fs){ + GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint; + LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude); + + //print("----- ${indexController.currentFeature[0].properties} -----"); + + return Destination( + name: fs.properties!["location_name"], + address: fs.properties!["address"], + phone: fs.properties!["phone"], + email: fs.properties!["email"], + webcontents: fs.properties!["webcontents"], + videos: fs.properties!["videos"], + category: fs.properties!["category"], + series: 1, + lat: pt.latitude, + lon: pt.longitude, + location_id: fs.properties!["location_id"], + list_order: 1, + photos: fs.properties!["photos"], + checkin_radious: fs.properties!["checkin_radius"], + auto_checkin: fs.properties!["auto_checkin"] == true ? 1 : 0, + cp: fs.properties!["cp"], + checkin_point: fs.properties!["checkin_point"], + buy_point: fs.properties!["buy_point"], + selected: false, + checkedin: false, + hidden_location: fs.properties!["hidden_location"] == true ?1 : 0 + ); + } + + void startTimerLocation(GeoJsonFeature fs, double distance) { + print("---- in startTimer ----"); + double checkin_radious = fs.properties!['checkin_radius'] ?? double.infinity; + if(checkin_radious >= distance){ + indexController.currentDestinationFeature.clear(); + Destination d = festuretoDestination(fs); + indexController.currentDestinationFeature.add(d); + print("---- before calling startTimer ----"); + startTimer(d, distance); + } + } + + void startTimer(Destination d, double distance) async { + skip_gps = true; + print("---- in startTimer ----"); + double checkin_radious = d.checkin_radious ?? double.infinity; + bool auto_checkin = d.auto_checkin == 0 ? false : true; + bool location_already_checked_in = d.checkedin ?? false; + bool isUser_logged_in = indexController.currentUser.length > 0 ? true : false; + //make current destination + print("---- checkin_radious ${checkin_radious} ----"); + print("---- distance ${distance} ----"); + if(checkin_radious >= distance){ + //currentSelectedDestinations.add(d); + indexController.currentDestinationFeature.clear(); + indexController.currentDestinationFeature.add(d); + + print("---- checked in as ${indexController.currentDestinationFeature[0].checkedin.toString()} ----"); + } + else { + skip_gps = false; + return; + } + + DatabaseHelper db = DatabaseHelper.instance; + List ds = await db.getDestinationByLatLon(d.lat!, d.lon!); + if(ds.isEmpty){ + print("----- in location popup cp - ${d.cp}----"); + if(d.cp == -1){ + _chekcs = 1; + //start + print("---- in start -----"); + _chekcs = 1; + is_at_start.value = true; + showModalBottomSheet(context: Get.context!, isScrollControlled: true, + builder:((context) => BottomSheetNew()) + ).whenComplete((){ + skip_gps = false; + _chekcs = 0; + is_at_start.value = false; + }); + } + else + { + print("----- in location popup checkin cp - ${d.cp}----"); + _chekcs = 1; + //is_in_checkin.value = true; + showModalBottomSheet(context: Get.context!, isScrollControlled: true, + builder:((context) => BottomSheetNew()) + ).whenComplete((){ + skip_gps = false; + _chekcs = 0; + is_in_checkin.value = false; + }); + } + } + + print("---- location checkin radious ${d.checkin_radious} ----"); + print("---- already checked in ${location_already_checked_in} ----"); + if(checkin_radious >= distance && location_already_checked_in == false){ + if(auto_checkin){ + if(!checking_in){ + makeCheckin(d, true); + if(d.cp != -1){ + rogaining_counted.value =true; + } + skip_gps = false; + } + } + else{ + // ask for checkin + if(d.hidden_location != null && d.hidden_location ==true && is_in_rog.value == true){ + _chekcs = 1; + is_in_checkin.value = true; + showModalBottomSheet(context: Get.context!, isScrollControlled: true, + builder:((context) => CameraPage()) + ).whenComplete((){ + skip_gps = false; + _chekcs = 0; + is_in_checkin.value = false; + }); + } + else if(is_in_rog.value == true){ + _chekcs = 1; + is_in_checkin.value = true; + showModalBottomSheet(context: Get.context!, isScrollControlled: true, + builder:((context) => BottomSheetNew()) + ).whenComplete((){ + skip_gps = false; + _chekcs = 0; + is_in_checkin.value = false; + }); + } + + } + } + + if(isUser_logged_in && d.cp == -1 && location_already_checked_in){ + //check for rogaining + if(is_at_goal.value == false && rogaining_counted.value){ + //goal + print("---- in goal -----"); + _chekcs = 1; + is_at_goal.value = true; + showModalBottomSheet(context: Get.context!, isScrollControlled: true, + builder:((context) => CameraPage()) + ).whenComplete((){ + skip_gps = false; + _chekcs = 0; + is_at_goal.value = false; + }); + } + else if(is_in_rog.value == false){ + //start + print("---- in start -----"); + _chekcs = 1; + is_at_start.value = true; + showModalBottomSheet(context: Get.context!, isScrollControlled: true, + builder:((context) => BottomSheetNew()) + ).whenComplete((){ + skip_gps = false; + _chekcs = 0; + is_at_start.value = false; + }); + } + } + print("---- _chekcs ${_chekcs} ----"); + if(_chekcs == 0){ + skip_gps = false; + } + } + + void startTimer2(Destination d, double distance) { + skip_gps = true; + print("---- in startTimer ----"); + double checkin_radious = d.checkin_radious ?? double.infinity; + bool auto_checkin = d.auto_checkin == 0 ? false : true; + bool location_already_checked_id = d.checkedin ?? false; + bool isUser_logged_in = indexController.currentUser.length > 0 ? true : false; + //make current destination + print("---- checkin_radious ${checkin_radious} ----"); + print("---- distance ${distance} ----"); + if(checkin_radious >= distance){ + //currentSelectedDestinations.add(d); + indexController.currentDestinationFeature.clear(); + indexController.currentDestinationFeature.add(d); + + print("---- checked in as ${indexController.currentDestinationFeature[0].checkedin.toString()} ----"); + } const oneSec = const Duration(seconds: 1); _timer = Timer.periodic( oneSec, (Timer timer) { if (_start == 0) { - if(is_in_rog.value == false){ - is_in_rog.value = true; - addToRogaining(current_lat, current_lon, d.location_id!); - Get.snackbar("Rogaining Started ", "Rogaining session started"); + //make checkin + print("---- location checkin radious ${d.checkin_radious} ----"); + print("---- already checked in ${location_already_checked_id} ----"); + if(checkin_radious >= distance && location_already_checked_id == false){ + if(auto_checkin){ + if(!checking_in){ + makeCheckin(d, true); + if(d.cp != -1){ + rogaining_counted.value =true; + } + skip_gps = false; + } + } + else{ + // ask for checkin + _chekcs = 1; + is_in_checkin.value = true; + showModalBottomSheet(context: Get.context!, isScrollControlled: true, + builder:((context) => BottomSheetNew()) + ).whenComplete((){ + skip_gps = false; + _chekcs = 0; + is_in_checkin.value = false; + }); + } } - else{ - //finish rogiain - if (rogaining_counted.value && distance <=250){ - Get.toNamed(AppPages.CAMERA_PAGE); + + if(isUser_logged_in && d.cp == -1 && location_already_checked_id){ + //check for rogaining + if(is_at_goal.value == false && rogaining_counted.value){ + //goal + print("---- in goal -----"); + _chekcs = 1; + is_at_goal.value = true; + showModalBottomSheet(context: Get.context!, isScrollControlled: true, + builder:((context) => BottomSheetNew()) + ).whenComplete((){ + skip_gps = false; + _chekcs = 0; + is_at_goal.value = false; + }); + } + else if(is_in_rog.value == false){ + //start + print("---- in start -----"); + _chekcs = 1; + is_at_start.value = true; + showModalBottomSheet(context: Get.context!, isScrollControlled: true, + builder:((context) => BottomSheetNew()) + ).whenComplete((){ + skip_gps = false; + _chekcs = 0; + is_at_start.value = false; + }); } } timer.cancel(); } else { _start--; } + print("---- _chekcs ${_chekcs} ----"); + if(_chekcs == 0){ + skip_gps = false; + } }, ); } + void resetRogaining(){ + is_in_checkin.value = false; + is_in_rog.value = false; + is_at_start.value = false; + is_at_goal.value = false; + + _start = 0; + _chekcs = 0; + rogaining_counted.value = false; + } + void openCamera(BuildContext context) { photos.clear(); Navigator.push( @@ -110,10 +366,8 @@ class DestinationController extends GetxController { }); } - Future getDEstinationForLatLong(double lat, double long)async { + Future getDestinationForLatLong(double lat, double long)async { - String jjjj = '{"id":1,"type":"Feature","geometry":{"type":"MultiPoint","coordinates":[[136.731357,35.370094]]},"properties":{"location_id":915101,"location_name":"柳津","category":"買い物","zip":"〒501-6100","address":"柳津町字仙右城7696-1"}}'; - for(final d in destinations){ if(lat == d.lat && long == d.lon){ return d; @@ -121,90 +375,67 @@ class DestinationController extends GetxController { } } - // void addToRogaining(Rogaining rog){ - // DatabaseHelper db = DatabaseHelper.instance; - // db.insertRogaining(rog); - // } + void checkForCheckin(double la, double ln){ - checkForCheckin(double la, double ln){ + print("--- skip_gps ---- ${skip_gps}----"); for(final d in destinations){ - print("-----loc_id- ${d.location_id}----"); + print("--- check checkin for--loc_id- ${d.location_id}----"); - if(!checking_in) - { - checking_in = true; double lat = d.lat!; double lon = d.lon!; LatLng p = LatLng(lat, lon); - getDEstinationForLatLong(lat, lon).then((value){ + getDestinationForLatLong(lat, lon).then((value){ var distance = Distance(); double dist = distance.as(LengthUnit.Meter, LatLng(lat, lon), LatLng(la, ln)); - double rad = value!.checkin_radious ?? double.infinity; - bool auto_checkin = value.auto_checkin == 0 ? false : true; + //double checkin_radious = value!.checkin_radious ?? double.infinity; + //bool auto_checkin = value.auto_checkin == 0 ? false : true; + //bool location_already_checked_id = d.checkedin ?? false; - print("-----rogaining_counted---${rogaining_counted.value}-----"); - print("-----is_in_rog---${is_in_rog}-----"); - print("-----dist is ---${dist}-----"); + // print("-----rogaining_counted---${rogaining_counted.value}-----"); + // print("-----is_in_rog---${is_in_rog}-----"); + // print("-----dist is ---${dist}-----"); + //print("----- ${indexController.currentUser} ----"); - if(d.cp != -1 && is_in_rog == true){ - rogaining_counted.value == true; - } - - if(d.cp == -1 && dist <= 250 && rogaining_counted.value == false){ + if(dist <= 250 && skip_gps == false){ + //near a destination + print("---- time with ${d.location_id} ----"); startTimer(d, dist); } - - indexController.currentDestinationFeature.add(value); - //indexController.getAction(); - - - if(rad >= dist){ - if(auto_checkin){ - makeCheckin(value, true); - } - else{ - // showModalBottomSheet(context: Get.context!, isScrollControlled: true, - // builder:((context) => BottomSheetWidget()) - // ).whenComplete((){ - // checking_in = false; - // }); - } - } - - // if(!checking_in){ - // checking_in = true; - // if(rad >= dist){ - // if(auto_checkin){ - // if(indexController.currentAction.isNotEmpty){ - // print(indexController.currentAction[0]); - // indexController.currentAction[0][0]["checkin"] = true; - // Map temp = Map.from(indexController.currentAction[0][0]); - // indexController.currentAction.clear(); - // print("---temp---${temp}"); - // indexController.currentAction.add([temp]); - // } - // indexController.makeAction(Get.context!); - // } - // else{ - // showModalBottomSheet(context: Get.context!, isScrollControlled: true, - // builder:((context) => BottomSheetWidget()) - // ).whenComplete((){ - // checking_in = false; - // }); - // } - // } - // } }); - } + } + //check for location in bounds + for(GeoJsonFeature fs in indexController.locations[0].collection){ + + GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint; + LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude); + + double lat_fs = pt.latitude; + double lon_fs = pt.longitude; + LatLng p_fs = LatLng(lat_fs, lon_fs); + var distance_fs = Distance(); + double dist_fs = distance_fs.as(LengthUnit.Meter, LatLng(lat_fs, lon_fs), LatLng(la, ln)); + + if(dist_fs <= 250 && skip_gps == false){ + //near a location + print("---- before call startTimerLocation ----"); + startTimerLocation(fs, dist_fs); + } } } - void addToRogaining(double lat, double lon, int destination_id){ + void addToRogaining(double lat, double lon, int destination_id) async { + DatabaseHelper db = DatabaseHelper.instance; + Destination d = await db.getDestinationById(destination_id); + if(d == null){ + Destination df = festuretoDestination(indexController.currentFeature[0]); + makeCheckin(df, true); + } + Rogaining rog = Rogaining( rog_id: null, course_id: 1, @@ -214,7 +445,6 @@ class DestinationController extends GetxController { lon:lon, time_stamp: DateTime.now().toUtc().microsecondsSinceEpoch ); - DatabaseHelper db = DatabaseHelper.instance; db.insertRogaining(rog).then((value){ print("----- inserted value ${value} ---------"); }); @@ -224,15 +454,17 @@ class DestinationController extends GetxController { // print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${action}@@@@@@@@@@@"); DatabaseHelper db = DatabaseHelper.instance; int res = await db.updateAction(destination, action); - List ddd = await db.getDestinationByLatLon(destination.lat!, destination.lon!); - // print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ddddd ${ddd[0].checkedin} @@@@@@@@@@@"); + if(ddd.isEmpty){ + await db.insertDestination(destination); + } + print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ddddd ${ddd[0].checkedin} @@@@@@@@@@@"); // print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${res}@@@@@@@@@@@"); - PopulateDestinations(); // print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ after populating ${res} @@@@@@@@@@@"); // print("---- database update resulr ------ res : ${res}-------"); + PopulateDestinations(); /// post to NATNAT if(indexController.currentUser.length > 0){ int cp_num = int.parse(destination.cp!.toString()); @@ -252,14 +484,12 @@ class DestinationController extends GetxController { //print("------ in iniit"); - - if (defaultTargetPlatform == TargetPlatform.android) { locationSettings = AndroidSettings( accuracy: LocationAccuracy.bestForNavigation, distanceFilter: 00, forceLocationManager: true, - intervalDuration: const Duration(seconds: 1), + intervalDuration: const Duration(seconds: 10), //(Optional) Set foreground notification config to keep the app alive //when going to the background foregroundNotificationConfig: const ForegroundNotificationConfig( @@ -273,7 +503,7 @@ class DestinationController extends GetxController { locationSettings = AppleSettings( accuracy: LocationAccuracy.bestForNavigation, activityType: ActivityType.fitness, - distanceFilter: 1, + distanceFilter: 30, pauseLocationUpdatesAutomatically: false, // Only set to true if our app will be started up in the background. showBackgroundLocationIndicator: true @@ -293,7 +523,7 @@ class DestinationController extends GetxController { current_lat = position != null ? position.latitude : 0; current_lon = position != null ? position.longitude : 0; - if(isSelected.value){ + if(is_gps_selected.value){ double czoom = indexController.rogMapController!.zoom; indexController.rogMapController!.move(LatLng(position!.latitude, position!.longitude), czoom); //String user_id = indexController.currentUser[0]["user"]["id"].toString(); @@ -302,6 +532,8 @@ class DestinationController extends GetxController { gps.clear(); gps.add("-- lat : ${position.latitude}, lon : ${position.longitude} --"); checkForCheckin(position!.latitude, position.longitude); + print("--- call check checkin"); + print("---- skip gps is ${skip_gps.toString()} ----"); //}); } @@ -342,9 +574,9 @@ class DestinationController extends GetxController { void deleteDestination(Destination d){ //int id = destinations[index].location_id!; //print("---- index ${destinations[index].location_id!}-----"); - for(Destination ss in currentSelectedDestinations){ + for(Destination ss in destinations){ if(ss.location_id == d.location_id){ - currentSelectedDestinations.remove(ss); + destinations.remove(ss); break; } } @@ -365,7 +597,7 @@ class DestinationController extends GetxController { void addDestinations(Destination dest){ - print('------ destination controller in add destination ${dest.name} ---- :::::'); + print('------ destination controller in add destination ${dest.checkin_radious} ---- :::::'); DatabaseHelper db = DatabaseHelper.instance; db.getDestinationByLatLon(dest.lat!, dest.lon!).then((value){ @@ -395,12 +627,12 @@ class DestinationController extends GetxController { db.getDestinations().then((value){ destinationCount.value = 0; for(Destination d in value){ - for(Destination s in currentSelectedDestinations){ + for(Destination s in destinations){ if(d.location_id == s.location_id){ d.selected = !d.selected!; } } - + print("------ destination controller populating destination-------- ${d.checkedin}-------- :::::"); destinations.add(d); } // destinationCount.value = 0; diff --git a/lib/pages/destination/destination_page.dart b/lib/pages/destination/destination_page.dart index e21e527..96ad280 100644 --- a/lib/pages/destination/destination_page.dart +++ b/lib/pages/destination/destination_page.dart @@ -160,14 +160,32 @@ class DestnationPage extends StatelessWidget { automaticallyImplyLeading: true, title: Text("app_title".tr), actions: [ - TextButton( - onPressed: (){ - //ExternalService().StartRogaining('team_name', "2222"); - //destinationController.openCamera(context); + InkWell( + onTap: (){ Get.toNamed(AppPages.CAMERA_PAGE); - }, - child: Icon(Icons.ac_unit), + }, + child: destinationController.is_in_rog == true ? + Image.asset("assets/images/basic-walking.gif",height: 10.0,) + : + destinationController.is_at_goal == true ? + IconButton( + onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);}, + icon: Icon(Icons.assistant_photo), + ) + : + IconButton( + onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);}, + icon: Icon(Icons.accessibility), + ), ), + // TextButton( + // onPressed: (){ + // //ExternalService().StartRogaining('team_name', "2222"); + // //destinationController.openCamera(context); + // Get.toNamed(AppPages.CAMERA_PAGE); + // }, + // child: Icon(Icons.ac_unit), + // ), Obx(() => ToggleButtons( disabledColor: Colors.grey.shade200, @@ -176,9 +194,12 @@ class DestnationPage extends StatelessWidget { Icon(Icons.explore, size: 35.0, )], onPressed: (int index) { - destinationController.isSelected.value = !destinationController.isSelected.value; + destinationController.is_gps_selected.value = !destinationController.is_gps_selected.value; + if(destinationController.is_gps_selected.value){ + destinationController.skip_gps = false; + } }, - isSelected: [destinationController.isSelected.value], + isSelected: [destinationController.is_gps_selected.value], ), ), // IconButton(onPressed: (){ diff --git a/lib/pages/destination_map/destination_map_page.dart b/lib/pages/destination_map/destination_map_page.dart index 7189080..6357f6e 100644 --- a/lib/pages/destination_map/destination_map_page.dart +++ b/lib/pages/destination_map/destination_map_page.dart @@ -131,7 +131,12 @@ class DestinationMapPage extends StatelessWidget { if (mapEvent is MapEventMoveStart) { } if (mapEvent is MapEventMoveEnd) { - destinationController.isSelected.value = false; + //destinationController.is_gps_selected.value = true; + //indexController.mapController!.move(c.center, c.zoom); + LatLngBounds bounds = c.bounds!; + indexController.currentBound.clear(); + indexController.currentBound.add(bounds); + indexController.loadLocationsBound(); } }); }); diff --git a/lib/pages/index/index_controller.dart b/lib/pages/index/index_controller.dart index 4339e16..565bfb9 100644 --- a/lib/pages/index/index_controller.dart +++ b/lib/pages/index/index_controller.dart @@ -113,13 +113,6 @@ class IndexController extends GetxController { @override void onInit() { - // if(locations.length == 0){ - // LocationService.loadLocations().then((value){ - // locations.add(value!); - // //print(value); - // }); - // } - _ever = ever(rog_mode, (_) => print("$_ has been changed (ever)")); if(perfectures.length == 0){ @@ -215,7 +208,6 @@ void login(String email, String password, BuildContext context){ else{ switchPage(AppPages.INITIAL); } - //Get.toNamed(AppPages.INITIAL); }else{ Get.snackbar( 'failed'.tr, @@ -587,7 +579,6 @@ void login(String email, String password, BuildContext context){ if(rog_mode == 1){ DestinationController destinationController = Get.find(); - print("---- destination index--- ${destinationController.destination_index_data} --------"); } else { GeoJsonFeature pt = fs as GeoJsonFeature; @@ -620,7 +611,6 @@ void login(String email, String password, BuildContext context){ if(rog_mode == 1){ DestinationController destinationController = Get.find(); - print("---- destination index--- ${destinationController.destination_index_data} --------"); } else { diff --git a/lib/pages/index/index_page.dart b/lib/pages/index/index_page.dart index 6e0bfcb..515c993 100644 --- a/lib/pages/index/index_page.dart +++ b/lib/pages/index/index_page.dart @@ -68,19 +68,23 @@ class IndexPage extends GetView { child: InkWell( child: Obx(() => - destinationController.isSelected == true ? + destinationController.is_gps_selected == true ? Padding( padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0), child: InkWell( child: Image(image: AssetImage('assets/images/route3_off.png'), width: 35, height: 35,), - onTap: (){Get.toNamed(AppPages.DESTINATION_MAP);}, + onTap: (){ + indexController.switchPage(AppPages.TRAVEL); + }, ), ) : Padding( padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0), child: InkWell( child: Image(image: AssetImage('assets/images/route2_on.png'),width: 35, height: 35,), - onTap: (){Get.toNamed(AppPages.DESTINATION_MAP);}, + onTap: (){ + indexController.switchPage(AppPages.TRAVEL); + }, ), ) ) diff --git a/lib/services/location_service.dart b/lib/services/location_service.dart index b645bd0..cf28504 100644 --- a/lib/services/location_service.dart +++ b/lib/services/location_service.dart @@ -164,6 +164,7 @@ class LocationService{ return null; } else{ + //print("---- feature got from server is ${cc.collection[0].properties} ------"); return cc; } } diff --git a/lib/utils/const.dart b/lib/utils/const.dart index bacb16a..865290c 100644 --- a/lib/utils/const.dart +++ b/lib/utils/const.dart @@ -2,9 +2,10 @@ class ConstValues{ - static const server_uri = "http://container.intranet.sumasen.net:8100"; + static const container_svr = "http://container.intranet.sumasen.net:8100"; + static const server_uri = "https://rogaining.sumasen.net"; static const dev_server = "http://localhost:8100"; - static const dev_ip_server = "http://192.168.8.100:8100"; + static const dev_ip_server = "http://192.168.1.10:8100"; static const dev_home_ip_server = "http://172.20.10.9:8100"; static String currentServer(){ diff --git a/lib/utils/database_helper.dart b/lib/utils/database_helper.dart index dde5bd4..9c9e429 100644 --- a/lib/utils/database_helper.dart +++ b/lib/utils/database_helper.dart @@ -45,7 +45,8 @@ class DatabaseHelper{ checkedin INTEGER, cp REAL, checkin_point REAL, - buy_point REAL + buy_point REAL, + hidden_location INTEGER ) '''); @@ -82,6 +83,14 @@ class DatabaseHelper{ return roglist; } + Future getDestinationById(int id) async { + Database db = await instance.database; + var rog = await db.query('destination', where: "location_id = ${id}"); + List deslist = rog.isNotEmpty + ? rog.map((e) => Destination.fromMap(e)).toList() : []; + return deslist[0]; + } + Future deleteRogaining(int rog_id) async { Database db = await instance.database; @@ -195,7 +204,7 @@ class DatabaseHelper{ dest.toMap(), conflictAlgorithm: ConflictAlgorithm.replace, ); - print("------ database helper insert ${res}-----------::::::::"); + print("------ database helper insert ${dest.toMap()}-----------::::::::"); return res; } diff --git a/lib/utils/string_values.dart b/lib/utils/string_values.dart index b7e865f..85fbe57 100644 --- a/lib/utils/string_values.dart +++ b/lib/utils/string_values.dart @@ -58,7 +58,16 @@ class StringValues extends Translations{ 'goal_saved': "Goal Saved", 'goal_added_successfuly' : 'Goal added successfully', 'goal_not_added' : 'Goal not added', - 'please_try_again' : 'Please try again' + 'please_try_again' : 'Please try again', + "Click start to start rogaining":"Click start to start rogaining", + "you are at roganing point, start rogaining":"you are at roganing point, start rogaining", + "Start":"Start", + "Rogaining Started":"Rogaining Started", + "Rogaining session started":"Rogaining session started", + "Not started yet":"Not started yet", + "You have not started rogaining yet.":"You have not started rogaining yet.", + "Not reached the goal yet": "Not reached the goal yet", + "You have not reached the goal yet.":"You have not reached the goal yet." }, 'ja_JP': { 'drawer_title':'ロゲイニング参加者はログイン するとチェックポイントが参照 できます', @@ -117,7 +126,16 @@ class StringValues extends Translations{ 'goal_saved': "目標を保存しました", 'goal_added_successfuly' : '目標が正常に追加されました', 'goal_not_added' : '目標が追加されていません', - 'please_try_again' : 'もう一度お試しください' + 'please_try_again' : 'もう一度お試しください', + "Click start to start rogaining":"開始をクリックして、ロゲイニングを開始します", + "you are at roganing point, start rogaining":"あなたはロガニングポイントにいます、ロガニングを始めてください", + "Start":"始める", + "Rogaining Started":"ロゲイニング開始", + "Rogaining session started":"ロゲイニングセッション開始", + "Not started yet":"まだ開始されていません", + "You have not started rogaining yet.":"あなたはまだロゲイニングを始めていません。", + "Not reached the goal yet": "まだ目標に達していない", + "You have not reached the goal yet.":"あなたはまだゴールに達していません。" }, }; } \ No newline at end of file diff --git a/lib/widgets/bottom_sheet_new.dart b/lib/widgets/bottom_sheet_new.dart index a9afd07..ab90b9e 100644 --- a/lib/widgets/bottom_sheet_new.dart +++ b/lib/widgets/bottom_sheet_new.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:geojson/geojson.dart'; import 'package:get/get.dart'; import 'package:get/get_state_manager/get_state_manager.dart'; @@ -8,6 +9,7 @@ import 'package:rogapp/model/destination.dart'; import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/routes/app_pages.dart'; +import 'package:rogapp/utils/const.dart'; import 'package:rogapp/utils/database_helper.dart'; import 'package:rogapp/utils/text_util.dart'; import 'package:rogapp/widgets/bottom_sheet_controller.dart'; @@ -21,6 +23,7 @@ class BottomSheetNew extends GetView { Image getImage(){ + String server_url = ConstValues.currentServer(); if(indexController.rog_mode == 1){ //print("----- rogaining mode 1"); if(indexController.currentDestinationFeature.length <= 0 || indexController.currentDestinationFeature[0].photos! == ""){ @@ -40,7 +43,7 @@ class BottomSheetNew extends GetView { } else { return Image(image: NetworkImage( - 'http://container.intranet.sumasen.net:8100/media/' + indexController.currentDestinationFeature[0].photos!, + '${server_url}/media/compressed/' + indexController.currentDestinationFeature[0].photos!, ), errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { return Image.asset("assets/images/empty_image.png"); @@ -67,7 +70,7 @@ class BottomSheetNew extends GetView { } else { return Image(image: NetworkImage( - 'http://container.intranet.sumasen.net:8100/media/' + gf.properties!["photos"], + '${server_url}/media/compressed/' + gf.properties!["photos"], ), errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { return Image.asset("assets/images/empty_image.png"); @@ -96,11 +99,15 @@ class BottomSheetNew extends GetView { @override Widget build(BuildContext context) { + print('---- rog_mode ----- ${indexController.rog_mode} -----'); return indexController.rog_mode == 0 ? detailsSheet(context) : destinationSheet(context); } // Show destination detais SingleChildScrollView destinationSheet(BuildContext context) { + + print('---- currentDestinationFeature ----- ${indexController.currentDestinationFeature[0].name} -----'); + return SingleChildScrollView( child: Column( children: [ @@ -156,6 +163,77 @@ class BottomSheetNew extends GetView { ), ], ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Obx(() => + indexController.currentDestinationFeature.isNotEmpty && destinationController.is_in_checkin.value == true ? + Row( + children: [ + ElevatedButton( + onPressed: (){ + if(indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false){ + destinationController.makeCheckin(indexController.currentDestinationFeature[0], true); + if(indexController.currentDestinationFeature[0].cp != -1){ + destinationController.rogaining_counted.value =true; + } + } + else{ + destinationController.makeCheckin(indexController.currentDestinationFeature[0], false); + } + Get.back(); + }, + child: Text( + indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false ? + "Chekin" + : + "Checkput" + ) + ), + ], + ) + : + Container(), + ), + Obx(() => + destinationController.is_at_start.value == true ? + ElevatedButton( + onPressed: (){ + destinationController.is_in_rog.value = true; + destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, indexController.currentDestinationFeature[0].location_id!); + Get.back(); + }, + child: Text( + indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ? + "Start Rogaining" + : + "Wrong destination ..." + ) + ) + : + Container(), + + ), + Obx(() => + destinationController.is_at_goal.value == true && destinationController.rogaining_counted ==true ? + ElevatedButton( + onPressed: (){ + Get.toNamed(AppPages.CAMERA_PAGE); + Get.back(); + }, + child: Text( + indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ? + "Finish Rogaining" + : + "Wrong destination ..." + ) + ) + : + Container(), + + ), + ], + ), Obx(() => indexController.currentDestinationFeature[0].address != null && indexController.currentDestinationFeature[0].address!.isNotEmpty ? getDetails(context, "address".tr, indexController.currentDestinationFeature[0].address! ?? '') @@ -187,19 +265,19 @@ class BottomSheetNew extends GetView { Container(width: 0.0, height: 0,), ), SizedBox(height: 20.0,), - Obx(() => - //wantToGo(context), + // Obx(() => + // //wantToGo(context), - FutureBuilder( - future: wantToGo(context), - builder: (context, snapshot) { - return Container( - child: snapshot.data, - ); - }, - ), + // FutureBuilder( + // future: wantToGo(context), + // builder: (context, snapshot) { + // return Container( + // child: snapshot.data, + // ); + // }, + // ), - ), + // ), SizedBox(height: 60.0,) ], ), @@ -440,6 +518,8 @@ class BottomSheetNew extends GetView { GeoJsonMultiPoint mp = indexController.currentFeature[0].geometry as GeoJsonMultiPoint; LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude); + //print("----- ${indexController.currentFeature[0].properties} -----"); + Destination dest = Destination( name: indexController.currentFeature[0].properties!["location_name"], address: indexController.currentFeature[0].properties!["address"], @@ -454,13 +534,14 @@ class BottomSheetNew extends GetView { location_id: indexController.currentFeature[0].properties!["location_id"], list_order: 1, photos: indexController.currentFeature[0].properties!["photos"], - checkin_radious: indexController.currentFeature[0].properties!["checkin_radious"], + checkin_radious: indexController.currentFeature[0].properties!["checkin_radius"], auto_checkin: indexController.currentFeature[0].properties!["auto_checkin"] == true ? 1 : 0, cp: indexController.currentFeature[0].properties!["cp"], checkin_point: indexController.currentFeature[0].properties!["checkin_point"], buy_point: indexController.currentFeature[0].properties!["buy_point"], selected: false, - checkedin: false + checkedin: false, + hidden_location: indexController.currentFeature[0].properties!["hidden_location"] == true ?1 : 0 ); destinationController.addDestinations(dest); Get.back(); @@ -589,13 +670,11 @@ class BottomSheetNew extends GetView { }, child: Container( width: MediaQuery.of(context).size.width - 160, - child: Expanded( - child: Text(text, - style: TextStyle( - color: isurl ? Colors.blue : Colors.black, - ), + child: Text(text, + style: TextStyle( + color: isurl ? Colors.blue : Colors.black, ), - ), + ), ), ), ], diff --git a/lib/widgets/destination_widget.dart b/lib/widgets/destination_widget.dart index 28ee9bf..c57cb51 100644 --- a/lib/widgets/destination_widget.dart +++ b/lib/widgets/destination_widget.dart @@ -46,22 +46,23 @@ class DestinationWidget extends StatelessWidget { } } - bool getSelection(int index){ - bool ret = false; - destinationController.destination_index_data.forEach((element) { - if(index == element["index"]){ - if(element["selected"] == true){ - ret = true; - return; - } - } - }); - return ret; - } + // bool getSelection(int index){ + // bool ret = false; + // destinationController.destination_index_data.forEach((element) { + // if(index == element["index"]){ + // if(element["selected"] == true){ + // ret = true; + // return; + // } + // } + // }); + // return ret; + // } void doDelete() { destinationController.currentSelectedDestinations.forEach((element) { destinationController.deleteDestination(element); + destinationController.resetRogaining(); }); // destinationController.destination_index_data.forEach((element) { // //print(element["index"]); @@ -174,13 +175,14 @@ class DestinationWidget extends StatelessWidget { onTap: () async { { Destination? fs = destinationController.destinations[index]; - print("----fsf-----${fs}"); + print("----fsf-----${fs.location_id}"); if(fs != null){ - if(indexController.currentDestinationFeature.length > 0) { + if(indexController.currentDestinationFeature.isNotEmpty) { indexController.currentDestinationFeature.clear(); } indexController.currentDestinationFeature.add(fs); + print("--- ndexController.currentDestinationFeature ----- ${ indexController.currentDestinationFeature[0].name} ----"); //indexController.getAction(); showModalBottomSheet(context: context, isScrollControlled: true, @@ -196,7 +198,7 @@ class DestinationWidget extends StatelessWidget { if(destinationController.currentSelectedDestinations.length > 0){ if(destinationController.currentSelectedDestinations[0].location_id == destinationController.destinations[index].location_id){ destinationController.currentSelectedDestinations.clear(); - print("---- fount ----"); + print("---- found ----"); destinationController.PopulateDestinations(); return; } diff --git a/lib/widgets/map_widget.dart b/lib/widgets/map_widget.dart index 8c601b5..8dd9791 100644 --- a/lib/widgets/map_widget.dart +++ b/lib/widgets/map_widget.dart @@ -85,6 +85,7 @@ class MapWidget extends StatelessWidget { if (mapEvent is MapEventMoveEnd) { //print(DateTime.now().toString() + ' [MapEventMoveStart] END'); indexController.loadLocationsBound(); + //indexController.rogMapController!.move(c.center, c.zoom); } }); });