DailyWalkingSummary

class DailyWalkingSummary(val date: LocalDate, val steps: Int = 0, val calories: Double = 0.0, val distance: Double = 0.0, val distanceUnit: String? = null, val activeMinutes: Int = 0, val durationUnit: String? = null, val lastSync: String? = null, val deviceType: DeviceType? = null)

One day's SmartWalking totals, rolled up from the month returned by com.advantahealth.api.activities.Activities.get.

The monthly fetch already carries a per-day breakdown; this is that breakdown reduced to one row per day, so week and month charts, streaks and daily averages can be drawn without re-deriving them from AFActivitiesSummary.activities. It adds no network call — every value comes from the same response.

A member can sync several times a day, and the backend reports each sync window separately. Those windows are summed here (steps, calories, distance, activeMinutes), while distanceUnit, durationUnit, lastSync and deviceType are taken from the most recent window that reported one.

Days with no SmartWalking entry are absent from the list, rather than present with zeros — a day the member never synced is not a day they walked zero steps. Fill the gaps yourself when a chart needs a bar per day.

Kotlin — a week of bars and the daily average

val summary = AFCore.activities().get(month = 8, year = 2026)
val byDate = summary.dailyWalking.associateBy { it.date }
val week = (0..6).map { offset ->
val day = today.minus(6 - offset, DateTimeUnit.DAY)
byDate[day]?.steps ?: 0 // absent day renders as an empty bar
}
val averageOnDaysWalked = summary.dailyWalking.map { it.steps }.average()

Swift — the same read

let summary = try await AFCore.shared.activities().get(month: 8, year: 2026)
let byDate = Dictionary(uniqueKeysWithValues: summary.dailyWalking.map { ($0.date, $0) })
let averageOnDaysWalked = summary.dailyWalking.map { Int($0.steps) }.reduce(0, +)
/ max(summary.dailyWalking.count, 1)

Constructors

Link copied to clipboard
constructor(date: LocalDate, steps: Int = 0, calories: Double = 0.0, distance: Double = 0.0, distanceUnit: String? = null, activeMinutes: Int = 0, durationUnit: String? = null, lastSync: String? = null, deviceType: DeviceType? = null)

Properties

Link copied to clipboard

Active minutes that day, summed across sync windows and normalized to minutes.

Link copied to clipboard

Calories burned that day, summed across sync windows.

Link copied to clipboard
val date: LocalDate

The calendar day these totals belong to.

Link copied to clipboard

The health platform the day's steps came from, or null when the backend reported none or an unrecognized one.

Link copied to clipboard

Distance covered that day, summed across sync windows. Read distanceUnit before rendering it — the backend reports metric and imperial per tenant and the SDK does not convert.

Link copied to clipboard

Unit distance is expressed in as the backend named it (e.g. "Miles", "Meters"), or null when it reported none.

Link copied to clipboard

Unit of the raw duration the backend reported (e.g. "Minutes"), or null when it reported none. activeMinutes is already normalized; this is for labelling the backend's own figure.

Link copied to clipboard

Timestamp of the last sync that contributed to this day, as the ISO-8601 string the backend sent, or null when it reported none.

Link copied to clipboard
val steps: Int

Steps recorded that day, summed across sync windows.

Functions

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