I'm implementing an app for iOS that is based on events. These events have a startTime and endTime. They are available to the user to see only at this interval from startTime to endTime.
That's how it works: An user can create an event and post it to the Firebase database (the event contains startTime and endTime). So if the current time matches this interval, the user can see the current events that are going on; but if the endTime arrives, the event gets deleted from the database and the user can no longer access it.
How does this check works on an iOS app with Firebase?
I'm sorry if I wasn't clear
I've had to implement something similar. Here's the breakdown of how you can achieve this with Firebase.
Firebase does not provide server-side logic so you can't rely on Firebase deleting the data for you (in the case the event owner terminating the app, turning off phone, etc).
FirebaseServerValue.timestamp to provide your event with a standard time value. This will be your constant to either allow or deny a user from seeing an event.
if / else statements to control the event's visibility only between
endTime (also set as timestamps).
Because you can't use server side logic to delete the data, you must use the client to remove data from Firebase. Use the
if / else logic from #3 to determine if your current timestamp value is past the
endTime timestamp, and, if true, remove that piece of data from Firebase.
Hope this helps.