Commit c6689a9c authored by Noam Bonnie's avatar Noam Bonnie

Support for Android group alert behavior

parent 1525b511
...@@ -92,7 +92,24 @@ public class SendNotificationTask extends AsyncTask<Void, Void, Void> { ...@@ -92,7 +92,24 @@ public class SendNotificationTask extends AsyncTask<Void, Void, Void> {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
String group = bundle.getString("group"); String group = bundle.getString("group");
if (group != null) group = URLDecoder.decode( group, "UTF-8" ); if (group != null) group = URLDecoder.decode( group, "UTF-8" );
notification.setGroup(group); notification.setGroup(group);
String groupAlertBehavior = bundle.getString("groupAlertBehavior", "all");
switch(groupAlertBehavior) {
case "children":
notification.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN);
break;
case "summary":
notification.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY);
break;
case "all":
notification.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_ALL);
break;
default:
notification.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_ALL);
}
if (bundle.containsKey("groupSummary") && bundle.getBoolean("groupSummary")) { if (bundle.containsKey("groupSummary") && bundle.getBoolean("groupSummary")) {
notification.setGroupSummary(true); notification.setGroupSummary(true);
} }
......
...@@ -89,6 +89,8 @@ declare module "react-native-fcm" { ...@@ -89,6 +89,8 @@ declare module "react-native-fcm" {
ticker?: string; ticker?: string;
auto_cancel?: boolean; auto_cancel?: boolean;
group?: string; group?: string;
groupSummary?: boolean;
groupAlertBehavior?: string;
picture?: string; picture?: string;
ongoing?: boolean; ongoing?: boolean;
lights?: boolean; lights?: boolean;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment