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

Revisit the EnhancedLocationUpdate model #46

Open
KacperKluka opened this issue Jul 21, 2022 · 0 comments
Open

Revisit the EnhancedLocationUpdate model #46

KacperKluka opened this issue Jul 21, 2022 · 0 comments
Labels
breaking Backwards incompatible changes made to the public API. code-quality Affects the developer experience when working in our codebase. enhancement New feature or improved functionality.

Comments

@KacperKluka
Copy link
Contributor

KacperKluka commented Jul 21, 2022

Background
Recently we've discovered that the Mapbox SDK v2 no longer generates a new location update each second and we are planning to use intermediateLocations (called also keyPoints) to help us create accurate rider paths when the GPS location updates are not frequent enough. In that case, we will have 2 lists that contain locations that are in between the previous and the current location: intermediateLocations and skippedLocations. Both are important for creating an accurate route and currently are independent of each other. This makes it harder to use them as the users would have to get them in the correct order to be able to draw them on the map.

Suggestions
Given the above and the fact that those two list seem to serve the same purpose for the users, I'd suggest that we merge them into one list, that will contain all locations between the previous and current locations in the right order. I would drop the intermediateLocations and leave the skippedLocations as it is already used in the LocationAnimator to create smooth animations (so less changes would be required in other parts of the AAT).

Additionally, the EnhancedLocationUpdate has a field called type which can either be PREDICTED or ACTUAL. This determines whether an enhanced location update is predicted or based on an actual location. Now, the Mapbox SDK does not generate new location updates constantly but rather it creates a new enhanced location update when it receives a raw location update from the GPS. Therefore, as there probably won't be any predicted location updates, the type field seems unnecessary and perhaps could be removed as well.


Before
This is the current structure of EnhancedLocationUpdate (from the AAT Android):

class EnhancedLocationUpdate(
    /**
     * Current location of the publisher.
     */
    val location: Location,

    /**
     * List of publisher locations that were skipped since the last sent location update.
     * A location can be skipped due to the active [Resolution] or network issues.
     * This list may be empty.
     */
    val skippedLocations: List<Location>,

    /**
     * List of predicted location points leading up to the [location] of this enhanced location update.
     * This list may be empty.
     */
    val intermediateLocations: List<Location>,

    /**
     * The type of [location] of this enhanced location update.
     */
    val type: LocationUpdateType
)

enum class LocationUpdateType {
    /**
     * The location was predicted using the previous locations of the publisher.
     */
    PREDICTED,

    /**
     * The location is enhanced but not predicted.
     */
    ACTUAL,
}

After

class EnhancedLocationUpdate(
    /**
     * Current location of the publisher.
     */
    val location: Location,

    /**
     * List of publisher locations that were skipped since the last sent location update.
     * A location can be skipped due to the active [Resolution] or network issues.
     * This list may be empty.
     */
    val skippedLocations: List<Location>
)

┆Issue is synchronized with this Jira Task by Unito

@QuintinWillison QuintinWillison added enhancement New feature or improved functionality. code-quality Affects the developer experience when working in our codebase. breaking Backwards incompatible changes made to the public API. and removed api labels Dec 8, 2022
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. enhancement New feature or improved functionality.
Development

No branches or pull requests

2 participants