|
|
|
|
@ -1,5 +1,3 @@
|
|
|
|
|
import 'package:doctor_app_flutter/lookups/auth_lookup.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/providers/auth_provider.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
@ -8,6 +6,7 @@ import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
|
|
|
|
|
import '../../config/config.dart';
|
|
|
|
|
import '../../providers/auth_provider.dart';
|
|
|
|
|
import '../../routes.dart';
|
|
|
|
|
import '../../util/dr_app_shared_pref.dart';
|
|
|
|
|
import '../../util/dr_app_toast_msg.dart';
|
|
|
|
|
@ -30,6 +29,7 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
|
|
|
|
|
Future _loggedUserFuture;
|
|
|
|
|
var _loggedUser;
|
|
|
|
|
int _loginType = 1;
|
|
|
|
|
String _platformImei;
|
|
|
|
|
Future _loginTypeFuture;
|
|
|
|
|
|
|
|
|
|
Map _loginTypeMap = {
|
|
|
|
|
@ -55,25 +55,35 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
|
|
|
|
|
sharedPref.getObj('loggedUser').then((userInfo) {
|
|
|
|
|
_loggedUser = userInfo;
|
|
|
|
|
});
|
|
|
|
|
sharedPref.getString('platformImei').then((imei){
|
|
|
|
|
_platformImei = imei;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
_loggedUserFuture = _prefs.then((SharedPreferences prefs) {
|
|
|
|
|
return (prefs.getString('platformImei'));
|
|
|
|
|
});
|
|
|
|
|
_loggedUserFuture = getSharedPref();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
getSharedPref();
|
|
|
|
|
AuthProvider authProv = Provider.of<AuthProvider>(context);
|
|
|
|
|
selectDeviceImei(authProv);
|
|
|
|
|
|
|
|
|
|
var imeiModel = {'IMEI': _platformImei};
|
|
|
|
|
_loginTypeFuture = authProv.selectDeviceImei(imeiModel);
|
|
|
|
|
return FutureBuilder(
|
|
|
|
|
future: Future.wait([_loginTypeFuture,_loggedUserFuture]),
|
|
|
|
|
future: Future.wait([_loggedUserFuture ,_loginTypeFuture]),
|
|
|
|
|
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
|
|
|
|
_loginTypeFuture.then((res) {
|
|
|
|
|
_loginType =
|
|
|
|
|
2; //res['SELECTDeviceIMEIbyIMEI_List'][0]['LogInType'];
|
|
|
|
|
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print('${err}');
|
|
|
|
|
});
|
|
|
|
|
switch (snapshot.connectionState) {
|
|
|
|
|
case ConnectionState.waiting:
|
|
|
|
|
return DrAppCircularProgressIndeicator();
|
|
|
|
|
@ -323,19 +333,4 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
|
|
|
|
|
showErorrMsg(localMsg) {
|
|
|
|
|
toastMsg.showErrorToast(localMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selectDeviceImei(AuthProvider authProv) {
|
|
|
|
|
sharedPref.getString('platformImei').then((imei) {
|
|
|
|
|
var imeiModel = {'IMEI': imei};
|
|
|
|
|
_loginTypeFuture = authProv.selectDeviceImei(imeiModel).then((res) {
|
|
|
|
|
// setState(() {
|
|
|
|
|
_loginType = 2; //res['SELECTDeviceIMEIbyIMEI_List'][0]['LogInType'];
|
|
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
print(_loginType.toString());
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print('${err}');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|