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

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

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

Loading…
Cancel
Save