Merge branch 'elham' into 'development'

Elham

See merge request Cloud_Solution/doctor_app_flutter!134
merge-requests/135/head
Elham 6 years ago
commit c35c6f7444

@ -20,19 +20,18 @@ const GET_DOC_PROFILES = 'Doctors.svc/REST/GetDocProfiles';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED }
class AuthProvider with ChangeNotifier { class AuthProvider with ChangeNotifier {
List <ClinicModel>doctorsClinicList=[]; List<ClinicModel> doctorsClinicList = [];
bool isLogin= false; String selectedClinicName;
bool isLogin = false;
bool isLoading = true; bool isLoading = true;
AuthProvider(){ AuthProvider() {
getUserAuthentication(); getUserAuthentication();
} }
void getUserAuthentication() async{ void getUserAuthentication() async {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if(profile != null) if (profile != null) {
{
isLoading = false; isLoading = false;
isLogin = true; isLogin = true;
} else { } else {
@ -41,17 +40,19 @@ class AuthProvider with ChangeNotifier {
} }
notifyListeners(); notifyListeners();
} }
APP_STATUS get stutas { APP_STATUS get stutas {
if (isLoading) { if (isLoading) {
return APP_STATUS.LOADING; return APP_STATUS.LOADING;
} else{ } else {
if ( this.isLogin) { if (this.isLogin) {
return APP_STATUS.AUTHENTICATED; return APP_STATUS.AUTHENTICATED;
} else { } else {
return APP_STATUS.UNAUTHENTICATED; return APP_STATUS.UNAUTHENTICATED;
} }
} }
} }
Future<dynamic> login(UserModel userInfo) async { Future<dynamic> login(UserModel userInfo) async {
try { try {
dynamic localRes; dynamic localRes;
@ -112,8 +113,7 @@ class AuthProvider with ChangeNotifier {
} }
} }
Future sendActivationCodeByOtpNotificationType( Future sendActivationCodeByOtpNotificationType(activationCodeModel) async {
activationCodeModel) async {
try { try {
var localRes; var localRes;
await BaseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE, await BaseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE,
@ -135,11 +135,12 @@ class AuthProvider with ChangeNotifier {
await BaseAppClient.post(MEMBER_CHECK_ACTIVATION_CODE_NEW, await BaseAppClient.post(MEMBER_CHECK_ACTIVATION_CODE_NEW,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
localRes = response; localRes = response;
selectedClinicName =
ClinicModel.fromJson(response['List_DoctorsClinic'][0]).clinicName;
notifyListeners();
response['List_DoctorsClinic'].forEach((v) { response['List_DoctorsClinic'].forEach((v) {
doctorsClinicList.add(new ClinicModel.fromJson(v)); doctorsClinicList.add(new ClinicModel.fromJson(v));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
throw error; throw error;
}, body: activationCodeModel); }, body: activationCodeModel);
@ -163,6 +164,9 @@ class AuthProvider with ChangeNotifier {
await BaseAppClient.post(GET_DOC_PROFILES, await BaseAppClient.post(GET_DOC_PROFILES,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
localRes = response; localRes = response;
//ClinicDescription
selectedClinicName = response['DoctorProfileList'][0]['ClinicDescription'];
notifyListeners();
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
throw error; throw error;
}, body: docInfo); }, body: docInfo);
@ -172,6 +176,4 @@ class AuthProvider with ChangeNotifier {
throw error; throw error;
} }
} }
} }

@ -77,7 +77,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
Container( Container(
margin: EdgeInsets.only(left: 10, top: 10), margin: EdgeInsets.only(left: 10, top: 10),
child: AppText( child: AppText(
TranslationBase.of(context).familyMedicine, authProvider.selectedClinicName != null?authProvider.selectedClinicName:'',
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: SizeConfig.textMultiplier * 2.5, fontSize: SizeConfig.textMultiplier * 2.5,
), ),

@ -300,8 +300,8 @@ class _LoginFormState extends State<LoginForm> {
try { try {
platformImei = platformImei =
await ImeiPlugin.getImei(shouldShowRequestPermissionRationale: false); await ImeiPlugin.getImei(shouldShowRequestPermissionRationale: false);
idunique = await ImeiPlugin.getId(); idunique = await ImeiPlugin.getImei();
} on PlatformException { } catch(e) {
platformImei = 'Failed to get platform version.'; platformImei = 'Failed to get platform version.';
} }

Loading…
Cancel
Save