|
|
|
|
@ -15,6 +15,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/penguin_method_channel.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
|
import 'package:firebase_messaging/firebase_messaging.dart';
|
|
|
|
|
import 'package:firebase_messaging/firebase_messaging.dart' as fir;
|
|
|
|
|
@ -386,9 +387,16 @@ class PushNotificationHandler {
|
|
|
|
|
if (remoteMessage.data.isEmpty) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
debugPrint('the value of the remote message is ${remoteMessage.data}');
|
|
|
|
|
if (remoteMessage.data['is_call'] == 'true' || remoteMessage.data['is_call'] == true) {
|
|
|
|
|
_incomingCall(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 {
|
|
|
|
|
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 {
|
|
|
|
|
print("Push Notification Token: " + token);
|
|
|
|
|
await AppSharedPreferences().setString(PUSH_TOKEN, token);
|
|
|
|
|
|