Skip to content

Commit

Permalink
🤖 Apply Spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
arriolac authored and github-actions[bot] committed Mar 5, 2024
1 parent 10f2fec commit f674d9b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ class HomeViewModel(
@OptIn(ExperimentalCoroutinesApi::class)
private val libraryEpisodes = podcastStore.followedPodcastsSortedByLastEpisode()
.flatMapLatest { followedPodcasts ->
combine(followedPodcasts.map { p ->
episodeStore.episodesInPodcast(p.podcast.uri, 5)
}) { allEpisodes ->
combine(
followedPodcasts.map { p ->
episodeStore.episodesInPodcast(p.podcast.uri, 5)
}
) { allEpisodes ->
allEpisodes.toList().flatten().sortedByDescending { it.episode.published }
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.jetcaster.ui.home.library

import androidx.compose.foundation.lazy.LazyListScope
Expand All @@ -7,20 +23,20 @@ import com.example.jetcaster.data.EpisodeToPodcast
import com.example.jetcaster.ui.home.category.EpisodeListItem

fun LazyListScope.libraryItems(
episodes: List<EpisodeToPodcast>,
navigateToPlayer: (String) -> Unit
episodes: List<EpisodeToPodcast>,
navigateToPlayer: (String) -> Unit
) {
if (episodes.isEmpty()) {
// TODO: Empty state
return
}
if (episodes.isEmpty()) {
// TODO: Empty state
return
}

items(episodes, key = { it.episode.uri }) { item ->
EpisodeListItem(
episode = item.episode,
podcast = item.podcast,
onClick = navigateToPlayer,
modifier = Modifier.fillParentMaxWidth()
)
}
items(episodes, key = { it.episode.uri }) { item ->
EpisodeListItem(
episode = item.episode,
podcast = item.podcast,
onClick = navigateToPlayer,
modifier = Modifier.fillParentMaxWidth()
)
}
}

0 comments on commit f674d9b

Please sign in to comment.