Updates & fixes

merge-requests/110/head
haroon amjad 3 years ago
parent 3b6f3f5c4f
commit 660fdb63dd

@ -513,5 +513,6 @@
"ourSponsor": "راعينا:",
"startingIn": "يبدأ في",
"youAreOutOfContest": "أنت خارج المسابقة.",
"winners": "الفائزين!!!"
"winners": "الفائزين!!!",
"fakeLocation": ".لقد تتبعنا أنك تحاول استخدام موقع مزيف! يعتبر هذا مخالفة وقد تم إخطار الموارد البشرية"
}

@ -513,6 +513,6 @@
"ourSponsor": "Our Sponsor:",
"startingIn": "Starting in",
"youAreOutOfContest": "You are out of the contest.",
"winners": "WINNERS!!!"
"winners": "WINNERS!!!",
"fakeLocation": "We traced out that you try to use a fake location! This is considered a violation, and HR has been notified."
}

@ -133,6 +133,28 @@ class DashboardApiClient {
}, url, postParams);
}
//Mark Fake Location
Future<GenericResponseModel?> markFakeLocation({String lat = "0", String? long = "0", required String sourceName}) async {
String url = "${ApiConsts.swpRest}CreateIssueInfo";
var uuid = Uuid();
// Generate a v4 (random) id
Map<String, dynamic> postParams = {
"UID": uuid.v4(), //Mobile Id
"Latitude": lat,
"Longitude": long,
"QRValue": '',
"NFCValue": sourceName == 'NFC' ? sourceName : '',
"WifiValue": sourceName == 'WIFI' ? sourceName : '',
"EmployeeID": AppState().memberInformationList!.eMPLOYEENUMBER,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
return responseData;
}, url, postParams);
}
//Check ITG Type
Future<MohemmItgResponseItem?> getITGPageNotification() async {
String url = "${ApiConsts.cocRest}Mohemm_ITG_GetPageNotification";

@ -2,9 +2,9 @@ import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart';
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://erptstapp.srca.org.sa"; // SRCA 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/";

@ -528,7 +528,9 @@ class CodegenLoader extends AssetLoader{
"youWantToLeaveMarathon": "هل أنت متأكد أنك تريد العودة؟ سوف تخرج من المسابقة.",
"ourSponsor": "راعينا:",
"startingIn": "يبدأ في",
"youAreOutOfContest": "أنت خارج المسابقة."
"youAreOutOfContest": "أنت خارج المسابقة.",
"winners": "الفائزين!!!",
"fakeLocation": ".لقد تتبعنا أنك تحاول استخدام موقع مزيف! يعتبر هذا مخالفة وقد تم إخطار الموارد البشرية"
};
static const Map<String,dynamic> en_US = {
"mohemm": "Mohemm",
@ -1044,7 +1046,9 @@ static const Map<String,dynamic> en_US = {
"youWantToLeaveMarathon": "Are you sure you want to go back? You will be out of the contest.",
"ourSponsor": "Our Sponsor:",
"startingIn": "Starting in",
"youAreOutOfContest": "You are out of the contest."
"youAreOutOfContest": "You are out of the contest.",
"winners": "WINNERS!!!",
"fakeLocation": "We traced out that you try to use a fake location! This is considered a violation, and HR has been notified."
};
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
}

@ -500,5 +500,6 @@ abstract class LocaleKeys {
static const startingIn = 'startingIn';
static const youAreOutOfContest = 'youAreOutOfContest';
static const winners = 'winners';
static const fakeLocation = 'fakeLocation';
}

@ -436,6 +436,12 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
case "DELEGATE":
returnActionImage = "assets/images/delegate.svg";
break;
case "APPROVE":
returnActionImage = "assets/images/worklist/approve.svg";
break;
case "REJECT":
returnActionImage = "assets/images/worklist/reject.svg";
break;
case "REQUEST_INFO":
returnActionImage = "assets/images/request_info.svg";
break;

@ -46,12 +46,12 @@ class Location {
});
}
static void getCurrentLocation(Function(LatLng?) callback, BuildContext context) {
static void getCurrentLocation(Function(LatLng?, bool isMocked) callback, BuildContext context) {
void done(Position position) {
//AppStorage.sp.saveLocation(position);
bool isMocked = position.isMocked;
LatLng? myCurrentLocation = LatLng(position.latitude, position.longitude);
callback(myCurrentLocation);
callback(myCurrentLocation, isMocked);
}
AppPermissions.location((granted) {

@ -94,8 +94,12 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
// if (isNfcEnabled)
attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () {
if (isNfcLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng) {
performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
Location.getCurrentLocation((LatLng? latlng, bool isMocked) {
if (isMocked) {
markFakeAttendance("NFC", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "");
} else {
performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
}
}, context);
} else {
performNfcAttendance(widget.model);
@ -104,8 +108,12 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
if (isWifiEnabled)
attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, () {
if (isWifiLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng) {
performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
Location.getCurrentLocation((LatLng? latlng, bool isMocked) {
if (isMocked) {
markFakeAttendance("WIFI", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "");
} else {
performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
}
}, context);
} else {
performWifiAttendance(widget.model);
@ -115,8 +123,12 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
if (isQrEnabled)
attendanceMethod("QR", "assets/images/ic_qr.svg", isQrEnabled, () async {
if (isQrLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng) {
performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
Location.getCurrentLocation((LatLng? latlng, bool isMocked) {
if (isMocked) {
markFakeAttendance("QR", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "");
} else {
performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
}
}, context);
} else {
performQrCodeAttendance(widget.model);
@ -136,7 +148,7 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
Utils.showLoading(context);
try {
GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId, isGpsRequired: isNfcLocationEnabled, lat: lat, long: lng);
if(g?.messageStatus != 1) {
if (g?.messageStatus != 1) {
Utils.hideLoading(context);
showDialog(
context: context,
@ -157,7 +169,6 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
child: SuccessDialog(widget.isFromDashboard),
);
}
} catch (ex) {
print(ex);
Utils.hideLoading(context);
@ -171,7 +182,7 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
Utils.showLoading(context);
try {
GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId ?? "", isGpsRequired: isNfcLocationEnabled, lat: lat, long: lng);
if(g?.messageStatus != 1) {
if (g?.messageStatus != 1) {
Utils.hideLoading(context);
showDialog(
context: context,
@ -276,6 +287,21 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
}
}
void markFakeAttendance(String sourceName, String lat, String long) async {
Utils.showLoading(context);
try {
await DashboardApiClient().markFakeLocation(sourceName: sourceName, lat: lat, long: long);
Utils.hideLoading(context);
Utils.confirmDialog(context, LocaleKeys.fakeLocation.tr());
} catch (ex) {
print(ex);
Utils.hideLoading(context);
Utils.handleException(ex, context, (msg) {
Utils.confirmDialog(context, msg);
});
}
}
Widget attendanceMethod(String title, String image, bool isEnabled, VoidCallback onPress) => Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),

Loading…
Cancel
Save