From 0e329e8e2b4d7df08daeb680dfa6fa41ff2edc57 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 26 Jan 2023 10:50:21 +0300 Subject: [PATCH 1/6] ticket balance value display fixed & infant added in value. --- lib/generated/codegen_loader.g.dart | 6 ++++++ lib/generated/locale_keys.g.dart | 11 ++++++----- lib/provider/dashboard_provider_model.dart | 2 +- lib/ui/landing/widget/menus_widget.dart | 4 ++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 1563767..f3497d3 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -533,6 +533,9 @@ class CodegenLoader extends AssetLoader{ "startingIn": "يبدأ في", "youAreOutOfContest": "أنت خارج المسابقة.", "winners": "الفائزين!!!", + "expireAfter": "تنتهي بعد", + "oneWeek": "أسبوع 1", + "twoWeek": "2 أسبوع", "noUpcoming": "لا يوجد قادم", "fakeLocation": ".لقد تتبعنا أنك تحاول استخدام موقع مزيف! يعتبر هذا مخالفة وقد تم إخطار الموارد البشرية", "noWinner": "حزين! لم يفز أحد اليوم.", @@ -1058,6 +1061,9 @@ static const Map en_US = { "startingIn": "Starting in", "youAreOutOfContest": "You are out of the contest.", "winners": "WINNERS!!!", + "expireAfter": "Expires After", + "oneWeek": "1 Week", + "twoWeek": "2 Week", "noUpcoming": "There is no upcoming", "fakeLocation": "We traced out that you try to use a fake location! This is considered a violation, and HR has been notified.", "noWinner": "Sad! No one won today.", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 184748a..4eb91c9 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -1,6 +1,6 @@ // DO NOT EDIT. This is code generated via package:easy_localization/generate.dart -abstract class LocaleKeys { +abstract class LocaleKeys { static const mohemm = 'mohemm'; static const english = 'english'; static const arabic = 'arabic'; @@ -250,7 +250,7 @@ abstract class LocaleKeys { static const Payroll = 'Payroll'; static const civilIdentityNumber = 'civilIdentityNumber'; static const dateOfBirth = 'dateOfBirth'; - static const maritalStatus = 'maritalStatus '; + static const maritalStatus = 'maritalStatus '; static const fullName = 'fullName'; static const remove = 'remove'; static const submit = 'submit'; @@ -280,7 +280,7 @@ abstract class LocaleKeys { static const enterNewInfo = 'enterNewInfo'; static const endDate = 'endDate'; static const removeThisMember = 'removeThisMember'; - static const wantUpdateThisMember = 'wantUpdateThisMember '; + static const wantUpdateThisMember = 'wantUpdateThisMember '; static const addNewFamilyMember = 'addNewFamilyMember'; static const addRow = 'addRow'; static const pleaseSelect = 'pleaseSelect'; @@ -503,12 +503,13 @@ abstract class LocaleKeys { static const startingIn = 'startingIn'; static const youAreOutOfContest = 'youAreOutOfContest'; static const winners = 'winners'; - static const noUpcoming = 'noUpcoming'; - static const fakeLocation = 'fakeLocation'; static const expireAfter = 'expireAfter'; static const oneWeek = 'oneWeek'; static const twoWeek = 'twoWeek'; + static const noUpcoming = 'noUpcoming'; + static const fakeLocation = 'fakeLocation'; static const noWinner = 'noWinner'; static const myTeam = 'myTeam'; static const youCanPlayDemo = 'youCanPlayDemo'; + } diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index aa9a38f..5899699 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -190,7 +190,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { accrualList = await DashboardApiClient().getAccrualBalances(DateFormat("MM/dd/yyyy").format(date)); isLeaveTicketBalanceLoading = false; leaveBalanceAccrual = accrualList![0]; - ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + (accrualList![2].accrualNetEntitlement ?? 0.0); + ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + (accrualList![2].accrualNetEntitlement ?? 0.0) + (accrualList![3].accrualNetEntitlement ?? 0.0); notifyListeners(); } catch (ex) { isLeaveTicketBalanceLoading = false; diff --git a/lib/ui/landing/widget/menus_widget.dart b/lib/ui/landing/widget/menus_widget.dart index 3e24f63..64855ee 100644 --- a/lib/ui/landing/widget/menus_widget.dart +++ b/lib/ui/landing/widget/menus_widget.dart @@ -96,7 +96,7 @@ class MenusWidget extends StatelessWidget { Row( children: [ Expanded( - child: data.leaveBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), + child: data.leaveBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1), ), RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), ], @@ -123,7 +123,7 @@ class MenusWidget extends StatelessWidget { Row( children: [ Expanded( - child: data.ticketBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), + child: data.ticketBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1), ), RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), ], From a59656184f9ef4fea945fab87a7fb7bf1adbd093 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 26 Jan 2023 11:03:05 +0300 Subject: [PATCH 2/6] session log out check change. --- lib/api/api_client.dart | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/api/api_client.dart b/lib/api/api_client.dart index 1a70428..8518cd7 100644 --- a/lib/api/api_client.dart +++ b/lib/api/api_client.dart @@ -87,13 +87,12 @@ class ApiClient { if (!kReleaseMode) { logger.i("res: " + response.body); } + var jsonData = jsonDecode(response.body); - if (jsonData["MessageStatus"] == 2) { - AppState().setIsAuthenticated = false; + if (jsonData["IsAuthenticated"] != null) { + AppState().setIsAuthenticated = jsonData["IsAuthenticated"]; } - - - if (jsonData["ErrorMessage"] == null && jsonData["MessageStatus"] == 1) { + if (jsonData["ErrorMessage"] == null) { return factoryConstructor(jsonData); } else { APIError? apiError; From 580c7d62f51fda258585f3b57fa60bc28037ca63 Mon Sep 17 00:00:00 2001 From: Faiz Hashmi Date: Thu, 26 Jan 2023 11:19:36 +0300 Subject: [PATCH 3/6] some fixes while testing --- lib/extensions/string_extensions.dart | 6 ++- lib/ui/marathon/marathon_provider.dart | 20 +++++--- lib/ui/marathon/marathon_screen.dart | 49 ++++++++++++-------- lib/ui/marathon/widgets/marathon_banner.dart | 2 +- 4 files changed, 49 insertions(+), 28 deletions(-) diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index b916f23..53b70a5 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -158,13 +158,15 @@ extension EmailValidator on String { style: TextStyle(height: 1, color: color ?? MyColors.darkTextColor, fontSize: 22, letterSpacing: -1.44, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), ); - Widget toText24({Color? color, bool isBold = false}) => Text( + Widget toText24({Color? color, bool isBold = false, bool isCentered = false}) => Text( this, + textAlign: isCentered ? TextAlign.center : null, style: TextStyle(height: 23 / 24, color: color ?? MyColors.darkTextColor, fontSize: 24, letterSpacing: -1.44, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), ); - Widget toText30({Color? color, bool isBold = false}) => Text( + Widget toText30({Color? color, bool isBold = false, bool isCentered = false}) => Text( this, + textAlign: isCentered ? TextAlign.center : null, style: TextStyle(height: 20 / 32, color: color ?? MyColors.darkTextColor, fontSize: 32, letterSpacing: -1.2, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), ); diff --git a/lib/ui/marathon/marathon_provider.dart b/lib/ui/marathon/marathon_provider.dart index 9185a19..856a484 100644 --- a/lib/ui/marathon/marathon_provider.dart +++ b/lib/ui/marathon/marathon_provider.dart @@ -190,6 +190,7 @@ class MarathonProvider extends ChangeNotifier { oneSec, (Timer timer) async { if (totalSecondsToWaitForMarathon == 0) { + timer.cancel(); if (isUserWaiting) { MarathonApiClient().joinMarathonAsParticipant().whenComplete(() async { await callNextQuestionApi(); @@ -197,7 +198,6 @@ class MarathonProvider extends ChangeNotifier { } else { isButtonEnabled = false; } - timer.cancel(); return; } else { totalSecondsToWaitForMarathon--; @@ -210,20 +210,24 @@ class MarathonProvider extends ChangeNotifier { int totalCurrentQuestionTime = 0; int currentGapTime = 0; Timer timerForQuestion = Timer.periodic(const Duration(seconds: 1), (Timer timer) {}); + int callCountThreshold = 0; void startTimerForQuestion() { const Duration oneSec = Duration(seconds: 1); timerForQuestion = Timer.periodic( oneSec, (Timer timer) async { - // This 2 is just to show the color of answer tile for 1 and then update card status + // This 1 is just to show the color of answer tile for 1 and then update card status if (totalCurrentQuestionTime - currentGapTime == 1) { - getCorrectAnswerAndUpdateAnswerColor(); + if (callCountThreshold == 0) { + getCorrectAnswerAndUpdateAnswerColor(); + } } if (totalCurrentQuestionTime - currentGapTime == -2) { - updateCardStatusToAnswer(); - + if (callCountThreshold == 0) { + updateCardStatusToAnswer(); + } // scheduleMicrotask(() async { // if (AppState().getIsDemoMarathon || isUserOutOfGame) { // await callNextQuestionApi(); @@ -243,6 +247,7 @@ class MarathonProvider extends ChangeNotifier { notifyListeners(); } totalCurrentQuestionTime--; + callCountThreshold = 0; } if (totalCurrentQuestionTime == 0) { @@ -255,6 +260,7 @@ class MarathonProvider extends ChangeNotifier { } else { if (totalCurrentQuestionTime - currentGapTime != -2) { totalCurrentQuestionTime--; + callCountThreshold = 0; } } @@ -413,6 +419,7 @@ class MarathonProvider extends ChangeNotifier { } void getCorrectAnswerAndUpdateAnswerColor() { + callCountThreshold = 1; if (selectedOptionIndex != null) { scheduleMicrotask(() async { if (AppState().getIsDemoMarathon) { @@ -447,7 +454,7 @@ class MarathonProvider extends ChangeNotifier { if (currentQuestionNumber == 0) { return; } - + callCountThreshold = 1; scheduleMicrotask(() async { await callNextQuestionApi(); }); @@ -478,6 +485,7 @@ class MarathonProvider extends ChangeNotifier { void resetValues() async { _currentQuestionNumber = 0; + iAmWinner = false; cardContentList.clear(); itsMarathonTime = false; timerForWinnerSelection.cancel(); diff --git a/lib/ui/marathon/marathon_screen.dart b/lib/ui/marathon/marathon_screen.dart index 9d76cf7..f4207a1 100644 --- a/lib/ui/marathon/marathon_screen.dart +++ b/lib/ui/marathon/marathon_screen.dart @@ -169,26 +169,37 @@ class MarathonScreen extends StatelessWidget { ], ) : const SizedBox(), - 36.height, + 34.height, if (provider.selectedWinners != null) ...[ - ListView.separated( - shrinkWrap: true, - itemCount: provider.selectedWinners!.length, - separatorBuilder: (BuildContext context, int index) { - return const Divider(); - }, - itemBuilder: (BuildContext context, int index) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - (AppState().isArabic(context) ? provider.selectedWinners![index].nameEn : provider.selectedWinners![index].nameEn)!.toText16( - color: MyColors.grey3AColor, - ), - provider.selectedWinners!.first.employeeId!.toText16(color: MyColors.grey57Color), - ], - ); - }, - ), + provider.selectedWinners!.length == 1 + ? Column( + children: [ + (AppState().isArabic(context) ? provider.selectedWinners![0].nameEn : provider.selectedWinners![0].nameEn)!.toText24( + color: MyColors.grey3AColor, + isCentered: true, + ), + 8.height, + AppState().memberInformationList!.eMPLOYEENUMBER!.toText22(color: MyColors.grey57Color), + ], + ) + : ListView.separated( + shrinkWrap: true, + itemCount: provider.selectedWinners!.length, + separatorBuilder: (BuildContext context, int index) { + return const Divider(); + }, + itemBuilder: (BuildContext context, int index) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (AppState().isArabic(context) ? provider.selectedWinners![index].nameEn : provider.selectedWinners![index].nameEn)!.toText16( + color: MyColors.grey3AColor, + ), + provider.selectedWinners!.first.employeeId!.toText16(color: MyColors.grey57Color), + ], + ); + }, + ), ], 60.height, if (provider.marathonDetailModel.sponsors != null && provider.marathonDetailModel.sponsors!.isNotEmpty) ...[ diff --git a/lib/ui/marathon/widgets/marathon_banner.dart b/lib/ui/marathon/widgets/marathon_banner.dart index 223fb2c..f9076bc 100644 --- a/lib/ui/marathon/widgets/marathon_banner.dart +++ b/lib/ui/marathon/widgets/marathon_banner.dart @@ -431,7 +431,7 @@ class MarathonBanner extends StatelessWidget { ), Flexible( child: Text( - (AppState().isArabic(context) ? provider.marathonDetailModel.titleAr ?? "" : provider.marathonDetailModel.titleEn ?? "").trimString(15), + (AppState().isArabic(context) ? provider.marathonDetailModel.titleAr ?? "" : provider.marathonDetailModel.titleEn ?? "").trimString(isTablet ? 25 : 15), overflow: TextOverflow.ellipsis, style: TextStyle( fontStyle: FontStyle.italic, From 550e26dce15e4ffdd1157a15d3b486f4c86712e6 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 26 Jan 2023 11:20:31 +0300 Subject: [PATCH 4/6] Attendance loader fix --- lib/ui/landing/dashboard_screen.dart | 3 --- lib/widgets/mark_attendance_widget.dart | 11 +---------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index af6f903..db1f1fc 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -76,11 +76,8 @@ class _DashboardScreenState extends State with WidgetsBindingOb void checkSession() async { try { - Utils.showLoading(context); await DashboardApiClient().getOpenMissingSwipes(); - Utils.hideLoading(context); } catch (ex) { - Utils.hideLoading(context); Utils.handleException(ex, context, null); } } diff --git a/lib/widgets/mark_attendance_widget.dart b/lib/widgets/mark_attendance_widget.dart index 03d4847..5cfc347 100644 --- a/lib/widgets/mark_attendance_widget.dart +++ b/lib/widgets/mark_attendance_widget.dart @@ -75,6 +75,7 @@ class _MarkAttendanceWidgetState extends State { @override Widget build(BuildContext context) { + return Container( padding: EdgeInsets.only(left: 21, right: 21, bottom: 21, top: widget.topPadding), decoration: const BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), @@ -228,22 +229,12 @@ class _MarkAttendanceWidgetState extends State { } if (isConnected) { - // if (Platform.isIOS) { - // await closeWifiRequest(); - // await Future.delayed(Duration(seconds: 6)); - // } else { - // await WiFiForIoTPlugin.forceWifiUsage(true); - // } await WiFiForIoTPlugin.forceWifiUsage(true); await Future.delayed(const Duration(seconds: 6)); try { GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 3, nfcValue: "", isGpsRequired: isWifiLocationEnabled, lat: lat, long: lng); bool status = await model.fetchAttendanceTracking(context); Utils.hideLoading(context); - // if (Platform.isAndroid) { - // await closeWifiRequest(); - // } - await closeWifiRequest(); showMDialog( context, From 4a431fb752687cd8910d4a9479b4bb1d97365276 Mon Sep 17 00:00:00 2001 From: Aamir Muhammad Date: Thu, 26 Jan 2023 11:40:11 +0300 Subject: [PATCH 5/6] Notification Fix --- ios/Runner/AppDelegate.swift | 1 - lib/classes/notifications.dart | 5 ++--- lib/provider/chat_provider_model.dart | 7 +++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 528e5c0..b4ad5b3 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -14,7 +14,6 @@ import flutter_local_notifications FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in GeneratedPluginRegistrant.register(with: registry) } - if #available(iOS 10.0, *) { UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate } diff --git a/lib/classes/notifications.dart b/lib/classes/notifications.dart index cebf76d..0773575 100644 --- a/lib/classes/notifications.dart +++ b/lib/classes/notifications.dart @@ -60,7 +60,7 @@ class AppNotifications { } void _handleMessage(RemoteMessage message) { - Utils.saveStringFromPrefs("isAppOpendByChat", "true"); + Utils.saveStringFromPrefs("isAppOpendByChat", "false"); } void _handleOpenApp(RemoteMessage message) { @@ -77,7 +77,6 @@ AndroidNotificationChannel channel = const AndroidNotificationChannel( Future backgroundMessageHandler(RemoteMessage message) async { await Firebase.initializeApp(); - Utils.saveStringFromPrefs("isAppOpendByChat", "true"); - logger.w(message.data["user_chat_history_response"]); + Utils.saveStringFromPrefs("isAppOpendByChat", "false"); Utils.saveStringFromPrefs("notificationData", message.data["user_chat_history_response"].toString()); } diff --git a/lib/provider/chat_provider_model.dart b/lib/provider/chat_provider_model.dart index 08b148d..56001d6 100644 --- a/lib/provider/chat_provider_model.dart +++ b/lib/provider/chat_provider_model.dart @@ -1451,12 +1451,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } void openChatByNoti(BuildContext context) async { - SingleUserChatModel nUser = SingleUserChatModel.fromJson( - jsonDecode(await Utils.getStringFromPrefs("notificationData")), - ); Utils.saveStringFromPrefs("isAppOpendByChat", "false"); + SingleUserChatModel nUser = SingleUserChatModel.fromJson(jsonDecode(await Utils.getStringFromPrefs("notificationData"))); Utils.saveStringFromPrefs("notificationData", "null"); - Future.delayed(const Duration(seconds: 1)); + logger.w(jsonEncode(nUser)); + Future.delayed(const Duration(seconds: 2)); for (ChatUser user in searchedChats!) { if (user.id == nUser.targetUserId) { Navigator.pushNamed(context, AppRoutes.chatDetailed, arguments: ChatDetailedScreenParams(user, false)); From be32b9c4a20efa08c65326fd93d32f7c4d8d2cc1 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 26 Jan 2023 12:50:26 +0300 Subject: [PATCH 6/6] attendance fixes --- lib/classes/utils.dart | 2 ++ lib/widgets/dialogs/confirm_dialog.dart | 8 +++---- lib/widgets/mark_attendance_widget.dart | 30 ++++++++++++++++++++----- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index 5990edf..2c36694 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -115,12 +115,14 @@ class Utils { } else { if (!AppState().isAuthenticated) { showDialog( + barrierDismissible: false, context: cxt, builder: (cxt) => ConfirmDialog( message: errorMessage, onTap: () { Navigator.pushNamedAndRemoveUntil(cxt, AppRoutes.login, (Route route) => false); }, + onCloseTap: () {}, ), ); } else { diff --git a/lib/widgets/dialogs/confirm_dialog.dart b/lib/widgets/dialogs/confirm_dialog.dart index 4c94340..560bd26 100644 --- a/lib/widgets/dialogs/confirm_dialog.dart +++ b/lib/widgets/dialogs/confirm_dialog.dart @@ -12,8 +12,9 @@ class ConfirmDialog extends StatelessWidget { final String message; final String? okTitle; final VoidCallback? onTap; + final VoidCallback? onCloseTap; - const ConfirmDialog({Key? key, this.title, required this.message, this.okTitle, this.onTap}) : super(key: key); + const ConfirmDialog({Key? key, this.title, required this.message, this.okTitle, this.onTap, this.onCloseTap}) : super(key: key); @override Widget build(BuildContext context) { @@ -41,9 +42,8 @@ class ConfirmDialog extends StatelessWidget { icon: const Icon(Icons.close), color: MyColors.darkTextColor, constraints: const BoxConstraints(), - onPressed: () { - Navigator.pop(context); - }, + onPressed: () => onCloseTap ?? Navigator.pop(context), + // onPressed: () => Navigator.pop(context), ) ], ), diff --git a/lib/widgets/mark_attendance_widget.dart b/lib/widgets/mark_attendance_widget.dart index 5cfc347..8603f6e 100644 --- a/lib/widgets/mark_attendance_widget.dart +++ b/lib/widgets/mark_attendance_widget.dart @@ -75,7 +75,6 @@ class _MarkAttendanceWidgetState extends State { @override Widget build(BuildContext context) { - return Container( padding: EdgeInsets.only(left: 21, right: 21, bottom: 21, top: widget.topPadding), decoration: const BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), @@ -146,7 +145,6 @@ class _MarkAttendanceWidgetState extends State { Future performNfcAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { if (Platform.isIOS) { - Utils.readNFc(onRead: (String nfcId) async { Utils.showLoading(context); try { @@ -215,7 +213,25 @@ class _MarkAttendanceWidgetState extends State { } } + Future checkSession() async { + try { + Utils.showLoading(context); + await DashboardApiClient().getOpenMissingSwipes(); + Utils.hideLoading(context); + return true; + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + return false; + } + } + Future performWifiAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { + if (Platform.isAndroid) { + if (!(await checkSession())) { + return; + } + } Utils.showLoading(context); bool isConnected = await WiFiForIoTPlugin.connect(AppState().getMohemmWifiSSID ?? "", password: AppState().getMohemmWifiPassword ?? "", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false); @@ -228,7 +244,7 @@ class _MarkAttendanceWidgetState extends State { } } - if (isConnected) { + if (isConnected && AppState().isAuthenticated) { await WiFiForIoTPlugin.forceWifiUsage(true); await Future.delayed(const Duration(seconds: 6)); try { @@ -248,8 +264,12 @@ class _MarkAttendanceWidgetState extends State { Utils.handleException(ex, context, null); } } else { - Utils.hideLoading(context); - Utils.confirmDialog(context, LocaleKeys.comeNearHMGWifi.tr()); + if (AppState().isAuthenticated) { + Utils.hideLoading(context); + Utils.confirmDialog(context, LocaleKeys.comeNearHMGWifi.tr()); + } else { + await closeWifiRequest(); + } } }