update to server location popup
This commit is contained in:
@ -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<Destination> destinations = <Destination>[].obs;
|
||||
List<Map<String, dynamic>> destination_index_data = <Map<String, dynamic>>[].obs;
|
||||
double current_lat = 0.0;
|
||||
double current_lon = 0.0;
|
||||
|
||||
List<Destination> currentSelectedDestinations = <Destination>[].obs;
|
||||
List<Destination> currentSelectedDestinations = <Destination>[].obs;
|
||||
|
||||
var is_in_checkin = false.obs;
|
||||
var is_in_rog = false.obs;
|
||||
List<Rogaining> rogainings = <Rogaining>[].obs;
|
||||
var is_at_start = false.obs;
|
||||
var is_at_goal = false.obs;
|
||||
//List<Rogaining> rogainings = <Rogaining>[].obs;
|
||||
|
||||
bool checking_in = false;
|
||||
var isSelected = false.obs;
|
||||
var is_gps_selected = true.obs;
|
||||
BuildContext? context;
|
||||
|
||||
List<String> gps = <String>["-- stating --"].obs;
|
||||
@ -49,6 +53,8 @@ class DestinationController extends GetxController {
|
||||
|
||||
var travelMode = 0.obs;
|
||||
|
||||
bool skip_gps = false;
|
||||
|
||||
|
||||
Map<String, dynamic> matrix = {};
|
||||
|
||||
@ -57,34 +63,284 @@ class DestinationController extends GetxController {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
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<Destination> 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<Destination?> getDEstinationForLatLong(double lat, double long)async {
|
||||
Future<Destination?> 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<String,dynamic> temp = Map<String,dynamic>.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<Destination> 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;
|
||||
|
||||
Reference in New Issue
Block a user