Activities

interface Activities

Activities feature — fetch and record member activities for calendar or list views.

What this interface does

  • Fetch monthly and today summaries for building a calendar or a list.

  • Fetch filtered summaries (e.g., only gym visits) for a specific month.

  • Record automatic visits when the host app detects a qualifying event.

Data returned

  • AFActivitiesSummary contains:

  • A monthly summary (totals, progress) used to render calendar badges and header stats.

  • A list of individual activities used to populate daily cells or list items.

Platform & threading

  • All functions are suspend and should be called from a coroutine.

  • Errors surface as Throwable and should be handled at call sites.

Typical UI flows (calendar/list)

  • Calendar view: call get for the visible month; render daily counts/badges.

Properties

Link copied to clipboard

Observable stream of server-confirmed calendar changes.

Functions

Link copied to clipboard
abstract suspend fun deleteAutomaticVisit(date: String): AFResult

Deletes an automatic visit previously recorded via submitAutomaticVisit.

Link copied to clipboard
abstract suspend fun get(month: Int, year: Int): AFActivitiesSummary

Retrieves a monthly activities summary for the given month and year.

Link copied to clipboard

Returns the visits captured on this device that are still waiting in the offline outbox for upload, in delivery (FIFO) order.

Link copied to clipboard
abstract suspend fun submitAutomaticVisit(visitType: VisitType, timestampInSeconds: Long, latitude: Double, longitude: Double, facilityId: String, timeSpentInSeconds: Long): AFResult

Records an automatic visit on behalf of the member.

Link copied to clipboard
abstract fun subscribeToActivityEvents(onEvent: (MemberActivityEvent) -> Unit, onError: (Throwable) -> Unit = {}): FlowSubscription

Swift-friendly callback wrapper around activityEvents. Call FlowSubscription.close to stop receiving events.