Skip to content

Final bugfix before ecosystem release#141

Open
RyanCheung555 wants to merge 3 commits intomainfrom
ryan/final-bugfix
Open

Final bugfix before ecosystem release#141
RyanCheung555 wants to merge 3 commits intomainfrom
ryan/final-bugfix

Conversation

@RyanCheung555
Copy link
Copy Markdown
Contributor

@RyanCheung555 RyanCheung555 commented Apr 23, 2026

Overview

  • Apply UI fixes
  • Handle showing routes for specific route options

Changes Made

  • Remove map centering button
  • Add back buttons to setting-related screens
  • Update contributors list
  • Show more relevant routes for arrive by route option and handle potential errors with leave by route option

Test Coverage

  • Tested on Medium Phone on Ecosystem flag
  • Tested multiple routes and leave by / arrive by times

Next Steps (delete if not applicable)

  • Hopefully this will be the last bug fix PR before ecosystem release

Summary by CodeRabbit

Release Notes

  • New Features

    • Back navigation buttons added to Settings, About, and Support screens for improved screen navigation
    • Route recommendations now intelligently filtered and sorted based on your departure and arrival timing preferences
  • Updates

    • Team member information refreshed in the About screen
  • Improvements

    • Removed "My Location" button from map interface for a cleaner experience

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 2026

Warning

Rate limit exceeded

@RyanCheung555 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 50 minutes and 58 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 50 minutes and 58 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5630cf4e-c69f-447b-9610-91f234286854

📥 Commits

Reviewing files that changed from the base of the PR and between 98a7a1d and f5aa428.

📒 Files selected for processing (1)
  • app/src/main/java/com/cornellappdev/transit/util/RouteOptionsDisplayProcessor.kt
📝 Walkthrough

Walkthrough

This pull request introduces route display filtering and sorting logic via a new displayedRouteFlow in RouteViewModel, adds back-navigation callbacks to Settings-related screens, disables the Maps location button, and establishes a new RouteOptionsDisplayProcessor utility for complex route filtering based on departure/arrival cutoff modes.

Changes

Cohort / File(s) Summary
Navigation & Settings Back Navigation
NavigationController.kt, SettingsScreen.kt, AboutScreen.kt, SupportScreen.kt
Added onBackClick callback parameters to Settings, About, and Support screens; wired back-arrow IconButton UI elements to trigger navController.popBackStack() navigation from these destination screens.
Route Display Flow & Filtering
RouteViewModel.kt, RouteOptionsDisplayProcessor.kt, TransitConstants.kt
Introduced new displayedRouteFlow in RouteViewModel that transforms lastRouteFlow using time-based filtering/sorting logic; created RouteOptionsDisplayProcessor.kt with filterAndSortForArriveBy and filterAndSortForLeaveCutoff extension functions; added transit timing constants (LEAVE_AT_MAX_DISPLAYED_ROUTES, LEAVE_CUTOFF_HORIZON_MINUTES, ARRIVE_BY_CUTOFF_GRACE_MINUTES, WALKING_TRANSIT_TIE_MINUTES).
Route Screen Data Source
RouteScreen.kt
Updated route list data source from lastRouteFlow to displayedRouteFlow for displaying filtered/sorted routes.
Map UI Settings
HomeScreen.kt
Disabled the "My Location" button on GoogleMap via myLocationButtonEnabled = false in MapUiSettings.

Sequence Diagram

sequenceDiagram
    participant RouteVM as RouteViewModel
    participant Processor as RouteOptionsDisplayProcessor
    participant StateFlow as displayedRouteFlow
    participant RouteScreen

    RouteVM->>RouteVM: lastRouteFlow emits ApiResponse<RouteOptions>
    
    alt Response is Success
        RouteVM->>RouteVM: Check arriveByFlow value
        
        alt Arrive By Mode
            RouteVM->>Processor: filterAndSortForArriveBy(cutoff)
            Processor-->>RouteVM: Filtered RouteOptions (by arrival cutoff)
        else Leave At/Leave Now Mode
            RouteVM->>Processor: filterAndSortForLeaveCutoff(cutoff, maxRoutes)
            Processor-->>RouteVM: Filtered RouteOptions (by departure cutoff & tie logic)
        end
        
        RouteVM->>StateFlow: Emit transformed ApiResponse.Success
    else Response is not Success
        RouteVM->>StateFlow: Pass through unchanged
    end
    
    StateFlow->>RouteScreen: displayedRouteFlow state updates
    RouteScreen->>RouteScreen: Re-render route list with filtered/sorted routes
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Address internal testing issues #139 — Both modify RouteViewModel and RouteScreen to handle route data transformation and display, directly extending route-handling logic.
  • Make ecosystem places searchable #134 — Both update settings-related navigation wiring with back-click callbacks across NavigationController, SettingsScreen, AboutScreen, and SupportScreen.
  • Use new eatery backend  #137 — Both modify route-fetching/display pipeline including RouteViewModel changes and route-list rendering behavior in RouteScreen.

Suggested reviewers

  • AndrewCheung360

🐰 Back buttons and filters flow with grace,
As routes now filter at their perfect pace,
Settings screens hop backward with a click—
Navigation smooth, the logic swift and slick!
Hop, sort, and navigate with delight!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is vague and generic, using non-descriptive language like 'final bugfix' without conveying specific information about the changes made. Replace with a specific, descriptive title that highlights the primary change, such as 'Add back navigation to settings screens and improve route filtering logic'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description covers all required template sections with sufficient detail about the changes, testing approach, and intent, making it a complete submission.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ryan/final-bugfix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/src/main/java/com/cornellappdev/transit/ui/screens/settings/AboutScreen.kt (1)

129-229: ⚠️ Potential issue | 🟡 Minor

Add vertical scrolling to the Column — it currently lacks a verticalScroll modifier but contains substantial content: back button, title, logo, Pod Leads (9 names), five team rows (iOS: 17, Android: 17, Design: 10, Marketing: 11, Backend: 12 members), and a website button. On smaller devices or with larger font scales, lower content will be clipped. Add .verticalScroll(rememberScrollState()) to the Column modifier (requires importing verticalScroll and rememberScrollState from androidx.compose.foundation), or consider switching to a LazyColumn.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@app/src/main/java/com/cornellappdev/transit/ui/screens/settings/AboutScreen.kt`
around lines 129 - 229, The Column used in AboutScreen (the Column block that
wraps IconButton, Texts, Image, MemberList, the for loop over names, etc.) is
not scrollable and can clip content; update its modifier chain to include
.verticalScroll(rememberScrollState()) (or replace the Column with a LazyColumn)
so the entire content can scroll on small screens/large font sizes, and add the
imports androidx.compose.foundation.verticalScroll and
androidx.compose.foundation.rememberScrollState; ensure you modify the same
Column that contains IconButton/onBackClick and the for ((team, members) in
names) loop.
🧹 Nitpick comments (2)
app/src/main/java/com/cornellappdev/transit/ui/screens/SettingsScreen.kt (1)

38-43: Consider ordering onBackClick first and giving callbacks default values.

Putting the navigation/back callback first is a common convention and matches the visual order (back button is at the top). Additionally, defaulting the lambdas to {} would make previews and future call sites less brittle (the preview at Line 114 currently relies on positional ordering of four identical () -> Unit parameters, which is easy to misalign silently).

-fun SettingsScreen(
-    onSupportClick: () -> Unit,
-    onAboutClick: () -> Unit,
-    onNotificationsAndPrivacyClick: () -> Unit,
-    onBackClick: () -> Unit
-) {
+fun SettingsScreen(
+    onBackClick: () -> Unit = {},
+    onAboutClick: () -> Unit = {},
+    onNotificationsAndPrivacyClick: () -> Unit = {},
+    onSupportClick: () -> Unit = {},
+) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/src/main/java/com/cornellappdev/transit/ui/screens/SettingsScreen.kt`
around lines 38 - 43, Reorder the SettingsScreen parameters so onBackClick
appears first and give all callback parameters default empty lambdas ({}), e.g.
change the function signature of SettingsScreen to accept onBackClick: () ->
Unit as the first parameter and make onSupportClick, onAboutClick,
onNotificationsAndPrivacyClick default to {}; update any callers and the Preview
that currently rely on positional arguments to either use named arguments or
rely on the new defaults to avoid misalignment. Ensure references to
SettingsScreen in the file are adjusted to the new parameter order or use named
parameters.
app/src/main/java/com/cornellappdev/transit/ui/screens/settings/AboutScreen.kt (1)

136-143: Duplicated back-button composable across three screens.

The same IconButton + KeyboardArrowLeft + IconGray tint block is repeated verbatim in SettingsScreen.kt, AboutScreen.kt, and SupportScreen.kt. Consider extracting a small BackButton(onClick: () -> Unit) composable (e.g., in ui/components/) to keep styling consistent and reduce duplication.

♻️ Example extraction
`@Composable`
fun BackButton(onBackClick: () -> Unit, modifier: Modifier = Modifier) {
    IconButton(onClick = onBackClick, modifier = modifier) {
        Icon(
            imageVector = Icons.AutoMirrored.Outlined.KeyboardArrowLeft,
            contentDescription = "Go back",
            tint = IconGray,
            modifier = Modifier.size(24.dp)
        )
    }
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@app/src/main/java/com/cornellappdev/transit/ui/screens/settings/AboutScreen.kt`
around lines 136 - 143, Duplicate back-button UI (IconButton +
Icons.AutoMirrored.Outlined.KeyboardArrowLeft + IconGray tint) appears in
AboutScreen, SettingsScreen, and SupportScreen; extract a reusable `@Composable`
BackButton(onBackClick: () -> Unit, modifier: Modifier = Modifier) into your
ui/components package and replace the repeated blocks with a call to
BackButton(onBackClick = ...) in AboutScreen.kt, SettingsScreen.kt, and
SupportScreen.kt so styling and behavior are centralized while preserving the
IconButton, KeyboardArrowLeft imageVector, IconGray tint, and
Modifier.size(24.dp).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@app/src/main/java/com/cornellappdev/transit/util/RouteOptionsDisplayProcessor.kt`:
- Around line 284-296: The current logic computes a fallbackTransit and then
does ranked = (preferred + fallbackTransit?) .sortedWith { ... } and finally
takes ranked.take(maxRoutes), which can drop the fallbackTransit; modify the
post-sort trimming to ensure fallbackTransit (the transit option found in the
fallback computation) is always included when non-null: after sorting (in the
variable ranked) if maxRoutes != null then take the first maxRoutes but if
fallbackTransit != null and fallbackTransit is not in that slice, replace the
last element of the slice with fallbackTransit (or otherwise insert
fallbackTransit and trim to maxRoutes) before calling toRouteOptions; keep using
compareByEffectiveLeaveTime for sorting and preserve preferred/fallbackTransit
variables and the final toRouteOptions call.
- Around line 80-92: The function Route.isLegalForLeaveCutoff currently treats
null from firstBoardingDepartureInstantOrNull() as “walking-only”; instead, if
firstBoardingDepartureInstantOrNull() returns null and the route is NOT a
walking-only route, return false (fail closed). Update isLegalForLeaveCutoff so
that immediately after calling firstBoardingDepartureInstantOrNull() you check
the route type (use the existing walking-only predicate on Route, e.g.,
isWalkingOnly or equivalent) and only treat null as legal when the route is
actually walking-only; otherwise return false, then proceed to use
walkingDurationBeforeFirstBoardingOrNull() and the isBefore check as before.

---

Outside diff comments:
In
`@app/src/main/java/com/cornellappdev/transit/ui/screens/settings/AboutScreen.kt`:
- Around line 129-229: The Column used in AboutScreen (the Column block that
wraps IconButton, Texts, Image, MemberList, the for loop over names, etc.) is
not scrollable and can clip content; update its modifier chain to include
.verticalScroll(rememberScrollState()) (or replace the Column with a LazyColumn)
so the entire content can scroll on small screens/large font sizes, and add the
imports androidx.compose.foundation.verticalScroll and
androidx.compose.foundation.rememberScrollState; ensure you modify the same
Column that contains IconButton/onBackClick and the for ((team, members) in
names) loop.

---

Nitpick comments:
In
`@app/src/main/java/com/cornellappdev/transit/ui/screens/settings/AboutScreen.kt`:
- Around line 136-143: Duplicate back-button UI (IconButton +
Icons.AutoMirrored.Outlined.KeyboardArrowLeft + IconGray tint) appears in
AboutScreen, SettingsScreen, and SupportScreen; extract a reusable `@Composable`
BackButton(onBackClick: () -> Unit, modifier: Modifier = Modifier) into your
ui/components package and replace the repeated blocks with a call to
BackButton(onBackClick = ...) in AboutScreen.kt, SettingsScreen.kt, and
SupportScreen.kt so styling and behavior are centralized while preserving the
IconButton, KeyboardArrowLeft imageVector, IconGray tint, and
Modifier.size(24.dp).

In `@app/src/main/java/com/cornellappdev/transit/ui/screens/SettingsScreen.kt`:
- Around line 38-43: Reorder the SettingsScreen parameters so onBackClick
appears first and give all callback parameters default empty lambdas ({}), e.g.
change the function signature of SettingsScreen to accept onBackClick: () ->
Unit as the first parameter and make onSupportClick, onAboutClick,
onNotificationsAndPrivacyClick default to {}; update any callers and the Preview
that currently rely on positional arguments to either use named arguments or
rely on the new defaults to avoid misalignment. Ensure references to
SettingsScreen in the file are adjusted to the new parameter order or use named
parameters.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8cfd9dba-fbe7-46a2-bf4b-f75a12a2a0ae

📥 Commits

Reviewing files that changed from the base of the PR and between 11de6d2 and 98a7a1d.

📒 Files selected for processing (9)
  • app/src/main/java/com/cornellappdev/transit/ui/NavigationController.kt
  • app/src/main/java/com/cornellappdev/transit/ui/screens/HomeScreen.kt
  • app/src/main/java/com/cornellappdev/transit/ui/screens/RouteScreen.kt
  • app/src/main/java/com/cornellappdev/transit/ui/screens/SettingsScreen.kt
  • app/src/main/java/com/cornellappdev/transit/ui/screens/settings/AboutScreen.kt
  • app/src/main/java/com/cornellappdev/transit/ui/screens/settings/SupportScreen.kt
  • app/src/main/java/com/cornellappdev/transit/ui/viewmodels/RouteViewModel.kt
  • app/src/main/java/com/cornellappdev/transit/util/RouteOptionsDisplayProcessor.kt
  • app/src/main/java/com/cornellappdev/transit/util/TransitConstants.kt

Comment thread app/src/main/java/com/cornellappdev/transit/util/RouteOptionsDisplayProcessor.kt Outdated
import com.cornellappdev.transit.ui.theme.TransitBlue
import com.cornellappdev.transit.ui.theme.robotoFamily

private val names = mapOf(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can probably be made into another issue but hardcoded strings like these should ideally be extracted into some sort of strings.xml or constants file instead of living in the screen

@@ -233,5 +256,5 @@ fun AboutScreen() {
@Preview(showBackground = true)
@Composable
private fun PreviewAboutScreen() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: for consistency, should stick with Preview after AboutScreen

@@ -233,5 +256,5 @@ fun AboutScreen() {
@Preview(showBackground = true)
@Composable
private fun PreviewAboutScreen() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, there's a preview rendering issue here as well.

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.

2 participants