pushed new API

pull/3/head
faizatflutter 2 months ago
parent 357cf4392e
commit 45e868adba

@ -279,10 +279,14 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
@ -296,10 +300,14 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
@ -451,7 +459,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = 3A359E86ZF;
DEVELOPMENT_TEAM = ZB3P5B74MA;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
@ -633,7 +641,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = 3A359E86ZF;
DEVELOPMENT_TEAM = ZB3P5B74MA;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
@ -658,7 +666,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = 3A359E86ZF;
DEVELOPMENT_TEAM = ZB3P5B74MA;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;

@ -1,12 +1,13 @@
import 'package:dartz/dartz.dart';
import 'package:hmg_patient_app_new/core/api/api_client.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_exception.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
import 'package:hmg_patient_app_new/features/authentication/models/select_device_by_imei.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
import 'package:http/http.dart';
abstract class AuthenticationRepo {
Future<Either<Failure, dynamic>> signIn({required String phone, required String password});
Future<Either<Failure, SelectDeviceByImeiRespModelElement?>> selectDeviceByImei({required String deviceIMEI});
}
class AuthenticationRepoImp implements AuthenticationRepo {
@ -16,28 +17,14 @@ class AuthenticationRepoImp implements AuthenticationRepo {
AuthenticationRepoImp({required this.loggerService, required this.apiClient});
@override
Future<Either<Failure, dynamic>> signIn({required String phone, required String password}) async {
try {
// Mock API call with delayed response
final result = await Future.delayed(
const Duration(seconds: 2),
() => {
'success': true,
'data': [
{
'id': '1',
'name': 'Dr. Ahmed Hassan',
'specialty': 'Cardiology',
'experience': '10 years',
'rating': 4.8,
'image': 'https://example.com/doctor1.jpg'
},
]
}
);
Future<Either<Failure, SelectDeviceByImeiRespModelElement?>> selectDeviceByImei({required String deviceIMEI}) async {
final mapDevice = {"": deviceIMEI};
if (result != null && result is Map && result['success'] != null && result['success'] != null && result['success'] != false) {
return Right(result);
final String apiUrl = "https://hmgwebservices.com/Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI" ;
try {
final Response result = await apiClient.postJsonForResponse(apiUrl, mapDevice);
if (result !=null) {
return Right(null);
} else {
loggerService.errorLogs(result.toString());
return Left(ServerFailure(result.toString()));
@ -54,6 +41,4 @@ class AuthenticationRepoImp implements AuthenticationRepo {
return Left(ServerFailure(e.toString()));
}
}
}
}

@ -7,6 +7,8 @@ class AuthenticationViewModel extends ChangeNotifier {
AuthenticationViewModel({required this.authenticationRepo});
Future<void> signUp({
required String phone,
required String password,
@ -14,13 +16,12 @@ class AuthenticationViewModel extends ChangeNotifier {
Function(String)? onError,
}) async {
Utils.showLoading();
final resultEither = await authenticationRepo.signIn(
phone: phone,
password: password,
);
final String deviceIMEI =
"cIkkB7h7Q7uoFkC4Qv82xG:APA91bEb53Z9XzqymCIctaLxCoMX6bm9fuKlWILQ59uUqfwhCoD42AOP1-jWGB1WYd9BVN5PT2pUUFxrT07vcNg1KH9OH39mrPgCl0m21XVIgWrzNnCkufg";
if (resultEither.isLeft()) {
final resultEither = await authenticationRepo.selectDeviceByImei(deviceIMEI: deviceIMEI);
if (resultEither.isLeft()) {
}
@ -37,7 +38,7 @@ class AuthenticationViewModel extends ChangeNotifier {
if (onError != null) onError(failure.message);
},
(data) {
Utils.hideLoading();
notifyListeners();
if (onSuccess != null) onSuccess(data);
},

@ -48,21 +48,21 @@ class GetPatientLastLoginDetailsResponseModel {
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ID'] = this.iD;
data['IMEI'] = this.iMEI;
data['LogInType'] = this.logInType;
data['PatientID'] = this.patientID;
data['OutSA'] = this.outSA;
data['Mobile'] = this.mobile;
data['IdentificationNo'] = this.identificationNo;
data['Name'] = this.name;
data['NameN'] = this.nameN;
data['CreatedOn'] = this.createdOn;
data['EditedOn'] = this.editedOn;
data['BiometricEnabled'] = this.biometricEnabled;
data['PatientType'] = this.patientType;
data['PreferredLanguage'] = this.preferredLanguage;
final Map<String, dynamic> data = <String, dynamic>{};
data['ID'] = iD;
data['IMEI'] = iMEI;
data['LogInType'] = logInType;
data['PatientID'] = patientID;
data['OutSA'] = outSA;
data['Mobile'] = mobile;
data['IdentificationNo'] = identificationNo;
data['Name'] = name;
data['NameN'] = nameN;
data['CreatedOn'] = createdOn;
data['EditedOn'] = editedOn;
data['BiometricEnabled'] = biometricEnabled;
data['PatientType'] = patientType;
data['PreferredLanguage'] = preferredLanguage;
return data;
}
}

@ -0,0 +1,77 @@
// To parse this JSON data, do
//
// final selectDeviceByImeiRespModel = selectDeviceByImeiRespModelFromJson(jsonString);
import 'dart:convert';
Map<String, dynamic> selectDeviceByImeiRespModelFromJson(String str) => Map.from(json.decode(str)).map((k, v) => MapEntry<String, dynamic>(k, v));
String selectDeviceByImeiRespModelToJson(Map<String, dynamic> data) => json.encode(Map.from(data).map((k, v) => MapEntry<String, dynamic>(k, v)));
class SelectDeviceByImeiRespModelElement {
int id;
String imei;
int logInType;
int patientId;
bool outSa;
String mobile;
String identificationNo;
String name;
String nameN;
String createdOn;
String editedOn;
bool biometricEnabled;
int patientType;
int preferredLanguage;
SelectDeviceByImeiRespModelElement({
required this.id,
required this.imei,
required this.logInType,
required this.patientId,
required this.outSa,
required this.mobile,
required this.identificationNo,
required this.name,
required this.nameN,
required this.createdOn,
required this.editedOn,
required this.biometricEnabled,
required this.patientType,
required this.preferredLanguage,
});
factory SelectDeviceByImeiRespModelElement.fromJson(Map<String, dynamic> json) => SelectDeviceByImeiRespModelElement(
id: json["ID"],
imei: json["IMEI"],
logInType: json["LogInType"],
patientId: json["PatientID"],
outSa: json["OutSA"],
mobile: json["Mobile"],
identificationNo: json["IdentificationNo"],
name: json["Name"],
nameN: json["NameN"],
createdOn: json["CreatedOn"],
editedOn: json["EditedOn"],
biometricEnabled: json["BiometricEnabled"],
patientType: json["PatientType"],
preferredLanguage: json["PreferredLanguage"],
);
Map<String, dynamic> toJson() => {
"ID": id,
"IMEI": imei,
"LogInType": logInType,
"PatientID": patientId,
"OutSA": outSa,
"Mobile": mobile,
"IdentificationNo": identificationNo,
"Name": name,
"NameN": nameN,
"CreatedOn": createdOn,
"EditedOn": editedOn,
"BiometricEnabled": biometricEnabled,
"PatientType": patientType,
"PreferredLanguage": preferredLanguage,
};
}
Loading…
Cancel
Save