Compare commits

...

3 Commits

Author SHA1 Message Date
haroon amjad 162e1102b5 Merge branch 'master_mohemm_flutter'
# Conflicts:
#	lib/app_state/app_state.dart
#	pubspec.yaml
1 year ago
haroon amjad f09f08be82 Store update to version 6.0 1 year ago
Sultan khan c7a4e4023e error code 699 fixes 1 year ago

@ -16,13 +16,14 @@ class APIError {
int? errorCode;
int? errorType;
String? errorMessage;
APIError(this.errorCode, this.errorMessage, this.errorType);
int? errorStatusCode;
APIError(this.errorCode, this.errorMessage, this.errorType, this.errorStatusCode);
Map<String, dynamic> toJson() => {
'errorCode': errorCode,
'errorMessage': errorMessage,
'errorType': errorType,
'ErrorStatusCode': errorStatusCode
};
@override
@ -38,14 +39,14 @@ APIException _throwAPIException(Response response) {
if (response.body != null && response.body.isNotEmpty) {
var jsonError = jsonDecode(response.body);
print(jsonError);
apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage'], jsonError['ErrorType']);
apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage'], jsonError['ErrorType'], jsonError['ErrorStatusCode']);
}
return APIException(APIException.BAD_REQUEST, error: apiError);
case 400:
APIError? apiError;
if (response.body != null && response.body.isNotEmpty) {
var jsonError = jsonDecode(response.body);
apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage'], jsonError['ErrorType']);
apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage'], jsonError['ErrorType'],jsonError['ErrorStatusCode']);
}
return APIException(APIException.BAD_REQUEST, error: apiError);
case 401:
@ -96,7 +97,7 @@ class ApiClient {
return factoryConstructor(jsonData);
} else {
APIError? apiError;
apiError = APIError(jsonData['ErrorCode'], jsonData['ErrorEndUserMessage'], jsonData['ErrorType'] ?? 0);
apiError = APIError(jsonData['ErrorCode'], jsonData['ErrorEndUserMessage'], jsonData['ErrorType'] ?? 0, jsonData['ErrorStatusCode']);
throw APIException(APIException.BAD_REQUEST, error: apiError);
}
} catch (ex) {
@ -146,7 +147,7 @@ class ApiClient {
}
var response = await _post(Uri.parse(url), body: requestBody, headers: _headers).timeout(Duration(seconds: 120));
if (response.statusCode >= 200 && response.statusCode < 300) {
if (response. statusCode >= 200 && response.statusCode < 300) {
return response;
} else {
throw _throwAPIException(response);

@ -106,7 +106,7 @@ class DashboardApiClient {
}
//Mark Attendance
Future<GenericResponseModel?> markAttendance({String lat = "0", String? long = "0", required int pointType, String nfcValue = "", bool isGpsRequired = false, String QRValue = ""}) async {
Future<GenericResponseModel?> markAttendance({String lat = "0", String? long = "0", required int pointType, String nfcValue = "", bool isGpsRequired = false, String QRValue = "", String payrollCode = ""}) async {
String url = "${ApiConsts.swpRest}AuthenticateAndSwipeUserSupportNFC";
var uuid = Uuid();
// Generate a v4 (random) id
@ -120,7 +120,8 @@ class DashboardApiClient {
"PointType": pointType, // NFC=2, Wifi = 3, QR= 1,
"NFCValue": nfcValue,
"WifiValue": pointType == 3 ? "100" : "",
"IsGpsRequired": isGpsRequired
"IsGpsRequired": isGpsRequired,
"PayrollCodeStr": AppState().postParamsObject?.payrollCodeStr.toString() ?? ""
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {

@ -90,7 +90,7 @@ class AppState {
String get getHuaweiPushToken => _huaweiPushToken;
final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 33, versionID: 5.9, mobileType: Platform.isAndroid ? "android" : "ios");
final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 33, versionID: 6.0, mobileType: Platform.isAndroid ? "android" : "ios");
void setPostParamsInitConfig() {
isAuthenticated = false;

@ -4,10 +4,12 @@ class ApiConsts {
// static String baseUrl = "http://10.200.204.11"; // Local server
// static String baseUrl = "https://erptstapp.srca.org.sa"; // SRCA server
// static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver
// static String baseUrl = "http://10.201.204.101:2024";
// static String baseUrl = "https://webservices.hmg.com"; // PreProd
// static String baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrl = "https://mohemm.hmg.com"; // New Live 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/";

@ -390,6 +390,15 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
}
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
dynamic errorCode = ex;
if(errorCode.error.errorStatusCode ==699){
Future.delayed(const Duration(seconds: 2), ()
{
Navigator.pop(context);
Navigator.pushNamedAndRemoveUntil(
context, AppRoutes.login, (Route<dynamic> route) => false);
});
}
}
}

@ -654,6 +654,15 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
otpFieldClear.value = "";
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
dynamic errorCode = ex;
if(errorCode.error.errorStatusCode ==699){
Future.delayed(const Duration(seconds: 2), ()
{
Navigator.pop(context);
Navigator.pushNamedAndRemoveUntil(
context, AppRoutes.login, (Route<dynamic> route) => false);
});
}
}
},
() => {

Loading…
Cancel
Save