Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make TrackableState consistent with Android #625

Open
lawrence-forooghian opened this issue Mar 20, 2023 · 1 comment
Open

Make TrackableState consistent with Android #625

lawrence-forooghian opened this issue Mar 20, 2023 · 1 comment
Labels
breaking Backwards incompatible changes made to the public API. code-quality Affects the developer experience when working in our codebase.

Comments

@lawrence-forooghian
Copy link
Collaborator

lawrence-forooghian commented Mar 20, 2023

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.

@lawrence-forooghian lawrence-forooghian added code-quality Affects the developer experience when working in our codebase. breaking Backwards incompatible changes made to the public API. labels Mar 20, 2023
@sync-by-unito
Copy link

sync-by-unito bot commented Mar 20, 2023

➤ Automation for Jira commented:

The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3468

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Backwards incompatible changes made to the public API. code-quality Affects the developer experience when working in our codebase.
Development

No branches or pull requests

1 participant