updated and fix checking, buy point

This commit is contained in:
Mohamed Nouffer
2023-09-14 22:53:51 +05:30
parent aa7b13b76a
commit b54c29eb4b
10 changed files with 247 additions and 95 deletions

View File

@ -132,20 +132,23 @@ class DestinationController extends GetxController {
Future<void> startTimer(Destination d, double distance) async {
print("=== passed dest is ${d.location_id} ${d.checkedin} ====");
//skip_gps = true;
skip_gps = true;
print("---- in startTimer ----");
DatabaseHelper db = DatabaseHelper.instance;
List<Destination> ds = await db.getDestinationByLatLon(d.lat!, d.lon!);
Destination? dss;
if(ds.isNotEmpty){
if (ds.isNotEmpty) {
dss = ds.first;
}
double checkinRadious = d.checkin_radious ?? double.infinity;
bool autoCheckin = d.auto_checkin == 0 ? false : true;
bool buyPoint = dss != null && dss.buy_point != null && dss.buy_point! > 0 ? true : false;
bool buyPointImageAdded = dss != null && dss.buypoint_image != null ? true : false;
bool buyPoint = dss != null && dss.buy_point != null && dss.buy_point! > 0
? true
: false;
bool buyPointImageAdded =
dss != null && dss.buypoint_image != null ? true : false;
bool locationAlreadyCheckedIn =
ds.length > 0 && ds[0].checkedin == true ? true : false;
bool isuserLoggedIn = indexController.currentUser.isNotEmpty ? true : false;
@ -170,7 +173,8 @@ class DestinationController extends GetxController {
constraints: BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
context: Get.context!,
isScrollControlled: true,
builder: ((context) => CameraPage())).whenComplete(() {
builder: ((context) =>
CameraPage(destination: dss))).whenComplete(() {
skip_gps = false;
chekcs = 0;
is_in_checkin.value = false;
@ -192,7 +196,9 @@ class DestinationController extends GetxController {
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
context: Get.context!,
isScrollControlled: true,
builder: ((context) => BottomSheetNew())).whenComplete(() {
builder: ((context) => BottomSheetNew(
destination: d,
))).whenComplete(() {
skip_gps = false;
chekcs = 0;
is_at_start.value = false;
@ -208,7 +214,9 @@ class DestinationController extends GetxController {
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
context: Get.context!,
isScrollControlled: true,
builder: ((context) => BottomSheetNew())).whenComplete(() {
builder: ((context) => BottomSheetNew(
destination: d,
))).whenComplete(() {
skip_gps = false;
chekcs = 0;
is_in_checkin.value = false;
@ -265,7 +273,9 @@ class DestinationController extends GetxController {
expand: true,
context: Get.context!,
backgroundColor: Colors.transparent,
builder: (context) => BottomSheetNew()).whenComplete(() {
builder: (context) => BottomSheetNew(
destination: d,
)).whenComplete(() {
skip_gps = false;
chekcs = 0;
is_in_checkin.value = false;
@ -296,7 +306,8 @@ class DestinationController extends GetxController {
context: Get.context!,
isScrollControlled: true,
builder: ((context) => CameraPage(
destination: d,
buyPointPhoto: true,
destination: dss,
dbDest: ds.first,
))).whenComplete(() {
skip_gps = false;
@ -329,7 +340,7 @@ class DestinationController extends GetxController {
context: Get.context!,
isScrollControlled: true,
builder: ((context) => CameraPage(
destination: d,
destination: dss,
))).whenComplete(() {
skip_gps = false;
chekcs = 0;
@ -348,7 +359,9 @@ class DestinationController extends GetxController {
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
context: Get.context!,
isScrollControlled: true,
builder: ((context) => BottomSheetNew())).whenComplete(() {
builder: ((context) => BottomSheetNew(
destination: d,
))).whenComplete(() {
print("----- finished start -------");
skip_gps = false;
chekcs = 0;
@ -402,7 +415,7 @@ class DestinationController extends GetxController {
});
}
void openCamera(BuildContext context) {
void openCamera(BuildContext context, Destination? destination) {
photos.clear();
Navigator.push(
context,
@ -437,17 +450,15 @@ class DestinationController extends GetxController {
return null;
}
void CallforCheckin(Destination d) {
Future<void> CallforCheckin(Destination d) async {
bool autoCheckin = d.auto_checkin == 0 ? false : true;
print("---- f- checkin ${d.sub_loc_id} ----");
if (autoCheckin) {
if (!checking_in) {
print(
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ make checkin ${d.sub_loc_id}@@@@@@@@@@@");
makeCheckin(d, true, "");
if (d.cp != -1) {
rogaining_counted.value = true;
}
skip_gps = false;
}
} else {
print("--- hidden loc ${d.hidden_location} ----");
@ -460,18 +471,46 @@ class DestinationController extends GetxController {
chekcs = 3;
is_in_checkin.value = true;
photos.clear();
showModalBottomSheet(
await showModalBottomSheet(
constraints:
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
context: Get.context!,
isScrollControlled: true,
builder: ((context) => CameraPage(
manulaCheckin: true,
destination: d,
))).whenComplete(() {
skip_gps = false;
//rogaining_counted.value = true;
chekcs = 0;
is_in_checkin.value = false;
))).whenComplete(() async {
if (d.buy_point != null && d.buy_point! > 0) {
skip_gps = true;
photos.clear();
DatabaseHelper db = DatabaseHelper.instance;
List<Destination> ds =
await db.getDestinationByLatLon(d.lat!, d.lon!);
Destination? dss;
if (ds.isNotEmpty) {
dss = ds.first;
}
await showModalBottomSheet(
constraints:
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
context: Get.context!,
isScrollControlled: true,
builder: ((context) => CameraPage(
buyPointPhoto: true,
destination: d,
dbDest: dss,
))).whenComplete(() {
skip_gps = false;
rogaining_counted.value = true;
chekcs = 0;
is_in_checkin.value = false;
});
} else {
skip_gps = false;
chekcs = 0;
is_in_checkin.value = false;
}
});
} else {
Get.snackbar("始まっていない", "ロゲイニングを始める必要があります");
@ -504,7 +543,7 @@ class DestinationController extends GetxController {
//near a location
print("---- before call startTimerLocation ----");
await startTimerLocation(fs, distFs);
return;
break;
}
}
print("--- 123 ---- $skip_gps----");
@ -580,7 +619,7 @@ class DestinationController extends GetxController {
DatabaseHelper db = DatabaseHelper.instance;
await db.updateBuyPoint(destination, imageurl);
PopulateDestinations();
PopulateDestinations();
await GallerySaver.saveImage(imageurl);
}