Package com.example.breeze_seas
Class EventCommentsDB
java.lang.Object
com.example.breeze_seas.EventCommentsDB
EventCommentsDB provides event-scoped Firestore access for realtime comment viewing,
posting, and organizer deletion.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback used for individual comment mutations.static interfaceCallback used when the current event's comments change in realtime. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComment(Event event, User user, String body, boolean authorOrganizer, EventCommentsDB.CommentMutationCallback callback) Adds one new comment to the given event's comments subcollection.voiddeleteComment(String eventId, String commentId, EventCommentsDB.CommentMutationCallback callback) Deletes one comment from the given event's comments subcollection.voidstartCommentsListen(String eventId, EventCommentsDB.CommentsUpdatedCallback callback) Starts listening for realtime comments updates on one event.voidStops the active realtime comments listener, if one exists.
-
Constructor Details
-
EventCommentsDB
public EventCommentsDB()Creates a Firestore-backed comments data helper.
-
-
Method Details
-
startCommentsListen
public void startCommentsListen(@NonNull String eventId, @NonNull EventCommentsDB.CommentsUpdatedCallback callback) Starts listening for realtime comments updates on one event.- Parameters:
eventId- Identifier of the event whose comments should be observed.callback- Listener that receives updated comment snapshots and errors.
-
stopCommentsListen
public void stopCommentsListen()Stops the active realtime comments listener, if one exists. -
addComment
public void addComment(@NonNull Event event, @Nullable User user, @NonNull String body, boolean authorOrganizer, @NonNull EventCommentsDB.CommentMutationCallback callback) Adds one new comment to the given event's comments subcollection.- Parameters:
event- Event receiving the new comment.user- Current app user who is posting the comment.body- Comment text content to save.authorOrganizer- Whether the author is posting as an organizer.callback- Listener notified when the mutation succeeds or fails.
-
deleteComment
public void deleteComment(@NonNull String eventId, @NonNull String commentId, @NonNull EventCommentsDB.CommentMutationCallback callback) Deletes one comment from the given event's comments subcollection.- Parameters:
eventId- Identifier of the event that owns the comment.commentId- Identifier of the comment document to remove.callback- Listener notified when the mutation succeeds or fails.
-