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

feat: Combine existing trip details into new combined stop page #551

Open
wants to merge 4 commits into
base: es-legacy-stop-page
Choose a base branch
from

Conversation

EmmaSimon
Copy link
Contributor

@EmmaSimon EmmaSimon commented Nov 21, 2024

Summary

Ticket: Combined stop + trip details: barebones UX

Stacked onto #554

This takes the existing trip details page and inserts it into the existing stop details page. Also updates the map to display the stop and vehicle whenever the vehicle filter changes.

Simulator Screenshot - iPhone 15 - 2024-11-21 at 14 56 46 Simulator Screenshot - iPhone 15 - 2024-11-21 at 14 57 06

- [ ] If you added any user facing strings on iOS, are they included in Localizable.xcstrings?

Testing

WIP - I'm really deeply struggling with the tests, so I figured I should probably put this up for a first round of feedback while I slog through them.

@EmmaSimon EmmaSimon changed the base branch from main to es-legacy-stop-page November 22, 2024 18:12
@EmmaSimon EmmaSimon changed the title feat: Add a feature flag for a combined stop and trip details page feat: Combine existing trip details into new combined stop page Nov 22, 2024
Copy link
Collaborator

@KaylaBrady KaylaBrady left a comment

Choose a reason for hiding this comment

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

Awesome foundation!

@@ -160,7 +169,7 @@ class ViewportProvider: ObservableObject {
center: CLLocationCoordinate2D,
inView: [CLLocationCoordinate2D],
// Insets with different horizontal/vertical values will result in the center point being off center
padding: EdgeInsets = .init(top: 75, leading: 50, bottom: 75, trailing: 50)
padding: EdgeInsets = Defaults.overviewPadding
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 nice

@@ -103,7 +103,7 @@ struct LegacyStopDetailsView: View {
now: now.toKotlinInstant(),
filter: filter,
setFilter: setFilter,
pushNavEntry: nearbyVM.pushNavEntry,
pushNavEntry: { entry in nearbyVM.pushNavEntry(entry) },
Copy link
Collaborator

Choose a reason for hiding this comment

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

question (non-blocking): is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I didn't love this, it's required because I changed the pushNavEntry signature to take a second optional argument when called from the map, but all these places expect a signature with only a single argument, so they won't compile unless we do this. It can be changed back once we get rid of the feature flag and can directly set the lock boolean when calling the vehicle nav from the map.

@@ -64,6 +64,7 @@ extension HomeMapView {
joinVehiclesChannel(routeId: routeId, directionId: directionId)
} else {
leaveVehiclesChannel()
vehiclesData = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

question(non-blocking): why move this out of leaveVehiclesChannel?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the vehicles channel was being disconnected and reconnected every time you selected another departure, which was leading to all of the vehicles flickering in and out every time. It would probably make sense to instead not disconnect and reconnect, that can probably happen in a follow up.

viewportProvider.followVehicle(vehicle: nextVehicle, target: nearbyVM.getTargetStop(global: globalData))
} else {
if nearbyVM.combinedStopAndTrip, let stop = nearbyVM.getTargetStop(global: globalData) {
viewportProvider.vehicleOverview(vehicle: nextVehicle, stop: stop)
Copy link
Collaborator

Choose a reason for hiding this comment

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

question (non-blocking): Should this follow the vehicle as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Asked in figma and was told that we just want to show both on selection, then keep the map static.

@@ -118,21 +118,22 @@ struct NearbyTransitView: View {
ScrollView {
LazyVStack(spacing: 0) {
ForEach(transit, id: \.id) { nearbyTransit in
switch onEnum(of: nearbyTransit) {
let nearby: StopsAssociated = nearbyTransit
Copy link
Collaborator

Choose a reason for hiding this comment

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

question (non-blocking): could nearbyTransit just be renamed nearby at the top-level?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was because I had some unrelated compilation error within the case statement (it was the pushNavEntry arg thing I mentioned above), and instead of giving a useful error, it was instead a type error about nearbyTransit not being a StopsAssociated, so I added this to get more useful compilation errors in the future.

@@ -121,7 +121,7 @@ struct AnnotatedMap: View {
.selected(isSelected)
.allowOverlap(true)
.allowOverlapWithPuck(true)
.visible(zoomLevel >= StopLayerGenerator.shared.stopZoomThreshold)
.visible(zoomLevel >= StopLayerGenerator.shared.stopZoomThreshold || isSelected)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been bothering me for a while lol

import SwiftPhoenixClient
import SwiftUI

extension StopDetailsPage {
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion (non-blocking): I like this split out! Since this is all logic-focused, I think it could be worth moving it into a ViewModel. I think that would help with testability - you could test the ViewModel directly, and mock ViewModel function calls where helpful to unit test the view.

Copy link
Contributor Author

@EmmaSimon EmmaSimon Nov 22, 2024

Choose a reason for hiding this comment

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

Yeah that's a good idea! I can add that as an AC on the next ticket. edit: done

Comment on lines +100 to +101
// Adding a second bool argument here is a hack until we can remove the feature flag and set the new stop details
// entry directly, until then, we need a way to distinguish between entries coming from the map or not.
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

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