updateMobileSetup

abstract suspend fun updateMobileSetup(timestampInSeconds: Long, gymVisitMode: GymVisitMode, isEulaAccepted: Boolean, timeZoneOffset: String?, isSetupFinished: Boolean): AFResult

Updates the member’s mobile setup (onboarding) state on the backend.

Call it when the member completes (or re-runs) the setup flow so EULA acceptance, the gym-visit mode, and the setup-finished flag are recorded server-side instead of only on the device.

Return

An AFResult indicating whether the update was accepted; on failure the backend error surfaces through AFResult.exception.

Parameters

timestampInSeconds

When the setup step completed, as Unix seconds.

gymVisitMode

The GymVisitMode the member selected.

isEulaAccepted

true when the member accepted the end-user license agreement.

timeZoneOffset

The member’s time zone as an IANA id such as "America/Chicago" - despite the parameter name, not a UTC offset. The backend replaces anything that is not an IANA id, a UTC offset such as "-06:00" included, with America/New_York. Pass the device's zone (TimeZone.currentSystemDefault().id in Kotlin, TimeZone.current.identifier in Swift), or null to omit it.

isSetupFinished

true when the member finished the whole setup flow.

Throws

if the update fails for a non-recoverable reason.

Android (Kotlin)

lifecycleScope.launch {
try {
val result = AFCore.applicationSettings().updateMobileSetup(
timestampInSeconds = System.currentTimeMillis() / 1000,
gymVisitMode = GymVisitMode.AUTOMATIC,
isEulaAccepted = true,
timeZoneOffset = TimeZone.currentSystemDefault().id, // IANA id, e.g. "America/Chicago"
isSetupFinished = true,
)
if (result.status) showSuccess("Setup saved") else showError(result.statusMessage)
} catch (t: Throwable) {
showError("Could not save setup: ${t.message}")
}
}

iOS (Swift)

Task {
do {
let result = try await AFCore.shared.applicationSettings().updateMobileSetup(
timestampInSeconds: Int64(Date().timeIntervalSince1970),
gymVisitMode: .automatic,
isEulaAccepted: true,
timeZoneOffset: TimeZone.current.identifier, // IANA id, e.g. "America/Chicago"
isSetupFinished: true
)
if result.status { self.showSuccess("Setup saved") }
else { self.showError(result.statusMessage) }
} catch {
self.showError("Could not save setup: \\(error.localizedDescription)")
}
}