diff --git a/lib/model/rog.dart b/lib/model/rog.dart new file mode 100644 index 0000000..cfff79b --- /dev/null +++ b/lib/model/rog.dart @@ -0,0 +1,47 @@ +class Rog { + int? id; + String? team_name; + String? event_code; + int? user_id; + int? cp_number; + int? checkintime; + String? image; + int? rog_action_type; + + Rog({ + this.id, + this.team_name, + this.event_code, + this.user_id, + this.cp_number, + this.checkintime, + this.image, + this.rog_action_type + }); + + factory Rog.fromMap(Map json){ + return Rog( + id: json['id'], + team_name: json['team_name'], + event_code: json['event_code'], + user_id: json['user_id'], + cp_number: json['cp_number'], + checkintime: json['checkintime'], + image: json['image'], + rog_action_type: json['rog_action_type'] + ); + } + + Map toMap(){ + return { + 'id': id, + 'team_name' : team_name, + 'event_code': event_code, + 'user_id': user_id, + 'cp_number': cp_number, + 'checkintime': checkintime, + 'image': image, + 'rog_action_type': rog_action_type + }; + } +} \ No newline at end of file diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index 713ef1c..d40b885 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -70,6 +70,10 @@ class DestinationController extends GetxController { int chekcs = 0; var rogaining_counted = false.obs; + String getFormatedTime(DateTime datetime){ + return DateFormat('yyyy-MM-dd HH:mm:ss').format(datetime); + } + Destination festuretoDestination(GeoJsonFeature fs){ GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint; LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude); @@ -278,96 +282,6 @@ class DestinationController extends GetxController { } } - // 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) { - // //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; - // }); - // } - // } - - // 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(){ currentSelectedDestinations.forEach((element) { deleteDestination(element); @@ -479,19 +393,6 @@ class DestinationController extends GetxController { print("--- made checkin ${df.location_id} ----"); makeCheckin(df, true, ""); } - - Rogaining rog = Rogaining( - rog_id: null, - course_id: 1, - user_id: indexController.currentUser[0]['user']['id'], - location_id: destination_id, - lat: lat, - lon:lon, - time_stamp: DateTime.now().toUtc().microsecondsSinceEpoch - ); - db.insertRogaining(rog).then((value){ - print("----- inserted value ${value} ---------"); - }); is_in_rog.value = true; } @@ -598,10 +499,35 @@ class DestinationController extends GetxController { locationPermission.add(err.toString()); } + ever(indexController.connectionStatusName, connectionChanged); + super.onInit(); } + void connectionChanged(String val) { + print('----- %%%%%%%%%%%%%%%%%%%%% ----- ${val}'); + if(val == "wifi" || val == "mobile"){ + String _token = indexController.currentUser[0]["token"]; + DatabaseHelper db = DatabaseHelper.instance; + db.allRogianing().then((value){ + value.forEach((e) { + if(e.rog_action_type == 0){ + ExternalService().StartRogaining(); + } + else if(e.rog_action_type == 1){ + 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!); + } + else if(e.rog_action_type == 2){ + var datetime = new DateTime.fromMicrosecondsSinceEpoch(e.checkintime!); + ExternalService().makeGoal(e.user_id!, _token, e.team_name!, e.image!, getFormatedTime(datetime), e.event_code!); + } + }); + }); + } + } + void checkPermission() async { LocationPermission permission = await Geolocator.checkPermission(); if (permission != LocationPermission.whileInUse || diff --git a/lib/pages/destination/destination_page.dart b/lib/pages/destination/destination_page.dart index f6cdd99..0a8f36e 100644 --- a/lib/pages/destination/destination_page.dart +++ b/lib/pages/destination/destination_page.dart @@ -178,13 +178,8 @@ class DestnationPage extends StatelessWidget { 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(() => + // Text(indexController.connectionStatusName.value) // ), Obx(() => ToggleButtons( diff --git a/lib/pages/index/index_controller.dart b/lib/pages/index/index_controller.dart index 565bfb9..ac40b5f 100644 --- a/lib/pages/index/index_controller.dart +++ b/lib/pages/index/index_controller.dart @@ -1,6 +1,8 @@ import 'dart:async'; +import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/plugin_api.dart'; import 'package:flutter_polyline_points/flutter_polyline_points.dart'; @@ -64,6 +66,11 @@ class IndexController extends GetxController { late Worker _ever; + ConnectivityResult connectionStatus = ConnectivityResult.none; + var connectionStatusName = "".obs; + final Connectivity _connectivity = Connectivity(); + late StreamSubscription _connectivitySubscription; + void toggleMode(){ if(mode.value==0){ mode += 1; @@ -123,9 +130,35 @@ class IndexController extends GetxController { //loadSubPerfFor("9"); }); } + + _connectivitySubscription = _connectivity.onConnectivityChanged.listen(_updateConnectionStatus); + super.onInit(); } +@override +void onClose() { + _connectivitySubscription.cancel(); + super.onClose(); +} + +Future _updateConnectionStatus(ConnectivityResult result) async { + connectionStatus = result; + connectionStatusName.value = result.name; +} + +Future initConnectivity() async { + late ConnectivityResult result; + // Platform messages may fail, so we use a try/catch PlatformException. + try { + result = await _connectivity.checkConnectivity(); + } on PlatformException catch (e) { + print('Couldn\'t check connectivity status --- $e'); + return; + } + + return _updateConnectionStatus(result); + } LatLngBounds boundsFromLatLngList(List list) { double? x0, x1, y0, y1; diff --git a/lib/services/external_service.dart b/lib/services/external_service.dart index 50f639e..3f0405b 100644 --- a/lib/services/external_service.dart +++ b/lib/services/external_service.dart @@ -1,11 +1,19 @@ import 'dart:io'; import 'package:get/get.dart'; import 'package:http/http.dart' as http; +import 'package:intl/intl.dart'; +import 'package:rogapp/model/rog.dart'; import 'package:rogapp/pages/index/index_controller.dart'; +import 'package:rogapp/utils/database_helper.dart'; +import 'package:sqflite/sqlite_api.dart'; import 'dart:convert'; import '../utils/const.dart'; +// +// Rog type 0- start 1- checkin 2- goal +// + class ExternalService { static final ExternalService _instance = ExternalService._internal(); @@ -15,35 +23,56 @@ class ExternalService { ExternalService._internal(); + String getFormatedTime(DateTime datetime){ + return DateFormat('yyyy-MM-dd HH:mm:ss').format(datetime); + } + Future> StartRogaining() async { - Map _res = {}; final IndexController indexController = Get.find(); - + + Map _res = {}; + int user_id = 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"]; - String url = 'https://natnats.mobilous.com/start_from_rogapp'; - //print('---- toekn is ${token} -----'); - final http.Response response = await http.post( - Uri.parse(url), - headers: { - 'Content-Type': 'application/json; charset=UTF-8', - }, - body: jsonEncode({ - 'team_name': _team, - 'event_code': _event_code - }), - ); + if(indexController.connectionStatusName != "wifi" || indexController.connectionStatusName != "mobile"){ + DatabaseHelper db = DatabaseHelper.instance; + Rog _rog = Rog( + id:1, + team_name: _team, + event_code : _event_code, + user_id: user_id, + cp_number: -1, + checkintime: DateTime.now().toUtc().microsecondsSinceEpoch, + image: null, + rog_action_type: 0 + ); + db.insertRogaining(_rog); + } + else { + String url = 'https://natnats.mobilous.com/start_from_rogapp'; + //print('---- toekn is ${token} -----'); + final http.Response response = await http.post( + Uri.parse(url), + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + }, + body: jsonEncode({ + 'team_name': _team, + 'event_code': _event_code + }), + ); - print("---- start rogianing api status ---- ${response.statusCode}"); + print("---- start rogianing api status ---- ${response.statusCode}"); - if (response.statusCode == 200) { - _res = json.decode(utf8.decode(response.bodyBytes)); - print('----_res : ${_res} ----'); + if (response.statusCode == 200) { + _res = json.decode(utf8.decode(response.bodyBytes)); + print('----_res : ${_res} ----'); + } } return _res; } @@ -51,56 +80,89 @@ class ExternalService { Future> makeCheckpoint(int user_id, String token, String checkin_time, String teamname, int cp, String eventcode, String imageurl) async { Map _res = {}; String url = 'https://natnats.mobilous.com/checkin_from_rogapp'; + final IndexController indexController = Get.find(); if(imageurl != null){ - String server_url = ConstValues.currentServer(); - String url1 = "${server_url}/api/checkinimage/"; - final im1Bytes = File(imageurl!).readAsBytesSync(); - String im1_64 = base64Encode(im1Bytes); - final http.Response response = await http.post( - Uri.parse(url1), - headers: { - 'Content-Type': 'application/json; charset=UTF-8', - 'Authorization': 'Token ${token}' - }, - // 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number' - body: jsonEncode({ - 'user' : user_id.toString(), - 'team_name': teamname, - 'event_code': eventcode, - 'checkinimage' : im1_64, - 'checkintime' : checkin_time, - 'cp_number' : cp.toString() - }), + if(indexController.connectionStatusName != "wifi" || indexController.connectionStatusName != "mobile"){ + DatabaseHelper db = DatabaseHelper.instance; + Rog _rog = Rog( + id:1, + team_name: teamname, + event_code : eventcode, + user_id: user_id, + cp_number: cp, + checkintime: DateTime.now().toUtc().microsecondsSinceEpoch, + image: imageurl, + rog_action_type: 1, ); + db.insertRogaining(_rog); + } + else { + String server_url = ConstValues.currentServer(); + String url1 = "${server_url}/api/checkinimage/"; + final im1Bytes = File(imageurl!).readAsBytesSync(); + String im1_64 = base64Encode(im1Bytes); - _res = json.decode(utf8.decode(response.bodyBytes)); + final http.Response response = await http.post( + Uri.parse(url1), + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + 'Authorization': 'Token ${token}' + }, + // 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number' + body: jsonEncode({ + 'user' : user_id.toString(), + 'team_name': teamname, + 'event_code': eventcode, + 'checkinimage' : im1_64, + 'checkintime' : checkin_time, + 'cp_number' : cp.toString() + }), + ); - print("-----@@@@@ ${_res} -----"); + _res = json.decode(utf8.decode(response.bodyBytes)); - if(response.statusCode == 201){ - //print('---- toekn is ${token} -----'); - final http.Response response2 = await http.post( - Uri.parse(url), - headers: { - 'Content-Type': 'application/json; charset=UTF-8', - }, - body: jsonEncode({ - 'team_name': teamname, - 'cp_number': cp.toString(), - 'event_code': eventcode, - 'image': _res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net') - }), - ); - print("--- checnin response ${response2.statusCode}----"); - if (response2.statusCode == 200) { - _res = json.decode(utf8.decode(response2.bodyBytes)); - print('----checkin res _res : ${_res} ----'); - } - } + print("-----@@@@@ ${_res} -----"); + + if(response.statusCode == 201){ + //print('---- toekn is ${token} -----'); + final http.Response response2 = await http.post( + Uri.parse(url), + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + }, + body: jsonEncode({ + 'team_name': teamname, + 'cp_number': cp.toString(), + 'event_code': eventcode, + 'image': _res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net') + }), + ); + print("--- checnin response ${response2.statusCode}----"); + if (response2.statusCode == 200) { + _res = json.decode(utf8.decode(response2.bodyBytes)); + print('----checkin res _res : ${_res} ----'); + } + } + } } else{ + if(indexController.connectionStatusName != "wifi" || indexController.connectionStatusName != "mobile"){ + DatabaseHelper db = DatabaseHelper.instance; + Rog _rog = Rog( + id:1, + team_name: teamname, + event_code : eventcode, + user_id: user_id, + cp_number: cp, + checkintime: DateTime.now().toUtc().microsecondsSinceEpoch, + image: null, + rog_action_type: 1, + ); + db.insertRogaining(_rog); + } + else { final http.Response response3 = await http.post( Uri.parse(url), headers: { @@ -118,6 +180,7 @@ class ExternalService { _res = json.decode(utf8.decode(response3.bodyBytes)); print('----checkin res _res : ${_res} ----'); } + } } return _res; } @@ -125,52 +188,70 @@ class ExternalService { Future> makeGoal(int user_id, String token, String teamname, String image, String goal_time, String eventcode) async { Map _res2 = {}; - - String server_url = ConstValues.currentServer(); - String url1 = "${server_url}/api/goalimage/"; - final im1Bytes = File(image!).readAsBytesSync(); - String im1_64 = base64Encode(im1Bytes); - final http.Response response = await http.post( - Uri.parse(url1), - headers: { - 'Content-Type': 'application/json; charset=UTF-8', - 'Authorization': 'Token ${token}' - }, - // 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number' - body: jsonEncode({ - 'user' : user_id.toString(), - 'team_name': teamname, - 'event_code': eventcode, - 'goaltime' : goal_time, - 'goalimage' : im1_64, - 'cp_number' : "-1" - }), - ); + final IndexController indexController = Get.find(); - String url = 'https://natnats.mobilous.com/goal_from_rogapp'; - //print("---response is : ${response.statusCode}----"); - if (response.statusCode == 201) { - Map _res = json.decode(utf8.decode(response.bodyBytes)); - print('----_res : ${_res} ----'); - print('---- image url ${_res["goalimage"]} ----'); - final http.Response response2 = await http.post( - Uri.parse(url), - headers: { - 'Content-Type': 'application/json; charset=UTF-8', - }, - body: jsonEncode({ - 'team_name': teamname, - 'event_code': eventcode, - 'goal_time' : goal_time, - 'image' : _res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net') - } - ), + if(indexController.connectionStatusName != "wifi" || indexController.connectionStatusName != "mobile"){ + DatabaseHelper db = DatabaseHelper.instance; + Rog _rog = Rog( + id:1, + team_name: teamname, + event_code : eventcode, + user_id: user_id, + cp_number: -1, + checkintime: DateTime.now().toUtc().microsecondsSinceEpoch, + image: image, + rog_action_type: 1, + ); + db.insertRogaining(_rog); + } + else{ + String server_url = ConstValues.currentServer(); + String url1 = "${server_url}/api/goalimage/"; + final im1Bytes = File(image!).readAsBytesSync(); + String im1_64 = base64Encode(im1Bytes); + + final http.Response response = await http.post( + Uri.parse(url1), + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + 'Authorization': 'Token ${token}' + }, + // 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number' + body: jsonEncode({ + 'user' : user_id.toString(), + 'team_name': teamname, + 'event_code': eventcode, + 'goaltime' : goal_time, + 'goalimage' : im1_64, + 'cp_number' : "-1" + }), ); - print('----- response2 is ${response2} --------'); - if (response2.statusCode == 200) { - _res2 = json.decode(utf8.decode(response2.bodyBytes)); - } + + String url = 'https://natnats.mobilous.com/goal_from_rogapp'; + //print("---response is : ${response.statusCode}----"); + if (response.statusCode == 201) { + Map _res = json.decode(utf8.decode(response.bodyBytes)); + print('----_res : ${_res} ----'); + print('---- image url ${_res["goalimage"]} ----'); + final http.Response response2 = await http.post( + Uri.parse(url), + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + }, + body: jsonEncode({ + 'team_name': teamname, + 'event_code': eventcode, + 'goal_time' : goal_time, + 'image' : _res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net') + } + ), + ); + print('----- response2 is ${response2} --------'); + if (response2.statusCode == 200) { + _res2 = json.decode(utf8.decode(response2.bodyBytes)); + } + } } return _res2; } diff --git a/lib/utils/database_helper.dart b/lib/utils/database_helper.dart index 2251dc7..92cd348 100644 --- a/lib/utils/database_helper.dart +++ b/lib/utils/database_helper.dart @@ -5,6 +5,8 @@ import 'package:rogapp/model/destination.dart'; import 'package:sqflite/sqflite.dart'; import 'package:path/path.dart'; +import '../model/rog.dart'; + class DatabaseHelper{ DatabaseHelper._privateConstructor(); static final DatabaseHelper instance = DatabaseHelper._privateConstructor(); @@ -58,43 +60,47 @@ class DatabaseHelper{ user_id INTEGER, lat REAL, lon REAL, - time_stamp INTEGER + time_stamp INTEGER, + image TEXT ) '''); + await db.execute(''' + CREATE TABLE rog( + id INTEGER PRIMARY KEY AUTOINCREMENT, + team_name TEXT, + event_code TEXT, + user_id INTEGER, + cp_number INTEGER, + checkintime INTEGER, + image TEXT, + rog_action_type INTEGER + ) + '''); } - Future> allRogianing() async { + Future> allRogianing() async { Database db = await instance.database; - var rog = await db.query('rogaining'); - List roglist = rog.isNotEmpty ? - rog.map((e) => Rogaining.fromMap(e)).toList() : []; + var rog = await db.query('rog'); + List roglist = rog.isNotEmpty ? + rog.map((e) => Rog.fromMap(e)).toList() : []; print("--------- ${rog}"); return roglist; } - Future> getRogainingByLatLon(double lat, double lon) async { + Future> getRogainingByLatLon(double lat, double lon) async { Database db = await instance.database; - var rog = await db.query('rogaining', where: "lat = ${lat} and lon= ${lon}"); - List roglist = rog.isNotEmpty - ? rog.map((e) => Rogaining.fromMap(e)).toList() : []; + var rog = await db.query('rog', where: "lat = ${lat} and lon= ${lon}"); + List roglist = rog.isNotEmpty + ? rog.map((e) => Rog.fromMap(e)).toList() : []; return roglist; } - Future> getDestinationById(int id) async { + Future deleteRogaining(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; - } - - - Future deleteRogaining(int rog_id) async { - Database db = await instance.database; - var rog = await db.delete('rogaining', where: "rog_id = ${rog_id}"); + var rog = await db.delete('rog', where: "id = ${id}"); int ret = rog > 0 ? rog : -1; return ret; @@ -103,24 +109,24 @@ class DatabaseHelper{ Future deleteAllRogaining() async { Database db = await instance.database; - await db.delete('rogaining'); + await db.delete('rog'); } - FutureisRogAlreadyAvailable(int rog_id) async{ + FutureisRogAlreadyAvailable(int id) async{ Database db = await instance.database; - var rog = await db.query('rogaining', where: "rog_id = ${rog_id}"); + var rog = await db.query('rog', where: "id = ${id}"); return rog.length > 0 ? true : false; } - Future insertRogaining(Rogaining rog) async { + Future insertRogaining(Rog rog) async { Database db = await instance.database; - int? next_order = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(rog_id) FROM rogaining')); + int? next_order = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(id) FROM rog')); next_order = next_order==null ? 0 : next_order; next_order = next_order + 1; - rog.rog_id = next_order; + rog.id = next_order; int res = await db.insert( - 'rogaining', + 'rog', rog.toMap(), conflictAlgorithm: ConflictAlgorithm.replace, ); @@ -138,6 +144,15 @@ class DatabaseHelper{ return destList; } + 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; + } + + Future> getDestinationByLatLon(double lat, double lon) async { Database db = await instance.database; var dest = await db.query('destination', where: "lat = ${lat} and lon= ${lon}", orderBy: 'list_order'); diff --git a/pubspec.lock b/pubspec.lock index 5354119..c66e634 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -120,6 +120,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.16.0" + connectivity_plus: + dependency: "direct main" + description: + name: connectivity_plus + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.2" + connectivity_plus_platform_interface: + dependency: transitive + description: + name: connectivity_plus_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.3" cross_file: dependency: transitive description: @@ -141,6 +155,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.5" + dbus: + dependency: transitive + description: + name: dbus + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.8" extra_pedantic: dependency: transitive description: @@ -569,6 +590,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.2" + nm: + dependency: transitive + description: + name: nm + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.0" path: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 34866ee..1676564 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -72,6 +72,7 @@ dependencies: camera_camera: ^3.0.0-dev intl: ^0.17.0 modal_bottom_sheet: ^2.1.2 + connectivity_plus: ^3.0.2 flutter_icons: android: true diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index ce843bc..61ce00d 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,11 +6,14 @@ #include "generated_plugin_registrant.h" +#include #include #include #include void RegisterPlugins(flutter::PluginRegistry* registry) { + ConnectivityPlusWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); GeolocatorWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("GeolocatorWindows")); PermissionHandlerWindowsPluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index b3ea692..b81c4ea 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + connectivity_plus geolocator_windows permission_handler_windows url_launcher_windows