Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Make TrackableState consistent with Android #625

@lawrence-forooghian

Description

@lawrence-forooghian

As of #624, Swift’s TrackableState looks like this:

/**
 Indicates Asset connection status (i.e. if courier is publishing their location)
 */
public enum TrackableState: Int {
    /**
     Asset is connected to tracking system and we're receiving their position
     */
    case online

    /**
     Asset is not connected
     */
    case offline

    /**
     Connection has failed
     */
    case failed
}

but in Android at 4d13ae7 it looks like this:

/**
 * Represents a state of a trackable that's being tracked by a publisher.
 */
sealed class TrackableState {
    /**
     * Trackable state is [Online] when it's being actively tracked.
     * This state can change to either [Offline] or [Failed].
     */
    object Online : TrackableState()

    /**
     * Trackable state is [Publishing] when its locations are being published but it is not able to detect subscribers or receive data from them.
     * This state allows the trackable to be actively tracked, however, its features are limited compared to the [Online] state.
     * This state can change to either [Online] or [Offline] or [Failed].
     */
    object Publishing : TrackableState()

    /**
     * Trackable state is [Offline] when it's connecting or recovering from an error and hopefully will soon be back in the [Online] or [Publishing].
     * This state can change to either [Online] or [Publishing] or [Failed].
     */
    data class Offline(val errorInformation: ErrorInformation? = null) : TrackableState()

    /**
     * Trackable state is [Failed] when there was an error from which we cannot recover.
     * This is a final state.
     */
    data class Failed(val errorInformation: ErrorInformation) : TrackableState()
}

That is, there is an extra state Publishing, and the Offline and Failed states can communicate error information (which presumably on Swift is instead communicated using the publisher and subscribers’ delegate methods).

We should make Swift consistent with Android here, including the communication of error information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingBackwards incompatible changes made to the public API.code-qualityAffects the developer experience when working in our codebase.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions