Skip to content

Sort by proximity (premium) #153

Description

@MessiasLima

Description

Add a "Sort by proximity" option to the pill-shaped sort dropdown on task lists. When selected, tasks are ordered by distance from the user's current location to each task's location coordinates. This sort shows a flat list without date headers, displaying the distance next to each task.

When the user selects "Sort by proximity" for the first time, the app checks for location permission. If granted, the sort is applied normally. If not, the user is navigated to a screen that explains why location permission is needed, with a button to request the permission from the OS. If the user denies the permission, "Sort by proximity" is not selected and the previous sort remains active.

Tasks without a location are shown at the bottom in a separate "No location" group.

This feature is gated behind the premium subscription. Non-premium users see the option in the sort dropdown with a lock icon; tapping it opens the RevenueCat paywall.

Depends on #140 (Sort by date), #130 (Premium gating infrastructure), #152 (Create task screen — location field).

Scope

In scope: proximity sort option in the sort dropdown, distance calculation from user location to task location, flat list layout without date headers, "No location" group at the bottom, distance label on each task row, location permission check on first selection, location permission explanation screen with request button, premium gating with upsell CTA, and string resources.

Out of scope: location picker UI, map display on task detail, background location updates.

Acceptance criteria

  • GIVEN the user has a premium subscription and location permission is already granted
    WHEN they select "Sort by proximity" from the sort dropdown
    THEN tasks are ordered by distance from the user's current location to each task's location, nearest first
  • GIVEN proximity sort is active and tasks have locations set
    WHEN the task list renders
    THEN each task row displays the distance from the user (e.g. "0.3 km", "1.2 km")
  • GIVEN proximity sort is active
    WHEN the task list renders
    THEN no date headers are shown (flat list)
  • GIVEN proximity sort is active and some tasks have no location
    WHEN the task list renders
    THEN tasks without a location appear at the bottom in a separate "No location" group
  • GIVEN the user selects "Sort by proximity" for the first time and location permission has not been granted
    WHEN the action occurs
    THEN the user is navigated to a location permission explanation screen
  • GIVEN the user is on the location permission explanation screen
    WHEN they tap the button to enable location
    THEN the OS location permission prompt is shown
  • GIVEN the user grants location permission from the explanation screen
    WHEN the permission is granted
    THEN proximity sort is applied and tasks are ordered by distance
  • GIVEN the user denies location permission from the explanation screen
    WHEN the permission is denied
    THEN "Sort by proximity" is not selected and the previous sort remains active
  • GIVEN the user does not have a premium subscription
    WHEN the sort dropdown renders
    THEN "Sort by proximity" appears with a lock icon
  • GIVEN the user is not premium and taps the locked "Sort by proximity" option
    WHEN the action occurs
    THEN the RevenueCat paywall is presented
  • GIVEN the user's current location is unavailable (permission granted but location cannot be determined)
    WHEN proximity sort is active
    THEN tasks with locations are shown in an indeterminate order and the "No location" group still appears at the bottom
  • GIVEN user-visible text appears on the sort dropdown, distance labels, or permission explanation screen
    WHEN the app renders it
    THEN all visible text comes from string resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions