QR attendance

mirza_hmg_wifi_phase_1
mirza.shafique 1 year ago
parent ab68388504
commit 69a47173cf

@ -22,6 +22,7 @@
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="Mohemm" android:label="Mohemm"
android:extractNativeLibs="true" android:extractNativeLibs="true"
android:usesCleartextTraffic="true"
android:networkSecurityConfig="@xml/network_security_config" android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"> android:roundIcon="@mipmap/ic_launcher_round">
<activity <activity

@ -530,5 +530,7 @@
"connectHmgWifi": "قم بتوصيل HMG WIFI", "connectHmgWifi": "قم بتوصيل HMG WIFI",
"connectedHmgWifi": "اتصال HMG WIFI", "connectedHmgWifi": "اتصال HMG WIFI",
"itgForms": "نماذج (ITG)", "itgForms": "نماذج (ITG)",
"resetAdPassword": "إعادة تعيين كلمة مرور AD" "resetAdPassword": "إعادة تعيين كلمة مرور AD",
"connectedWithHmg": "Connected With HMG",
"networkMustHMG": "Network Must be HMG"
} }

@ -530,5 +530,7 @@
"connectHmgWifi": "Connect HMG WIFI", "connectHmgWifi": "Connect HMG WIFI",
"connectedHmgWifi": "Connected HMG WIFI", "connectedHmgWifi": "Connected HMG WIFI",
"itgForms": "ITG Forms", "itgForms": "ITG Forms",
"resetAdPassword": "Reset AD Password" "resetAdPassword": "Reset AD Password",
"connectedWithHmg": "Connected With HMG",
"networkMustHMG": "Network Must be HMG"
} }

@ -215,4 +215,19 @@ class DashboardApiClient {
return json; return json;
}, url, postParams); }, url, postParams);
} }
//Mark Fake Location
Future<GenericResponseModel?> checkLocelIP(String qrValue) async {
String url = "http://10.201.214.101:80/Services/SWP.svc/REST/CheckWifiCall";
Map<String, dynamic> postParams = {
"EmployeeID": AppState().memberInformationList!.eMPLOYEENUMBER,
"QRValue": qrValue,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
return responseData;
}, url, postParams);
}
} }

@ -13,6 +13,7 @@ import 'package:mohem_flutter_app/provider/chat_call_provider.dart';
import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
import 'package:mohem_flutter_app/provider/eit_provider_model.dart'; import 'package:mohem_flutter_app/provider/eit_provider_model.dart';
import 'package:mohem_flutter_app/provider/hmg_connection_provider.dart';
import 'package:mohem_flutter_app/theme/app_theme.dart'; import 'package:mohem_flutter_app/theme/app_theme.dart';
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart'; import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
import 'package:month_year_picker/month_year_picker.dart'; import 'package:month_year_picker/month_year_picker.dart';
@ -20,6 +21,8 @@ import 'package:provider/provider.dart';
import 'package:provider/single_child_widget.dart'; import 'package:provider/single_child_widget.dart';
import 'package:sizer/sizer.dart'; import 'package:sizer/sizer.dart';
Logger logger = Logger( Logger logger = Logger(
// filter: null, // Use the default LogFilter (-> only log in debug mode) // filter: null, // Use the default LogFilter (-> only log in debug mode)
printer: PrettyPrinter( printer: PrettyPrinter(
@ -73,6 +76,9 @@ Future<void> main() async {
// ChangeNotifierProvider<ChatCallProvider>( // ChangeNotifierProvider<ChatCallProvider>(
// create: (_) => ChatCallProvider(), // create: (_) => ChatCallProvider(),
// ), // ),
ChangeNotifierProvider<HmgConnectionProvider>(
create: (_) => HmgConnectionProvider(),
),
], ],
child: const MyApp(), child: const MyApp(),
), ),

@ -22,7 +22,7 @@ class HmgConnectionProvider extends ChangeNotifier {
// bool isConnected = await WiFiForIoTPlugin.connect(AppState().getMohemmWifiSSID ?? "", // bool isConnected = await WiFiForIoTPlugin.connect(AppState().getMohemmWifiSSID ?? "",
// password: AppState().getMohemmWifiPassword ?? "", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false); // password: AppState().getMohemmWifiPassword ?? "", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false);
bool isConnected = await WiFiForIoTPlugin.connect("MOHEMM-CONNECT", password: "0987654321", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false); bool isConnected = await WiFiForIoTPlugin.connect("HMG-MOHEMM", password: "M0hemm@1212", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false);
if (isConnected) { if (isConnected) {

@ -195,8 +195,8 @@ class _LoginScreenState extends State<LoginScreen> {
isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool; isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool;
if (!kReleaseMode) { if (!kReleaseMode) {
// username.text = "15444"; // Maha User // username.text = "15444"; // Maha User
// username.text = "15153"; // Tamer User username.text = "15153"; // Tamer User
// password.text = "Abcd@12345"; password.text = "tata@1234";
// username.text = "206535"; // Hashim User // username.text = "206535"; // Hashim User
// password.text = "Namira786"; // password.text = "Namira786";

@ -3,7 +3,9 @@ import 'dart:io';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:geolocator/geolocator.dart';
// import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:mohem_flutter_app/api/dashboard_api_client.dart'; import 'package:mohem_flutter_app/api/dashboard_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
@ -89,7 +91,8 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.only(left: 25, right: 25, top: 10, bottom: 10), padding: const EdgeInsets.only(left: 25, right: 25, top: 10, bottom: 10),
child: (provider.isConnectedToHMG ? LocaleKeys.connectedWithHmg.tr() : LocaleKeys.networkMustHMG.tr()).toText12(color: Colors.white), // child: (provider.isConnectedToHMG ? LocaleKeys.connectedWithHmg.tr() : LocaleKeys.networkMustHMG.tr()).toText12(color: Colors.white),
child: (provider.isConnectedToHMG ? "Connected With HMG" : "Network Must be HMG").toText12(color: Colors.white),
), ),
Container( Container(
padding: EdgeInsets.only(left: 21, right: 21, bottom: 21, top: widget.topPadding), padding: EdgeInsets.only(left: 21, right: 21, bottom: 21, top: widget.topPadding),
@ -112,15 +115,15 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, provider.isConnectedToHMG, () async { attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, provider.isConnectedToHMG, () async {
if (await provider.checkHmgNetworkConnectivity()) { if (await provider.checkHmgNetworkConnectivity()) {
if (isNfcLocationEnabled) { if (isNfcLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng, bool isMocked) { Location.getCurrentLocation((Position? latlng, bool isMocked) {
if (isMocked) { if (isMocked) {
markFakeAttendance("NFC", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "",provider: provider); markFakeAttendance("NFC", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "", provider: provider);
} else { } else {
performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "",provider: provider); performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "", provider: provider);
} }
}, context); }, context);
} else { } else {
performNfcAttendance(widget.model,provider: provider); performNfcAttendance(widget.model, provider: provider);
} }
} else { } else {
Utils.showToast("Please connect with the HMG internet to mark attendance"); Utils.showToast("Please connect with the HMG internet to mark attendance");
@ -130,15 +133,15 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, provider.isConnectedToHMG, () async { attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, provider.isConnectedToHMG, () async {
if (await provider.checkHmgNetworkConnectivity()) { if (await provider.checkHmgNetworkConnectivity()) {
if (isWifiLocationEnabled) { if (isWifiLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng, bool isMocked) { Location.getCurrentLocation((Position? latlng, bool isMocked) {
if (isMocked) { if (isMocked) {
markFakeAttendance("WIFI", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "",provider: provider); markFakeAttendance("WIFI", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "", provider: provider);
} else { } else {
performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "",provider: provider); performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "", provider: provider);
} }
}, context); }, context);
} else { } else {
performWifiAttendance(widget.model,provider: provider); performWifiAttendance(widget.model, provider: provider);
} }
} else { } else {
Utils.showToast("Please connect with the HMG internet to mark attendance"); Utils.showToast("Please connect with the HMG internet to mark attendance");
@ -148,18 +151,18 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
}), }),
if (isQrEnabled) if (isQrEnabled)
attendanceMethod("QR", "assets/images/ic_qr.svg", isQrEnabled, provider.isConnectedToHMG, () async { attendanceMethod("QR", "assets/images/ic_qr.svg", isQrEnabled, provider.isConnectedToHMG, () async {
if (isQrLocationEnabled) { // if (isQrLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng, bool isMocked) { // Location.getCurrentLocation((Position? latlng, bool isMocked) {
if (isMocked) { // if (isMocked) {
markFakeAttendance("QR", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "",provider: provider); // markFakeAttendance("QR", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "", provider: provider);
} else { // } else {
performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); // performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
} // }
}, context); // }, context);
} else { // } else {
performQrCodeAttendance(widget.model); // performQrCodeAttendance(widget.model);
} // }
// performQrCodeAttendance(model); performQrCodeAttendance(widget.model);
}), }),
], ],
) )
@ -233,7 +236,6 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
); );
provider.closeWifiRequest(); provider.closeWifiRequest();
} }
} catch (ex) { } catch (ex) {
print(ex); print(ex);
Utils.hideLoading(context); Utils.hideLoading(context);
@ -307,22 +309,39 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
), ),
); );
if (qrCodeValue != null) { if (qrCodeValue != null) {
Utils.showLoading(context); print("-----------f---");
try { print(qrCodeValue);
GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 1, isGpsRequired: isQrLocationEnabled, lat: lat, long: lng, QRValue: qrCodeValue); Utils.showToast(qrCodeValue);
bool status = await model.fetchAttendanceTracking(context); // Utils.showLoading(context);
Utils.hideLoading(context); checkLocalIP(qrCodeValue);
showMDialog( // try {
context, // GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 1, isGpsRequired: isQrLocationEnabled, lat: lat, long: lng, QRValue: qrCodeValue);
backgroundColor: Colors.transparent, // bool status = await model.fetchAttendanceTracking(context);
isDismissable: true, // Utils.hideLoading(context);
child: SuccessDialog(widget.isFromDashboard), // showMDialog(
); // context,
} catch (ex) { // backgroundColor: Colors.transparent,
print(ex); // isDismissable: true,
Utils.hideLoading(context); // child: SuccessDialog(widget.isFromDashboard),
Utils.handleException(ex, context, null); // );
} // } catch (ex) {
// print(ex);
// Utils.hideLoading(context);
// Utils.handleException(ex, context, null);
// }
}
}
void checkLocalIP(String qrValue) async {
Utils.showLoading(context);
try {
await DashboardApiClient().checkLocelIP(qrValue);
Utils.hideLoading(context);
Utils.confirmDialog(context, "Local Ip called");
} catch (ex) {
print(ex);
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
} }
} }

@ -46,7 +46,7 @@ dependencies:
local_auth: ^1.1.9 local_auth: ^1.1.9
fluttertoast: ^8.0.8 fluttertoast: ^8.0.8
syncfusion_flutter_calendar: ^19.4.48 syncfusion_flutter_calendar: ^19.4.48
# flutter_calendar_carousel: ^2.1.0 # flutter_calendar_carousel: ^2.1.0
pie_chart: ^5.1.0 pie_chart: ^5.1.0
shared_preferences: ^2.0.12 shared_preferences: ^2.0.12
firebase_messaging: ^13.0.4 firebase_messaging: ^13.0.4
@ -54,9 +54,9 @@ dependencies:
logger: ^1.1.0 logger: ^1.1.0
flutter_countdown_timer: ^4.1.0 flutter_countdown_timer: ^4.1.0
nfc_manager: ^3.2.0 nfc_manager: ^3.2.0
# uuid: ^3.0.6 # uuid: ^3.0.6
# device_info_plus: ^4.0.0 # device_info_plus: ^4.0.0
# android_id: ^0.1.3+1 # android_id: ^0.1.3+1
platform_device_id: ^1.0.1 platform_device_id: ^1.0.1
image_picker: ^0.8.5+3 image_picker: ^0.8.5+3
file_picker: ^4.6.1 file_picker: ^4.6.1
@ -66,21 +66,22 @@ dependencies:
open_file: ^3.2.1 open_file: ^3.2.1
wifi_iot: ^0.3.18 wifi_iot: ^0.3.18
flutter_html: ^3.0.0-alpha.6 flutter_html: ^3.0.0-alpha.6
# flutter_barcode_scanner: ^2.0.0 # flutter_barcode_scanner: ^2.0.0
qr_code_scanner: ^1.0.1 qr_code_scanner: ^1.0.1
# qr_flutter: ^4.0.0 # qr_flutter: ^4.0.0
url_launcher: ^6.0.15 url_launcher: ^6.0.15
share: 2.0.4 share: 2.0.4
flutter_rating_bar: ^4.0.1 flutter_rating_bar: ^4.0.1
auto_size_text: ^3.0.0 auto_size_text: ^3.0.0
pull_to_refresh: ^2.0.0 pull_to_refresh: ^2.0.0
# lottie json animations # lottie json animations
file: ^6.1.4
lottie: any lottie: any
# Marathon Card Swipe # Marathon Card Swipe
appinio_swiper: ^1.1.1 appinio_swiper: ^1.1.1
expandable: ^5.0.1 expandable: ^5.0.1
# networkImage # networkImage
cached_network_image: ^3.2.2 cached_network_image: ^3.2.2
#Chat #Chat
@ -101,11 +102,11 @@ dependencies:
video_player: ^2.5.1 video_player: ^2.5.1
just_audio: ^0.9.30 just_audio: ^0.9.30
# safe_device: ^1.1.2 # safe_device: ^1.1.2
flutter_layout_grid: ^2.0.1 flutter_layout_grid: ^2.0.1
#Huawei Dependencies #Huawei Dependencies
# huawei_hmsavailability: ^6.6.0+300 # huawei_hmsavailability: ^6.6.0+300
huawei_location: 6.0.0+302 huawei_location: 6.0.0+302
huawei_push: ^6.7.0+300 huawei_push: ^6.7.0+300
firebase_crashlytics: ^2.9.0 firebase_crashlytics: ^2.9.0
@ -114,7 +115,7 @@ dependencies:
carousel_slider: ^4.2.1 carousel_slider: ^4.2.1
#Huawei Specified #Huawei Specified
# store_checker: ^1.1.0 # store_checker: ^1.1.0
google_api_availability: ^3.0.1 google_api_availability: ^3.0.1

Loading…
Cancel
Save