Class ImageController

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

public class ImageController extends Object
Controller class responsible for managing image data stored in Firestore. Provides methods to retrieve all images and delete a specific image by its ID.
  • Field Details

    • db

      public com.google.firebase.firestore.FirebaseFirestore db
  • Constructor Details

    • ImageController

      public ImageController()
      Constructs a new ImageController and initializes the Firebase Firestore instance. This instance is used to interact with the Firestore database.
  • Method Details

    • getAllImages

      public void getAllImages(ImageController.ImageListCallback callback)
      Retrieves all images from the Firestore database. This method fetches all the image documents stored in the "images" collection, converts them into ImageData objects, and passes them to the callback.
      Parameters:
      callback - The callback interface to handle the retrieved images or error.
    • deleteImage

      public void deleteImage(String imageId, ImageController.DeleteImageCallback callback)
      Deletes a specific image by its ID from the Firestore database.
      Parameters:
      imageId - The ID of the image to be deleted.
      callback - The callback interface to handle the success or failure of the deletion.