pushed new API

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

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

@ -1,12 +1,13 @@
import 'package:dartz/dartz.dart'; import 'package:dartz/dartz.dart';
import 'package:hmg_patient_app_new/core/api/api_client.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_exception.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_failure.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:hmg_patient_app_new/services/logger_service.dart';
import 'package:http/http.dart';
abstract class AuthenticationRepo { 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 { class AuthenticationRepoImp implements AuthenticationRepo {
@ -16,28 +17,14 @@ class AuthenticationRepoImp implements AuthenticationRepo {
AuthenticationRepoImp({required this.loggerService, required this.apiClient}); AuthenticationRepoImp({required this.loggerService, required this.apiClient});
@override @override
Future<Either<Failure, dynamic>> signIn({required String phone, required String password}) async { Future<Either<Failure, SelectDeviceByImeiRespModelElement?>> selectDeviceByImei({required String deviceIMEI}) async {
try { final mapDevice = {"": deviceIMEI};
// 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'
},
]
}
);
if (result != null && result is Map && result['success'] != null && result['success'] != null && result['success'] != false) { final String apiUrl = "https://hmgwebservices.com/Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI" ;
return Right(result); try {
final Response result = await apiClient.postJsonForResponse(apiUrl, mapDevice);
if (result !=null) {
return Right(null);
} else { } else {
loggerService.errorLogs(result.toString()); loggerService.errorLogs(result.toString());
return Left(ServerFailure(result.toString())); return Left(ServerFailure(result.toString()));
@ -54,6 +41,4 @@ class AuthenticationRepoImp implements AuthenticationRepo {
return Left(ServerFailure(e.toString())); return Left(ServerFailure(e.toString()));
} }
} }
}
}

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

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