1 package expo.modules.notifications.notifications.interfaces; 2 3 import com.google.firebase.messaging.FirebaseMessagingService; 4 5 import expo.modules.notifications.notifications.model.Notification; 6 import expo.modules.notifications.notifications.model.NotificationResponse; 7 8 /** 9 * Interface used to register in {@link NotificationManager} 10 * and be notified of new message events. 11 */ 12 public interface NotificationListener { 13 /** 14 * Callback called when new notification is received. 15 * 16 * @param notification Notification received 17 */ onNotificationReceived(Notification notification)18 default void onNotificationReceived(Notification notification) { 19 } 20 21 /** 22 * Callback called when new notification response is received. 23 * 24 * @param response Notification response received 25 * @return Whether the notification response has been handled 26 */ onNotificationResponseReceived(NotificationResponse response)27 default boolean onNotificationResponseReceived(NotificationResponse response) { 28 return false; 29 } 30 31 /** 32 * Callback called when some notifications are dropped. 33 * See {@link FirebaseMessagingService#onDeletedMessages()} 34 */ onNotificationsDropped()35 default void onNotificationsDropped() { 36 } 37 } 38