Activity
Activity model — a normalized record that has been accepted by the Mobile API.
Each instance represents a member action that can count toward goals (e.g., gym visit, virtual workout, challenge step). See ActivityType for the catalog of valid types.
Notes
Date format:
dateis an ISO-8601 string (UTC recommended), e.g."2025-08-22T14:03:00Z". Parse withkotlinx.datetime.Instant.parse(dateString)when needed.Icon source:
iconResmay be a local resource key/path or a remote URL.Status semantics: Common values include
"Accepted","Pending","Rejected","Completed". Tenant backends may define additional statuses; handle unknown values gracefully.
Android (Kotlin) — rendering a list item
lifecycleScope.launch {
val activities: List<Activity> = AFCore.activities().get(month: Int, year: Int)
adapter.submitList(activities)
}
// ViewHolder binding
fun bind(item: Activity) {
titleView.text = item.name ?: item.type.name
statusView.text = item.status ?: "—"
// Parse date if present
val dateLabel = item.date?.let {
runCatching { kotlinx.datetime.Instant.parse(it) }.getOrNull()
?.toLocalDateTime(kotlinx.datetime.TimeZone.currentSystemDefault())
?.let { dt -> "${dt.date} ${dt.time.hour}:${dt.time.minute.toString().padStart(2, '0')}" }
} ?: "Unknown date"
dateView.text = dateLabel
// Load iconRes (URL or local)
item.iconRes?.let { icon ->
if (icon.startsWith("http")) imageLoader.load(url = icon, into = iconView)
else iconView.setImageResource(resolveDrawable(icon)) // your mapping function
}
}iOS (Swift) — showing the latest accepted activity
Task {
do {
let activities = try await AFCore.shared.activities().getRecent()
if let firstAccepted = activities.first(where: { ($0.status ?? "").lowercased() == "accepted" }) {
let title = firstAccepted.name ?? firstAccepted.type.name
let dateStr = firstAccepted.date ?? "—"
self.showToast("\\(title) on \\(dateStr)")
} else {
self.showToast("No accepted activities yet")
}
} catch {
self.showError("Failed to load activities: \\(error.localizedDescription)")
}
}Filtering by type (Kotlin)
val gymVisits = activities.filter { it.type == ActivityType.GYM_VISIT }Constructors
Properties
Additional structured information related to this activity (optional).
The processing status (e.g., Accepted, Pending, Rejected, Completed).
The ActivityType for this record.