WD: notification for navigation added

merge-update-with-lab-changes
taha.alam 2 years ago
parent b1432280a1
commit 1e8953538a

@ -54,7 +54,7 @@ class PayfortService extends BaseService {
"Pat_Token": result.tokenName, "Pat_Token": result.tokenName,
"IsRefund": false, "IsRefund": false,
"RemmeberMe": false, "RemmeberMe": false,
"Reconciliation_Reference": result.reconciliationReference, "Reconciliation_Reference": "",
"LanguageID": 1, "LanguageID": 1,
"PatientID": patientID "PatientID": patientID
}; };

@ -3,7 +3,8 @@ import 'package:flutter/services.dart';
class PenguinMethodChannel { class PenguinMethodChannel {
static const MethodChannel _channel = MethodChannel('launch_penguin_ui'); static const MethodChannel _channel = MethodChannel('launch_penguin_ui');
static Future<void> launch(String storyboardName, String languageCode, String username) async { static Future<void> launch(String storyboardName, String languageCode, String username,
{NavigationClinicDetails? details}) async {
try { try {
await _channel.invokeMethod('launchPenguin', { await _channel.invokeMethod('launchPenguin', {
"storyboardName": storyboardName, "storyboardName": storyboardName,
@ -20,10 +21,20 @@ class PenguinMethodChannel {
"isEnableReportIssue": true, "isEnableReportIssue": true,
"languageCode": languageCode, "languageCode": languageCode,
"clientKey": "UGVuZ3VpbklOX1Blbk5hdl9QSUY=", "clientKey": "UGVuZ3VpbklOX1Blbk5hdl9QSUY=",
"mapBoxKey": "sk.eyJ1IjoicndhaWQiLCJhIjoiY2x6NWo0bTMzMWZodzJrcGZpemYzc3Z4dSJ9.uSSZuwNSGCcCdPAiORECmg" "mapBoxKey": "sk.eyJ1IjoicndhaWQiLCJhIjoiY2x6NWo0bTMzMWZodzJrcGZpemYzc3Z4dSJ9.uSSZuwNSGCcCdPAiORECmg",
"clinic_id": details?.clinicId ?? "",
"patient_id": details?.patientId ?? "",
"project_id": details?.projectId ?? "",
}); });
} on PlatformException catch (e) { } on PlatformException catch (e) {
print("Failed to launch PenguinIn: '${e.message}'."); print("Failed to launch PenguinIn: '${e.message}'.");
} }
} }
} }
class NavigationClinicDetails{
String? clinicId;
String? patientId;
String? projectId;
}

@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/pages/webRTC/OpenTok/OpenTok.dart';
import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart';
import 'package:diplomaticquarterapp/uitl/app-permissions.dart'; import 'package:diplomaticquarterapp/uitl/app-permissions.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/penguin_method_channel.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:firebase_messaging/firebase_messaging.dart' as fir; import 'package:firebase_messaging/firebase_messaging.dart' as fir;
@ -386,9 +387,16 @@ class PushNotificationHandler {
if (remoteMessage.data.isEmpty) { if (remoteMessage.data.isEmpty) {
return; return;
} }
debugPrint('the value of the remote message is ${remoteMessage.data}');
if (remoteMessage.data['is_call'] == 'true' || remoteMessage.data['is_call'] == true) { if (remoteMessage.data['is_call'] == 'true' || remoteMessage.data['is_call'] == true) {
_incomingCall(remoteMessage.data); _incomingCall(remoteMessage.data);
// showCallkitIncoming(remoteMessage.data); // showCallkitIncoming(remoteMessage.data);
}if(remoteMessage.data['is_navigation'] == 'true' || remoteMessage.data['is_navigation'] == true ){
NavigationClinicDetails data = NavigationClinicDetails();
data.clinicId = remoteMessage.data['clinic_Id'];
data.patientId = remoteMessage.data['patient_Id'];
data.projectId = remoteMessage.data['project_Id'];
initPenguinSDK(data);
} else { } else {
GetNotificationsResponseModel notification = new GetNotificationsResponseModel(); GetNotificationsResponseModel notification = new GetNotificationsResponseModel();
@ -406,6 +414,21 @@ class PushNotificationHandler {
} }
} }
initPenguinSDK(NavigationClinicDetails data) async {
final bool permited = await AppPermission.askPenguinPermissions();
if (!permited) {
Map<Permission, PermissionStatus> statuses = await [
Permission.location,
Permission.bluetooth,
Permission.bluetoothConnect,
Permission.bluetoothScan,
Permission.activityRecognition,
].request().whenComplete(() {
PenguinMethodChannel.launch("penguin", "en", "1231755", details: data);
});
}
}
onToken(String token) async { onToken(String token) async {
print("Push Notification Token: " + token); print("Push Notification Token: " + token);
await AppSharedPreferences().setString(PUSH_TOKEN, token); await AppSharedPreferences().setString(PUSH_TOKEN, token);

Loading…
Cancel
Save