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: Sectional Audio #2190

Merged
merged 15 commits into from
Sep 12, 2024
Merged

feat: Sectional Audio #2190

merged 15 commits into from
Sep 12, 2024

Conversation

cmaddox5
Copy link
Contributor

@cmaddox5 cmaddox5 commented Sep 5, 2024

Asana task: Create new Sectional audio

This PR adds the code necessary to enable audio on Sectionals. Luckily, the departures widget is already configured to readout so there were no widget changes necessary. The default for the config is set up so audio is always enabled. We shouldn't need to do anything after deploying.

  • Tests added?

@cmaddox5 cmaddox5 changed the title feat: Section Audio feat: Sectional Audio Sep 9, 2024
@cmaddox5 cmaddox5 marked this pull request as ready for review September 9, 2024 19:44
@cmaddox5 cmaddox5 requested a review from a team as a code owner September 9, 2024 19:44
lib/screens/v2/candidate_generator/widgets/departures.ex Outdated Show resolved Hide resolved
lib/screens/v2/widget_instance/departures.ex Outdated Show resolved Hide resolved
lib/screens/v2/widget_instance/departures.ex Outdated Show resolved Hide resolved
lib/screens_web/views/v2/audio/departures_view.ex Outdated Show resolved Hide resolved
header: %Header{title: "Section Header"}
}

screen = struct(Screen, %{app_id: :busway_v2})
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular reason you used struct for these? It seems equivalent to %Screen{app_id: :busway_v2}, but with less compile-time safety.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to automatically apply the enforced keys that we don't care about. Creating the struct without some hardware specific fields throws a compilation error.

Copy link
Contributor

@digitalcora digitalcora left a comment

Choose a reason for hiding this comment

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

One last comment, but looking good. One step closer to dropping v1 screens!

@@ -54,7 +53,7 @@ defmodule Screens.V2.CandidateGenerator.Widgets.Departures do
Keyword.get(options, :departure_fetch_fn, &Departure.fetch/2),
Keyword.get(options, :post_process_fn, fn results, _config -> results end),
Keyword.get(options, :route_fetch_fn, &Route.fetch/1),
now
options[:now]
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like this is now effectively a required argument, rather than an "option" with a default value — if you didn't provide it, downstream code would crash when it expected a DateTime but got nil. I think if it's optional it should be a keyword with a default value, but if it's required it should be its own argument. No preference as to which.

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 good point, didn't think about that. Making it optional seems fine and lines up with the rest of the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I think I'm changing my mind. We already default now in the app CGs so there's already the variable available to pass to this.

@cmaddox5 cmaddox5 merged commit b0b685c into main Sep 12, 2024
11 checks passed
@cmaddox5 cmaddox5 deleted the cm/sectional-audio branch September 12, 2024 14:17
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