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
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
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
WHEN the task list renders
THEN each task row displays the distance from the user (e.g. "0.3 km", "1.2 km")
WHEN the task list renders
THEN no date headers are shown (flat list)
WHEN the task list renders
THEN tasks without a location appear at the bottom in a separate "No location" group
WHEN the action occurs
THEN the user is navigated to a location permission explanation screen
WHEN they tap the button to enable location
THEN the OS location permission prompt is shown
WHEN the permission is granted
THEN proximity sort is applied and tasks are ordered by distance
WHEN the permission is denied
THEN "Sort by proximity" is not selected and the previous sort remains active
WHEN the sort dropdown renders
THEN "Sort by proximity" appears with a lock icon
WHEN the action occurs
THEN the RevenueCat paywall is presented
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
WHEN the app renders it
THEN all visible text comes from string resources