update for server sync
This commit is contained in:
@ -507,22 +507,28 @@ class DestinationController extends GetxController {
|
|||||||
|
|
||||||
void connectionChanged(String val) {
|
void connectionChanged(String val) {
|
||||||
print('----- %%%%%%%%%%%%%%%%%%%%% ----- ${val}');
|
print('----- %%%%%%%%%%%%%%%%%%%%% ----- ${val}');
|
||||||
|
Map<String, dynamic> _res = {};
|
||||||
if(val == "wifi" || val == "mobile"){
|
if(val == "wifi" || val == "mobile"){
|
||||||
String _token = indexController.currentUser[0]["token"];
|
String _token = indexController.currentUser[0]["token"];
|
||||||
DatabaseHelper db = DatabaseHelper.instance;
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
db.allRogianing().then((value){
|
db.allRogianing().then((value){
|
||||||
value.forEach((e) {
|
value.forEach((e) async {
|
||||||
if(e.rog_action_type == 0){
|
if(e.rog_action_type == 0){
|
||||||
ExternalService().StartRogaining();
|
_res = await ExternalService().StartRogaining();
|
||||||
}
|
}
|
||||||
else if(e.rog_action_type == 1){
|
else if(e.rog_action_type == 1){
|
||||||
var datetime = new DateTime.fromMicrosecondsSinceEpoch(e.checkintime!);
|
var datetime = new DateTime.fromMicrosecondsSinceEpoch(e.checkintime!);
|
||||||
ExternalService().makeCheckpoint(e.user_id!, _token, getFormatedTime(datetime), e.team_name!, e.cp_number!, e.event_code!, e.image!);
|
_res = await ExternalService().makeCheckpoint(e.user_id!, _token, getFormatedTime(datetime), e.team_name!, e.cp_number!, e.event_code!, e.image!);
|
||||||
}
|
}
|
||||||
else if(e.rog_action_type == 2){
|
else if(e.rog_action_type == 2){
|
||||||
var datetime = new DateTime.fromMicrosecondsSinceEpoch(e.checkintime!);
|
var datetime = new DateTime.fromMicrosecondsSinceEpoch(e.checkintime!);
|
||||||
ExternalService().makeGoal(e.user_id!, _token, e.team_name!, e.image!, getFormatedTime(datetime), e.event_code!);
|
_res = await ExternalService().makeGoal(e.user_id!, _token, e.team_name!, e.image!, getFormatedTime(datetime), e.event_code!);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(_res.isNotEmpty){
|
||||||
|
db.deleteRogaining(e.id!);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user