ProgramFeature

class ProgramFeature(var name: String? = null, var activated: Boolean = false)

ProgramFeature — represents a feature inside a ProgramEntitlement.

Features are specific capabilities within a program. For example, the GymVisits program may include:

  • Check-In

  • Automatic Visits

  • Self-Report

  • Facilities

Properties

  • name Feature name (e.g., "Automatic Visits", "Facilities").

  • activated Whether the feature is enabled for the signed-in member.

Notes

Android (Kotlin) — checking Self-Report

lifecycleScope.launch {
val features = AFCore.programs().getAvailableFeature()
val selfReport = features.find { it?.name == "Self-Report" }
if (selfReport?.activated == true) {
AFCore.selfReport().submit(
facilityId = 42,
timestampInSeconds = Clock.System.now().epochSeconds,
timeSpentInSeconds = 3600,
atFacility = true
)
} else {
showError("Self-Report feature not enabled")
}
}

iOS (Swift) — checking Self-Report

Task {
let features = try await AFCore.shared.programs().getAvailableFeature()
if features.contains(where: { $0?.name == "Self-Report" && $0?.activated == true }) {
try await AFCore.shared.selfReport().submit(
facilityId: 42,
timestampInSeconds: Int64(Date().timeIntervalSince1970),
timeSpentInSeconds: 3600,
atFacility: true
)
} else {
print("Self-Report feature not enabled")
}
}

Constructors

Link copied to clipboard
constructor(name: String? = null, activated: Boolean = false)

Properties

Link copied to clipboard
Link copied to clipboard
var name: String?

Functions

Link copied to clipboard
open override fun toString(): String