redirection notification implemented

master
haroon amjad 1 day ago
parent a99b3e393a
commit b1ac1c1530

@ -358,7 +358,7 @@ var CAN_PAY_FOR_FOR_WALKIN_APPOINTMENT = 'Services/Doctors.svc/REST/CanPayForWal
var CHANNEL = 3; var CHANNEL = 3;
var GENERAL_ID = 'Cs2020@2016\$2958'; var GENERAL_ID = 'Cs2020@2016\$2958';
var IP_ADDRESS = '10.20.10.20'; var IP_ADDRESS = '10.20.10.20';
var VERSION_ID = 20.3; var VERSION_ID = 20.4;
var SETUP_ID = '91877'; var SETUP_ID = '91877';
var LANGUAGE = 2; var LANGUAGE = 2;
// var PATIENT_OUT_SA = 0; // var PATIENT_OUT_SA = 0;

@ -20,6 +20,11 @@ class GetNotificationsResponseModel {
String? isReadOn; String? isReadOn;
int? channelID; int? channelID;
int? projectID; int? projectID;
String? isExternalRedirect;
String? externalRedirectURLAndroid;
String? externalRedirectURLIos;
String? redirectButtonTextEn;
String? redirectButtonTextAr;
GetNotificationsResponseModel( GetNotificationsResponseModel(
{this.id, {this.id,
@ -42,7 +47,10 @@ class GetNotificationsResponseModel {
this.isRead, this.isRead,
this.isReadOn, this.isReadOn,
this.channelID, this.channelID,
this.projectID}); this.projectID,
this.isExternalRedirect,
this.externalRedirectURLAndroid,
this.externalRedirectURLIos, this.redirectButtonTextEn, this.redirectButtonTextAr});
GetNotificationsResponseModel.fromJson(Map<String, dynamic> json) { GetNotificationsResponseModel.fromJson(Map<String, dynamic> json) {
id = json['Id']; id = json['Id'];
@ -66,6 +74,11 @@ class GetNotificationsResponseModel {
isReadOn = json['IsReadOn']; isReadOn = json['IsReadOn'];
channelID = json['ChannelID']; channelID = json['ChannelID'];
projectID = json['ProjectID']; projectID = json['ProjectID'];
isExternalRedirect = json['isExternalRedirect'];
externalRedirectURLAndroid = json['externalRedirectURLAndroid'];
externalRedirectURLIos = json['externalRedirectURLIos'];
redirectButtonTextEn = json['redirectButtonTextEn'];
redirectButtonTextAr = json['redirectButtonTextAr'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -91,6 +104,11 @@ class GetNotificationsResponseModel {
data['IsReadOn'] = this.isReadOn; data['IsReadOn'] = this.isReadOn;
data['ChannelID'] = this.channelID; data['ChannelID'] = this.channelID;
data['ProjectID'] = this.projectID; data['ProjectID'] = this.projectID;
data['isExternalRedirect'] = this.isExternalRedirect;
data['externalRedirectURLAndroid'] = this.externalRedirectURLAndroid;
data['externalRedirectURLIos'] = this.externalRedirectURLIos;
data['redirectButtonTextEn'] = this.redirectButtonTextEn;
data['redirectButtonTextAr'] = this.redirectButtonTextAr;
return data; return data;
} }
} }

@ -189,7 +189,7 @@ class BaseAppClient {
// body['IdentificationNo'] = 1023854217; // body['IdentificationNo'] = 1023854217;
// body['MobileNo'] = "531940021"; //0560717232 // body['MobileNo'] = "531940021"; //0560717232
// body['PatientID'] = 4774402; //4609100 // body['PatientID'] = 1018977; //4609100 //2904826
// body['TokenID'] = "@dm!n"; // body['TokenID'] = "@dm!n";
// Patient ID: 3027574 // Patient ID: 3027574

@ -260,7 +260,7 @@ class PrescriptionsService extends BaseService {
body['Id'] = presOrderID; body['Id'] = presOrderID;
body['StatusId'] = 6; body['StatusId'] = 6;
body['ClickButton'] = 14; body['ClickButton'] = 14;
await baseAppClient.post(UPDATE_PRESCRIPTION_ORDER_RC, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { await baseAppClient.post(UPDATE_PRESCRIPTION_ORDER_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: body); }, body: body);

@ -1,9 +1,16 @@
import 'dart:io';
import 'package:hmg_patient_app/core/model/notifications/get_notifications_response_model.dart'; import 'package:hmg_patient_app/core/model/notifications/get_notifications_response_model.dart';
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
import 'package:hmg_patient_app/theme/colors.dart';
import 'package:hmg_patient_app/uitl/date_uitl.dart'; import 'package:hmg_patient_app/uitl/date_uitl.dart';
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart'; import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
import 'package:hmg_patient_app/widgets/buttons/defaultButton.dart';
import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart'; import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart';
import 'package:hmg_patient_app/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:hmg_patient_app/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:youtube_player_flutter/youtube_player_flutter.dart'; import 'package:youtube_player_flutter/youtube_player_flutter.dart';
class NotificationsDetailsPage extends StatefulWidget { class NotificationsDetailsPage extends StatefulWidget {
@ -60,6 +67,7 @@ class _NotificationsDetailsPageState extends State<NotificationsDetailsPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
isShowAppBar: true, isShowAppBar: true,
showNewAppBar: true, showNewAppBar: true,
@ -115,6 +123,19 @@ class _NotificationsDetailsPageState extends State<NotificationsDetailsPage> {
}, fit: BoxFit.fill), }, fit: BoxFit.fill),
), ),
SizedBox(height: 18), SizedBox(height: 18),
(widget.notification.isExternalRedirect.toString() == "true")
? DefaultButton(
projectViewModel.isArabic ? widget.notification.redirectButtonTextAr! : widget.notification.redirectButtonTextEn!,
() {
if (Platform.isIOS) {
launchUrl(Uri.parse(widget.notification.externalRedirectURLIos.toString()));
} else {
launchUrl(Uri.parse(widget.notification.externalRedirectURLAndroid.toString()));
}
},
color: CustomColors.accentColor,
)
: SizedBox(),
// Text( // Text(
// widget.notification.message!.trim(), // widget.notification.message!.trim(),
// style: TextStyle( // style: TextStyle(

@ -408,6 +408,11 @@ class PushNotificationHandler {
notification.messageTypeData = remoteMessage.data['picture']; notification.messageTypeData = remoteMessage.data['picture'];
notification.message = remoteMessage.data['message']; notification.message = remoteMessage.data['message'];
notification.notificationType = remoteMessage.data["NotificationType"].toString(); notification.notificationType = remoteMessage.data["NotificationType"].toString();
notification.isExternalRedirect = remoteMessage.data["isExternalRedirect"].toString();
notification.externalRedirectURLAndroid = remoteMessage.data["externalRedirectURLAndroid"].toString();
notification.externalRedirectURLIos = remoteMessage.data["externalRedirectURLIos"].toString();
notification.redirectButtonTextEn = remoteMessage.data["redirectButtonTextEn"].toString();
notification.redirectButtonTextAr = remoteMessage.data["redirectButtonTextAr"].toString();
if (remoteMessage.data["NotificationType"] == "2") { if (remoteMessage.data["NotificationType"] == "2") {
notification.videoURL = remoteMessage.data["VideoUrl"]; notification.videoURL = remoteMessage.data["VideoUrl"];
} }

Loading…
Cancel
Save