family file

merge-update-with-lab-changes
Sultan Khan 5 years ago
parent cb99b2a7a7
commit 8887ba85fe

@ -52,7 +52,8 @@ class BaseAppClient {
: PATIENT_TYPE_ID;
if (user != null) {
body['TokenID'] = token;
body['PatientID'] = user['PatientID'];
body['PatientID'] =
body['PatientID'] != null ? body['PatientID'] : user['PatientID'];
body['PatientOutSA'] = user['OutSA'];
body['SessionID'] = getSessionId(token);
}

@ -1,7 +1,10 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart';
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
@ -14,7 +17,7 @@ import 'package:diplomaticquarterapp/routes.dart';
class MyFamily extends StatelessWidget {
//bool isLoading = true;
final familyFileProvider = FamilyFilesProvider();
AppSharedPreferences sharedPref = new AppSharedPreferences();
var userID;
Widget build(BuildContext context) {
@ -115,7 +118,14 @@ class MyFamily extends StatelessWidget {
Text(result.patientName)),
Expanded(
flex: 2,
child: Icon(Icons.group)),
child: IconButton(
icon: Icon(Icons.group),
color: Colors.black,
onPressed: () {
switchUser(
result, context);
},
)),
Expanded(
flex: 1,
child: IconButton(
@ -205,4 +215,25 @@ class MyFamily extends StatelessWidget {
sharedPref.remove(FAMILY_FILE);
(context as Element).reassemble();
}
switchUser(user, context) {
Utils.showProgressDialog(context);
this
.familyFileProvider
.silentLoggin(user)
.then((value) => loginAfter(value, context));
}
loginAfter(result, context) {
Utils.hideProgressDialog();
result = CheckActivationCode.fromJson(result);
this.sharedPref.clear();
this.sharedPref.setObject(USER_PROFILE, result.list);
this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID);
this.sharedPref.setString(TOKEN, result.authenticationTokenID);
//this.checkIfUserAgreedBefore(result),
Navigator.of(context).pushNamed(
HOME,
);
}
}

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/family-file/add_family_file_request.dart';
import 'package:diplomaticquarterapp/core/model/family-file/insert_share_file_request.dart';
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart';
import 'package:diplomaticquarterapp/models/Authentication/send_activation_request.dart';
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
@ -30,6 +31,9 @@ const String UPDATE_FILE_STATUS =
const String REMOVE_FILE_STATUS =
'Services/Authentication.svc/REST/ActiveDeactive_PatientFile';
const String ACTIVATION_CODE_URL =
"Services/Authentication.svc/REST/CheckActivationCode";
class FamilyFilesProvider with ChangeNotifier {
bool isLogin = false;
bool isLoading = true;
@ -189,21 +193,34 @@ class FamilyFilesProvider with ChangeNotifier {
}
}
silentLoggin(switchUser, {onSuccess}) async {
Future<dynamic> silentLoggin(GetAllSharedRecordsByStatusList switchUser,
{onSuccess}) async {
//var currentUser = this.authService.getAuthenticatedUser();
var currentUser =
AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
//const request = new SwitchUserRequest();
Map<String, dynamic> request = {};
request['LogInTokenID'] = '';
// request['PatientOutSA'] = currentUser.PatientOutSA ? 1 : 0;
request['PatientMobileNumber'] = switchUser.MobileNumber;
request['PatientOutSA'] = currentUser.outSA; //? 1 : 0;
request['PatientMobileNumber'] =
switchUser.mobileNumber; //['MobileNumber'];
request['SearchType'] = 2;
// request['SuperUser'] = currentUser.PatientID;
request['SuperUser'] = currentUser.patientID; //currentUser.PatientID;
request['PatientIdentificationID'] = '';
request['IsSilentLogin'] = true;
if (switchUser.mobileNumber != null &&
switchUser.patientID != currentUser.patientID) {
request['PatientID'] = switchUser.patientID; //['PatientID'];
} else {
request['PatientID'] = switchUser.responseID; //['ResponseID'];
}
request['ZipCode'] = currentUser.outSA == 1 ? "971" : "966";
request['activationCode'] = '0000';
request['isRegister'] = false;
try {
dynamic localRes;
await new BaseAppClient().post(REMOVE_FILE_STATUS,
await new BaseAppClient().post(ACTIVATION_CODE_URL,
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {

@ -1,10 +1,12 @@
import 'dart:async';
import 'package:flutter_tts/flutter_tts.dart';
class RobotProvider {
static final RobotProvider _singleton = RobotProvider._internal();
var value;
StreamController<Map> controller = StreamController<Map>.broadcast();
FlutterTts flutterTts = FlutterTts();
getData() {
// return data;
}
@ -22,4 +24,7 @@ class RobotProvider {
}
RobotProvider._internal();
speak(data) async {
await flutterTts.speak(data);
}
}

@ -53,7 +53,7 @@ class _SearchBot extends State<BottomBarSearch> {
FlutterTts flutterTts = FlutterTts();
var selectedLang;
bool isSearching = false;
Map results = {};
String lastStatus;
bool _isInit = true;
@ -196,7 +196,7 @@ class _SearchBot extends State<BottomBarSearch> {
getCommands(result) async {
//RoboSearch.closeAlertDialog(context);
print(result);
results = result;
//getDoctorsList(12, 17, 40036, context);
switch (result["CommandNumber"]) {
@ -210,12 +210,20 @@ class _SearchBot extends State<BottomBarSearch> {
context,
doctorId: result['DoctorId'],
);
} else if (result['ProjectId'] != null && result['ClinicId'] != null) {
} else if (result['ProjectId'] != null && result['ClinicId'] != 0) {
getDoctorsList(
result['ProjectId'],
result['ClinicId'],
context,
);
} else if (result['ProjectId'] != null && result['ClinicId'] == 0) {
Navigator.push(
AppGlobal.context,
MaterialPageRoute(
builder: (context) => Search(
type: 0,
)));
speak();
}
break;
// case '101':
@ -246,7 +254,9 @@ class _SearchBot extends State<BottomBarSearch> {
// break;
default:
{
if (result['ProjectId'] != null && result['ClinicId'] != null) {
if (result['ProjectId'] != null &&
result['ClinicId'] != null &&
result['DoctorId'] == 0) {
getDoctorsList(
result['ProjectId'],
result['ClinicId'],
@ -254,13 +264,10 @@ class _SearchBot extends State<BottomBarSearch> {
);
}
}
break;
}
if (_currentLocaleId == 'en-GB' && result['ReturnMessage'] != null) {
await flutterTts.speak(result['ReturnMessage']);
} else if (result['ReturnMessage_Ar'] != null) {
await flutterTts.speak(result['ReturnMessage_Ar']);
}
//searchProvider.setLisener(result);
}
@ -280,6 +287,7 @@ class _SearchBot extends State<BottomBarSearch> {
navigateToDoctorProfile(context, doctorData[0], docProfileList[0],
isAppo: true);
speak();
}
});
}
@ -299,6 +307,7 @@ class _SearchBot extends State<BottomBarSearch> {
});
if (doctorId == null) {
navigateToSearchResults(context, doctorsList);
speak();
} else {
getDoctorProfile(
projectId, clinicId, doctorId, context, doctorsList);
@ -331,4 +340,15 @@ class _SearchBot extends State<BottomBarSearch> {
MaterialPageRoute(
builder: (context) => SearchResults(doctorsList: docList)));
}
speak() async {
if (_currentLocaleId == 'en-GB' && results['ReturnMessage'] != null) {
await flutterTts.speak(results['ReturnMessage']);
} else if (results['ReturnMessage_Ar'] != null) {
await flutterTts.speak(results['ReturnMessage_Ar']);
}
Future.delayed(const Duration(seconds: 3), () {
initSpeechState().then((value) => startVoiceSearch());
});
}
}

Loading…
Cancel
Save