Class TicketDB
Current integration scope:
- uses the agreed device-based schema from events/{eventId}/participants/{deviceId}
- supports live Firestore loading for the agreed participant statuses
Outstanding: - replace fallback display labels once the final event metadata contract is fully implemented
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceListener notified when any of the ticket-tab lists are refreshed. -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptInvitation(TicketUIModel ticket) Accepts an active ticket that requires a user decision.voidaddListener(TicketDB.Listener listener) Registers a listener for ticket-list refresh events.voiddeclineInvitation(TicketUIModel ticket) Declines an active ticket that requires a user decision.Returns a snapshot of the current Active tab ticket list.Returns a snapshot of the current Attending tab ticket list.static TicketDBReturns the shared ticket data source used by the Tickets feature.Returns a snapshot of the current Past tab ticket list.voidleaveWaitlist(TicketUIModel ticket) Removes the current entrant from an event's participant list.voidrefreshTickets(android.content.Context context, String preferredDeviceId) Reloads all ticket lists for the provided device-scoped entrant.voidremoveListener(TicketDB.Listener listener) Unregisters a listener that no longer needs ticket updates.
-
Method Details
-
getInstance
Returns the shared ticket data source used by the Tickets feature.- Returns:
- Singleton
TicketDBinstance.
-
addListener
Registers a listener for ticket-list refresh events.- Parameters:
listener- Listener to add if it is not already registered.
-
removeListener
Unregisters a listener that no longer needs ticket updates.- Parameters:
listener- Listener to remove.
-
refreshTickets
public void refreshTickets(@NonNull android.content.Context context, @Nullable String preferredDeviceId) Reloads all ticket lists for the provided device-scoped entrant.If the preferred device id is unavailable, this falls back to the current Android device id.
- Parameters:
context- Context used to resolve the Android device identifier fallback.preferredDeviceId- Preferred participant device id from the signed-in user session.
-
getActiveTickets
Returns a snapshot of the current Active tab ticket list.- Returns:
- Copy of the active-ticket list.
-
getAttendingTickets
Returns a snapshot of the current Attending tab ticket list.- Returns:
- Copy of the attending-ticket list.
-
getPastTickets
Returns a snapshot of the current Past tab ticket list.- Returns:
- Copy of the past-ticket list.
-
acceptInvitation
Accepts an active ticket that requires a user decision.Public-event invitations move into the attending state. Private-event invitations move into the waiting-list state because the entrant is only accepting the right to join the waitlist for that event and still needs to survive the draw before becoming attending.
- Parameters:
ticket- Invited ticket being accepted.
-
declineInvitation
Declines an active ticket that requires a user decision.Public-event invitations move into the past-history state. Private-event invitations are simply removed because the entrant is declining the chance to join that private event's waitlist.
- Parameters:
ticket- Invited ticket being declined.
-
leaveWaitlist
Removes the current entrant from an event's participant list.- Parameters:
ticket- Active ticket whose participant row should be deleted.
-