diff --git a/lib/main.dart b/lib/main.dart index 4c54520..54a726a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -85,7 +85,7 @@ class _MyAppState extends State with WidgetsBindingObserver { restoreGame(); if(destinationController.positionStream == null){ destinationController.startGPSTimer(); - destinationController.startGame(); + //destinationController.startGame(); } break; case AppLifecycleState.inactive: diff --git a/lib/model/destination.dart b/lib/model/destination.dart index 86a295f..caeed66 100644 --- a/lib/model/destination.dart +++ b/lib/model/destination.dart @@ -24,6 +24,7 @@ class Destination { double? buy_point; int? hidden_location; String? checkin_image; + String? buypoint_image; Destination({ this.name, @@ -48,7 +49,8 @@ class Destination { this.checkin_point, this.buy_point, this.hidden_location, - this.checkin_image + this.checkin_image, + this.buypoint_image }); factory Destination.fromMap(Map json) { @@ -79,7 +81,8 @@ class Destination { checkin_point: json['checkin_point'], buy_point: json['buy_point'], hidden_location: json['hidden_location'], - checkin_image: json['checkin_image'] + checkin_image: json['checkin_image'], + buypoint_image: json["buypoint_image"] ); } @@ -109,7 +112,8 @@ class Destination { 'checkin_point' : checkin_point, 'buy_point' : buy_point, 'hidden_location' : hidden_location, - 'checkin_image': checkin_image + 'checkin_image': checkin_image, + 'buypoint_image' : buypoint_image }; } diff --git a/lib/pages/camera/camera_page.dart b/lib/pages/camera/camera_page.dart index c97da83..563efcb 100644 --- a/lib/pages/camera/camera_page.dart +++ b/lib/pages/camera/camera_page.dart @@ -8,143 +8,183 @@ import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/services/external_service.dart'; + class CameraPage extends StatelessWidget { Destination? destination; - CameraPage({Key? key, this.destination}) : super(key: key); - DestinationController destinationController = Get.find(); + Destination? dbDest; + CameraPage({Key? key, this.destination, this.dbDest}) : super(key: key); + DestinationController destinationController = + Get.find(); IndexController indexController = Get.find(); var settingGoal = false.obs; Timer? timer; - ImageProvider getFinishImage(){ - if(destinationController.photos.isNotEmpty){ + ImageProvider getFinishImage() { + if (destinationController.photos.isNotEmpty) { return FileImage(destinationController.photos[0]); - } - else{ + } else { return const AssetImage('assets/images/empty_image.png'); } } Widget getAction(BuildContext context) { - if(destinationController.is_at_goal.value && destinationController.is_in_rog.value){ - return Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - ElevatedButton( - onPressed: (){ - if(settingGoal.value ==false){ - destinationController.openCamera(context); - } - }, - child: Text("take_photo of the clock".tr) - ), - Obx(() => - destinationController.photos.isNotEmpty ? - settingGoal.value == false ? - ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: Colors.red - ), - onPressed: () async { - print("----- user isss ${indexController.currentUser[0]} -----"); + print("----cccheckin is --- ${dbDest?.checkedin} ----"); - settingGoal.value = true; - try{ - int userId = indexController.currentUser[0]["user"]["id"]; - //print("--- Pressed -----"); - String _team = indexController.currentUser[0]["user"]['team_name']; - //print("--- _team : ${_team}-----"); - String _event_code = indexController.currentUser[0]["user"]["event_code"]; - //print("--- _event_code : ${_event_code}-----"); - String _token = indexController.currentUser[0]["token"]; - //print("--- _token : ${_token}-----"); - DateTime now = DateTime.now(); - String formattedDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(now); - - await ExternalService().makeGoal(userId, _token, _team, destinationController.photos[0].path, formattedDate, _event_code).then((value){ - print("---called ext api ${value['status']} ------"); - if(value['status'] == 'OK'){ - Get.back(); - destinationController.skip_gps = false; - Get.snackbar("目標が保存されました", "目標が正常に追加されました"); - destinationController.resetRogaining(); - } - else{ - print("---- status ${value['status']} ---- "); - Get.snackbar("目標が追加されていません", "please_try_again"); - } - }); - } - on Exception catch(_){ - settingGoal.value = false; - } - finally{ - settingGoal.value = false; - } - }, - child:Text("finish_goal".tr) - ) - : - Container( - child: const Center( - child: CircularProgressIndicator(), - ), - ) - : - Container() - ) - ], - ); - } - else{ + if (destinationController.is_at_goal.value && + destinationController.is_in_rog.value) { return Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Obx(() => - ElevatedButton( - onPressed: (){ + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + ElevatedButton( + onPressed: () { + if (settingGoal.value == false) { destinationController.openCamera(context); - }, - child: destinationController.photos.isNotEmpty ? const Text("再撮影") : const Text("撮影") - ) - ), - Obx(() => - destinationController.photos.isNotEmpty ? - ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: Colors.red - ), - onPressed: (){ - print("##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######"); - destinationController.makeCheckin(indexController.currentDestinationFeature[0], true, destinationController.photos[0].path); - Get.back(); - destinationController.rogaining_counted.value = true; - destinationController.skip_gps = false; - destinationController.is_photo_shoot.value = false; - Get.snackbar("チェックインした", "正常にチェックインしました"); - - // ExternalService().makeGoal(user_id, _token, _team, destinationController.photos[0].path, formattedDate, _event_code).then((value){ - // print("---called ext api ${value['status']} ------"); - // if(value['status'] == 'OK'){ - // Get.back(); - // destinationController.skip_gps = false; - // Get.snackbar("Checked in", "Checked in successfuly"); - // } - // else{ - // print("---- status ${value['status']} ---- "); - // Get.snackbar("Checkin not added", "please_try_again"); - // } - // }); - }, - child: const Text("チェックイン") - ): - Container() - ) - ], - ); + } + }, + child: Text("take_photo of the clock".tr)), + Obx(() => destinationController.photos.isNotEmpty + ? settingGoal.value == false + ? ElevatedButton( + style: + ElevatedButton.styleFrom(backgroundColor: Colors.red), + onPressed: () async { + print( + "----- user isss ${indexController.currentUser[0]} -----"); + + settingGoal.value = true; + try { + int userId = + indexController.currentUser[0]["user"]["id"]; + //print("--- Pressed -----"); + String _team = indexController.currentUser[0]["user"] + ['team_name']; + //print("--- _team : ${_team}-----"); + String _event_code = indexController.currentUser[0] + ["user"]["event_code"]; + //print("--- _event_code : ${_event_code}-----"); + String _token = + indexController.currentUser[0]["token"]; + //print("--- _token : ${_token}-----"); + DateTime now = DateTime.now(); + String formattedDate = + DateFormat('yyyy-MM-dd HH:mm:ss').format(now); + + await ExternalService() + .makeGoal( + userId, + _token, + _team, + destinationController.photos[0].path, + formattedDate, + _event_code) + .then((value) { + print( + "---called ext api ${value['status']} ------"); + if (value['status'] == 'OK') { + Get.back(); + destinationController.skip_gps = false; + Get.snackbar("目標が保存されました", "目標が正常に追加されました"); + destinationController.resetRogaining(); + } else { + print("---- status ${value['status']} ---- "); + Get.snackbar("目標が追加されていません", "please_try_again"); + } + }); + } on Exception catch (_) { + settingGoal.value = false; + } finally { + settingGoal.value = false; + } + }, + child: Text("finish_goal".tr)) + : Container( + child: const Center( + child: CircularProgressIndicator(), + ), + ) + : Container()) + ], + ); + } else if (destinationController.is_in_rog.value && + dbDest?.checkedin != null && + dbDest?.checkedin == true) { + //make buypoint image + return Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Obx(() => ElevatedButton( + onPressed: () { + destinationController.openCamera(context); + }, + child: destinationController.photos.isNotEmpty + ? const Text("再撮影") + : const Text("撮影"))), + Obx(() => destinationController.photos.isNotEmpty + ? ElevatedButton( + style: ElevatedButton.styleFrom(backgroundColor: Colors.red), + onPressed: () async { + print( + "##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######"); + await destinationController.makeBuyPoint( + destination!, + destinationController.photos[0].path); + Get.back(); + destinationController.rogaining_counted.value = true; + destinationController.skip_gps = false; + destinationController.is_photo_shoot.value = false; + Get.snackbar("追加した", "領収書の写真を追加しました"); + }, + child: const Text("レシートの写真を撮る")) + : Container()) + ], + ); + } else { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Obx(() => ElevatedButton( + onPressed: () { + destinationController.openCamera(context); + }, + child: destinationController.photos.isNotEmpty + ? const Text("再撮影") + : const Text("撮影"))), + Obx(() => destinationController.photos.isNotEmpty + ? ElevatedButton( + style: ElevatedButton.styleFrom(backgroundColor: Colors.red), + onPressed: () async { + print( + "##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######"); + await destinationController.makeCheckin( + indexController.currentDestinationFeature[0], + true, + destinationController.photos[0].path); + Get.back(); + destinationController.rogaining_counted.value = true; + destinationController.skip_gps = false; + destinationController.is_photo_shoot.value = false; + Get.snackbar("チェックインした", "正常にチェックインしました"); + + // ExternalService().makeGoal(user_id, _token, _team, destinationController.photos[0].path, formattedDate, _event_code).then((value){ + // print("---called ext api ${value['status']} ------"); + // if(value['status'] == 'OK'){ + // Get.back(); + // destinationController.skip_gps = false; + // Get.snackbar("Checked in", "Checked in successfuly"); + // } + // else{ + // print("---- status ${value['status']} ---- "); + // Get.snackbar("Checkin not added", "please_try_again"); + // } + // }); + }, + child: const Text("チェックイン")) + : Container()) + ], + ); } } @@ -154,94 +194,92 @@ class CameraPage extends StatelessWidget { @override Widget build(BuildContext context) { - if(destinationController.is_in_rog.value){ + if (destinationController.is_in_rog.value) { return Scaffold( - appBar: - destinationController.is_in_rog.value && destinationController.rogaining_counted.value == true ? - AppBar( - title: destination!.cp == -1 ? - Text("finishing_rogaining".tr) - : - Text("cp_pls_take_photo".tr) - , - leading: IconButton( - icon: Text("cancel".tr), - onPressed: (){ - Navigator.of(context).pop(); - destinationController.skip_10s = true; - timer = Timer.periodic(const Duration(seconds: 10), (Timer t){ - destinationController.skip_10s = false; - }); - }, - ), - centerTitle: true, - ) - : - AppBar( - title: const Text("チェックポイント"), - ), - body: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Padding( - padding: const 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 - ) + appBar: destinationController.is_in_rog.value && + destinationController.rogaining_counted.value == true + ? AppBar( + title: destination!.cp == -1 + ? Text("finishing_rogaining".tr) + : Text("cp_pls_take_photo".tr), + leading: IconButton( + icon: Text("cancel".tr), + onPressed: () { + Navigator.of(context).pop(); + destinationController.skip_10s = true; + timer = + Timer.periodic(const Duration(seconds: 10), (Timer t) { + destinationController.skip_10s = false; + }); + }, + ), + centerTitle: true, + ) + : AppBar( + title: const Text("チェックポイント"), + ), + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Padding( + padding: const 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 { + getAction(context), + ], + ), + ); + } else { return StartRogaining(); } - } } class StartRogaining extends StatelessWidget { StartRogaining({Key? key}) : super(key: key); - DestinationController destinationController = Get.find(); + 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: const TextStyle(fontSize: 24)), - const SizedBox(height: 40.0,), - ElevatedButton( - onPressed: (){ - Get.back(); - destinationController.skip_gps = false; - }, - child: const Text("Back"), - ), - ], + 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: const TextStyle(fontSize: 24)), + const SizedBox( + height: 40.0, + ), + ElevatedButton( + onPressed: () { + Get.back(); + destinationController.skip_gps = false; + }, + child: const Text("Back"), + ), + ], + ), ), ), - ), ); } } @@ -249,32 +287,38 @@ class StartRogaining extends StatelessWidget { class NotAtGoal extends StatelessWidget { NotAtGoal({Key? key}) : super(key: key); - DestinationController destinationController = Get.find(); + 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: const TextStyle(fontSize: 24)), - const SizedBox(height: 40.0,), - ElevatedButton( - onPressed: (){ - Get.back(); - destinationController.skip_gps = false; - }, - child: const Text("Back"), - ), - ], + 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: const TextStyle(fontSize: 24)), + const SizedBox( + height: 40.0, + ), + ElevatedButton( + onPressed: () { + Get.back(); + destinationController.skip_gps = false; + }, + child: const 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 96a236e..36882fb 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -108,7 +108,7 @@ class DestinationController extends GetxController { hidden_location: fs.properties!["hidden_location"] == true ? 1 : 0); } - void startTimerLocation(GeoJsonFeature fs, double distance) { + Future startTimerLocation(GeoJsonFeature fs, double distance) async { print("---- in startTimer ----"); print("---- is in rog is ${is_in_rog} ----"); //skip_gps = true; @@ -125,21 +125,27 @@ class DestinationController extends GetxController { // } indexController.currentFeature.add(fs); print("---- before calling startTimer ----"); - startTimer(d, distance); + await startTimer(d, distance); return; } } - void startTimer(Destination d, double distance) async { + Future 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 ds = await db.getDestinationByLatLon(d.lat!, d.lon!); + Destination? dss; + 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 locationAlreadyCheckedIn = ds.length > 0 && ds[0].checkedin == true ? true : false; bool isuserLoggedIn = indexController.currentUser.isNotEmpty ? true : false; @@ -160,7 +166,7 @@ class DestinationController extends GetxController { if (is_photo_shoot.value == true) { photos.clear(); - showModalBottomSheet( + await showModalBottomSheet( constraints: BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), context: Get.context!, isScrollControlled: true, @@ -181,7 +187,7 @@ class DestinationController extends GetxController { chekcs = 1; is_in_checkin.value = true; is_at_start.value = true; - showModalBottomSheet( + await showModalBottomSheet( constraints: BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), context: Get.context!, @@ -192,11 +198,12 @@ class DestinationController extends GetxController { is_at_start.value = false; is_in_checkin.value = false; }); + return; } else if (is_in_rog.value == true && indexController.rog_mode == 1) { print("----- in location popup checkin cp - ${d.cp}----"); chekcs = 2; is_in_checkin.value = true; - showModalBottomSheet( + await showModalBottomSheet( constraints: BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), context: Get.context!, @@ -206,6 +213,7 @@ class DestinationController extends GetxController { chekcs = 0; is_in_checkin.value = false; }); + return; } } @@ -224,6 +232,7 @@ class DestinationController extends GetxController { } skip_gps = false; } + return; } else { print("--- hidden loc ${d.hidden_location} ----"); // ask for checkin @@ -234,7 +243,8 @@ class DestinationController extends GetxController { chekcs = 3; is_in_checkin.value = true; photos.clear(); - showModalBottomSheet( + print("--- calling checkin ---"); + await showModalBottomSheet( constraints: BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), context: Get.context!, @@ -247,10 +257,11 @@ class DestinationController extends GetxController { chekcs = 0; is_in_checkin.value = false; }); + return; } else if (is_in_rog.value == true && d.cp != -1) { chekcs = 4; is_in_checkin.value = true; - showMaterialModalBottomSheet( + await showMaterialModalBottomSheet( expand: true, context: Get.context!, backgroundColor: Colors.transparent, @@ -259,6 +270,7 @@ class DestinationController extends GetxController { chekcs = 0; is_in_checkin.value = false; }); + return; // showModalBottomSheet(context: Get.context!, isScrollControlled: true, // builder:((context) => BottomSheetNew()) // ).whenComplete((){ @@ -268,6 +280,31 @@ class DestinationController extends GetxController { // }); } } + } else if (checkinRadious >= distance && + locationAlreadyCheckedIn == true && + buyPointImageAdded == false && + ds.isNotEmpty && + buyPoint == true && + is_in_rog.value == true) { + chekcs = 5; + is_in_checkin.value = true; + photos.clear(); + print( + "--- open buy point ${buyPointImageAdded} ${d.buypoint_image} ----"); + await showModalBottomSheet( + constraints: BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), + context: Get.context!, + isScrollControlled: true, + builder: ((context) => CameraPage( + destination: d, + dbDest: ds.first, + ))).whenComplete(() { + skip_gps = false; + rogaining_counted.value = true; + chekcs = 0; + is_in_checkin.value = false; + }); + return; } print("---- cp --- ${d.cp} -----"); print("--- at goal $is_at_goal ---"); @@ -286,7 +323,7 @@ class DestinationController extends GetxController { chekcs = 5; is_at_goal.value = true; photos.clear(); - showModalBottomSheet( + await showModalBottomSheet( constraints: BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), context: Get.context!, @@ -298,6 +335,7 @@ class DestinationController extends GetxController { chekcs = 0; is_at_goal.value = false; }); + return; } else if (is_in_rog.value == false && indexController.rog_mode == 1 && DateTime.now().difference(last_goal_at).inHours >= 24) { @@ -305,7 +343,7 @@ class DestinationController extends GetxController { print("---- in start -----"); chekcs = 6; is_at_start.value = true; - showModalBottomSheet( + await showModalBottomSheet( constraints: BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), context: Get.context!, @@ -316,6 +354,7 @@ class DestinationController extends GetxController { chekcs = 0; is_at_start.value = false; }); + return; } } print("==== _chekcs $chekcs ===="); @@ -358,7 +397,7 @@ class DestinationController extends GetxController { db.deleteAllDestinations().then((value) { PopulateDestinations(); startGPSTimer(); - startGame(); + //startGame(); //initGPS(); }); } @@ -440,12 +479,12 @@ class DestinationController extends GetxController { } } - void checkForCheckin() async { + Future checkForCheckin() async { print("--- Start of checkForCheckin function ---"); try { print("--- 000 ---- $skip_gps----"); - await Future.delayed(const Duration(milliseconds: 3500)); + await Future.delayed(const Duration(milliseconds: 2500)); final la = current_lat; final ln = current_lon; for (GeoJsonFeature fs in indexController.locations[0].collection) { @@ -458,20 +497,23 @@ class DestinationController extends GetxController { var distanceFs = const Distance(); double distFs = distanceFs.as( LengthUnit.Meter, LatLng(latFs, lonFs), LatLng(la, ln)); + Destination des = festuretoDestination(fs); - if (distFs <= 250 && skip_gps == false) { + if (distFs <= des.checkin_radious! && skip_gps == false) { print("--- 789 ---- $skip_gps----"); //near a location print("---- before call startTimerLocation ----"); - startTimerLocation(fs, distFs); + await startTimerLocation(fs, distFs); + return; } } print("--- 123 ---- $skip_gps----"); } catch (e) { print("An error occurred: $e"); + await checkForCheckin(); } finally { print("--- End of checkForCheckin function, calling recursively ---"); - checkForCheckin(); + await checkForCheckin(); } } @@ -534,7 +576,15 @@ class DestinationController extends GetxController { saveGameState(); } - void makeCheckin( + Future makeBuyPoint(Destination destination, String imageurl) async { + DatabaseHelper db = DatabaseHelper.instance; + + await db.updateBuyPoint(destination, imageurl); + PopulateDestinations(); + await GallerySaver.saveImage(imageurl); + } + + Future makeCheckin( Destination destination, bool action, String imageurl) async { print( "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${destination.sub_loc_id}@@@@@@@@@@@"); @@ -550,7 +600,7 @@ class DestinationController extends GetxController { await GallerySaver.saveImage(imageurl); - //PopulateDestinations(); + PopulateDestinations(); /// post to NATNAT if (indexController.currentUser.isNotEmpty) { @@ -656,7 +706,7 @@ class DestinationController extends GetxController { _GPStimer?.cancel(); // Start a new timer that fires every 3 seconds - _timer = Timer.periodic(Duration(seconds: 3), (timer) async { + _timer = Timer.periodic(Duration(seconds: 1), (timer) async { Position position = await Geolocator.getCurrentPosition( desiredAccuracy: LocationAccuracy.high); current_lat = position.latitude; @@ -677,8 +727,8 @@ class DestinationController extends GetxController { _GPStimer?.cancel(); } - void startGame() { - checkForCheckin(); + Future startGame() async { + await checkForCheckin(); } @override diff --git a/lib/utils/database_helper.dart b/lib/utils/database_helper.dart index 482cae5..3d43bd3 100644 --- a/lib/utils/database_helper.dart +++ b/lib/utils/database_helper.dart @@ -49,7 +49,8 @@ class DatabaseHelper{ checkin_point REAL, buy_point REAL, hidden_location INTEGER, - checkin_image TEXT + checkin_image TEXT, + buypoint_image TEXT ) '''); @@ -259,6 +260,20 @@ class DatabaseHelper{ return res; } + Future updateBuyPoint(Destination destination, String imageUrl)async { + print("---- updating puypint image in db -----"); + Database db = await instance.database; + Map row = { + "buypoint_image": imageUrl + }; + return await db.update( + "destination", + row, + where: 'location_id = ?', + whereArgs: [destination.location_id!] + ); + } + Future updateAction(Destination destination, bool checkin)async { Database db = await instance.database; int act = checkin == false ? 0 : 1;