Push notification fixes

merge-requests/400/head
haroon amjad 4 years ago
parent eeb20073cb
commit 0a90791aca

@ -38,7 +38,7 @@
</intent>
</queries>
<application
android:name="io.flutter.app.FlutterApplication"
android:name=".Application"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true"
android:label="Dr. Alhabib">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -171,24 +171,11 @@ class _InsuranceApprovalState extends State<InsuranceApproval> {
height: 25.0,
thickness: 1.0,
),
// Text(
// 'Company Name: ' +
// model.insuranceApproval[index]
// .companyName ==
// null
// ? '000'
// : model
// .insuranceApproval[index].companyName,
// style: TextStyle(
// fontSize: 17.5,
// fontWeight: FontWeight.w600),
// ),
Texts(
TranslationBase.of(context).companyName,
TranslationBase.of(context).companyName + ": " + model.insuranceApproval[index].companyName.toString(),
fontWeight: FontWeight.w600,
fontSize: 17.5,
),
Divider(
color: Colors.black,
height: 25.0,

@ -265,125 +265,124 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
// if (results[Permission.calendar].isGranted) ;
});
// requestPermissions();
// });
//
// //_firebase Background message handler
// _firebaseMessaging.configure(
// // onMessage: (Map<String, dynamic> message) async {
// // showDialog("onMessage: $message");
// // print("onMessage: $message");
// // print(message);
// // print(message['name']);
// // print(message['appointmentdate']);
// //
// // if (Platform.isIOS) {
// // if (message['is_call'] == "true") {
// // var route = ModalRoute.of(context);
// //
// // if (route != null) {
// // print(route.settings.name);
// // }
// //
// // Map<String, dynamic> myMap = new Map<String, dynamic>.from(message);
// // print(myMap);
// // LandingPage.isOpenCallPage = true;
// // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
// // if (!isPageNavigated) {
// // isPageNavigated = true;
// // Navigator.push(
// // context,
// // MaterialPageRoute(
// // builder: (context) => IncomingCall(
// // incomingCallData: LandingPage.incomingCallData)))
// // .then((value) {
// // isPageNavigated = false;
// // });
// // }
// // } else {
// // print("Is Call Not Found iOS");
// // }
// // } else {
// // print("Is Call Not Found iOS");
// // }
// //
// // if (Platform.isAndroid) {
// // if (message['data'].containsKey("is_call")) {
// // var route = ModalRoute.of(context);
// //
// // if (route != null) {
// // print(route.settings.name);
// // }
// //
// // Map<String, dynamic> myMap =
// // new Map<String, dynamic>.from(message['data']);
// // print(myMap);
// // LandingPage.isOpenCallPage = true;
// // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
// // if (!isPageNavigated) {
// // isPageNavigated = true;
// // Navigator.push(
// // context,
// // MaterialPageRoute(
// // builder: (context) => IncomingCall(
// // incomingCallData: LandingPage.incomingCallData)))
// // .then((value) {
// // isPageNavigated = false;
// // });
// // }
// // } else {
// // print("Is Call Not Found Android");
// // }
// // } else {
// // print("Is Call Not Found Android");
// // }
// // },
// // onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler,
// // onLaunch: (Map<String, dynamic> message) async {
// // print("onLaunch: $message");
// // showDialog("onLaunch: $message");
// // },
// // onResume: (Map<String, dynamic> message) async {
// // print("onResume: $message");
// // print(message);
// // print(message['name']);
// // print(message['appointmentdate']);
// //
// // showDialog("onResume: $message");
// //
// // if (Platform.isIOS) {
// // if (message['is_call'] == "true") {
// // var route = ModalRoute.of(context);
// //
// // if (route != null) {
// // print(route.settings.name);
// // }
// //
// // Map<String, dynamic> myMap =
// // new Map<String, dynamic>.from(message);
// // print(myMap);
// // LandingPage.isOpenCallPage = true;
// // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
// // if (!isPageNavigated) {
// // isPageNavigated = true;
// // Navigator.push(
// // context,
// // MaterialPageRoute(
// // builder: (context) => IncomingCall(
// // incomingCallData: LandingPage.incomingCallData)))
// // .then((value) {
// // isPageNavigated = false;
// // });
// // }
// // } else {
// // print("Is Call Not Found iOS");
// // }
// // } else {
// // print("Is Call Not Found iOS");
// // }
// // },
// );
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
// showDialog("onMessage: $message");
print("onMessage: $message");
print(message);
print(message['name']);
print(message['appointmentdate']);
if (Platform.isIOS) {
if (message['is_call'] == "true") {
var route = ModalRoute.of(context);
if (route != null) {
print(route.settings.name);
}
Map<String, dynamic> myMap = new Map<String, dynamic>.from(message);
print(myMap);
LandingPage.isOpenCallPage = true;
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
if (!isPageNavigated) {
isPageNavigated = true;
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => IncomingCall(
incomingCallData: LandingPage.incomingCallData)))
.then((value) {
isPageNavigated = false;
});
}
} else {
print("Is Call Not Found iOS");
}
} else {
print("Is Call Not Found iOS");
}
if (Platform.isAndroid) {
if (message['data'].containsKey("is_call")) {
var route = ModalRoute.of(context);
if (route != null) {
print(route.settings.name);
}
Map<String, dynamic> myMap =
new Map<String, dynamic>.from(message['data']);
print(myMap);
LandingPage.isOpenCallPage = true;
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
if (!isPageNavigated) {
isPageNavigated = true;
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => IncomingCall(
incomingCallData: LandingPage.incomingCallData)))
.then((value) {
isPageNavigated = false;
});
}
} else {
print("Is Call Not Found Android");
LocalNotification.getInstance().showNow(title: message['notification']['title'], subtitle: message['notification']['body']);
}
} else {
print("Is Call Not Found Android");
}
},
onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler,
onLaunch: (Map<String, dynamic> message) async {
print("onLaunch: $message");
// showDialog("onLaunch: $message");
},
onResume: (Map<String, dynamic> message) async {
print("onResume: $message");
print(message);
print(message['name']);
print(message['appointmentdate']);
// showDialog("onResume: $message");
if (Platform.isIOS) {
if (message['is_call'] == "true") {
var route = ModalRoute.of(context);
if (route != null) {
print(route.settings.name);
}
Map<String, dynamic> myMap =
new Map<String, dynamic>.from(message);
print(myMap);
LandingPage.isOpenCallPage = true;
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
if (!isPageNavigated) {
isPageNavigated = true;
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => IncomingCall(
incomingCallData: LandingPage.incomingCallData)))
.then((value) {
isPageNavigated = false;
});
}
} else {
print("Is Call Not Found iOS");
}
} else {
print("Is Call Not Found iOS");
}
},
);
}
showDialogs(String message) {

@ -53,7 +53,9 @@ class LocalNotification {
var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', 'HMG', importance: Importance.Max, priority: Priority.High, ticker: 'ticker', vibrationPattern: _vibrationPattern());
var iOSPlatformChannelSpecifics = IOSNotificationDetails();
var platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload);
await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err){
print(err);
});
});
}

@ -196,6 +196,7 @@ dependencies:
flutter_animarker: ^1.0.0
auto_size_text: ^2.0.1
equatable: ^1.2.5
signalr_core: ^1.0.8
dev_dependencies:
flutter_test:

Loading…
Cancel
Save