Skip to content

Commit

Permalink
[Podcast Feed Update] Update New Episode Found message (#3497)
Browse files Browse the repository at this point in the history
  • Loading branch information
mebarbosa authored Jan 29, 2025
1 parent 456b6e2 commit 9d7e782
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -928,16 +928,12 @@ class PodcastFragment : BaseFragment(), Toolbar.OnMenuItemClickListener {
when (state) {
PodcastViewModel.RefreshState.Error -> {}
PodcastViewModel.RefreshState.NotStarted -> {}
is PodcastViewModel.RefreshState.Refreshed -> {
if (state.type == PodcastViewModel.RefreshType.PULL_TO_REFRESH) {
binding?.swipeRefreshLayout?.isRefreshing = false
} else {
(activity as? FragmentHostListener)?.snackBarView()?.let { snackBarView ->
Snackbar.make(snackBarView, getString(LR.string.podcast_refresh_list_updated), Snackbar.LENGTH_LONG).show()
}
PodcastViewModel.RefreshState.NewEpisodeFound -> {
binding?.swipeRefreshLayout?.isRefreshing = false
(activity as? FragmentHostListener)?.snackBarView()?.let { snackBarView ->
Snackbar.make(snackBarView, getString(LR.string.podcast_refresh_new_episode_found), Snackbar.LENGTH_LONG).show()
}
}

is PodcastViewModel.RefreshState.Refreshing -> {
if (state.type == PodcastViewModel.RefreshType.PULL_TO_REFRESH) {
binding?.swipeRefreshLayout?.isRefreshing = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ class PodcastViewModel
launch {
_refreshState.emit(RefreshState.Refreshing(refreshType))
delay(2.seconds)
_refreshState.emit(RefreshState.Refreshed(refreshType))
_refreshState.emit(RefreshState.NewEpisodeFound)
}
}

Expand Down Expand Up @@ -628,7 +628,7 @@ class PodcastViewModel
sealed class RefreshState {
data object NotStarted : RefreshState()
data class Refreshing(val type: RefreshType) : RefreshState()
data class Refreshed(val type: RefreshType) : RefreshState()
data object NewEpisodeFound : RefreshState()
data object Error : RefreshState()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@
<string name="podcast_show_archived" translatable="false">@string/show_archived</string>
<string name="podcast_refresh_episodes">Refresh episode list</string>
<string name="podcast_refreshing_episode_list">Refreshing episode list…</string>
<string name="podcast_refresh_list_updated">Episode list updated!</string>
<string name="podcast_refresh_new_episode_found">New episode found!</string>
<string name="podcast_sort_episodes">Sort episodes</string>
<string name="podcast_subscribed">Following</string>
<string name="podcast_not_subscribed">Not Following</string>
Expand Down

0 comments on commit 9d7e782

Please sign in to comment.