|
|
|
@ -158,16 +158,19 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
|
|
|
|
|
bool isConnected =
|
|
|
|
|
await WiFiForIoTPlugin.connect(AppState().getMohemmWifiSSID ?? "", password: AppState().getMohemmWifiPassword ?? "", joinOnce: true, security: NetworkSecurity.WPA, withInternet: false);
|
|
|
|
|
if (isConnected) {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
await WiFiForIoTPlugin.forceWifiUsage(true);
|
|
|
|
|
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
await Future.delayed(Duration(seconds: 1));
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 3, nfcValue: "", isGpsRequired: isWifiLocationEnabled, lat: lat, long: lng);
|
|
|
|
|
bool status = await model.fetchAttendanceTracking(context);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
await closeWifiRequest();
|
|
|
|
|
// await closeWifiRequest();
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
await closeWifiRequest();
|
|
|
|
|
print("performWifiAttendance: "+ex.toString());
|
|
|
|
|
// await closeWifiRequest();
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
Utils.handleException(ex, context, (msg) {
|
|
|
|
|
Utils.confirmDialog(context, msg);
|
|
|
|
@ -179,7 +182,8 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<bool> closeWifiRequest() async {
|
|
|
|
|
await WiFiForIoTPlugin.forceWifiUsage(false);
|
|
|
|
|
// await WiFiForIoTPlugin.forceWifiUsage(false);
|
|
|
|
|
// Future.delayed(Duration(seconds: 2));
|
|
|
|
|
return await WiFiForIoTPlugin.disconnect();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|