Pharma LiveCare "IsPharmacy" Param added, Added Google API Availability check for Huawei devices

merge-update-with-lab-changes
haroon amjad 3 years ago
parent 3bc09f792a
commit 5045cc6faa

@ -20,8 +20,8 @@ var PACKAGES_ORDERS = '/api/orders';
var PACKAGES_ORDER_HISTORY = '/api/orders/items';
var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara';
// var BASE_URL = 'http://10.50.100.198:3334/';
// var BASE_URL = 'https://uat.hmgwebservices.com/';
var BASE_URL = 'https://hmgwebservices.com/';
var BASE_URL = 'https://uat.hmgwebservices.com/';
// var BASE_URL = 'https://hmgwebservices.com/';
// Pharmacy UAT URLs
// var BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
@ -321,7 +321,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnari
var CHANNEL = 3;
var GENERAL_ID = 'Cs2020@2016\$2958';
var IP_ADDRESS = '10.20.10.20';
var VERSION_ID = 10.0;
var VERSION_ID = 10.1;
var SETUP_ID = '91877';
var LANGUAGE = 2;
// var PATIENT_OUT_SA = 0;

@ -21,6 +21,7 @@ class DashboardViewModel extends BaseViewModel {
if (isLogin && _vitalSignService.weightKg.isEmpty) {
setState(ViewState.Busy);
await _vitalSignService.getPatientRadOrders();
booldType = await sharedPref.getString(BLOOD_TYPE) ?? "-";
if (_vitalSignService.hasError) {
error = _vitalSignService.error;

@ -604,7 +604,7 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
checkPaymentStatus(AppoitmentAllHistoryResultList appo) {
GifLoaderDialogUtils.showMyDialog(localContext);
DoctorsListService service = new DoctorsListService();
service.checkPaymentStatus(transID, localContext).then((res) {
service.checkPaymentStatus(transID, false, localContext).then((res) {
String paymentInfo = res['Response_Message'];
if (paymentInfo == 'Success') {
createAdvancePayment(res, appo);

@ -227,7 +227,7 @@ class ConfirmPaymentPage extends StatelessWidget {
checkPaymentStatus(AppoitmentAllHistoryResultList appo) {
DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(AppGlobal.context);
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), AppGlobal.context).then((res) {
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), false, AppGlobal.context).then((res) {
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
print("Printing Payment Status Reponse!!!!");
print(res);

@ -731,7 +731,7 @@ class _BookSuccessState extends State<BookSuccess> {
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) {
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), false, context).then((res) {
String paymentInfo = res['Response_Message'];
if (paymentInfo == 'Success') {
txn_ref = res['Merchant_Reference'];
@ -762,7 +762,7 @@ class _BookSuccessState extends State<BookSuccess> {
getApplePayAPQ(AppoitmentAllHistoryResultList appo) {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) {
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), false, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
String paymentInfo = res['Response_Message'];

@ -376,7 +376,7 @@ class _CovidPaymentSummaryState extends State<CovidPaymentSummary> {
checkPaymentStatus(AppoitmentAllHistoryResultList appo) {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) {
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), false, context).then((res) {
print("Printing Payment Status Reponse!!!!");
print(res);
String paymentInfo = res['Response_Message'];

@ -200,7 +200,7 @@ class _EdPaymentInformationPageState extends State<EdPaymentInformationPage> {
checkPaymentStatus(AppoitmentAllHistoryResultList appo) {
DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(AppGlobal.context);
service.checkPaymentStatus(transID, AppGlobal.context).then((res) {
service.checkPaymentStatus(transID, false, AppGlobal.context).then((res) {
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
String paymentInfo = res['Response_Message'];
if (paymentInfo == 'Success') {

@ -1097,7 +1097,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) {
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), false, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
String paymentInfo = res['Response_Message'];
if (paymentInfo == 'Success') {

@ -191,7 +191,7 @@ class LoggedSliderView extends StatelessWidget {
Texts(
'${TranslationBase.of(context).bloodType1} ${model.booldType}',
color: Colors.white,
fontSize: 8,
fontSize: 7,
)
],
),

@ -120,7 +120,7 @@ class _clinic_listState extends State<ClinicList> {
LiveCareService service = new LiveCareService();
GifLoaderDialogUtils.showMyDialog(context);
ERAppointmentFeesResponse erAppointmentFeesResponse = new ERAppointmentFeesResponse();
service.getERAppointmentFees(selectedClinicID, context).then((res) {
service.getERAppointmentFees(selectedClinicID, widget.isPharmacyLiveCare, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res['HasAppointment'] == true) {
isError = true;
@ -185,7 +185,7 @@ class _clinic_listState extends State<ClinicList> {
getERAppointmentTime(GetERAppointmentFeesList getERAppointmentFeesList) {
LiveCareService service = new LiveCareService();
GifLoaderDialogUtils.showMyDialog(context);
service.getERAppointmentTime(selectedClinicID, context).then((res) {
service.getERAppointmentTime(selectedClinicID, widget.isPharmacyLiveCare, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
showLiveCarePaymentDialog(getERAppointmentFeesList, res['WatingtimeInteger']);
}).catchError((err) {
@ -462,7 +462,7 @@ class _clinic_listState extends State<ClinicList> {
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(context);
service.checkPaymentStatus(widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) {
service.checkPaymentStatus(widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), widget.isPharmacyLiveCare, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
String paymentInfo = res['Response_Message'];
amount = res['Amount'].toString();
@ -489,7 +489,7 @@ class _clinic_listState extends State<ClinicList> {
addNewCallForPatientER(String clientRequestID) {
LiveCareService service = new LiveCareService();
GifLoaderDialogUtils.showMyDialog(context);
service.addNewCallForPatientER(selectedClinicID, clientRequestID, context).then((res) {
service.addNewCallForPatientER(selectedClinicID, clientRequestID, widget.isPharmacyLiveCare, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showSuccessToast(message: "New Call has been added successfully");
widget.getLiveCareHistory();
@ -595,7 +595,7 @@ class _clinic_listState extends State<ClinicList> {
widget.isPharmacyLiveCare = true;
widget.pharmacyLiveCareQRCode = value.split("/")[1];
liveCareClinicIDs = await sharedPref.getString(LIVECARE_CLINIC_DATA);
selectedClinicID = 1;
selectedClinicID = 7;
selectedClinicName = TranslationBase.of(context).pharmaLiveCare;
sharedPref.remove(LIVECARE_CLINIC_DATA);
startLiveCare();

@ -428,7 +428,7 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
GifLoaderDialogUtils.showMyDialog(AppGlobal.context);
DoctorsListService service = new DoctorsListService();
service.checkPaymentStatus(transID, AppGlobal.context).then((res) {
service.checkPaymentStatus(transID, false, AppGlobal.context).then((res) {
String paymentInfo = res['Response_Message'];
if (paymentInfo == 'Success') {
txn_ref = res['Merchant_Reference'];

@ -904,7 +904,7 @@ class DoctorsListService extends BaseService {
return Future.value(localRes);
}
Future<Map> checkPaymentStatus(String transactionID, BuildContext context) async {
Future<Map> checkPaymentStatus(String transactionID, bool isPharma, BuildContext context) async {
Map<String, dynamic> request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE));
@ -914,6 +914,7 @@ class DoctorsListService extends BaseService {
Request req = appGlobal.getPublicRequest();
request = {
"ClientRequestID": transactionID,
"IsPharmacy": isPharma,
"VersionID": req.VersionID,
"Channel": req.Channel,
"LanguageID": languageID == 'ar' ? 1 : 2,

@ -146,7 +146,7 @@ class LiveCareService extends BaseService {
return Future.value(localRes);
}
Future<Map> getERAppointmentFees(int serviceID, BuildContext context) async {
Future<Map> getERAppointmentFees(int serviceID, bool isPharmaLiveCare, BuildContext context) async {
Map<String, dynamic> request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
@ -155,6 +155,7 @@ class LiveCareService extends BaseService {
}
request = {
"IsPharmacy": isPharmaLiveCare,
"ServiceID": serviceID,
"ProjectID": 12,
"PatientID": authUser.patientID != null ? authUser.patientID : 0,
@ -172,7 +173,7 @@ class LiveCareService extends BaseService {
return Future.value(localRes);
}
Future<Map> getERAppointmentTime(int serviceID, BuildContext context) async {
Future<Map> getERAppointmentTime(int serviceID, bool isPharmaLiveCare, BuildContext context) async {
Map<String, dynamic> request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
@ -181,6 +182,7 @@ class LiveCareService extends BaseService {
}
request = {
"IsPharmacy": isPharmaLiveCare,
"ServiceID": serviceID,
"ProjectID": 12,
"Age": authUser.age != null ? authUser.age : 0,
@ -198,7 +200,7 @@ class LiveCareService extends BaseService {
return Future.value(localRes);
}
Future<Map> addNewCallForPatientER(int serviceID, String clientRequestID, BuildContext context) async {
Future<Map> addNewCallForPatientER(int serviceID, String clientRequestID, bool isPharma, BuildContext context) async {
Map<String, dynamic> request;
String deviceToken;
@ -214,6 +216,7 @@ class LiveCareService extends BaseService {
}
request = {
"IsPharmacy": isPharma,
"ErServiceID": serviceID,
"ClientRequestID": clientRequestID,
"DeviceToken": deviceToken,

@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/pages/webRTC/OpenTok/OpenTok.dart';
import 'package:diplomaticquarterapp/uitl/LocalNotification.dart';
import 'package:diplomaticquarterapp/uitl/app-permissions.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:firebase_messaging/firebase_messaging.dart' as fir;
import 'package:flutter/cupertino.dart';
@ -163,7 +164,6 @@ class PushNotificationHandler {
}
init() async {
hmsApiAvailability = new HmsApiAvailability();
// VoIP Callbacks
voIPKit.getVoIPToken().then((value) {
print('🎈 example: getVoIPToken: $value');
@ -226,83 +226,7 @@ class PushNotificationHandler {
// if (Platform.isAndroid && (!await FlutterHmsGmsAvailability.isHmsAvailable)) {
if (Platform.isAndroid) {
try {
await hmsApiAvailability.isHMSAvailable().then((value) async {
if (value != 0) {
final fcmToken = await FirebaseMessaging.instance.getToken();
if (fcmToken != null) onToken(fcmToken);
}
});
} catch (ex) {}
}
if (Platform.isIOS) {
final permission = await FirebaseMessaging.instance.requestPermission();
if (permission.authorizationStatus == AuthorizationStatus.denied) return;
} else {
// await Permission.notification.request().then((value) {
// }).catchError((err) {
// print(err);
// });
}
// 'Android HMS' (Handle Huawei Push_Kit Streams)
// if (Platform.isAndroid) {
// if (Platform.isAndroid && (await FlutterHmsGmsAvailability.isHmsAvailable)) {
// } else {
// 'Android GMS or iOS' (Handle Firebase Messaging Streams
try {
FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage message) async {
if (message != null) {
// print("Firebase getInitialMessage with message : ${message.data.toString()}");
subscribeFCMTopic();
if (Platform.isIOS)
await Future.delayed(Duration(milliseconds: 3000)).then((value) {
if (message != null) newMessage(message);
});
else if (message != null) newMessage(message);
}
});
} catch (ex) {}
FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
print("Firebase onMessage!!!");
// Utils.showPermissionConsentDialog(context, "onMessage", (){});
// newMessage(message);
if (Platform.isIOS)
await Future.delayed(Duration(milliseconds: 3000)).then((value) {
newMessage(message);
});
else
newMessage(message);
});
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) async {
print("Firebase onMessageOpenedApp!!!");
if (Platform.isIOS)
await Future.delayed(Duration(milliseconds: 3000)).then((value) {
newMessage(message);
});
else
newMessage(message);
});
FirebaseMessaging.instance.onTokenRefresh.listen((fcm_token) {
print("Push Notification onTokenRefresh: " + fcm_token);
onToken(fcm_token);
});
FirebaseMessaging.instance.getToken(vapidKey: 'BHRJG8sIzcysWxPw3B6xQjz_85nUuCfU6EAmpH18kyUTmB2cj35IdFwCyWSab80SA1v6oBSWVh-p6PcHPw_y00Y').then((String token) {
print("Push Notification getToken: " + token);
onToken(token);
});
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
if (Platform.isAndroid) {
await hmsApiAvailability.isHMSAvailable().then((value) async {
if (value == 0) {
if (!(await Utils.isGoogleServicesAvailable())) {
h_push.Push.enableLogger();
final result = await h_push.Push.setAutoInitEnabled(true);
@ -320,18 +244,61 @@ class PushNotificationHandler {
await h_push.Push.getToken('');
h_push.Push.registerBackgroundMessageHandler(backgroundMessageHandler);
} else {
final fcmToken = await FirebaseMessaging.instance.getToken();
if (fcmToken != null) onToken(fcmToken);
try {
FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage message) async {
if (message != null) {
if (Platform.isIOS)
await Future.delayed(Duration(milliseconds: 3000)).then((value) {
if (message != null) newMessage(message);
});
else if (message != null) newMessage(message);
}
});
} catch (ex) {}
FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
print("Firebase onMessage!!!");
if (Platform.isIOS)
await Future.delayed(Duration(milliseconds: 3000)).then((value) {
newMessage(message);
});
else
newMessage(message);
});
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) async {
print("Firebase onMessageOpenedApp!!!");
if (Platform.isIOS)
await Future.delayed(Duration(milliseconds: 3000)).then((value) {
newMessage(message);
});
else
newMessage(message);
});
FirebaseMessaging.instance.onTokenRefresh.listen((fcm_token) {
print("Push Notification onTokenRefresh: " + fcm_token);
onToken(fcm_token);
});
FirebaseMessaging.instance.getToken(vapidKey: 'BHRJG8sIzcysWxPw3B6xQjz_85nUuCfU6EAmpH18kyUTmB2cj35IdFwCyWSab80SA1v6oBSWVh-p6PcHPw_y00Y').then((String token) {
print("Push Notification getToken: " + token);
onToken(token);
});
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
}
}).catchError((err) {
print(err);
});
} catch (ex) {}
}
}
subscribeFCMTopic() async {
print("subscribeFCMTopic!!!");
await FirebaseMessaging.instance.unsubscribeFromTopic('all_hmg_patients').then((value) async {
await FirebaseMessaging.instance.subscribeToTopic('all_hmg_patients');
});
if (Platform.isIOS) {
final permission = await FirebaseMessaging.instance.requestPermission();
if (permission.authorizationStatus == AuthorizationStatus.denied) return;
} else {}
}
newMessage(RemoteMessage remoteMessage) async {
@ -374,10 +341,7 @@ class PushNotificationHandler {
Future<void> isAndroidPermissionGranted() async {
if (Platform.isAndroid) {
final bool granted = await flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>()?.areNotificationsEnabled() ?? false;
if (granted) {
print("-------------------- Permission Granted ------------------------");
print(granted);
} else {
if (!granted) {
await requestPermissions();
}
}

@ -44,6 +44,7 @@ import 'package:diplomaticquarterapp/widgets/dialogs/covid_consent_dialog.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_api_availability/google_api_availability.dart';
// import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart';
import 'package:provider/provider.dart';
@ -772,6 +773,15 @@ class Utils {
);
}
static Future<bool> isGoogleServicesAvailable() async {
GooglePlayServicesAvailability availability = await GoogleApiAvailability.instance.checkGooglePlayServicesAvailability();
String status = availability.toString().split('.').last;
if (status == "success") {
return true;
}
return false;
}
static Widget tableColumnValueWithUnderLine(String text, {bool isLast = false, bool isCapitable = true}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,

@ -1,6 +1,5 @@
import 'dart:ui';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

@ -601,6 +601,7 @@ class _AppDrawerState extends State<AppDrawer> {
switchUser(user, context) {
GifLoaderDialogUtils.showMyDialog(context);
sharedPref.remove(BLOOD_TYPE);
this.familyFileProvider.silentLoggin(user is AuthenticatedUser ? null : user, mainUser: user is AuthenticatedUser).then((value) {
// GifLoaderDialogUtils.hideDialog(context);
// Navigator.of(context).pop();

@ -37,9 +37,9 @@ class MyInAppBrowser extends InAppBrowser {
// static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE
static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT
// static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT
static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT
static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE
// static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE
// static String PRESCRIPTION_PAYMENT_WITH_ORDERID =
// 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID=';

@ -204,6 +204,7 @@ dependencies:
# sms_retriever: ^1.0.0
sms_otp_auto_verify: ^2.1.0
flutter_ios_voip_kit: ^0.0.5
google_api_availability: ^3.0.1
# firebase_core: 1.12.0
dependency_overrides:

Loading…
Cancel
Save