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