|
|
|
|
@ -1,86 +1,108 @@
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
import 'package:doctor_app_flutter/client/app_client.dart';
|
|
|
|
|
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 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 MEMBER_CHECK_ACTIVATION_CODE_NEW =
|
|
|
|
|
'Sentry.svc/REST/MemberCheckActivationCode_New';
|
|
|
|
|
const GET_DOC_PROFILES = 'Doctors.svc/REST/GetDocProfiles';
|
|
|
|
|
class AuthProvider with ChangeNotifier {
|
|
|
|
|
Future<Map> login(UserModel userInfo) async {
|
|
|
|
|
const url = LOGIN_URL;
|
|
|
|
|
|
|
|
|
|
class AuthProvider with ChangeNotifier {
|
|
|
|
|
Future<dynamic> login(UserModel userInfo) async {
|
|
|
|
|
try {
|
|
|
|
|
final response = await AppClient.post(url,
|
|
|
|
|
body: json.encode({
|
|
|
|
|
"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(json.decode(response.body));
|
|
|
|
|
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<Map> insertDeviceImei(imei) async {
|
|
|
|
|
const url = INSERT_DEVICE_IMEI;
|
|
|
|
|
|
|
|
|
|
Future<dynamic> insertDeviceImei(imei) async {
|
|
|
|
|
try {
|
|
|
|
|
final response = await AppClient.post(url, body: json.encode(imei));
|
|
|
|
|
return Future.value(json.decode(response.body));
|
|
|
|
|
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<Map> selectDeviceImei(imei) async {
|
|
|
|
|
const url = SELECT_DEVICE_IMEI;
|
|
|
|
|
|
|
|
|
|
Future<dynamic> selectDeviceImei(imei) async {
|
|
|
|
|
try {
|
|
|
|
|
final response = await AppClient.post(url, body: json.encode(imei));
|
|
|
|
|
return Future.value(json.decode(response.body));
|
|
|
|
|
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<Map> sendActivationCodeByOtpNotificationType(
|
|
|
|
|
Future sendActivationCodeByOtpNotificationType(
|
|
|
|
|
activationCodeModel) async {
|
|
|
|
|
const url = SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
final response = await AppClient.post(url, body: json.encode(activationCodeModel));
|
|
|
|
|
return Future.value(json.decode(response.body));
|
|
|
|
|
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<Map> memberCheckActivationCodeNew(activationCodeModel) async {
|
|
|
|
|
const url = MEMBER_CHECK_ACTIVATION_CODE_NEW;
|
|
|
|
|
|
|
|
|
|
Future<dynamic> memberCheckActivationCodeNew(activationCodeModel) async {
|
|
|
|
|
try {
|
|
|
|
|
final response = await AppClient.post(url, body: json.encode(activationCodeModel));
|
|
|
|
|
return Future.value(json.decode(response.body));
|
|
|
|
|
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;
|
|
|
|
|
@ -94,12 +116,16 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
|
*@return:Future<Map>
|
|
|
|
|
*@desc: getDocProfiles
|
|
|
|
|
*/
|
|
|
|
|
Future<Map> getDocProfiles(docInfo) async {
|
|
|
|
|
const url = GET_DOC_PROFILES;
|
|
|
|
|
|
|
|
|
|
Future<dynamic> getDocProfiles(docInfo) async {
|
|
|
|
|
try {
|
|
|
|
|
final response = await AppClient.post(url, body: json.encode(docInfo));
|
|
|
|
|
return Future.value(json.decode(response.body));
|
|
|
|
|
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;
|
|
|
|
|
|