Skip to content

Commit

Permalink
Merge pull request #851 from Automattic/release/7.35
Browse files Browse the repository at this point in the history
Merge release-7.35-rc-2 to main
  • Loading branch information
mchowning authored Mar 30, 2023
2 parents 76cea3d + f38f10f commit e38af77
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 28 deletions.
12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
7.35
-----
* Updates
* The Automotive skip forward and backward time settings were improved.
* The Automotive skip forward and backward time settings were improved
([#817](https://github.com/Automattic/pocket-casts-android/pull/817)).
* Fixed Automotive Up Next podcast images not loading.
* Fixed Automotive Up Next podcast images not loading
([#819](https://github.com/Automattic/pocket-casts-android/pull/819)).
* Fixed missing seek bar in the notification drawer and Android Automotive.
* Fixed missing seek bar in the notification drawer and Android Automotive
([#822](https://github.com/Automattic/pocket-casts-android/pull/822)).
* Added option to clear data when signing out of Android Automotive.
([828](https://github.com/Automattic/pocket-casts-android/pull/828))
* Added option to clear data when signing out of Android Automotive
([828](https://github.com/Automattic/pocket-casts-android/pull/828)).
* Podcast carousel on Discover screen now scrolls automatically
([818](https://github.com/Automattic/pocket-casts-android/pull/818)).

7.34
-----
Expand Down
1 change: 0 additions & 1 deletion base.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ android {
// Feature Flags
buildConfigField "boolean", "END_OF_YEAR_ENABLED", "false"
buildConfigField "boolean", "SINGLE_SIGN_ON_ENABLED", "false"
buildConfigField "boolean", "DISCOVER_FEATURED_AUTO_SCROLL", "false"

testInstrumentationRunner project.testInstrumentationRunner
testApplicationId "au.com.shiftyjelly.pocketcasts.test" + project.name.replace("-", "_")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import au.com.shiftyjelly.pocketcasts.discover.viewmodel.PodcastList
import au.com.shiftyjelly.pocketcasts.localization.helper.TimeHelper
import au.com.shiftyjelly.pocketcasts.localization.helper.tryToLocalise
import au.com.shiftyjelly.pocketcasts.models.entity.Episode
import au.com.shiftyjelly.pocketcasts.preferences.BuildConfig
import au.com.shiftyjelly.pocketcasts.repositories.images.into
import au.com.shiftyjelly.pocketcasts.servers.cdn.ArtworkColors
import au.com.shiftyjelly.pocketcasts.servers.cdn.StaticServerManagerImpl
Expand Down Expand Up @@ -216,23 +215,21 @@ internal class DiscoverAdapter(
recyclerView?.itemAnimator = null
recyclerView?.addOnScrollListener(scrollListener)

if (BuildConfig.DISCOVER_FEATURED_AUTO_SCROLL) {
autoScrollHelper = AutoScrollHelper {
if (adapter.itemCount == 0) return@AutoScrollHelper
val currentPosition = binding.pageIndicatorView.position
val nextPosition = (currentPosition + 1)
.takeIf { it < adapter.itemCount } ?: 0
MainScope().launch {
if (nextPosition > currentPosition) {
recyclerView?.smoothScrollToPosition(nextPosition)
} else {
/* Jump to the beginning to avoid a backward scroll animation */
recyclerView?.scrollToPosition(nextPosition)
}
binding.pageIndicatorView.position = nextPosition
trackSponsoredListImpression(nextPosition)
trackPageChanged(nextPosition)
autoScrollHelper = AutoScrollHelper {
if (adapter.itemCount == 0) return@AutoScrollHelper
val currentPosition = binding.pageIndicatorView.position
val nextPosition = (currentPosition + 1)
.takeIf { it < adapter.itemCount } ?: 0
MainScope().launch {
if (nextPosition > currentPosition) {
recyclerView?.smoothScrollToPosition(nextPosition)
} else {
/* Jump to the beginning to avoid a backward scroll animation */
recyclerView?.scrollToPosition(nextPosition)
}
binding.pageIndicatorView.position = nextPosition
trackSponsoredListImpression(nextPosition)
trackPageChanged(nextPosition)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ class SearchFragment : BaseFragment() {
val characterCount = query.length
val lowerCaseSearch = query.lowercase()
if ((characterCount == 1 && lowerCaseSearch.startsWith("h")) || (characterCount == 2 && lowerCaseSearch.startsWith("ht")) || (characterCount == 3 && lowerCaseSearch.startsWith("htt")) || lowerCaseSearch.startsWith("http")) {
if ((viewModel.state.value as? SearchState.Results)?.podcasts?.isNotEmpty() == true) {
binding.searchHistoryPanel.hide()
}
return true
}
viewModel.updateSearchQuery(query)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class SearchHandler @Inject constructor(
}
.toObservable()

if (settings.isFeatureFlagSearchImprovementsEnabled()) {
if (settings.isFeatureFlagSearchImprovementsEnabled() && !it.startsWith("http")) {
val episodesServerSearch = cacheServerManager
.searchEpisodes(it)
.map { episodeSearch ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -139,7 +142,23 @@ private fun SearchResultsView(
}
}
}
val podcasts by remember { mutableStateOf(state.podcasts) }
val podcastsRowState = rememberLazyListState()
val episodesRowState = rememberLazyListState()
LaunchedEffect(key1 = state.podcasts) {
// Only reset the scroll state if we have podcasts and they are different. This prevents resetting the
// scroll state when navigating back to the search results after tapping on one of the results.
if (state.podcasts.isNotEmpty() && state.podcasts != podcasts) {
podcastsRowState.scrollToItem(0)
}
}
LaunchedEffect(key1 = state.episodes) {
if (state.episodes.isNotEmpty()) {
episodesRowState.scrollToItem(0)
}
}
LazyColumn(
state = episodesRowState,
modifier = modifier
.nestedScroll(nestedScrollConnection)
) {
Expand All @@ -152,10 +171,13 @@ private fun SearchResultsView(
}
}
item {
LazyRow(contentPadding = PaddingValues(horizontal = 8.dp)) {
LazyRow(
state = podcastsRowState,
contentPadding = PaddingValues(horizontal = 8.dp)
) {
items(
items = state.podcasts.take(minOf(MAX_ITEM_COUNT, state.podcasts.size)),
key = { it.adapterId }
key = { it.uuid }
) { folderItem ->
when (folderItem) {
is FolderItem.Folder -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class SearchViewModel @Inject constructor(
}

fun updateSearchQuery(query: String, immediate: Boolean = false) {
// Prevent updating the search query when navigating back to the search results after tapping on a result.
if (_state.value.searchTerm == query) return
searchHandler.updateSearchQuery(query, immediate)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import au.com.shiftyjelly.pocketcasts.servers.sync.EpisodeSyncRequest
import au.com.shiftyjelly.pocketcasts.servers.sync.EpisodeSyncResponse
import au.com.shiftyjelly.pocketcasts.servers.sync.SyncServerManager
import au.com.shiftyjelly.pocketcasts.utils.Network
import au.com.shiftyjelly.pocketcasts.utils.SentryHelper
import au.com.shiftyjelly.pocketcasts.utils.Util
import au.com.shiftyjelly.pocketcasts.utils.extensions.isPositive
import au.com.shiftyjelly.pocketcasts.utils.log.LogBuffer
Expand Down Expand Up @@ -878,6 +879,11 @@ open class PlaybackManager @Inject constructor(
} else {
event.message
}
val isAutomotive = Util.isAutomotive(application)
SentryHelper.recordException(
message = "Illegal playback state encountered for episode uuid ${episode?.uuid}, isAutomotive $isAutomotive}: ",
throwable = event.error ?: IllegalStateException(event.message)
)
playbackStateRelay.accept(playbackState.copy(state = PlaybackState.State.ERROR, lastErrorMessage = errorMessage, lastChangeFrom = "onPlayerError"))
}
}
Expand Down
4 changes: 2 additions & 2 deletions version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Version Information for Vanilla / Release builds
versionName=7.35-rc-1
versionCode=9080
versionName=7.35-rc-2
versionCode=9081

0 comments on commit e38af77

Please sign in to comment.