File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
onesignal/src/main/java/com/onesignal
unittest/src/test/java/com/test/onesignal Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -715,6 +715,8 @@ private static void createGrouplessSummaryNotification(
715
715
String group = OneSignalNotificationManager .getGrouplessSummaryKey ();
716
716
String summaryMessage = grouplessNotifCount + " new messages" ;
717
717
int summaryNotificationId = OneSignalNotificationManager .getGrouplessSummaryId ();
718
+ OneSignalDbHelper dbHelper = OneSignalDbHelper .getInstance (currentContext );
719
+ createSummaryIdDatabaseEntry (dbHelper , group , summaryNotificationId );
718
720
719
721
PendingIntent summaryContentIntent = intentGenerator .getNewActionPendingIntent (
720
722
random .nextInt (),
Original file line number Diff line number Diff line change @@ -430,6 +430,26 @@ public void testFourGrouplessNotificationsUseDefaultGroup() throws Exception {
430
430
assertEquals (4 , getNotificationsInGroup ("os_group_undefined" ).size ());
431
431
}
432
432
433
+ @ Test
434
+ @ Config (sdk = Build .VERSION_CODES .N , shadows = { ShadowGenerateNotification .class })
435
+ public void testGrouplessSummaryNotificationIsDismissedOnClear () throws Exception {
436
+ OneSignal .setAppId ("b2f7f966-d8cc-11e4-bed1-df8f05be55ba" );
437
+ OneSignal .initWithContext (blankActivity .getApplicationContext ());
438
+ threadAndTaskWait ();
439
+
440
+ // Add 4 groupless notifications
441
+ postNotificationWithOptionalGroup (4 , null );
442
+ threadAndTaskWait ();
443
+
444
+ // Obtain the posted notifications
445
+ Map <Integer , PostedNotification > postedNotifs = ShadowRoboNotificationManager .notifications ;
446
+ assertEquals (5 , postedNotifs .size ());
447
+ // Clear OneSignal Notifications
448
+ OneSignal .clearOneSignalNotifications ();
449
+ threadAndTaskWait ();
450
+ assertEquals (0 , postedNotifs .size ());
451
+ }
452
+
433
453
@ Test
434
454
@ Config (sdk = Build .VERSION_CODES .LOLLIPOP , shadows = { ShadowGenerateNotification .class })
435
455
public void testNotifDismissAllOnGroupSummaryClickForAndroidUnderM () throws Exception {
You can’t perform that action at this time.
0 commit comments