import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:flutter/cupertino.dart'; import '../models/user_model.dart'; const LOGIN_URL = 'Sentry.svc/REST/MemberLogIN_New'; const INSERT_DEVICE_IMEI = 'Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI'; const SELECT_DEVICE_IMEI = 'Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI'; const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE = 'Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType'; const MEMBER_CHECK_ACTIVATION_CODE_NEW = 'Sentry.svc/REST/MemberCheckActivationCode_New'; const GET_DOC_PROFILES = 'Doctors.svc/REST/GetDocProfiles'; class AuthProvider with ChangeNotifier { Future login(UserModel userInfo) async { try { dynamic localRes; await BaseAppClient.post(LOGIN_URL, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { throw error; }, body: { "UserID": userInfo.UserID, "Password": userInfo.Password, "ProjectID": userInfo.ProjectID, "LanguageID": userInfo.LanguageID, "IPAdress": userInfo.IPAdress, "VersionID": userInfo.VersionID, "Channel": userInfo.Channel, "SessionID": userInfo.SessionID }); return Future.value(localRes); } catch (error) { print(error); throw error; } } Future insertDeviceImei(imei) async { try { dynamic localRes; await BaseAppClient.post(INSERT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { throw error; }, body: imei); return Future.value(localRes); } catch (error) { print(error); throw error; } } Future selectDeviceImei(imei) async { try { dynamic localRes; await BaseAppClient.post(SELECT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { throw error; }, body: imei); return Future.value(localRes); } catch (error) { print(error); throw error; } } Future sendActivationCodeByOtpNotificationType( activationCodeModel) async { try { var localRes; await BaseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { throw error; }, body: activationCodeModel); return Future.value(localRes); } catch (error) { print(error); throw error; } } Future memberCheckActivationCodeNew(activationCodeModel) async { try { dynamic localRes; await BaseAppClient.post(MEMBER_CHECK_ACTIVATION_CODE_NEW, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { throw error; }, body: activationCodeModel); return Future.value(localRes); } catch (error) { print(error); throw error; } } /* *@author: Elham Rababah *@Date:17/5/2020 *@param: docInfo *@return:Future *@desc: getDocProfiles */ Future getDocProfiles(docInfo) async { try { dynamic localRes; await BaseAppClient.post(GET_DOC_PROFILES, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { throw error; }, body: docInfo); return Future.value(localRes); } catch (error) { print(error); throw error; } } }