diff --git a/lib/core/service/auth_service.dart b/lib/core/service/auth_service.dart index ec56bed7..bdc500d0 100644 --- a/lib/core/service/auth_service.dart +++ b/lib/core/service/auth_service.dart @@ -1,13 +1,30 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/imei_details.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; +import 'package:doctor_app_flutter/models/auth/activation_code_for_verification_screen_model.dart'; +import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; +import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/user_model.dart'; +import 'package:provider/provider.dart'; class AuthService extends BaseService { List _imeiDetails = []; List get dashboardItemsList => _imeiDetails; + //TODO Change this to models Map _loginInfo = {}; Map get loginInfo => _loginInfo; + Map _activationCodeVerificationScreenRes = {}; + + Map get activationCodeVerificationScreenRes => _activationCodeVerificationScreenRes; + + Map _activationCodeForDoctorAppRes = {}; + + Map get activationCodeForDoctorAppRes => _activationCodeForDoctorAppRes; + Map _checkActivationCodeForDoctorAppRes = {}; + + Map get checkActivationCodeForDoctorAppRes => _checkActivationCodeForDoctorAppRes; Future selectDeviceImei(imei) async { try { // dynamic localRes; @@ -45,4 +62,65 @@ class AuthService extends BaseService { } } + + Future sendActivationCodeVerificationScreen(ActivationCodeForVerificationScreenModel activationCodeModel) async { + hasError = false; + _activationCodeVerificationScreenRes = {}; + try { + await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_VERIFICATION_SCREEN, + onSuccess: (dynamic response, int statusCode) { + _activationCodeVerificationScreenRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: activationCodeModel.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + + } + + Future sendActivationCodeForDoctorApp(ActivationCodeModel activationCodeModel)async { + hasError = false; + _activationCodeForDoctorAppRes = {}; + try { + await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_DOCTOR_APP, + onSuccess: (dynamic response, int statusCode) { + _activationCodeForDoctorAppRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: activationCodeModel.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + } + + Future checkActivationCodeForDoctorApp(CheckActivationCodeRequestModel checkActivationCodeRequestModel)async { + hasError = false; + _checkActivationCodeForDoctorAppRes = {}; + try { + await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP, + onSuccess: (dynamic response, int statusCode) { + // TODO improve the logic here + Provider.of(AppGlobal.CONTEX, listen: false).doctorsClinicList.clear(); + _checkActivationCodeForDoctorAppRes = response; + Provider.of(AppGlobal.CONTEX, listen: false).selectedClinicName = + ClinicModel.fromJson(response['List_DoctorsClinic'][0]).clinicName; + + response['List_DoctorsClinic'].forEach((v) { + Provider.of(AppGlobal.CONTEX, listen: false).doctorsClinicList.add(new ClinicModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: checkActivationCodeRequestModel.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + + } } diff --git a/lib/core/viewModel/auth_view_model.dart b/lib/core/viewModel/auth_view_model.dart index c1410fe6..add5db86 100644 --- a/lib/core/viewModel/auth_view_model.dart +++ b/lib/core/viewModel/auth_view_model.dart @@ -6,7 +6,7 @@ import 'package:doctor_app_flutter/core/model/insert_imei_model.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; -import 'package:doctor_app_flutter/models/auth/send_activation_code_model2.dart'; +import 'package:doctor_app_flutter/models/auth/activation_code_for_verification_screen_model.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; @@ -95,46 +95,6 @@ class AuthViewModel extends BaseViewModel { } } - Future sendActivationCodeForDoctorApp( - ActivationCodeModel activationCodeModel) async { - try { - var localRes; - await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_DOCTOR_APP, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: activationCodeModel.toJson()); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } - - Future checkActivationCodeForDoctorApp( - CheckActivationCodeRequestModel checkActivationCodeRequestModel) async { - try { - dynamic localRes; - await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - selectedClinicName = - ClinicModel.fromJson(response['List_DoctorsClinic'][0]).clinicName; - - response['List_DoctorsClinic'].forEach((v) { - doctorsClinicList.add(new ClinicModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - throw error; - }, body: checkActivationCodeRequestModel.toJson()); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } - Future getDocProfiles(docInfo, {bool allowChangeProfile = true}) async { try { @@ -158,21 +118,4 @@ class AuthViewModel extends BaseViewModel { throw error; } } - - Future sendActivationCodeVerificationScreen( - ActivationCodeModel2 activationCodeModel) async { - try { - var localRes; - await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_VERIFICATION_SCREEN, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: activationCodeModel.toJson()); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } } diff --git a/lib/core/viewModel/imei_view_model.dart b/lib/core/viewModel/imei_view_model.dart index 6499cfac..09bfe8b3 100644 --- a/lib/core/viewModel/imei_view_model.dart +++ b/lib/core/viewModel/imei_view_model.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_request_model.dart'; import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart'; @@ -6,9 +7,14 @@ import 'package:doctor_app_flutter/core/service/auth_service.dart'; import 'package:doctor_app_flutter/core/service/hospitals/hospitals_service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; -import 'package:doctor_app_flutter/models/auth/send_activation_code_model2.dart'; +import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; +import 'package:doctor_app_flutter/models/auth/activation_code_for_verification_screen_model.dart'; +import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; import 'package:doctor_app_flutter/models/doctor/user_model.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:provider/provider.dart'; + +import 'auth_view_model.dart'; class IMEIViewModel extends BaseViewModel { AuthService _authService = locator(); @@ -17,6 +23,10 @@ class IMEIViewModel extends BaseViewModel { List get imeiDetails => _authService.dashboardItemsList; List get hospitals => _hospitalsService.hospitals; get loginInfo => _authService.loginInfo; + get activationCodeVerificationScreenRes => _authService.activationCodeVerificationScreenRes; + get activationCodeForDoctorAppRes => _authService.activationCodeForDoctorAppRes; + get checkActivationCodeForDoctorAppRes => _authService.checkActivationCodeForDoctorAppRes; + Future selectDeviceImei(imei) async { setState(ViewState.Busy); await _authService.selectDeviceImei(imei); @@ -37,9 +47,19 @@ class IMEIViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future sendActivationCodeVerificationScreen(ActivationCodeModel2 activationCodeModel) async { + Future sendActivationCodeVerificationScreen(ActivationCodeForVerificationScreenModel activationCodeModel) async { + setState(ViewState.BusyLocal); + await _authService.sendActivationCodeVerificationScreen(activationCodeModel); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future sendActivationCodeForDoctorApp(ActivationCodeModel activationCodeModel) async { setState(ViewState.BusyLocal); - // await _authService.sendActivationCodeVerificationScreen(userInfo); + await _authService.sendActivationCodeForDoctorApp(activationCodeModel); if (_authService.hasError) { error = _authService.error; setState(ViewState.ErrorLocal); @@ -47,6 +67,18 @@ class IMEIViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future checkActivationCodeForDoctorApp(CheckActivationCodeRequestModel checkActivationCodeRequestModel) async { + setState(ViewState.BusyLocal); + await _authService.checkActivationCodeForDoctorApp(checkActivationCodeRequestModel); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + + } + } + Future getHospitalsList(memberID) async { GetHospitalsRequestModel getHospitalsRequestModel =GetHospitalsRequestModel(); diff --git a/lib/models/auth/send_activation_code_model2.dart b/lib/models/auth/activation_code_for_verification_screen_model.dart similarity index 91% rename from lib/models/auth/send_activation_code_model2.dart rename to lib/models/auth/activation_code_for_verification_screen_model.dart index 68a90c85..28cc58db 100644 --- a/lib/models/auth/send_activation_code_model2.dart +++ b/lib/models/auth/activation_code_for_verification_screen_model.dart @@ -1,4 +1,4 @@ -class ActivationCodeModel2 { +class ActivationCodeForVerificationScreenModel { int oTPSendType; String mobileNumber; String zipCode; @@ -12,7 +12,7 @@ class ActivationCodeModel2 { String vidaAuthTokenID; String vidaRefreshTokenID; String iMEI; - ActivationCodeModel2( + ActivationCodeForVerificationScreenModel( {this.oTPSendType, this.mobileNumber, this.zipCode, @@ -27,7 +27,7 @@ class ActivationCodeModel2 { this.vidaRefreshTokenID, this.iMEI}); - ActivationCodeModel2.fromJson(Map json) { + ActivationCodeForVerificationScreenModel.fromJson(Map json) { oTPSendType = json['OTP_SendType']; mobileNumber = json['MobileNumber']; zipCode = json['ZipCode']; diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index d7784881..5e069a2a 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -459,6 +459,7 @@ class _LoginsreenState extends State { sharedPref.setInt(PROJECT_ID, userInfo.projectID); await model.login(userInfo); if (model.state == ViewState.ErrorLocal) { + GifLoaderDialogUtils.hideDialog(context); Helpers.showErrorToast(model.error); } else { diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index 7503a70e..a83db25c 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -1,3 +1,5 @@ +import 'package:doctor_app_flutter/core/viewModel/imei_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -25,27 +27,30 @@ class _VerificationMethodsScreenState extends State { @override Widget build(BuildContext context) { - return AppScaffold( - isLoading: _isLoading, - isShowAppBar: false, - isHomeIcon: false, - backgroundColor: HexColor('#F8F8F8'), - body: ListView(children: [ - Container( - margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 50, - ), - VerificationMethods( - password: widget.password, - changeLoadingState: changeLoadingState, - ), - ], - ), - ), - ])); + return BaseView( + onModelReady: (model) async {}, + builder: (_, model, w) => AppScaffold( + isLoading: _isLoading, + isShowAppBar: false, + isHomeIcon: false, + backgroundColor: HexColor('#F8F8F8'), + body: ListView(children: [ + Container( + margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 50, + ), + VerificationMethods( + password: widget.password, + changeLoadingState: changeLoadingState, + model:model + ), + ], + ), + ), + ]))); } } diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index 91d80a71..dc95f6dd 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -1,11 +1,13 @@ import 'dart:io' show Platform; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/imei_details.dart'; +import 'package:doctor_app_flutter/core/viewModel/imei_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; -import 'package:doctor_app_flutter/models/auth/send_activation_code_model2.dart'; +import 'package:doctor_app_flutter/models/auth/activation_code_for_verification_screen_model.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; @@ -15,6 +17,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/otp/sms-popup.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -35,10 +38,11 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = Helpers(); class VerificationMethods extends StatefulWidget { - VerificationMethods({this.changeLoadingState, this.password}); + VerificationMethods({this.changeLoadingState, this.password, this.model}); final password; final Function changeLoadingState; + final IMEIViewModel model; @override _VerificationMethodsState createState() => _VerificationMethodsState(); @@ -330,8 +334,10 @@ class _VerificationMethodsState extends State { oTPSendType, AuthViewModel authProv) async { // TODO : build enum for verfication method if (oTPSendType == 1 || oTPSendType == 2) { - widget.changeLoadingState(true); + GifLoaderDialogUtils.showMyDialog(context); + int projectID = await sharedPref.getInt(PROJECT_ID); + // TODO create model for _loggedUser; ActivationCodeModel activationCodeModel = ActivationCodeModel( facilityId: projectID, memberID: _loggedUser['List_MemberInformation'][0]['MemberID'], @@ -339,49 +345,34 @@ class _VerificationMethodsState extends State { mobileNumber: _loggedUser['MobileNumber'], otpSendType: oTPSendType.toString(), password: widget.password); - - try { - authProv - .sendActivationCodeForDoctorApp(activationCodeModel) - .then((res) { - if (res['MessageStatus'] == 1) { - print("VerificationCode : " + res["VerificationCode"]); - sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]); - sharedPref.setString( - VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]); - sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]); - sharedPref.setString(PASSWORD, widget.password); - this.startSMSService(oTPSendType, authProv); - } else { - print(res['ErrorEndUserMessage']); - Helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - print('$err'); - widget.changeLoadingState(false); - - Helpers.showErrorToast(); - }); - } catch (e) {} + await widget.model + .sendActivationCodeForDoctorApp(activationCodeModel); + if(widget.model.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(widget.model.error); + GifLoaderDialogUtils.hideDialog(context); + }else{ + print("VerificationCode : " + widget.model.activationCodeForDoctorAppRes["VerificationCode"]); + sharedPref.setString(VIDA_AUTH_TOKEN_ID, widget.model.activationCodeForDoctorAppRes["VidaAuthTokenID"]); + sharedPref.setString( + VIDA_REFRESH_TOKEN_ID, widget.model.activationCodeForDoctorAppRes["VidaRefreshTokenID"]); + sharedPref.setString(LOGIN_TOKEN_ID, widget.model.activationCodeForDoctorAppRes["LogInTokenID"]); + sharedPref.setString(PASSWORD, widget.password); + GifLoaderDialogUtils.hideDialog(context); + this.startSMSService(oTPSendType, authProv); + } } else { // TODO route to this page with parameters to inicate we should present 2 option if (Platform.isAndroid && oTPSendType == 3) { Helpers.showErrorToast('Your device not support this feature'); } else { - // Navigator.of(context).push(MaterialPageRoute( - // builder: (BuildContext context) => - // VerificationMethodsScreen(password: widget.password,))); - - // Navigator.of(context).pushNamed(VERIFICATION_METHODS, - // arguments: {'verificationMethod': oTPSendType}); } } } sendActivationCodeVerificationScreen( oTPSendType, AuthViewModel authProv) async { - widget.changeLoadingState(true); - ActivationCodeModel2 activationCodeModel = ActivationCodeModel2( + GifLoaderDialogUtils.showMyDialog(context); + ActivationCodeForVerificationScreenModel activationCodeModel = ActivationCodeForVerificationScreenModel( iMEI: user.iMEI, facilityId: user.projectID, memberID: user.doctorID, @@ -392,37 +383,25 @@ class _VerificationMethodsState extends State { vidaAuthTokenID: user.vidaAuthTokenID, vidaRefreshTokenID: user.vidaRefreshTokenID); - try { - authProv - .sendActivationCodeVerificationScreen(activationCodeModel) - .then((res) { - if (res['MessageStatus'] == 1) { - print("VerificationCode : " + res["VerificationCode"]); - sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]); - sharedPref.setString( - VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]); - sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]); - if (oTPSendType == 1 || oTPSendType == 2) { - widget.changeLoadingState(false); - this.startSMSService(oTPSendType, authProv); - } else { - checkActivationCode(authProv); - } + await widget.model + .sendActivationCodeVerificationScreen(activationCodeModel); + + if(widget.model.state == ViewState.ErrorLocal) { + GifLoaderDialogUtils.hideDialog(context); + Helpers.showErrorToast(widget.model.error); + } else { + print("VerificationCode : " + widget.model.activationCodeVerificationScreenRes["VerificationCode"]); + sharedPref.setString(VIDA_AUTH_TOKEN_ID, widget.model.activationCodeVerificationScreenRes["VidaAuthTokenID"]); + sharedPref.setString( + VIDA_REFRESH_TOKEN_ID, widget.model.activationCodeVerificationScreenRes["VidaRefreshTokenID"]); + sharedPref.setString(LOGIN_TOKEN_ID, widget.model.activationCodeVerificationScreenRes["LogInTokenID"]); + if (oTPSendType == 1 || oTPSendType == 2) { + GifLoaderDialogUtils.hideDialog(context); + this.startSMSService(oTPSendType, authProv); } else { - print(res['ErrorEndUserMessage']); - Helpers.showErrorToast(res['ErrorEndUserMessage']); + checkActivationCode(authProv); } - }).catchError((err) { - print('$err'); - widget.changeLoadingState(false); - - Helpers.showErrorToast(); - }); - } catch (e) {} - // } - // else { - // checkActivationCode(authProv); - // } + } } Widget getButton(flag, authProv) { @@ -741,7 +720,7 @@ class _VerificationMethodsState extends State { stickyAuth: true, iOSAuthStrings: iosStrings); } on PlatformException catch (e) { - DrAppToastMsg.showErrorToast(e); + DrAppToastMsg.showErrorToast(e.toString()); } if (!mounted) return; if (user != null && (user.logInTypeID == 3 || user.logInTypeID == 4)) { @@ -769,30 +748,47 @@ class _VerificationMethodsState extends State { activationCode: value ?? '0000', oTPSendType: await sharedPref.getInt(OTP_TYPE), generalid: "Cs2020@2016\$2958"); + await widget.model.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp); - authProv - .checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp) - .then((res) async { - widget.changeLoadingState(false); - if (res['MessageStatus'] == 1) { - sharedPref.setString(TOKEN, res['AuthenticationTokenID']); - if (res['List_DoctorProfile'] != null) { - loginProcessCompleted(res['List_DoctorProfile'][0], authProv); - sharedPref.setObj(CLINIC_NAME, res['List_DoctorsClinic']); - } else { - sharedPref.setObj(CLINIC_NAME, res['List_DoctorsClinic']); - ClinicModel clinic = - ClinicModel.fromJson(res['List_DoctorsClinic'][0]); - getDocProfiles(clinic, authProv); - } + if(widget.model.state == ViewState.ErrorLocal){ + Navigator.pop(context); + Helpers.showErrorToast(widget.model.error); + } else { + sharedPref.setString(TOKEN, widget.model.checkActivationCodeForDoctorAppRes['AuthenticationTokenID']); + if (widget.model.checkActivationCodeForDoctorAppRes['List_DoctorProfile'] != null) { + loginProcessCompleted(widget.model.checkActivationCodeForDoctorAppRes['List_DoctorProfile'][0], authProv); + sharedPref.setObj(CLINIC_NAME, widget.model.checkActivationCodeForDoctorAppRes['List_DoctorsClinic']); } else { - Navigator.pop(context); - Helpers.showErrorToast(res['ErrorEndUserMessage']); + sharedPref.setObj(CLINIC_NAME, widget.model.checkActivationCodeForDoctorAppRes['List_DoctorsClinic']); + ClinicModel clinic = + ClinicModel.fromJson(widget.model.checkActivationCodeForDoctorAppRes['List_DoctorsClinic'][0]); + getDocProfiles(clinic, authProv); } - }).catchError((err) { - Navigator.pop(context); - Helpers.showErrorToast(err); - }); + } + + // authProv + // .checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp) + // .then((res) async { + // widget.changeLoadingState(false); + // if (res['MessageStatus'] == 1) { + // sharedPref.setString(TOKEN, res['AuthenticationTokenID']); + // if (res['List_DoctorProfile'] != null) { + // loginProcessCompleted(res['List_DoctorProfile'][0], authProv); + // sharedPref.setObj(CLINIC_NAME, res['List_DoctorsClinic']); + // } else { + // sharedPref.setObj(CLINIC_NAME, res['List_DoctorsClinic']); + // ClinicModel clinic = + // ClinicModel.fromJson(res['List_DoctorsClinic'][0]); + // getDocProfiles(clinic, authProv); + // } + // } else { + // Navigator.pop(context); + // Helpers.showErrorToast(res['ErrorEndUserMessage']); + // } + // }).catchError((err) { + // Navigator.pop(context); + // Helpers.showErrorToast(err); + // }); } loginProcessCompleted(Map profile, authProv) {