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 interface
Interface for listening to changes in the facilities collection. -
Method Summary
Modifier and TypeMethodDescriptionstatic FacilityDB
Get the singleton instance of FacilityDB.void
Set the facility change listener.void
Start listening to Firestore updates for the facilities collection.void
Stop 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
-