NFC Fixes

merge-requests/1/merge
haroon amjad 3 years ago
parent b0b84c572c
commit eb29553d26

@ -22,18 +22,36 @@
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string> <string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>sms</string>
<string>tel</string>
<string>mailto</string>
</array>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSCameraUsageDescription</key>
<string>This app requires camera access to capture &amp; upload pictures.</string>
<key>NSFaceIDUsageDescription</key>
<string>This app requires Face ID to allow biometric authentication for app login.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires photo library access to select image as document &amp; upload it.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This App requires access to your location to mark your attendance.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>This App requires access to your location to mark your attendance.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This App requires access to your location to mark your attendance.</string>
<key>NFCReaderUsageDescription</key>
<string>This App requires access to NFC to mark your attendance.</string>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
<string>Main</string> <string>Main</string>
<key>NSCameraUsageDescription</key>
<string>This app requires camera access to capture &amp; upload pictures.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires photo library access to select image as document &amp; upload it.</string>
<key>NSFaceIDUsageDescription</key>
<string>This app requires Face ID to allow biometric authentication for app login.</string>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
@ -47,12 +65,6 @@
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>sms</string>
<string>tel</string>
<string>mailto</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
</dict> </dict>

@ -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'; import 'package:permission_handler/permission_handler.dart';
class AppPermissions{ class AppPermissions {
static void location(Function(bool) completion) { static void location(Function(bool) completion, BuildContext context) {
Permission.location.isGranted.then((isGranted){ Permission.location.isGranted.then((isGranted){
if(!isGranted){ if(!isGranted){
Permission.location.request().then((granted){ Permission.location.request().then((granted){
@ -10,21 +15,34 @@ class AppPermissions{
} }
completion(isGranted); completion(isGranted);
}); });
} }
static void checkAll(Function(bool) completion){ static void showErrorLocationDialog(bool isPermissionError, BuildContext context) {
[ showDialog(
Permission.location context: context,
].request().then((value){ 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; bool allGranted = false;
value.values.forEach((element) { value.values.forEach((element) {
allGranted = allGranted && element == PermissionStatus.granted; allGranted = allGranted && element == PermissionStatus.granted;
}); });
completion(allGranted); completion(allGranted);
}); });
} }
} }

@ -59,7 +59,6 @@ class _DashboardScreenState extends State<DashboardScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<String> namesD = ["Nostalgia Perfume Perfume", "Al Nafoura", "AlJadi", "Nostalgia Perfume"];
GlobalKey<ScaffoldState> _key = GlobalKey(); // GlobalKey<ScaffoldState> _key = GlobalKey(); //
return Scaffold( return Scaffold(
key: _scaffoldState, key: _scaffoldState,
@ -71,15 +70,17 @@ class _DashboardScreenState extends State<DashboardScreen> {
return Row( return Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Image.memory( Image.memory(
Utils.getPostBytes( Utils.getPostBytes(
AppState().memberInformationList!.eMPLOYEEIMAGE ?? "", AppState().memberInformationList!.eMPLOYEEIMAGE ?? "",
), ),
errorBuilder: (BuildContext context, error, stackTrace) { errorBuilder: (BuildContext context, error, stackTrace) {
return SvgPicture.asset( return SvgPicture.asset(
"assets/images/user.svg", height: 34, width: 34, "assets/images/user.svg",
); height: 34,
}, width: 34,
);
},
width: 34, width: 34,
height: 34, height: 34,
fit: BoxFit.cover, fit: BoxFit.cover,

@ -60,10 +60,10 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
leading: IconButton( // leading: IconButton(
icon: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor), // icon: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
onPressed: () => Navigator.pop(context), // onPressed: () => Navigator.pop(context),
), // ),
actions: [Center(child: "Employee Digital ID".toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {})), 21.width], actions: [Center(child: "Employee Digital ID".toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {})), 21.width],
), ),
body: Column( body: Column(

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:math'; import 'dart:math';
import 'dart:ui'; import 'dart:ui';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:geolocator/geolocator.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) { void done(Position position) {
//AppStorage.sp.saveLocation(position); //AppStorage.sp.saveLocation(position);
@ -64,8 +65,10 @@ class Location {
done(value); done(value);
} }
}); });
} else {
// AppPermissions
} }
}); }, context);
} }
// static LatLng locationAwayFrom( // static LatLng locationAwayFrom(
@ -137,11 +140,11 @@ class _Map {
}); });
} }
void goToCurrentLocation({Completer<GoogleMapController>? mapController, double? direction = 0.0, bool? animation}) { // void goToCurrentLocation({Completer<GoogleMapController>? mapController, double? direction = 0.0, bool? animation}) {
Location.getCurrentLocation((location) { // Location.getCurrentLocation((location) {
moveTo(location!, zoom: 17, mapController: mapController!, animation: animation, direction: direction!); // moveTo(location!, zoom: 17, mapController: mapController!, animation: animation, direction: direction!);
}); // });
} // }
var routes = Map<String, DirectionsRoute>(); var routes = Map<String, DirectionsRoute>();

@ -90,7 +90,7 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
if (isNfcLocationEnabled) { if (isNfcLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng) { Location.getCurrentLocation((LatLng? latlng) {
performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
}); }, context);
} else { } else {
performNfcAttendance(widget.model); performNfcAttendance(widget.model);
} }
@ -100,7 +100,7 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
if (isWifiLocationEnabled) { if (isWifiLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng) { Location.getCurrentLocation((LatLng? latlng) {
performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
}); }, context);
} else { } else {
performWifiAttendance(widget.model); performWifiAttendance(widget.model);
} }
@ -111,7 +111,7 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
if (isQrLocationEnabled) { if (isQrLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng) { Location.getCurrentLocation((LatLng? latlng) {
performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
}); }, context);
} else { } else {
performQrCodeAttendance(widget.model); performQrCodeAttendance(widget.model);
} }

@ -56,6 +56,8 @@ class _NfcLayoutState extends State<NfcLayout> {
Navigator.pop(context); Navigator.pop(context);
widget.onNcfScan(nfcId); widget.onNcfScan(nfcId);
}); });
}).catchError((err) {
print(err);
}); });
} }

@ -1,4 +1,4 @@
name: mohem_flutter_app name: Mohemm
description: A new Flutter application. description: A new Flutter application.
# The following line prevents the package from being accidentally published to # The following line prevents the package from being accidentally published to
@ -60,7 +60,7 @@ dependencies:
google_maps_flutter: ^2.0.2 google_maps_flutter: ^2.0.2
google_maps_utils: ^1.4.0+1 google_maps_utils: ^1.4.0+1
google_directions_api: ^0.9.0 google_directions_api: ^0.9.0
geolocator: any geolocator: ^9.0.2
# flutter_compass: ^0.6.1 # flutter_compass: ^0.6.1
google_maps_flutter_web: ^0.3.2 google_maps_flutter_web: ^0.3.2
month_year_picker: ^0.2.0+1 month_year_picker: ^0.2.0+1

Loading…
Cancel
Save