Merge pull request #752 from lbryio/fcm-data

handle FCM data-only messages
This commit is contained in:
Akinwale Ariwodola 2019-11-04 08:48:50 +01:00 committed by GitHub
commit 21914a0bd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 13 deletions

2
app

@ -1 +1 @@
Subproject commit 5915919560f641d16da26b9dc06bd1a1f122585c
Subproject commit a127e14a0f6828d2d5d165d05f75afc315700138

View file

@ -41,19 +41,14 @@ public class LbrynetMessagingService extends FirebaseMessagingService {
Log.d(TAG, "From: " + remoteMessage.getFrom());
Map<String, String> payload = remoteMessage.getData();
String type = null;
String url = null;
if (payload != null) {
type = payload.get("type");
url = payload.get("target");
}
if (type != null && getEnabledTypes().indexOf(type) > -1) {
// Check if message contains a notification payload.
RemoteMessage.Notification remoteNotification = remoteMessage.getNotification();
if (remoteNotification != null) {
Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
sendNotification(remoteNotification.getTitle(), remoteNotification.getBody(), type, url);
String type = payload.get("type");
String url = payload.get("target");
String title = payload.get("title");
String body = payload.get("body");
if (type != null && getEnabledTypes().indexOf(type) > -1 && body != null && body.trim().length() > 0) {
Log.d(TAG, "Message Notification Body: " + body);
sendNotification(title, body, type, url);
}
}
}