Skip to content

Adds a white-label configurable arrival/departure filter#1096

Open
diveshpatil9104 wants to merge 1 commit intoOneBusAway:mainfrom
diveshpatil9104:feature/arrival-departure-filter-597
Open

Adds a white-label configurable arrival/departure filter#1096
diveshpatil9104 wants to merge 1 commit intoOneBusAway:mainfrom
diveshpatil9104:feature/arrival-departure-filter-597

Conversation

@diveshpatil9104
Copy link
Contributor

@diveshpatil9104 diveshpatil9104 commented Mar 12, 2026

Summary

Adds a white-label configurable arrival/departure filter that lets users choose which departures to display: All, Real-Time Only, or Scheduled Only. Closes #597.

Problem: Transit agencies using the white-label framework wanted to control whether scheduled (non-real-time) arrivals are shown. Some agencies have unreliable schedule data, and displaying "arrives 5 min late" highlights poor service performance. They needed the ability to hide scheduled arrivals when real-time data is unavailable.

Solution: A global ArrivalDepartureFilter setting accessible from both the Settings page and a Departure Type menu on each stop view. Brands can configure the default via CoreAppConfig.defaultArrivalDepartureFilter.

Changes

  • StopPreferences.swift — Added ArrivalDepartureFilter enum (.all, .estimatedOnly, .scheduledOnly)
  • CoreAppConfig.swift — Added defaultArrivalDepartureFilter property for white-label brand default + shared UserDefaults key
  • AppConfig.swift — Pass-through for new config parameter
  • ArrivalDeparture.swift — Added filter(by:) extension on [ArrivalDeparture] using the predicted property
  • StopViewController.swift — Reads global filter from UserDefaults, applies to both time-sorted and route-sorted views, adds Departure Type submenu
  • SettingsViewController.swift — Added Arrival Display section with AlertRow for global filter preference
  • ArrivalDepartureFilterTests.swift — Unit tests for filter logic, enum, empty arrays, complementary counts, and UserDefaults round-trips

Screenshots / Demo

Implementation.mp4

Test Plan

  • Unit tests pass (ArrivalDepartureFilterTests, ArrivalDepartureFilterEnumTests, ArrivalDepartureFilterUserDefaultsTests)
  • Open a stop with mixed real-time and scheduled arrivals
  • Tap ⋯ menu → Departure Type → Real-Time Only — verify only real-time arrivals remain
  • Tap Departure Type → Scheduled Only — verify only scheduled arrivals remain
  • Tap Departure Type → All Departures — verify all arrivals return
  • Navigate to a different stop — verify same filter applies (global setting)
  • Open Settings → Arrival Display → Show Departures — verify AlertRow shows current selection
  • Change filter in Settings, go back to a stop — verify filter is applied
  • Switch sort mode (time vs route) — verify filter works in both modes
  • Kill and relaunch app — verify filter preference persists

@diveshpatil9104 diveshpatil9104 force-pushed the feature/arrival-departure-filter-597 branch from 63e9337 to 0cc5dbb Compare March 15, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Select what arrival/departures to show: either scheduled, estimated or both

1 participant