|
|
|
|
@ -26,9 +26,9 @@ class LoginApiClient {
|
|
|
|
|
Map<String, dynamic> postParams = {};
|
|
|
|
|
postParams["DeviceToken"] = deviceToken;
|
|
|
|
|
postParams["DeviceType"] = deviceType;
|
|
|
|
|
// return await ApiClient().postJsonForObject((json) {
|
|
|
|
|
// GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
|
|
|
|
// print(jsonDecode(json["data"].first));
|
|
|
|
|
// return await ApiClient().postJsonForObject((json) {
|
|
|
|
|
// GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
|
|
|
|
// print(jsonDecode(json["data"].first));
|
|
|
|
|
// GetMobileLoginInfoListModel? modelData= GetMobileLoginInfoListModel.fromRawJson(jsonDecode(json["data"].first));
|
|
|
|
|
// print("getMobileLoginInfoNEW: ${modelData.toJson()}");
|
|
|
|
|
// // return (responseData.mohemmGetMobileLoginInfoList?.length ?? 0) > 0 ? (responseData.mohemmGetMobileLoginInfoList!.first) : null;
|
|
|
|
|
@ -43,7 +43,7 @@ class LoginApiClient {
|
|
|
|
|
|
|
|
|
|
Future<bool?> insertMobileLoginInfoNEW(String email, int sessionId, String employeeName, int loginType, String mobileNumber, String userName, String deviceToken, String deviceType) async {
|
|
|
|
|
//String url = "${ApiConsts.authRest}Mohemm_Insert_MobileDeviceInfo";
|
|
|
|
|
String url = "${ApiConsts.authRest}Mohemm_InsertMobileLoginInfo";
|
|
|
|
|
String url = "${ApiConsts.authRest}Mohemm_InsertMobileLoginInfo";
|
|
|
|
|
Map<String, dynamic> postParams = {
|
|
|
|
|
"MobileNumber": mobileNumber,
|
|
|
|
|
"p_USER_NAME": userName,
|
|
|
|
|
@ -53,7 +53,8 @@ class LoginApiClient {
|
|
|
|
|
"loginType": loginType,
|
|
|
|
|
"employeeName": employeeName,
|
|
|
|
|
"p_EMAIL_ADDRESS": email,
|
|
|
|
|
"gender": 1, //todo
|
|
|
|
|
"gender":1, //todo
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
postParams["deviceToken"] = deviceToken;
|
|
|
|
|
postParams["deviceType"] = deviceType;
|
|
|
|
|
@ -67,19 +68,19 @@ class LoginApiClient {
|
|
|
|
|
return ress;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<ApiResponse?> checkMobileAppVersion() async {
|
|
|
|
|
Future<CheckMobileAppVersionModel?> checkMobileAppVersion() async {
|
|
|
|
|
String url = "${ApiConsts.authRest}CheckMobileAppVersion";
|
|
|
|
|
Map<String, dynamic> postParams = {};
|
|
|
|
|
postParams.addAll(AppState().postParamsJson);
|
|
|
|
|
dynamic response = await ApiClient().postJsonForObject((json) => json, url, postParams, returnJsonData: false);
|
|
|
|
|
return ApiResponse.fromJson(response);
|
|
|
|
|
|
|
|
|
|
// if (res.data == null || res.data!.isEmpty) {
|
|
|
|
|
// return CheckMobileAppVersionModel(data: ""); // Handle the case where response data is null
|
|
|
|
|
// } else {
|
|
|
|
|
// CheckMobileAppVersionModel result = await ApiClassMapper().handleApiEndpoint(endpoint: "CheckMobileAppVersion", jsonData: response);
|
|
|
|
|
ApiResponse res = ApiResponse.fromJson(response);
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
if (res.data == null || res.data!.isEmpty) {
|
|
|
|
|
return CheckMobileAppVersionModel(data: ""); // Handle the case where response data is null
|
|
|
|
|
} else {
|
|
|
|
|
CheckMobileAppVersionModel res = await ApiClassMapper().handleApiEndpoint(endpoint: "CheckMobileAppVersion", jsonData: response.data);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<MemberLoginListModel> memberLogin(String username, String password) async {
|
|
|
|
|
@ -114,7 +115,7 @@ class LoginApiClient {
|
|
|
|
|
postParams["logInTokenID"] = AppState().postParamsObject?.getLogInTokenID;
|
|
|
|
|
dynamic response = await ApiClient().postJsonForObject((json) => json, url, postParams);
|
|
|
|
|
ApiResponse res = ApiResponse.fromJson(response);
|
|
|
|
|
AppState().isLogged = true;
|
|
|
|
|
AppState().isLogged =true;
|
|
|
|
|
return await ApiClassMapper().handleApiEndpoint(endpoint: "CheckActivationCode", jsonData: res.data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -130,16 +131,12 @@ class LoginApiClient {
|
|
|
|
|
|
|
|
|
|
Future<GenericResponseModel?> sendPublicActivationCode(String? mobileNumber, String? pUsername) async {
|
|
|
|
|
String url = "${ApiConsts.authRest}SendPublicActivationCode"; // todo @zahoor, not found in swagger
|
|
|
|
|
Map<String, dynamic> postParams = {
|
|
|
|
|
"mobileNumber": mobileNumber,
|
|
|
|
|
"p_MOBILE_NUMBER": mobileNumber,
|
|
|
|
|
"p_USER_NAME": pUsername,
|
|
|
|
|
};
|
|
|
|
|
Map<String, dynamic> postParams = {"mobileNumber": mobileNumber, "p_MOBILE_NUMBER": mobileNumber, "p_USER_NAME": pUsername, };
|
|
|
|
|
postParams.addAll(AppState().postParamsJson);
|
|
|
|
|
return await ApiClient().postJsonForObject((json) {
|
|
|
|
|
ApiResponse res = ApiResponse.fromJson(json);
|
|
|
|
|
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
|
|
|
|
|
AppState().postParamsObject?.setLogInTokenID = res.data['logInTokenID'] ?? AppState().postParamsObject?.getLogInTokenID;
|
|
|
|
|
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
|
|
|
|
|
AppState().postParamsObject?.setLogInTokenID = res.data['logInTokenID'] ?? AppState().postParamsObject?.getLogInTokenID;
|
|
|
|
|
AppState().postParamsObject?.setTokenID = res.data['logInTokenID'];
|
|
|
|
|
return responseData;
|
|
|
|
|
}, url, postParams);
|
|
|
|
|
|