|
|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
|
|
import 'package:mohem_flutter_app/api/api_client.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/api/api_mapper_class.dart';
|
|
|
|
|
@ -25,13 +26,21 @@ class LoginApiClient {
|
|
|
|
|
postParams["DeviceToken"] = deviceToken;
|
|
|
|
|
postParams["DeviceType"] = deviceType;
|
|
|
|
|
return await ApiClient().postJsonForObject((json) {
|
|
|
|
|
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
|
|
|
|
return (responseData.mohemmGetMobileLoginInfoList?.length ?? 0) > 0 ? (responseData.mohemmGetMobileLoginInfoList!.first) : null;
|
|
|
|
|
// 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;
|
|
|
|
|
return modelData;
|
|
|
|
|
}, url, postParams);
|
|
|
|
|
|
|
|
|
|
// dynamic response = await ApiClient().postJsonForObject((json) => json, url, postParams, token: AppState().postParamsObject!.tokenID);
|
|
|
|
|
// ApiResponse res = ApiResponse.fromJson(response);
|
|
|
|
|
// dynamic ress = await ApiClassMapper().handleApiEndpoint(endpoint: "Mohemm_GetMobileLoginInfo_NEW", jsonData: res.data);
|
|
|
|
|
// return ress;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<bool?> insertMobileLoginInfoNEW(
|
|
|
|
|
String email, int sessionId, String employeeName, int loginType, String mobileNumber, String userName, String deviceToken, String deviceType) async {
|
|
|
|
|
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";
|
|
|
|
|
Map<String, dynamic> postParams = {
|
|
|
|
|
@ -51,11 +60,10 @@ class LoginApiClient {
|
|
|
|
|
dynamic response = await ApiClient().postJsonForObject((json) => json, url, postParams, token: AppState().postParamsObject!.tokenID);
|
|
|
|
|
ApiResponse res = ApiResponse.fromJson(response);
|
|
|
|
|
dynamic ress = await ApiClassMapper().handleApiEndpoint(endpoint: "Mohemm_Insert_MobileDeviceInfo", jsonData: res);
|
|
|
|
|
if(ress == true){
|
|
|
|
|
if (ress == true) {
|
|
|
|
|
AppState().setLogged = true;
|
|
|
|
|
}
|
|
|
|
|
return ress;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<CheckMobileAppVersionModel?> checkMobileAppVersion() async {
|
|
|
|
|
@ -110,7 +118,10 @@ class LoginApiClient {
|
|
|
|
|
String url = "${ApiConsts.authRest}Get_BasicUserInformation";
|
|
|
|
|
Map<String, dynamic> postParams = {"P_APP_VERSION": pAppVersion, "P_USER_NAME": pUsername};
|
|
|
|
|
postParams.addAll(AppState().postParamsJson);
|
|
|
|
|
return await ApiClient().postJsonForObject((json) => GenericResponseModel.fromJson(json).basicMemberInformation, url, postParams);
|
|
|
|
|
dynamic response = await ApiClient().postJsonForObject((json) => json, url, postParams);
|
|
|
|
|
ApiResponse res = ApiResponse.fromJson(response);
|
|
|
|
|
return await ApiClassMapper().handleApiEndpoint(endpoint: "Get_BasicUserInformation", jsonData: res.data);
|
|
|
|
|
// return await ApiClient().postJsonForObject((json) => GenericResponseModel.fromJson(json).basicMemberInformation, url, postParams);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<GenericResponseModel?> sendPublicActivationCode(String? mobileNumber, String? pUsername) async {
|
|
|
|
|
|