Facilities

interface Facilities

Facilities feature — manage the facilities associated with the authenticated member.

This interface provides operations to retrieve, update, delete, monitor, and nominate facilities. Implementations connect to backend services and manage local persistence internally; developers interact only with these methods.

Capabilities

  • Get: retrieve all facilities for the current member.

  • Update: change verification status of a facility.

  • Delete: remove a facility from the member’s list.

  • Monitoring: start/stop monitoring facilities for presence and updates (leverages geofencing/proximity if available).

  • Nomination: submit a new facility for consideration and retrieve a list of past nominations.

Platform & threading

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

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

Typical flows

  • Initialization: call get to fetch facilities and display them in UI.

  • Status change: call update when a facility is verified or blacklisted.

  • Removal: call delete when a facility should no longer appear.

  • Real-time monitoring: call startMonitoring at login/onboarding, and stopMonitoring at logout or when presence tracking is no longer needed.

  • New facility suggestion: use nominateFacility to submit a new club. Check its status later by calling getNominatedFacilities.

Properties

Link copied to clipboard
open val geofenceEvents: SharedFlow<AFGeofenceEvent>

A SharedFlow that emits AFGeofenceEvent instances as geofence transitions occur for the member's monitored facilities.

Functions

Link copied to clipboard
abstract suspend fun delete(facilityId: Int): AFResult

Deletes a facility from the member’s list.

Link copied to clipboard
abstract suspend fun get(): List<Facility>

Retrieves the list of facilities associated with the current member.

Link copied to clipboard
Link copied to clipboard
abstract suspend fun isMonitoringActive(): Boolean
Link copied to clipboard
abstract suspend fun nominateFacility(clubName: String, address1: String, address2: String?, city: String, stateCode: String, zipCode: String, latitude: Double?, longitude: Double?, phoneNumber: String?, email: String?, managerName: String?, currentlyAMember: Boolean?, metadata: Map<String, String?>?): AFResult

Submits a new facility for nomination.

Link copied to clipboard
abstract suspend fun startMonitoring(): AFGeofencingResult

Starts monitoring presence events for the member’s facilities.

Link copied to clipboard
abstract suspend fun stopMonitoring(): Boolean

Stops monitoring facilities.

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

Subscribes to geofence transition events for monitored facilities.

Link copied to clipboard
abstract fun subscribeToStatus(onStatus: (AFGeofencingStatus) -> Unit, onError: (Throwable) -> Unit = {}): FlowSubscription

Subscribes to live geofencing-status changes. Replays the latest value to the new collector and emits whenever the SDK transitions states (e.g., from PAUSED to ACTIVE once the user grants Always location, or to PERMISSIONS_DENIED if the permission is revoked in Settings).

Link copied to clipboard
abstract suspend fun update(facilityId: Int, verified: Boolean): AFResult

Updates the verification status of a facility.