Package com.syzygy.events.database
Class User.NotificationListener
java.lang.Object
com.syzygy.events.database.User.NotificationListener
- All Implemented Interfaces:
com.google.firebase.firestore.EventListener<com.google.firebase.firestore.QuerySnapshot>
,Database.Dissolvable
- Enclosing class:
- User
@Dissolves
public class User.NotificationListener
extends Object
implements Database.Dissolvable, com.google.firebase.firestore.EventListener<com.google.firebase.firestore.QuerySnapshot>
Listeners for the creation of new notifications where the receiver is this user
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private final Consumer<Notification>
The consumer for new notificationsprivate final com.google.firebase.firestore.ListenerRegistration
The registration of the query listener -
Constructor Summary
ConstructorsConstructorDescriptionNotificationListener
(Consumer<Notification> onNewNotification) Adds a listener to the database which listens for any new notifications for this users -
Method Summary
-
Field Details
-
reg
private final com.google.firebase.firestore.ListenerRegistration regThe registration of the query listener -
onNotification
The consumer for new notifications -
init
private boolean init
-
-
Constructor Details
-
NotificationListener
Adds a listener to the database which listens for any new notifications for this usersCalls the `onNewNotification` consumer whenever a new notification is added to the database with the receiver being this user
- Parameters:
onNewNotification
- The consumer for new notifications
-
-
Method Details
-
dissolve
public void dissolve()Removes the listener- Specified by:
dissolve
in interfaceDatabase.Dissolvable
-
onEvent
public void onEvent(@Nullable com.google.firebase.firestore.QuerySnapshot value, @Nullable com.google.firebase.firestore.FirebaseFirestoreException error) - Specified by:
onEvent
in interfacecom.google.firebase.firestore.EventListener<com.google.firebase.firestore.QuerySnapshot>
-