|  |  |  | @ -1,3 +1,5 @@ | 
		
	
		
			
				|  |  |  |  | import 'dart:io'; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import 'package:easy_localization/easy_localization.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:flutter/material.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:flutter_svg/flutter_svg.dart'; | 
		
	
	
		
			
				
					|  |  |  | @ -155,22 +157,26 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |       print("wifi not location enabled"); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     bool isConnected = | 
		
	
		
			
				|  |  |  |  |         await WiFiForIoTPlugin.connect(AppState().getMohemmWifiSSID ?? "", password: AppState().getMohemmWifiPassword ?? "", joinOnce: true, security: NetworkSecurity.WPA, withInternet: false); | 
		
	
		
			
				|  |  |  |  |     Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |     bool isConnected = await WiFiForIoTPlugin.connect(AppState().getMohemmWifiSSID ?? "", | 
		
	
		
			
				|  |  |  |  |         password: AppState().getMohemmWifiPassword ?? "", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false); | 
		
	
		
			
				|  |  |  |  |     if (isConnected) { | 
		
	
		
			
				|  |  |  |  |       Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       await WiFiForIoTPlugin.forceWifiUsage(true); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       await Future.delayed(Duration(seconds: 1)); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       if (Platform.isIOS) { | 
		
	
		
			
				|  |  |  |  |         await closeWifiRequest(); | 
		
	
		
			
				|  |  |  |  |         await Future.delayed(Duration(seconds: 6)); | 
		
	
		
			
				|  |  |  |  |       } else { | 
		
	
		
			
				|  |  |  |  |         await WiFiForIoTPlugin.forceWifiUsage(true); | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |       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(); | 
		
	
		
			
				|  |  |  |  |         if (Platform.isAndroid) { | 
		
	
		
			
				|  |  |  |  |           await closeWifiRequest(); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |       } catch (ex) { | 
		
	
		
			
				|  |  |  |  |         print("performWifiAttendance: "+ex.toString()); | 
		
	
		
			
				|  |  |  |  |         // await closeWifiRequest(); | 
		
	
		
			
				|  |  |  |  |         print("performWifiAttendance: " + ex.toString()); | 
		
	
		
			
				|  |  |  |  |         await closeWifiRequest(); | 
		
	
		
			
				|  |  |  |  |         Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |         Utils.handleException(ex, context, (msg) { | 
		
	
		
			
				|  |  |  |  |           Utils.confirmDialog(context, msg); | 
		
	
	
		
			
				
					|  |  |  | @ -182,8 +188,9 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<bool> closeWifiRequest() async { | 
		
	
		
			
				|  |  |  |  |     // await WiFiForIoTPlugin.forceWifiUsage(false); | 
		
	
		
			
				|  |  |  |  |     // Future.delayed(Duration(seconds: 2)); | 
		
	
		
			
				|  |  |  |  |     if (Platform.isAndroid) { | 
		
	
		
			
				|  |  |  |  |       await WiFiForIoTPlugin.forceWifiUsage(false); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     return await WiFiForIoTPlugin.disconnect(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | 
 |