Activity

class Activity(var type: ActivityType? = null, var name: String? = null, var iconRes: String? = null, var statusType: ActivityStatus = ActivityStatus.IGNORE, var date: String? = null, var metaData: ActivityMetaData? = null, var message: String? = null)

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: date is an ISO-8601 string (UTC recommended), e.g. "2025-08-22T14:03:00Z". Parse with kotlinx.datetime.Instant.parse(dateString) when needed.

  • Icon source: iconRes may 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

Link copied to clipboard
constructor(type: ActivityType? = null, name: String? = null, iconRes: String? = null, statusType: ActivityStatus = ActivityStatus.IGNORE, date: String? = null, metaData: ActivityMetaData? = null, message: String? = null)

Properties

Link copied to clipboard
var date: String?

The recorded date/time as ISO-8601 string (e.g., 2025-08-22T14:03:00Z).

Link copied to clipboard

Icon reference for the activity (local key/path or remote URL).

Link copied to clipboard

A display-friendly message describing the record (optional).

Link copied to clipboard

Additional structured information related to this activity (optional).

Link copied to clipboard
var name: String?

A display-friendly name for the activity (optional).

Link copied to clipboard

The processing status (e.g., Accepted, Pending, Rejected, Completed).

Link copied to clipboard

The ActivityType for this record.

Functions

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