Class EventController

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

public class EventController extends Object
EventController handles the logic related to event creation, modification, and management. It communicates between the event model and the view components.
  • Constructor Details

    • EventController

      public EventController()
      Constructs a new EventController instance and initializes FirebaseAttendee.
  • Method Details

    • getEventDetails

      public void getEventDetails(String eventId, EventController.EventDetailsCallback callback)
      Fetches event details for a given event ID.
      Parameters:
      eventId - The ID of the event.
      callback - The callback to handle the fetched event details or error.
    • getEventMap

      public void getEventMap(String eventId, EventController.EventMapCallback callback)
      Fetches the map locations associated with a given event.
      Parameters:
      eventId - The ID of the event.
      callback - The callback to handle the fetched locations or error.
    • getAllEvents

      public void getAllEvents(EventController.EventListCallback callback)
      Fetches all available events.
      Parameters:
      callback - The callback to handle the fetched events or error.
    • setWaitingListLimit

      public void setWaitingListLimit(String eventId, int waitingListLimit, EventController.UpdateEventCallback callback)
      Validates and sets the waiting list limit for an event. Ensures that the limit is greater than or equal to the current waiting list size.
      Parameters:
      eventId - The ID of the event.
      waitingListLimit - The new waiting list limit.
      callback - Callback to handle success or error.
    • joinWaitingListWithLocation

      public void joinWaitingListWithLocation(String eventId, User user, com.google.firebase.firestore.GeoPoint userLocation, EventController.JoinWaitingListCallback callback)
      Adds a user to the event's waiting list with their location. Checks if the waiting list limit has been reached before adding the user.
      Parameters:
      eventId - The ID of the event.
      user - The user.
      userLocation - The location of the user.
      callback - The callback to handle success or error.
    • joinWaitingListWithoutLocation

      public void joinWaitingListWithoutLocation(String eventId, String userId, EventController.JoinWaitingListCallback callback)
      Adds a user to the event's waiting list without their location. Checks if the waiting list limit has been reached before adding the user.
      Parameters:
      eventId - The ID of the event.
      userId - The ID of the user.
      callback - The callback to handle success or error.
    • leaveWaitingList

      public void leaveWaitingList(Event event, User user, EventController.LeaveWaitingListCallback callback)
      Removes a user from the event's waiting list.
      Parameters:
      event - The event we are removing the user from
      user - The user.
      callback - The callback to handle success or error.
    • leaveLocationsList

      public void leaveLocationsList(Event event, String userId, EventController.LeaveLocationsListCallback callback)
      Removes a user from the event's locations map.
      Parameters:
      event - The event we are removing the users location from
      userId - The user ID.
      callback - The callback to handle success or error.
    • acceptEventInvitation

      public void acceptEventInvitation(String eventId, String userId, EventController.AcceptInvitationCallback callback)
      Accepts an event invitation for the user.
      Parameters:
      eventId - The ID of the event.
      userId - The ID of the user.
      callback - The callback to handle success or error.
    • declineEventInvitation

      public void declineEventInvitation(String eventId, String userId, EventController.DeclineInvitationCallback callback)
      Declines an event invitation for the user.
      Parameters:
      eventId - The ID of the event.
      userId - The ID of the user.
      callback - The callback to handle success or error.
    • saveEventToDatabase

      public void saveEventToDatabase(Event event, User user)
      Saves an event to the database.
      Parameters:
      event - The event object to save.
      user - The user associated with the event.
    • uploadEventPoster

      public void uploadEventPoster(android.net.Uri imageUri, Event eventObj, EventController.UploadEventPosterCallback callback)
      Uploads an event poster to Firebase Storage.
      Parameters:
      imageUri - The URI of the image to upload.
      eventObj - The event object associated with the poster.
      callback - The callback to handle success or error.
    • uploadEventQRCode

      public void uploadEventQRCode(Event eventObj, EventController.UploadEventQRCodeCallback callback)
      Uploads an event QR code to Firebase Storage.
      Parameters:
      eventObj - The event object associated with the QR code.
      callback - The callback to handle success or error.
    • updateEventDetails

      public void updateEventDetails(Event eventObj)
      Update an existing events information in the database
      Parameters:
      eventObj - event being updated
    • scanQRCode

      public void scanQRCode(String qrCodeData, EventController.ScanQRCodeCallback callback)
      Scan a qrcode from the users camera and returns the event
      Parameters:
      callback - The callback to handle the fetched events or error.
      qrCodeData - The qr code data embedded in the qrcode image
    • getUserWaitingListEvents

      public void getUserWaitingListEvents(String userId, EventController.EventListCallback callback)
      Fetches the list of events a user is waiting for.
      Parameters:
      userId - The ID of the user.
      callback - The callback to handle the fetched events or error.
    • getAllUserEvents

      public void getAllUserEvents(String userId, EventController.EventListCallback callback)
      Fetches the events a user is in a waiting list for or an owner of
      Parameters:
      userId - The ID of the user
      callback - The callback to handle the fetched events or error
    • deleteEventWithMedia

      public void deleteEventWithMedia(String eventId, EventController.DeleteEventCallback callback)
      Deletes an event along with its associated media (poster and QR code).
      Parameters:
      eventId - The ID of the event to be deleted.
      callback - The callback interface to notify the success or failure of the operation.
    • deleteEvent

      public void deleteEvent(String eventId, EventController.DeleteEventCallback callback)
      Deletes an event by its ID.
      Parameters:
      eventId - The ID of the event to be deleted.
      callback - The callback interface to notify the success or failure of the operation.
    • sendNotification

      public void sendNotification(Notification notification, EventController.SendDrawNotificationCallback callback)
      Creates a notification in the Notification collection indicates if a user was selected for an event
      Parameters:
      notification - notification to be created
      callback - The callback to handle success or error