Merge branch 'development' into 'master'

Development

See merge request Cloud_Solution/doctor_app_flutter!153
merge-requests/157/head
Mohammad Aljammal 5 years ago
commit 4dedcbad80

@ -7,3 +7,4 @@ final SLECTED_PATIENT_TYPE = 'slectedPatientType';
final APP_Language = 'language'; final APP_Language = 'language';
final DOCTOR_PROFILE = 'doctorProfile'; final DOCTOR_PROFILE = 'doctorProfile';
final LIVE_CARE_PATIENT = 'livecare-patient-profile'; final LIVE_CARE_PATIENT = 'livecare-patient-profile';
final LOGGED_IN_USER = 'loggedUser';

@ -30,7 +30,7 @@ class HttpInterceptor extends InterceptorContract {
data.headers["Content-Type"] = "application/json"; data.headers["Content-Type"] = "application/json";
data.headers["Accept"] = "application/json"; data.headers["Accept"] = "application/json";
// if (publicUrls.contains(data.url)) { // if (publicUrls.contains(data.url)) {
// var loggedUserInfo = await sharedPref.getObj('loggedUser'); // var loggedUserInfo = await sharedPref.getObj(LOGGED_IN_USER);
// var token = await sharedPref.getString(TOKEN); // var token = await sharedPref.getString(TOKEN);
// // print("token"+token); // // print("token"+token);
// // print('loggedUserInfo${loggedUserInfo["LogInTokenID"]}'); // // print('loggedUserInfo${loggedUserInfo["LogInTokenID"]}');

@ -1,20 +1,60 @@
class UserModel { class UserModel {
String UserID; String userID;
String Password; String password;
int ProjectID; int projectID;
int LanguageID; int languageID;
String IPAdress; String iPAdress;
double VersionID; double versionID;
int Channel; int channel;
String SessionID; String sessionID;
String tokenID;
String stamp;
bool isLoginForDoctorApp;
int patientOutSA;
UserModel( UserModel(
{this.UserID, {this.userID,
this.Password, this.password,
this.ProjectID, this.projectID,
this.LanguageID, this.languageID,
this.IPAdress, this.iPAdress,
this.VersionID, this.versionID,
this.Channel, this.channel,
this.SessionID}); this.sessionID,
this.tokenID,
this.stamp,
this.isLoginForDoctorApp,
this.patientOutSA});
UserModel.fromJson(Map<String, dynamic> json) {
userID = json['UserID'];
password = json['Password'];
projectID = json['ProjectID'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
versionID = json['VersionID'];
channel = json['Channel'];
sessionID = json['SessionID'];
tokenID = json['TokenID'];
stamp = json['stamp'];
isLoginForDoctorApp = json['IsLoginForDoctorApp'];
patientOutSA = json['PatientOutSA'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['UserID'] = this.userID;
data['Password'] = this.password;
data['ProjectID'] = this.projectID;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['SessionID'] = this.sessionID;
data['TokenID'] = this.tokenID;
data['stamp'] = this.stamp;
data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp;
data['PatientOutSA'] = this.patientOutSA;
return data;
}
} }

@ -4,7 +4,6 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import '../models/doctor/user_model.dart'; import '../models/doctor/user_model.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
@ -52,16 +51,7 @@ class AuthProvider with ChangeNotifier {
localRes = response; localRes = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
throw error; throw error;
}, body: { }, body: userInfo.toJson());
"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); return Future.value(localRes);
} catch (error) { } catch (error) {

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
@ -52,7 +53,7 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
}; };
Future<void> getSharedPref() async { Future<void> getSharedPref() async {
sharedPref.getObj('loggedUser').then((userInfo) { sharedPref.getObj(LOGGED_IN_USER).then((userInfo) {
_loggedUser = userInfo; _loggedUser = userInfo;
}); });
sharedPref.getString('platformImei').then((imei) { sharedPref.getString('platformImei').then((imei) {

@ -42,14 +42,14 @@ class _LoginFormState extends State<LoginForm> {
FocusNode focusProject = FocusNode(); FocusNode focusProject = FocusNode();
var userInfo = UserModel( var userInfo = UserModel(
UserID: '', userID: '',
Password: '', password: '',
ProjectID: 15, projectID: 15,
LanguageID: 2, languageID: 2,
IPAdress: "11.11.11.11", iPAdress: "11.11.11.11",
VersionID: 1.2, versionID: 1.2,
Channel: 9, channel: 9,
SessionID: "i1UJwCTSqt"); sessionID: "i1UJwCTSqt");
AuthProvider authProv; AuthProvider authProv;
@override @override
@ -95,7 +95,7 @@ class _LoginFormState extends State<LoginForm> {
return null; return null;
}, },
onSaved: (value) { onSaved: (value) {
userInfo.UserID = value.trim(); userInfo.userID = value.trim();
}, },
onFieldSubmitted: (_) { onFieldSubmitted: (_) {
focusPass.nextFocus(); focusPass.nextFocus();
@ -118,7 +118,7 @@ class _LoginFormState extends State<LoginForm> {
return null; return null;
}, },
onSaved: (value) { onSaved: (value) {
userInfo.Password = value; userInfo.password = value;
}, },
onFieldSubmitted: (_) { onFieldSubmitted: (_) {
focusPass.nextFocus(); focusPass.nextFocus();
@ -231,13 +231,13 @@ class _LoginFormState extends State<LoginForm> {
changeLoadingStata(true); changeLoadingStata(true);
if (loginFormKey.currentState.validate()) { if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save(); loginFormKey.currentState.save();
sharedPref.setInt(PROJECT_ID, userInfo.ProjectID); sharedPref.setInt(PROJECT_ID, userInfo.projectID);
authProv.login(userInfo).then((res) { authProv.login(userInfo).then((res) {
changeLoadingStata(false); changeLoadingStata(false);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
// insertDeviceImei(res, authProv); // insertDeviceImei(res, authProv);
saveObjToString('loggedUser', res); saveObjToString(LOGGED_IN_USER, res);
sharedPref.setString(TOKEN, res['LogInTokenID']); sharedPref.setString(TOKEN, res['LogInTokenID']);
print("token" + res['LogInTokenID']); print("token" + res['LogInTokenID']);
@ -278,7 +278,7 @@ class _LoginFormState extends State<LoginForm> {
authProv.insertDeviceImei(imeiInfo).then((res) { authProv.insertDeviceImei(imeiInfo).then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
setSharedPref('platformImei', _platformImei); setSharedPref('platformImei', _platformImei);
saveObjToString('loggedUser', preRes); saveObjToString(LOGGED_IN_USER, preRes);
Navigator.of(context).pushNamed(VERIFICATION_METHODS); Navigator.of(context).pushNamed(VERIFICATION_METHODS);
// save imei on shared preferance // save imei on shared preferance
} else { } else {
@ -349,7 +349,7 @@ class _LoginFormState extends State<LoginForm> {
onSelectProject(index) { onSelectProject(index) {
setState(() { setState(() {
userInfo.ProjectID = projectsList[index]["ID"]; userInfo.projectID = projectsList[index]["ID"];
projectIdController.text = projectsList[index]['Name']; projectIdController.text = projectsList[index]['Name'];
}); });

@ -50,7 +50,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
} }
Future<void> getSharedPref() async { Future<void> getSharedPref() async {
sharedPref.getObj('loggedUser').then((userInfo) { sharedPref.getObj(LOGGED_IN_USER).then((userInfo) {
_loggedUser = userInfo; _loggedUser = userInfo;
}); });
} }

@ -1,5 +1,6 @@
import 'dart:io' show Platform; import 'dart:io' show Platform;
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -41,7 +42,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
} }
Future<void> getSharedPref() async { Future<void> getSharedPref() async {
sharedPref.getObj('loggedUser').then((userInfo) { sharedPref.getObj(LOGGED_IN_USER).then((userInfo) {
_loggedUser = userInfo; _loggedUser = userInfo;
}); });
} }

Loading…
Cancel
Save