Class ImageController
java.lang.Object
com.example.iconic_raffleevent.controller.ImageController
Controller class responsible for managing image data stored in Firestore.
Provides methods to retrieve all images and delete a specific image by its ID.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Callback interface for deleting an image.static interface
Callback interface for retrieving a list of images. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new ImageController and initializes the Firebase Firestore instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteImage
(String imageId, ImageController.DeleteImageCallback callback) Deletes a specific image by its ID from the Firestore database.void
Retrieves all images from the Firestore database.
-
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
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
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.
-