From 1119fa1640360110100108a14eefbce2047d3749 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 28 Sep 2022 12:01:42 +0300 Subject: [PATCH 1/6] Updates & fixes --- lib/ui/attendance/monthly_attendance_screen.dart | 2 +- lib/ui/my_team/view_attendance.dart | 2 +- lib/ui/work_list/sheets/delegate_sheet.dart | 3 ++- lib/widgets/nfc/nfc_reader_sheet.dart | 15 ++++++++------- pubspec.yaml | 5 +++-- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/ui/attendance/monthly_attendance_screen.dart b/lib/ui/attendance/monthly_attendance_screen.dart index c45dc0b..ebbf03f 100644 --- a/lib/ui/attendance/monthly_attendance_screen.dart +++ b/lib/ui/attendance/monthly_attendance_screen.dart @@ -16,7 +16,7 @@ import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model. import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/circular_step_progress_bar.dart'; -import 'package:month_picker_dialog/month_picker_dialog.dart'; +import 'package:month_picker_dialog_2/month_picker_dialog_2.dart'; import 'package:pie_chart/pie_chart.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; diff --git a/lib/ui/my_team/view_attendance.dart b/lib/ui/my_team/view_attendance.dart index 7d8a6e0..0ca1bab 100644 --- a/lib/ui/my_team/view_attendance.dart +++ b/lib/ui/my_team/view_attendance.dart @@ -12,7 +12,7 @@ import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.d import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; -import 'package:month_picker_dialog/month_picker_dialog.dart'; +import 'package:month_picker_dialog_2/month_picker_dialog_2.dart'; import 'package:pie_chart/pie_chart.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; diff --git a/lib/ui/work_list/sheets/delegate_sheet.dart b/lib/ui/work_list/sheets/delegate_sheet.dart index 2904e07..229ddb1 100644 --- a/lib/ui/work_list/sheets/delegate_sheet.dart +++ b/lib/ui/work_list/sheets/delegate_sheet.dart @@ -200,7 +200,8 @@ class _DelegateSheetState extends State { ), ), if (isNeedEnableTextField) - FlatButton( + //Todo: Button to be fixed + TextButton( onPressed: () { fetchUserByInput(); }, diff --git a/lib/widgets/nfc/nfc_reader_sheet.dart b/lib/widgets/nfc/nfc_reader_sheet.dart index 53c0d4f..33332b9 100644 --- a/lib/widgets/nfc/nfc_reader_sheet.dart +++ b/lib/widgets/nfc/nfc_reader_sheet.dart @@ -88,18 +88,20 @@ class _NfcLayoutState extends State { "assets/icons/nfc/ic_nfc.png", height: MediaQuery.of(context).size.width / 3, ), - SizedBox( + const SizedBox( height: 30, ), - Text( + const Text( "Approach an NFC Tag", style: TextStyle( fontSize: 18, ), ), - SizedBox( + const SizedBox( height: 30, ), + + //Todo: Button to be fixed ButtonTheme( minWidth: MediaQuery.of(context).size.width / 1.2, height: 45.0, @@ -107,12 +109,11 @@ class _NfcLayoutState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6), ), - child: RaisedButton( + child: TextButton( onPressed: () { NfcManager.instance.stopSession(); Navigator.pop(context); }, - elevation: 0, child: Text("CANCEL"), ), ), @@ -159,6 +160,7 @@ class _NfcLayoutState extends State { SizedBox( height: 30, ), + //Todo: Button to be fixed ButtonTheme( minWidth: MediaQuery.of(context).size.width / 1.2, height: 45.0, @@ -166,14 +168,13 @@ class _NfcLayoutState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6), ), - child: RaisedButton( + child: TextButton( // onPressed: () { // _stream?.cancel(); // widget.onNcfScan(nfcId); // Navigator.pop(context); // }, onPressed: null, - elevation: 0, child: Text("DONE"), ), ), diff --git a/pubspec.yaml b/pubspec.yaml index ee15638..161f2ea 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -52,7 +52,7 @@ dependencies: shimmer: ^2.0.0 logger: ^1.1.0 flutter_countdown_timer: ^4.1.0 - nfc_manager: ^3.1.1 + nfc_manager: ^3.2.0 uuid: ^3.0.6 image_picker: ^0.8.5+3 file_picker: ^4.6.1 @@ -64,7 +64,8 @@ dependencies: # flutter_compass: ^0.6.1 google_maps_flutter_web: ^0.3.2 month_year_picker: ^0.2.0+1 - month_picker_dialog: ^0.4.0 +# month_picker_dialog: ^0.4.0 + month_picker_dialog_2: 0.5.5 open_file: ^3.2.1 wifi_iot: ^0.3.16 flutter_html: ^2.2.1 From eb6e503a3de4cfb1543eea7c1454daa474324a90 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 28 Sep 2022 12:02:02 +0300 Subject: [PATCH 2/6] Revert "Updates & fixes" This reverts commit 1119fa1640360110100108a14eefbce2047d3749. --- lib/ui/attendance/monthly_attendance_screen.dart | 2 +- lib/ui/my_team/view_attendance.dart | 2 +- lib/ui/work_list/sheets/delegate_sheet.dart | 3 +-- lib/widgets/nfc/nfc_reader_sheet.dart | 15 +++++++-------- pubspec.yaml | 5 ++--- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/lib/ui/attendance/monthly_attendance_screen.dart b/lib/ui/attendance/monthly_attendance_screen.dart index ebbf03f..c45dc0b 100644 --- a/lib/ui/attendance/monthly_attendance_screen.dart +++ b/lib/ui/attendance/monthly_attendance_screen.dart @@ -16,7 +16,7 @@ import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model. import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/circular_step_progress_bar.dart'; -import 'package:month_picker_dialog_2/month_picker_dialog_2.dart'; +import 'package:month_picker_dialog/month_picker_dialog.dart'; import 'package:pie_chart/pie_chart.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; diff --git a/lib/ui/my_team/view_attendance.dart b/lib/ui/my_team/view_attendance.dart index 0ca1bab..7d8a6e0 100644 --- a/lib/ui/my_team/view_attendance.dart +++ b/lib/ui/my_team/view_attendance.dart @@ -12,7 +12,7 @@ import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.d import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; -import 'package:month_picker_dialog_2/month_picker_dialog_2.dart'; +import 'package:month_picker_dialog/month_picker_dialog.dart'; import 'package:pie_chart/pie_chart.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; diff --git a/lib/ui/work_list/sheets/delegate_sheet.dart b/lib/ui/work_list/sheets/delegate_sheet.dart index 229ddb1..2904e07 100644 --- a/lib/ui/work_list/sheets/delegate_sheet.dart +++ b/lib/ui/work_list/sheets/delegate_sheet.dart @@ -200,8 +200,7 @@ class _DelegateSheetState extends State { ), ), if (isNeedEnableTextField) - //Todo: Button to be fixed - TextButton( + FlatButton( onPressed: () { fetchUserByInput(); }, diff --git a/lib/widgets/nfc/nfc_reader_sheet.dart b/lib/widgets/nfc/nfc_reader_sheet.dart index 33332b9..53c0d4f 100644 --- a/lib/widgets/nfc/nfc_reader_sheet.dart +++ b/lib/widgets/nfc/nfc_reader_sheet.dart @@ -88,20 +88,18 @@ class _NfcLayoutState extends State { "assets/icons/nfc/ic_nfc.png", height: MediaQuery.of(context).size.width / 3, ), - const SizedBox( + SizedBox( height: 30, ), - const Text( + Text( "Approach an NFC Tag", style: TextStyle( fontSize: 18, ), ), - const SizedBox( + SizedBox( height: 30, ), - - //Todo: Button to be fixed ButtonTheme( minWidth: MediaQuery.of(context).size.width / 1.2, height: 45.0, @@ -109,11 +107,12 @@ class _NfcLayoutState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6), ), - child: TextButton( + child: RaisedButton( onPressed: () { NfcManager.instance.stopSession(); Navigator.pop(context); }, + elevation: 0, child: Text("CANCEL"), ), ), @@ -160,7 +159,6 @@ class _NfcLayoutState extends State { SizedBox( height: 30, ), - //Todo: Button to be fixed ButtonTheme( minWidth: MediaQuery.of(context).size.width / 1.2, height: 45.0, @@ -168,13 +166,14 @@ class _NfcLayoutState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6), ), - child: TextButton( + child: RaisedButton( // onPressed: () { // _stream?.cancel(); // widget.onNcfScan(nfcId); // Navigator.pop(context); // }, onPressed: null, + elevation: 0, child: Text("DONE"), ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 161f2ea..ee15638 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -52,7 +52,7 @@ dependencies: shimmer: ^2.0.0 logger: ^1.1.0 flutter_countdown_timer: ^4.1.0 - nfc_manager: ^3.2.0 + nfc_manager: ^3.1.1 uuid: ^3.0.6 image_picker: ^0.8.5+3 file_picker: ^4.6.1 @@ -64,8 +64,7 @@ dependencies: # flutter_compass: ^0.6.1 google_maps_flutter_web: ^0.3.2 month_year_picker: ^0.2.0+1 -# month_picker_dialog: ^0.4.0 - month_picker_dialog_2: 0.5.5 + month_picker_dialog: ^0.4.0 open_file: ^3.2.1 wifi_iot: ^0.3.16 flutter_html: ^2.2.1 From b0b84c572cc9a26bcd868f2bf2d0e7e9f85a6a77 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 28 Sep 2022 13:26:07 +0300 Subject: [PATCH 3/6] Last Login Fixes --- ios/Flutter/AppFrameworkInfo.plist | 2 +- ios/Runner/Info.plist | 2 ++ lib/ui/attendance/monthly_attendance_screen.dart | 2 +- lib/ui/landing/widget/app_drawer.dart | 6 +++--- lib/ui/login/login_screen.dart | 6 +++--- lib/ui/login/verify_last_login_screen.dart | 15 ++++++++------- lib/ui/login/verify_login_screen.dart | 2 +- lib/ui/my_team/view_attendance.dart | 2 +- lib/ui/work_list/sheets/delegate_sheet.dart | 2 +- lib/widgets/nfc/nfc_reader_sheet.dart | 8 ++++---- pubspec.yaml | 2 +- 11 files changed, 26 insertions(+), 23 deletions(-) diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index 8d4492f..9625e10 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 9.0 + 11.0 diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index eaa735c..9673709 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -32,6 +32,8 @@ This app requires camera access to capture & upload pictures. NSPhotoLibraryUsageDescription This app requires photo library access to select image as document & upload it. + NSFaceIDUsageDescription + This app requires Face ID to allow biometric authentication for app login. UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/lib/ui/attendance/monthly_attendance_screen.dart b/lib/ui/attendance/monthly_attendance_screen.dart index c45dc0b..ebbf03f 100644 --- a/lib/ui/attendance/monthly_attendance_screen.dart +++ b/lib/ui/attendance/monthly_attendance_screen.dart @@ -16,7 +16,7 @@ import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model. import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/circular_step_progress_bar.dart'; -import 'package:month_picker_dialog/month_picker_dialog.dart'; +import 'package:month_picker_dialog_2/month_picker_dialog_2.dart'; import 'package:pie_chart/pie_chart.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; diff --git a/lib/ui/landing/widget/app_drawer.dart b/lib/ui/landing/widget/app_drawer.dart index ebe3f7b..523c1cc 100644 --- a/lib/ui/landing/widget/app_drawer.dart +++ b/lib/ui/landing/widget/app_drawer.dart @@ -136,8 +136,8 @@ class _AppDrawerState extends State { AppState().isAuthenticated = false; AppState().isLogged = false; AppState().setPostParamsInitConfig(); - SharedPreferences prefs = await SharedPreferences.getInstance(); - await prefs.clear(); - Navigator.pushNamedAndRemoveUntil(context, AppRoutes.login, (Route route) => false, arguments: false); + // SharedPreferences prefs = await SharedPreferences.getInstance(); + // await prefs.clear(); + Navigator.pushNamedAndRemoveUntil(context, AppRoutes.login, (Route route) => false, arguments: null); } } diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index f0f2c48..f8ec8e5 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -50,7 +50,7 @@ class _LoginScreenState extends State { @override void initState() { super.initState(); - // checkFirebaseToken(); + // checkFirebaseToken(); } @override @@ -130,8 +130,8 @@ class _LoginScreenState extends State { if (isAppOpenBySystem == null) { isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool; print('isAppOpenBySystem:$isAppOpenBySystem'); - username.text = "15153"; - password.text = "Abcd@12345"; + // username.text = "15153"; + // password.text = "Abcd@12345"; if (isAppOpenBySystem!) checkFirebaseToken(); } diff --git a/lib/ui/login/verify_last_login_screen.dart b/lib/ui/login/verify_last_login_screen.dart index faaf76e..9215cb7 100644 --- a/lib/ui/login/verify_last_login_screen.dart +++ b/lib/ui/login/verify_last_login_screen.dart @@ -211,7 +211,7 @@ class _VerifyLastLoginScreenState extends State { const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'); bool authenticated = false; try { - authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, iOSAuthStrings: iosStrings); + authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, biometricOnly: true, iOSAuthStrings: iosStrings); } on PlatformException catch (e) { print(e); Utils.hideLoading(context); @@ -238,12 +238,13 @@ class _VerifyLastLoginScreenState extends State { return; } else { if (mobileLoginInfoListModel!.loginType == 2 || mobileLoginInfoListModel!.loginType == 3) { - bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics(); - if (!authenticateWithFaceAndTouchID) { - return; - } else { - performApiCall(_title, _icon, _flag, isDirectLogin: true); - } + // bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics(); + // if (!authenticateWithFaceAndTouchID) { + // return; + // } else { + // performApiCall(_title, _icon, _flag, isDirectLogin: true); + // } + performApiCall(_title, _icon, _flag, isDirectLogin: true); } else { isNeedVerifyWithFaceIDAndBiometrics = true; selectedFlag = _flag; diff --git a/lib/ui/login/verify_login_screen.dart b/lib/ui/login/verify_login_screen.dart index 1d66df9..a713c0f 100644 --- a/lib/ui/login/verify_login_screen.dart +++ b/lib/ui/login/verify_login_screen.dart @@ -517,7 +517,7 @@ class _VerifyLoginScreenState extends State { const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'); bool authenticated = false; try { - authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, iOSAuthStrings: iosStrings); + authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, biometricOnly: true, iOSAuthStrings: iosStrings); } on PlatformException catch (e) { print(e); Utils.hideLoading(context); diff --git a/lib/ui/my_team/view_attendance.dart b/lib/ui/my_team/view_attendance.dart index b3f123e..555cfb0 100644 --- a/lib/ui/my_team/view_attendance.dart +++ b/lib/ui/my_team/view_attendance.dart @@ -15,7 +15,7 @@ import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/circular_step_progress_bar.dart'; -import 'package:month_picker_dialog/month_picker_dialog.dart'; +import 'package:month_picker_dialog_2/month_picker_dialog_2.dart'; import 'package:pie_chart/pie_chart.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; diff --git a/lib/ui/work_list/sheets/delegate_sheet.dart b/lib/ui/work_list/sheets/delegate_sheet.dart index 2904e07..b0cfef1 100644 --- a/lib/ui/work_list/sheets/delegate_sheet.dart +++ b/lib/ui/work_list/sheets/delegate_sheet.dart @@ -200,7 +200,7 @@ class _DelegateSheetState extends State { ), ), if (isNeedEnableTextField) - FlatButton( + TextButton( onPressed: () { fetchUserByInput(); }, diff --git a/lib/widgets/nfc/nfc_reader_sheet.dart b/lib/widgets/nfc/nfc_reader_sheet.dart index 53c0d4f..eff0b56 100644 --- a/lib/widgets/nfc/nfc_reader_sheet.dart +++ b/lib/widgets/nfc/nfc_reader_sheet.dart @@ -107,12 +107,12 @@ class _NfcLayoutState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6), ), - child: RaisedButton( + child: TextButton( onPressed: () { NfcManager.instance.stopSession(); Navigator.pop(context); }, - elevation: 0, + // elevation: 0, child: Text("CANCEL"), ), ), @@ -166,14 +166,14 @@ class _NfcLayoutState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6), ), - child: RaisedButton( + child: TextButton( // onPressed: () { // _stream?.cancel(); // widget.onNcfScan(nfcId); // Navigator.pop(context); // }, onPressed: null, - elevation: 0, + // elevation: 0, child: Text("DONE"), ), ), diff --git a/pubspec.yaml b/pubspec.yaml index e4f6dfc..bbe6f92 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -64,7 +64,7 @@ dependencies: # flutter_compass: ^0.6.1 google_maps_flutter_web: ^0.3.2 month_year_picker: ^0.2.0+1 - month_picker_dialog: ^0.4.0 + month_picker_dialog_2: 0.5.5 open_file: ^3.2.1 wifi_iot: ^0.3.16 flutter_html: ^2.2.1 From eb29553d26b2c5031c7383b30d34165b44dc6bef Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 28 Sep 2022 15:43:37 +0300 Subject: [PATCH 4/6] NFC Fixes --- ios/Runner/Info.plist | 36 ++++++++++++++-------- lib/classes/app_permissions.dart | 36 ++++++++++++++++------ lib/ui/landing/dashboard_screen.dart | 13 ++++---- lib/ui/login/verify_last_login_screen.dart | 8 ++--- lib/widgets/location/Location.dart | 17 +++++----- lib/widgets/mark_attendance_widget.dart | 6 ++-- lib/widgets/nfc/nfc_reader_sheet.dart | 2 ++ pubspec.yaml | 4 +-- 8 files changed, 79 insertions(+), 43 deletions(-) diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 9673709..13cb83e 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -22,18 +22,36 @@ ???? CFBundleVersion $(FLUTTER_BUILD_NUMBER) + LSApplicationQueriesSchemes + + sms + tel + mailto + LSRequiresIPhoneOS + NSCameraUsageDescription + This app requires camera access to capture & upload pictures. + NSFaceIDUsageDescription + This app requires Face ID to allow biometric authentication for app login. + NSPhotoLibraryUsageDescription + This app requires photo library access to select image as document & upload it. + NSLocationAlwaysAndWhenInUseUsageDescription + This App requires access to your location to mark your attendance. + NSLocationAlwaysUsageDescription + This App requires access to your location to mark your attendance. + NSLocationWhenInUseUsageDescription + This App requires access to your location to mark your attendance. + NFCReaderUsageDescription + This App requires access to NFC to mark your attendance. + UIBackgroundModes + + remote-notification + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main - NSCameraUsageDescription - This app requires camera access to capture & upload pictures. - NSPhotoLibraryUsageDescription - This app requires photo library access to select image as document & upload it. - NSFaceIDUsageDescription - This app requires Face ID to allow biometric authentication for app login. UISupportedInterfaceOrientations UIInterfaceOrientationPortrait @@ -47,12 +65,6 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - LSApplicationQueriesSchemes - - sms - tel - mailto - UIViewControllerBasedStatusBarAppearance diff --git a/lib/classes/app_permissions.dart b/lib/classes/app_permissions.dart index 983b400..1509b57 100644 --- a/lib/classes/app_permissions.dart +++ b/lib/classes/app_permissions.dart @@ -1,7 +1,12 @@ +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:geolocator/geolocator.dart'; import 'package:permission_handler/permission_handler.dart'; -class AppPermissions{ - static void location(Function(bool) completion) { +class AppPermissions { + static void location(Function(bool) completion, BuildContext context) { Permission.location.isGranted.then((isGranted){ if(!isGranted){ Permission.location.request().then((granted){ @@ -10,21 +15,34 @@ class AppPermissions{ } completion(isGranted); }); - } - static void checkAll(Function(bool) completion){ - [ - Permission.location - ].request().then((value){ + static void showErrorLocationDialog(bool isPermissionError, BuildContext context) { + showDialog( + context: context, + builder: (cxt) => ConfirmDialog( + message: "Please provide location permission", + onTap: () { + if (isPermissionError) { + Geolocator.openAppSettings(); + } else { + Geolocator.openLocationSettings(); + } + Navigator.pop(context); + // createVacationRule(list); + }, + ), + ); + } + static void checkAll(Function(bool) completion) { + [Permission.location].request().then((value) { bool allGranted = false; value.values.forEach((element) { allGranted = allGranted && element == PermissionStatus.granted; }); completion(allGranted); - }); } -} \ No newline at end of file +} diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 0410536..70b3ce0 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -59,7 +59,6 @@ class _DashboardScreenState extends State { @override Widget build(BuildContext context) { - List namesD = ["Nostalgia Perfume Perfume", "Al Nafoura", "AlJadi", "Nostalgia Perfume"]; GlobalKey _key = GlobalKey(); // return Scaffold( key: _scaffoldState, @@ -71,15 +70,17 @@ class _DashboardScreenState extends State { return Row( mainAxisSize: MainAxisSize.min, children: [ - Image.memory( + Image.memory( Utils.getPostBytes( AppState().memberInformationList!.eMPLOYEEIMAGE ?? "", ), - errorBuilder: (BuildContext context, error, stackTrace) { + errorBuilder: (BuildContext context, error, stackTrace) { return SvgPicture.asset( - "assets/images/user.svg", height: 34, width: 34, - ); - }, + "assets/images/user.svg", + height: 34, + width: 34, + ); + }, width: 34, height: 34, fit: BoxFit.cover, diff --git a/lib/ui/login/verify_last_login_screen.dart b/lib/ui/login/verify_last_login_screen.dart index 9215cb7..7229b53 100644 --- a/lib/ui/login/verify_last_login_screen.dart +++ b/lib/ui/login/verify_last_login_screen.dart @@ -60,10 +60,10 @@ class _VerifyLastLoginScreenState extends State { return Scaffold( appBar: AppBar( backgroundColor: Colors.transparent, - leading: IconButton( - icon: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor), - onPressed: () => Navigator.pop(context), - ), + // leading: IconButton( + // icon: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor), + // onPressed: () => Navigator.pop(context), + // ), actions: [Center(child: "Employee Digital ID".toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {})), 21.width], ), body: Column( diff --git a/lib/widgets/location/Location.dart b/lib/widgets/location/Location.dart index 47e2238..0ddca1c 100644 --- a/lib/widgets/location/Location.dart +++ b/lib/widgets/location/Location.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:math'; import 'dart:ui'; +import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:geolocator/geolocator.dart'; @@ -45,7 +46,7 @@ class Location { }); } - static void getCurrentLocation(Function(LatLng?) callback) { + static void getCurrentLocation(Function(LatLng?) callback, BuildContext context) { void done(Position position) { //AppStorage.sp.saveLocation(position); @@ -64,8 +65,10 @@ class Location { done(value); } }); + } else { + // AppPermissions } - }); + }, context); } // static LatLng locationAwayFrom( @@ -137,11 +140,11 @@ class _Map { }); } - void goToCurrentLocation({Completer? mapController, double? direction = 0.0, bool? animation}) { - Location.getCurrentLocation((location) { - moveTo(location!, zoom: 17, mapController: mapController!, animation: animation, direction: direction!); - }); - } + // void goToCurrentLocation({Completer? mapController, double? direction = 0.0, bool? animation}) { + // Location.getCurrentLocation((location) { + // moveTo(location!, zoom: 17, mapController: mapController!, animation: animation, direction: direction!); + // }); + // } var routes = Map(); diff --git a/lib/widgets/mark_attendance_widget.dart b/lib/widgets/mark_attendance_widget.dart index a3ed0d5..97bb76c 100644 --- a/lib/widgets/mark_attendance_widget.dart +++ b/lib/widgets/mark_attendance_widget.dart @@ -90,7 +90,7 @@ class _MarkAttendanceWidgetState extends State { if (isNfcLocationEnabled) { Location.getCurrentLocation((LatLng? latlng) { performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); - }); + }, context); } else { performNfcAttendance(widget.model); } @@ -100,7 +100,7 @@ class _MarkAttendanceWidgetState extends State { if (isWifiLocationEnabled) { Location.getCurrentLocation((LatLng? latlng) { performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); - }); + }, context); } else { performWifiAttendance(widget.model); } @@ -111,7 +111,7 @@ class _MarkAttendanceWidgetState extends State { if (isQrLocationEnabled) { Location.getCurrentLocation((LatLng? latlng) { performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); - }); + }, context); } else { performQrCodeAttendance(widget.model); } diff --git a/lib/widgets/nfc/nfc_reader_sheet.dart b/lib/widgets/nfc/nfc_reader_sheet.dart index eff0b56..c0d0edd 100644 --- a/lib/widgets/nfc/nfc_reader_sheet.dart +++ b/lib/widgets/nfc/nfc_reader_sheet.dart @@ -56,6 +56,8 @@ class _NfcLayoutState extends State { Navigator.pop(context); widget.onNcfScan(nfcId); }); + }).catchError((err) { + print(err); }); } diff --git a/pubspec.yaml b/pubspec.yaml index bbe6f92..e91a768 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,4 +1,4 @@ -name: mohem_flutter_app +name: Mohemm description: A new Flutter application. # The following line prevents the package from being accidentally published to @@ -60,7 +60,7 @@ dependencies: google_maps_flutter: ^2.0.2 google_maps_utils: ^1.4.0+1 google_directions_api: ^0.9.0 - geolocator: any + geolocator: ^9.0.2 # flutter_compass: ^0.6.1 google_maps_flutter_web: ^0.3.2 month_year_picker: ^0.2.0+1 From e6405b22515bac4f4d213270adc87e798bba51a3 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 29 Sep 2022 09:55:48 +0300 Subject: [PATCH 5/6] NFC fixes --- ios/Runner/Info.plist | 4 ++++ lib/classes/consts.dart | 4 ++-- lib/widgets/mark_attendance_widget.dart | 12 ++++++++---- lib/widgets/nfc/nfc_reader_sheet.dart | 15 +++++++++++++-- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 13cb83e..0534f2b 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -67,5 +67,9 @@ UIViewControllerBasedStatusBarAppearance + com.apple.developer.nfc.readersession.felica.systemcodes + + 0000 + diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 12f818e..17bd143 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -1,7 +1,7 @@ class ApiConsts { //static String baseUrl = "http://10.200.204.20:2801/"; // Local server - static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server - // static String baseUrl = "https://hmgwebservices.com"; // Live server + // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server + static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrlServices = baseUrl + "/Services/"; // server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; diff --git a/lib/widgets/mark_attendance_widget.dart b/lib/widgets/mark_attendance_widget.dart index 97bb76c..08e7c5e 100644 --- a/lib/widgets/mark_attendance_widget.dart +++ b/lib/widgets/mark_attendance_widget.dart @@ -158,16 +158,19 @@ class _MarkAttendanceWidgetState extends State { 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 { } Future closeWifiRequest() async { - await WiFiForIoTPlugin.forceWifiUsage(false); + // await WiFiForIoTPlugin.forceWifiUsage(false); + // Future.delayed(Duration(seconds: 2)); return await WiFiForIoTPlugin.disconnect(); } diff --git a/lib/widgets/nfc/nfc_reader_sheet.dart b/lib/widgets/nfc/nfc_reader_sheet.dart index c0d0edd..4ac055b 100644 --- a/lib/widgets/nfc/nfc_reader_sheet.dart +++ b/lib/widgets/nfc/nfc_reader_sheet.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:nfc_manager/nfc_manager.dart'; @@ -41,9 +42,13 @@ class _NfcLayoutState extends State { NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async { print(tag.data); - var f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22); + var f; + if (Platform.isAndroid) { + f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22); + } else { + f = MifareUltralight(tag: tag, identifier: tag.data["mifare"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22); + } String identifier = f.identifier.map((e) => e.toRadixString(16).padLeft(2, '0')).join(''); - // print(identifier); // => 0428fcf2255e81 nfcId = identifier; setState(() { @@ -54,6 +59,12 @@ class _NfcLayoutState extends State { Future.delayed(const Duration(seconds: 1), () { NfcManager.instance.stopSession(); Navigator.pop(context); + // if (Platform.isAndroid) { + // Navigator.pop(context); + // } else { + // Navigator.pop(context); + // Navigator.pop(context); + // } widget.onNcfScan(nfcId); }); }).catchError((err) { From ff2f42303e059d2a5602cbfe031dd85b0d494a03 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 29 Sep 2022 09:57:25 +0300 Subject: [PATCH 6/6] pubspec update --- pubspec.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index e91a768..14c034a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,4 +1,5 @@ -name: Mohemm +name: mohem_flutter_app + description: A new Flutter application. # The following line prevents the package from being accidentally published to