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

[Wear] Adds episode screen #1350

Merged
merged 1 commit into from
Apr 19, 2024
Merged

Conversation

kul3r4
Copy link
Contributor

@kul3r4 kul3r4 commented Apr 18, 2024

  • Adds episode screen
  • Adds capability to delete the queue
  • Removes playback speed change from entity screen (will be added to Player screen in another PR)
  • Refactor state classes to state interfaces for consistencies
@kul3r4 kul3r4 requested a review from a team as a code owner April 18, 2024 11:54
@@ -129,6 +133,35 @@ class MockEpisodePlayer(
next()
}

override fun play(playerEpisodes: List<PlayerEpisode>) {
if (isPlaying.value) {

Choose a reason for hiding this comment

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

Maybe you could...

never mind...

I'm not 100% convinced this is the exact logic I'd expect in a player, but seems fine.

@@ -62,7 +65,7 @@ class PodcastDetailsViewModel @Inject constructor(
) : ViewModel() {

private val podcastUri: String =
savedStateHandle.get<String>(PodcastDetails.podcastUri).let {
savedStateHandle.get<String>(PodcastDetails.PODCAST_URI).let {
Uri.decode(it)

Choose a reason for hiding this comment

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

We should check, I suspect decode is done already. But encoding is needed when you use a string template.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

We encode the URI when we navigate (e.g. https://github.com/android/compose-samples/blob/main/Jetcaster/app/src/main/java/com/example/jetcaster/ui/JetcasterAppState.kt#L79) so decoding should be done in the receiver (view model)

Choose a reason for hiding this comment

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

Isn't that because you are providing a string template, so must be already encoded?

    object Player : Screen("player/{$ARG_EPISODE_URI}") {
        fun createRoute(episodeUri: String) = "player/$episodeUri"
    }

But I thought the navigation library decodes for you. Is it different for SavedStateHandle?

https://stackoverflow.com/a/68951045
https://android-review.git.corp.google.com/c/platform/frameworks/support/+/1949864

That maybe explains a bug in one of our screen titles, but a nasty API design if so.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh TIL that it is already decoded. If so, then yes we wouldn't need to decode. Something to double check @kul3r4

modifier = modifier
) {
when (uiState) {
is EpisodeScreenState.Loaded -> {

Choose a reason for hiding this comment

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

Are some of these screens very similar structurally? Could the UIState represent the different screens and reuse the same screen composable?

@kul3r4 kul3r4 force-pushed the jetcaster/all_form_factors branch 3 times, most recently from ac3bd25 to d305b08 Compare April 18, 2024 15:22
@kul3r4 kul3r4 force-pushed the jetcaster/all_form_factors branch from d305b08 to e690662 Compare April 19, 2024 15:49
@kul3r4 kul3r4 merged commit 2530904 into android:main Apr 19, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants