Class NotificationController

java.lang.Object
com.example.iconic_raffleevent.controller.NotificationController

public class NotificationController extends Object
Controller class responsible for managing notifications for users. Provides methods to retrieve notifications and mark them as read.
  • Field Details

    • db

      public com.google.firebase.firestore.FirebaseFirestore db
    • notificationsCollection

      public com.google.firebase.firestore.CollectionReference notificationsCollection
    • firebaseAttendee

      public FirebaseAttendee firebaseAttendee
  • Constructor Details

    • NotificationController

      public NotificationController()
      Constructs a new NotificationController and initializes the Firebase Firestore instance. Also sets up the reference to the "Notification" collection in Firestore.
  • Method Details

    • sendNotification

      public void sendNotification(Notification notification, NotificationController.SendNotificationCallback callback)
      Uploads a new notification to the Notification collection in firebase
      Parameters:
      notification - Notification to be uploaded
      callback - The callback interface to handle the uploaded notifications or error
    • getNotifications

      public void getNotifications(String userId, NotificationController.GetNotificationsCallback callback)
      Retrieves the notifications for a specified user.
      Parameters:
      userId - The ID of the user for whom to fetch the notifications.
      callback - The callback interface to handle the fetched notifications or error.
    • markNotificationAsRead

      public void markNotificationAsRead(String notificationId, NotificationController.MarkNotificationAsReadCallback callback)
      Marks a notification as read by updating its "read" status in Firestore.
      Parameters:
      notificationId - The ID of the notification to mark as read.
      callback - The callback interface to handle the success or failure of the operation.