Class FacilityDB
java.lang.Object
com.example.slacks_lottoevent.database.FacilityDB
FacilityDB is a singleton class that manages the Firestore database for facilities.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface for listening to changes in the facilities collection. -
Method Summary
Modifier and TypeMethodDescriptionstatic FacilityDBGet the singleton instance of FacilityDB.voidSet the facility change listener.voidStart listening to Firestore updates for the facilities collection.voidStop listening to Firestore updates.com.google.android.gms.tasks.Task<Void>updateFacility(String name, String streetAddress, String deviceId) Add a new facility to the Firestore database.
-
Method Details
-
getInstance
Get the singleton instance of FacilityDB.- Returns:
- the singleton instance of FacilityDB
-
startListening
public void startListening()Start listening to Firestore updates for the facilities collection. -
stopListening
public void stopListening()Stop listening to Firestore updates. -
setFacilityChangeListener
Set the facility change listener.- Parameters:
listener- the facility change listener
-
updateFacility
public com.google.android.gms.tasks.Task<Void> updateFacility(String name, String streetAddress, String deviceId) Add a new facility to the Firestore database.- Parameters:
name- the name of the facilitystreetAddress- the street address of the facilitydeviceId- the device ID of the organizer- Returns:
- a Task representing the completion of the operation
-