before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
categoriesManager.setInterestCategories(emptySet())
doWhenFinished()
}
}
fun updateSelectedCategory(category: DiscoverCategory, isSelected: Boolean) {
_state.update {
it.copy(
selectedCategories = if (isSelected) {
it.selec... | The communication issue applies here as well. | }
fun updateSelectedCategory(category: DiscoverCategory, isSelected: Boolean) {
_state.update {
it.copy(
selectedCategories = if (isSelected) {
it.selectedCategories + category
} else {
it.selectedCategories - category
... | @@ -52,16 +56,21 @@ class OnboardingInterestsViewModel @Inject constructor(
}
}
- fun saveInterests() {
+ fun saveInterests(doWhenFinished: () -> Unit) { | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/recommendations/OnboardingInterestsViewModel.kt | 26 | Kotlin | 0.071 | suggestion | 45 | 51 | 51 | false | [Onboarding] Respect user's interests on Recommendations | 4,417 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
@Query("UPDATE playlists SET title = :name, syncStatus = $SYNC_STATUS_NOT_SYNCED WHERE uuid = :uuid")
abstract suspend fun updateName(uuid: String, name: String)
@Query("UPDATE playlists SET deleted = 1, syncStatus = $SYNC_STATUS_NOT_SYNCED WHERE uuid = :uuid")
abstract suspend fun markPlaylistAsDelete... | ```suggestion
JOIN manual_playlist_episodes AS playlistEpisode ON playlistEpisode.playlist_uuid = playlist.uuid
```
Should this just be an equals symbol? | @Query("UPDATE playlists SET title = :name, syncStatus = $SYNC_STATUS_NOT_SYNCED WHERE uuid = :uuid")
abstract suspend fun updateName(uuid: String, name: String)
@Query("UPDATE playlists SET deleted = 1, syncStatus = $SYNC_STATUS_NOT_SYNCED WHERE uuid = :uuid")
abstract suspend fun markPlaylistAsDelete... | @@ -98,6 +105,21 @@ abstract class PlaylistDao {
}
}
+ @Query(
+ """
+ SELECT
+ COUNT(*) AS episode_count,
+ SUM(MAX(0, IFNULL(podcastEpisode.duration, 0) - IFNULL(podcastEpisode.duration, 0))) AS time_left
+ FROM playlists AS playlist
+ JOIN manual_playl... | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/PlaylistDao.kt | 26 | Kotlin | 0.786 | question | 162 | 51 | 51 | false | Display manual playlist previews | 4,419 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | MiSikora |
abstract suspend fun updateAutoDownloadLimit(uuid: String, limit: Int)
@Query("UPDATE playlists SET title = :name, syncStatus = $SYNC_STATUS_NOT_SYNCED WHERE uuid = :uuid")
abstract suspend fun updateName(uuid: String, name: String)
@Query("UPDATE playlists SET deleted = 1, syncStatus = $SYNC_STATUS_N... | ```suggestion
SUM(MAX(0, IFNULL(podcastEpisode.duration, 0) - IFNULL(podcastEpisode.played_up_to, 0))) AS time_left
```
Should this use `played_up_to` to figure out the time left? | abstract suspend fun updateAutoDownloadLimit(uuid: String, limit: Int)
@Query("UPDATE playlists SET title = :name, syncStatus = $SYNC_STATUS_NOT_SYNCED WHERE uuid = :uuid")
abstract suspend fun updateName(uuid: String, name: String)
@Query("UPDATE playlists SET deleted = 1, syncStatus = $SYNC_STATUS_N... | @@ -98,6 +105,21 @@ abstract class PlaylistDao {
}
}
+ @Query(
+ """
+ SELECT
+ COUNT(*) AS episode_count,
+ SUM(MAX(0, IFNULL(podcastEpisode.duration, 0) - IFNULL(podcastEpisode.duration, 0))) AS time_left | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/PlaylistDao.kt | 26 | Kotlin | 0.929 | question | 189 | 51 | 51 | false | Display manual playlist previews | 4,419 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | MiSikora |
.sortedBy { rowInfo.popularCategoryIds.indexOf(it.id) },
)
}
}.ifEmpty {
categories
}.take(FEATURED_CATEGORY_COUNT).mapIndexed { index, item ->
item.copy(featuredIndex = index)
}
... | `.asStateFlow()` is unnecessary here since the flow is being later mapped and loses its State type. If you want/need to keep it as State it can be `discoverCategories.map().stateIn(scope, /* appropriate configuration */)` | }
}.ifEmpty {
categories
}.take(FEATURED_CATEGORY_COUNT).mapIndexed { index, item ->
item.copy(featuredIndex = index)
}
State.Idle(
featuredCategories = featuredCategories,
allCategories = cat... | @@ -93,6 +94,12 @@ class CategoriesManager @Inject constructor(
}
}.distinctUntilChanged()
+ val availableInterestCategories = discoverCategories.asStateFlow()
+ .map { categories ->
+ categories.filter { it.popularity != null }
+ .sortedBy { it.popularity }
+ ... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/categories/CategoriesManager.kt | 26 | Kotlin | 0.714 | suggestion | 221 | 51 | 51 | false | [Onboarding] Add `popularity` to categories | 4,425 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
viewModel.sleepTimerAddExtraMins(mins = 1)
analyticsTracker.track(AnalyticsEvent.PLAYER_SLEEP_TIMER_EXTENDED, mapOf(AMOUNT_KEY to TimeUnit.MILLISECONDS.toSeconds(1.minutes())))
viewModel.timeLeftInSeconds()?.let { timeLeft ->
binding?.root?.announceAccessibility("1 minute added to sl... | I'm not sure this is working the same way.
Before
https://github.com/user-attachments/assets/b391aef1-2f5c-494f-ad72-92a58004167d
After
https://github.com/user-attachments/assets/fd8923a9-ffe0-45dd-af41-42f087927de9 | private fun startCustomTimer() {
viewModel.sleepTimerAfter(mins = viewModel.sleepCustomTimeInMinutes)
analyticsTracker.track(AnalyticsEvent.PLAYER_SLEEP_TIMER_ENABLED, mapOf(TIME_KEY to TimeUnit.MILLISECONDS.toSeconds(viewModel.sleepCustomTimeInMinutes.minutes())))
close()
}
private... | @@ -253,17 +254,17 @@ class SleepFragment : BaseDialogFragment() {
} else {
viewModel.sleepCustomTimeInMinutes += 5
}
- binding?.root?.announceForAccessibility("Custom sleep time ${viewModel.sleepCustomTimeInMinutes}")
+ binding?.root?.announceAccessibility("Custom sleep tim... | modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/SleepFragment.kt | 26 | Kotlin | 0.5 | suggestion | 219 | 51 | 51 | false | Support target SDK 36 | 4,444 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | MiSikora |
JOIN podcasts AS podcast ON podcast.uuid IS playlistEpisode.podcast_uuid
WHERE
playlist.uuid IS :playlistId
AND podcastEpisode.archived IS 0
ORDER BY
-- newest to oldest
CASE WHEN playlist.sortId IS 0 THEN podcastEpisode.published_date END DESC,
... | ```suggestion
-- playlist episode columns
``` | JOIN podcasts AS podcast ON podcast.uuid IS playlistEpisode.podcast_uuid
WHERE
playlist.uuid IS :playlistId
AND podcastEpisode.archived IS 0
ORDER BY
-- newest to oldest
CASE WHEN playlist.sortId IS 0 THEN podcastEpisode.published_date END DESC,
... | @@ -257,6 +259,86 @@ abstract class PlaylistDao {
)
abstract fun observeManualPlaylistPodcasts(playlistId: String): Flow<List<String>>
+ @Query(
+ """
+ SELECT
+ -- plaulist episode columns | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/PlaylistDao.kt | 26 | Kotlin | 0.571 | suggestion | 59 | 51 | 51 | false | Add a query for loading manual playlist episodes | 4,445 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | MiSikora |
}
}
@Query(
"""
SELECT
COUNT(*) AS episode_count,
SUM(IFNULL(podcastEpisode.archived, 0)) AS archived_episode_count,
SUM(MAX(0, IFNULL(podcastEpisode.duration, 0) - IFNULL(podcastEpisode.played_up_to, 0))) AS time_left
FROM playlists AS playlist
... | As `manual` is a boolean is there a reason it's not just comparing to 1? | }
}
@Query(
"""
SELECT
COUNT(*) AS episode_count,
SUM(IFNULL(podcastEpisode.archived, 0)) AS archived_episode_count,
SUM(MAX(0, IFNULL(podcastEpisode.duration, 0) - IFNULL(podcastEpisode.played_up_to, 0))) AS time_left
FROM playlists AS playlist
... | @@ -134,6 +134,26 @@ abstract class PlaylistDao {
@Query("SELECT episode_uuid FROM manual_playlist_episodes WHERE playlist_uuid IS :playlistUuid")
abstract suspend fun getManualPlaylistEpisodeUuids(playlistUuid: String): List<String>
+ @Query(
+ """
+ SELECT DISTINCT episode.podcast_uuid
+ ... | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/PlaylistDao.kt | 26 | Kotlin | 0.357 | question | 72 | 51 | 51 | false | Do not cleanup manual playlists data | 4,475 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | MiSikora |
private val unsubscribeRelay = PublishRelay.create<String>()
private val podcastDao = appDatabase.podcastDao()
private val episodeDao = appDatabase.episodeDao()
override suspend fun unsubscribe(podcastUuid: String, playbackManager: PlaybackManager) {
try {
val podcast = podcastDao.f... | Has this been removed, as the podcast could still be being displayed on the page? | override val coroutineContext: CoroutineContext
get() = Dispatchers.Default
private val unsubscribeRelay = PublishRelay.create<String>()
private val podcastDao = appDatabase.podcastDao()
private val episodeDao = appDatabase.episodeDao()
private val playlistDao = appDatabase.playlistDao()
... | @@ -80,30 +82,26 @@ class PodcastManagerImpl @Inject constructor(
private val unsubscribeRelay = PublishRelay.create<String>()
private val podcastDao = appDatabase.podcastDao()
private val episodeDao = appDatabase.episodeDao()
+ private val playlistDao = appDatabase.playlistDao()
override suspe... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/podcast/PodcastManagerImpl.kt | 26 | Kotlin | 0.429 | question | 82 | 51 | 51 | false | Do not cleanup manual playlists data | 4,475 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | MiSikora |
if (this.isSwipedThresholdReached != isSwipedThresholdReached) {
this.isSwipedThresholdReached = isSwipedThresholdReached
if (useHapticFeedback) {
swipeableView.performHapticFeedback(HapticFeedbackConstants.CONTEXT_CLICK)
}
}
}
private fun re... | This timing change from 0 to 350 milliseconds appears unrelated to the main purpose of this PR (encapsulating swipe button creation logic). Consider separating this change into a different PR or providing context for why this timing adjustment is necessary for the factory refactoring.
```suggestion
... |
if (this.isSwipedThresholdReached != isSwipedThresholdReached) {
this.isSwipedThresholdReached = isSwipedThresholdReached
if (useHapticFeedback) {
swipeableView.performHapticFeedback(HapticFeedbackConstants.CONTEXT_CLICK)
}
}
}
private fun re... | @@ -242,7 +242,7 @@ class SwipeRowLayout<T : SwipeButton.UiState> @JvmOverloads constructor(
primaryButton.callOnSwipeActionListeners()
swipedAction?.cancel()
swipedAction = runDelayedAction(
- 0.milliseconds,
+ 350.milliseconds, | modules/services/views/src/main/java/au/com/shiftyjelly/pocketcasts/views/swipe/SwipeRowLayout.kt | 26 | Kotlin | 0.857 | refactor | 339 | 51 | 51 | false | Encapsulate swipe buttons creation logic | 4,497 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
viewModelScope.launch {
val episode = episodeManager.findEpisodeByUuid(episodeUuid) as? PodcastEpisode ?: return@launch
withContext(Dispatchers.IO) {
episodeManager.unarchiveBlocking(episode)
}
}
}
fun removeFromPlaylist(episodeUuid: String) ... | The comment mentions potential memory leaks but doesn't provide guidance on how to avoid them or why this design was chosen. Consider adding mitigation strategies or referencing why the suspend function approach is necessary despite the risk.
```suggestion
// Unlike other functions, this one is suspending because i... |
viewModelScope.launch {
val episode = episodeManager.findEpisodeByUuid(episodeUuid) as? PodcastEpisode ?: return@launch
withContext(Dispatchers.IO) {
episodeManager.unarchiveBlocking(episode)
}
}
}
fun removeFromPlaylist(episodeUuid: String) ... | @@ -0,0 +1,152 @@
+package au.com.shiftyjelly.pocketcasts.views.swipe
+
+import androidx.fragment.app.FragmentManager
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
+import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsT... | modules/services/views/src/main/java/au/com/shiftyjelly/pocketcasts/views/swipe/SwipeActionViewModel.kt | 26 | Kotlin | 1 | performance | 1,291 | 51 | 51 | false | Handle playlist swipe actions | 4,498 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
package au.com.shiftyjelly.pocketcasts.views.swipe
import android.content.Context
import android.graphics.Color
import au.com.shiftyjelly.pocketcasts.models.to.PlaylistEpisode
import au.com.shiftyjelly.pocketcasts.ui.extensions.getThemeColor
import au.com.shiftyjelly.pocketcasts.images.R as IR
import au.com.shiftyjell... | I fixed icon in #4505 after clarifying it with designers. | val id = when (this) {
AddToUpNextTop -> UR.attr.support_04
AddToUpNextBottom -> UR.attr.support_03
RemoveFromUpNext -> UR.attr.support_05
Share -> UR.attr.support_01
Archive -> UR.attr.support_06
Unarchive -> UR.attr.support_06
... | @@ -57,5 +60,6 @@ enum class SwipeAction(
Unarchive -> IR.drawable.ic_unarchive
RemoveFromPlaylist -> IR.drawable.ic_delete
DeleteUserEpisode -> IR.drawable.ic_delete
+ AddToPlaylist -> IR.drawable.ic_playlist_add_episode | modules/services/views/src/main/java/au/com/shiftyjelly/pocketcasts/views/swipe/SwipeAction.kt | 26 | Kotlin | 0.214 | suggestion | 57 | 62 | 29 | false | Add swipe to add to playlist action | 4,504 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | MiSikora |
Sleep(
id = "sleep",
titleId = { LR.string.player_sleep_timer },
iconId = { IR.drawable.ic_sleep },
analyticsValue = "sleep_timer",
),
Star(
id = "star",
titleId = { if (it is PodcastEpisode && it.isStarred) LR.string.unstar_episode else LR.string.star_episode... | The showIf condition only checks for the feature flag but doesn't validate that the episode is a PodcastEpisode. According to the testing instructions, user episodes should not show this action. The condition should be `{ it is PodcastEpisode && FeatureFlag.isEnabled(Feature.PLAYLISTS_REBRANDING, immutable = true) }`.
... | Sleep(
id = "sleep",
titleId = { LR.string.player_sleep_timer },
iconId = { IR.drawable.ic_sleep },
analyticsValue = "sleep_timer",
),
Star(
id = "star",
titleId = { if (it is PodcastEpisode && it.isStarred) LR.string.unstar_episode else LR.string.star_episode... | @@ -45,6 +47,13 @@ enum class ShelfItem(
showIf = { it is PodcastEpisode },
analyticsValue = "share_episode",
),
+ AddToPlaylist(
+ id = "add_to_playlist",
+ titleId = { LR.string.add_to_playlist_description },
+ showIf = { FeatureFlag.isEnabled(Feature.PLAYLISTS_REBRANDIN... | modules/services/preferences/src/main/java/au/com/shiftyjelly/pocketcasts/preferences/model/ShelfRowItem.kt | 26 | Kotlin | 1 | suggestion | 453 | 51 | 51 | false | Add "add to playlist" shelf action | 4,505 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
package au.com.shiftyjelly.pocketcasts.playlists.manual
import android.os.Bundle
import android.os.Parcelable
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Co... | The import `androidx.core.view.postDelayed` is not used anywhere in the file. This unused import should be removed.
```suggestion
``` | package au.com.shiftyjelly.pocketcasts.playlists.manual
import android.os.Bundle
import android.os.Parcelable
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
... | @@ -4,53 +4,79 @@ import android.os.Bundle
import android.os.Parcelable
import android.view.LayoutInflater
import android.view.ViewGroup
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.Column
import androidx.compose.fou... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/manual/AddToPlaylistFragment.kt | 15 | Kotlin | 0.786 | suggestion | 134 | 40 | 40 | false | Add episode playlist creation flow | 4,506 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
override fun onScroll(e1: MotionEvent?, e2: MotionEvent, distanceX: Float, distanceY: Float): Boolean {
updateSwipeDirection(-distanceX)
if (dragEventDirections.size >= 10) {
dragEventDirections.removeFirst()
}
val currentTr... | The magic numbers -1 and +1 are unexplained. Consider adding comments to clarify why these offsets are necessary, or extract them as named constants to improve code readability. | override fun onScroll(e1: MotionEvent?, e2: MotionEvent, distanceX: Float, distanceY: Float): Boolean {
updateSwipeDirection(-distanceX)
if (dragEventDirections.size >= 10) {
dragEventDirections.removeFirst()
}
val currentTr... | @@ -444,13 +446,29 @@ private class SwipeGestureHandler(
override fun onFling(e1: MotionEvent?, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
updateSwipeDirection(velocityX)
+ val swipedThreshold = getSwipedThreshold()
+ val (minX, maxX) = ... | modules/services/views/src/main/java/au/com/shiftyjelly/pocketcasts/views/swipe/SwipeRowLayout.kt | 26 | Kotlin | 0.429 | refactor | 177 | 51 | 51 | false | Improve fling gesture | 4,508 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
episodes = filteredEpisodes,
unfilteredEpisodeCount = unfilteredEpisodes.size,
)
}
}
flow.stateIn(viewModelScope, SharingStarted.WhileSubscribed(stopTimeoutMillis = 300, replayExpirationMillis = 300), initialValu... | The comparison should use `>=` instead of `>` to be consistent with the logic in PlaylistViewModel.kt line 217 where `episodeCount >= PlaylistManager.MANUAL_PLAYLIST_EPISODE_LIMIT` is used.
```suggestion
mapOf("is_playlist_full" to (episodeCount >= PlaylistManager.MANUAL_PLAYLIST_EPISODE_LIMIT)),
``` | episodes = filteredEpisodes,
unfilteredEpisodeCount = unfilteredEpisodes.size,
)
}
}
flow.stateIn(viewModelScope, SharingStarted.WhileSubscribed(stopTimeoutMillis = 300, replayExpirationMillis = 300), initialValu... | @@ -116,6 +119,26 @@ class AddEpisodesViewModel @AssistedInject constructor(
}
}
+ fun trackScreenShown() {
+ tracker.track(AnalyticsEvent.FILTER_ADD_EPISODES_SHOWN)
+ }
+
+ fun trackFolderTapped() {
+ tracker.track(AnalyticsEvent.FILTER_ADD_EPISODES_FOLDER_TAPPED)
+ }
+
+ f... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/manual/AddEpisodesViewModel.kt | 26 | Kotlin | 0.857 | suggestion | 313 | 51 | 51 | false | Add manual playlist analytics | 4,509 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
package au.com.shiftyjelly.pocketcasts.playlists.manual
import androidx.compose.foundation.text.input.TextFieldState
import androidx.compose.ui.text.TextRange
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import au.com.shiftyjelly.pocketcasts.compose.text.SearchFieldState
import au.com.s... | The import AddToPlaylistFragmentFactory is unused in this file; only Source is referenced. Please remove the unused import to satisfy lint and keep imports clean.
```suggestion
import au.com.shiftyjelly.pocketcasts.views.swipe.AddToPlaylistFragmentFactory.Source
import dagger.assisted.Assisted
import dagger.assisted.As... | package au.com.shiftyjelly.pocketcasts.playlists.manual
import androidx.compose.foundation.text.input.TextFieldState
import androidx.compose.ui.text.TextRange
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
import au.com.shifty... | @@ -4,9 +4,13 @@ import androidx.compose.foundation.text.input.TextFieldState
import androidx.compose.ui.text.TextRange
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
+import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
+import au.com.shiftyjelly.pocketcasts.analytics.Analyti... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/manual/AddToPlaylistViewModel.kt | 15 | Kotlin | 1 | suggestion | 376 | 40 | 40 | false | Add manual playlist analytics | 4,509 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.material.SnackbarHostState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import android... | The import AddToPlaylistFragmentFactory is not used in this file; only Source is used. Remove the unused import to avoid lint warnings.
```suggestion
``` | import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.material.SnackbarHostState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import android... | @@ -23,13 +23,16 @@ import androidx.core.os.bundleOf
import androidx.fragment.app.viewModels
import androidx.fragment.compose.content
import androidx.navigation.compose.rememberNavController
+import au.com.shiftyjelly.pocketcasts.compose.CallOnce
import au.com.shiftyjelly.pocketcasts.compose.components.AnimatedNonN... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/manual/AddToPlaylistFragment.kt | 26 | Kotlin | 0.786 | suggestion | 154 | 51 | 51 | false | Add manual playlist analytics | 4,509 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
package au.com.shiftyjelly.pocketcasts.playlists.manual
import androidx.compose.foundation.text.input.TextFieldState
import androidx.compose.ui.text.TextRange
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import au.com.shiftyjelly.pocketcasts.compose.text.SearchFieldState
import au.com.s... | [nitpick] AddToPlaylistViewModel (features module) depends on views.swipe.AddToPlaylistFragmentFactory solely to access the nested enum Source for analytics. Consider moving Source to a shared, top-level type (e.g., AddToPlaylistSource in a common/analytics module) or changing APIs to accept a simple source string to r... | package au.com.shiftyjelly.pocketcasts.playlists.manual
import androidx.compose.foundation.text.input.TextFieldState
import androidx.compose.ui.text.TextRange
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
import au.com.shifty... | @@ -4,9 +4,13 @@ import androidx.compose.foundation.text.input.TextFieldState
import androidx.compose.ui.text.TextRange
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
+import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
+import au.com.shiftyjelly.pocketcasts.analytics.Analyti... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/manual/AddToPlaylistViewModel.kt | 13 | Kotlin | 0.643 | suggestion | 372 | 38 | 38 | false | Add manual playlist analytics | 4,509 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
}
}
flow.stateIn(viewModelScope, SharingStarted.WhileSubscribed(stopTimeoutMillis = 300, replayExpirationMillis = 300), initialValue = null)
}
}
data class UiState(
val playlist: ManualPlaylist,
val sources: List<ManualPlaylistEpisodeSource>,
... | Defaulting episodeCount to Int.MAX_VALUE will always report is_playlist_full = true when uiState.playlist is null, which can skew analytics. Consider defaulting to false when playlist is unknown, e.g., compute isFull only if totalEpisodeCount is non-null and use false otherwise.
```suggestion
val episodeCount =... | episodes = filteredEpisodes,
unfilteredEpisodeCount = unfilteredEpisodes.size,
)
}
}
flow.stateIn(viewModelScope, SharingStarted.WhileSubscribed(stopTimeoutMillis = 300, replayExpirationMillis = 300), initialValu... | @@ -116,6 +119,26 @@ class AddEpisodesViewModel @AssistedInject constructor(
}
}
+ fun trackScreenShown() {
+ tracker.track(AnalyticsEvent.FILTER_ADD_EPISODES_SHOWN)
+ }
+
+ fun trackFolderTapped() {
+ tracker.track(AnalyticsEvent.FILTER_ADD_EPISODES_FOLDER_TAPPED)
+ }
+
+ f... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/manual/AddEpisodesViewModel.kt | 26 | Kotlin | 1 | suggestion | 696 | 29 | 51 | false | Add manual playlist analytics | 4,509 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
fun showSettings() {
viewModelScope.launch {
isNameChanged = false
isAutoDownloadChanged = false
isAutoDownloadLimitChanged = false
_showSettingsSignal.emit(Unit)
}
}
fun toggleShowArchived() {
viewModelScope.launch {
play... | Similar to AddEpisodesViewModel, defaulting to Int.MAX_VALUE causes is_playlist_full to be reported as true when playlist/metadata is unavailable. Prefer computing the flag only when totalEpisodeCount is available and default to false otherwise to avoid inflating 'full' counts.
```suggestion
val episodeCount = ... |
fun showSettings() {
viewModelScope.launch {
isNameChanged = false
isAutoDownloadChanged = false
isAutoDownloadLimitChanged = false
_showSettingsSignal.emit(Unit)
}
}
fun toggleShowArchived() {
viewModelScope.launch {
play... | @@ -211,7 +211,11 @@ class PlaylistViewModel @AssistedInject constructor(
}
fun trackAddEpisodesTapped() {
- analyticsTracker.track(AnalyticsEvent.FILTER_EDIT_RULES_TAPPED)
+ val episodeCount = uiState.value.playlist?.metadata?.totalEpisodeCount ?: Int.MAX_VALUE
+ analyticsTracker.track... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/PlaylistViewModel.kt | 26 | Kotlin | 0.857 | suggestion | 631 | 51 | 51 | false | Add manual playlist analytics | 4,509 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
)
}
composable(OldOnboardingFlow.FORGOT_PASSWORD) {
OnboardingForgotPasswordPage(
theme = theme,
onBackPress = { navController.popBackStack() },
onComplete = { exitOnboarding(OnboardingExitInfo.Simple) },
onUpdateSy... | [nitpick] NewOnboardingFlow directly depends on OldOnboardingFlow's route constant, which couples the 'new' and 'old' flows. Consider defining a route constant in NewOnboardingFlow (e.g., ROUTE_ENCOURAGE_FREE_ACCOUNT) and using it here (and mapping to it in startDestination at line 55) to avoid cross-flow coupling. | },
onLoginComplete = { subscription ->
onLoginToExistingAccount(flow, subscription, exitOnboarding)
},
onForgotPasswordClick = { navController.navigate(OldOnboardingFlow.FORGOT_PASSWORD) },
onUpdateSystemBars = onUpdateS... | @@ -162,6 +175,37 @@ object NewOnboardingFlow {
)
}
+ composable(OldOnboardingFlow.ENCOURAGE_FREE_ACCOUNT) { | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/NewOnboardingFlow.kt | 26 | Kotlin | 0.5 | suggestion | 316 | 51 | 51 | false | Update account creation encouragement screen | 4,512 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
targetCompatibility = JavaVersion.toVersion(javaTarget.target)
}
setCompileSdkVersion(project.property("compileSdkVersion") as Int)
defaultConfig {
minSdk = project.property("minSdkVersion") as Int
targetSdk = project.property("target... | Praise (❤️): Nice deduplication here! 🥇 |
buildConfigField("int", "VERSION_CODE", "${project.property("versionCode")}")
buildConfigField("String", "VERSION_NAME", "\"${project.property("versionName")}\"")
buildConfigField("String", "SETTINGS_ENCRYPT_SECRET", "\"${project.property("settingsEncryptSecret")}\"")
... | @@ -253,6 +255,19 @@ subprojects {
buildConfigField("String", "META_APP_ID", "\"${project.property("metaAppId")}\"")
buildConfigField("String", "APPS_FLYER_KEY", "\"${project.property("appsFlyerKey")}\"")
+ buildConfigField("String", "SERVER_MAIN_URL", serverMainUrlPro... | build.gradle.kts | 26 | Kotlin | 0.071 | suggestion | 39 | 51 | 51 | false | Add prototype build type | 4,518 | Automattic/pocket-casts-android | 1,688 | Kotlin | ParaskP7 | MiSikora |
buildConfigField("String", "SERVER_CACHE_URL", "\"https://podcast-api.pocketcasts.net\"")
buildConfigField("String", "SERVER_CACHE_HOST", "\"podcast-api.pocketcasts.net\"")
buildConfigField("String", "SERVER_STATIC_URL", "\"https://static.pocketcasts.net\"")
... | Questions (❓):
1. This is what we really want here, right? 🤔
2. Because `isDebuggable` is `false` by default, we set it to `false` here explicitly to make sure reader of this build type can quickly reason about ti, correct? 🤔 | }
maybeCreate("debugProd").apply {
isDebuggable = true
isPseudoLocalesEnabled = true
enableUnitTestCoverage = false
enableAndroidTestCoverage = false
ext.set("alwaysUpdateBuildId", false)... | @@ -321,37 +336,20 @@ subprojects {
enableAndroidTestCoverage = false
ext.set("alwaysUpdateBuildId", false)
- buildConfigField("String", "SERVER_MAIN_URL", serverMainUrlProd)
- buildConfigField("String", "SERVER_API_URL", serverApiUrlProd... | build.gradle.kts | 26 | Kotlin | 0.786 | bug | 229 | 51 | 51 | false | Add prototype build type | 4,518 | Automattic/pocket-casts-android | 1,688 | Kotlin | ParaskP7 | MiSikora |
applicationId = project.property("applicationId").toString()
multiDexEnabled = true
}
sourceSets {
getByName("androidTest") {
assets.srcDir(files("$rootDir/modules/services/model/schemas"))
}
}
buildFeatures {
buildConfig = true
viewBinding =... | Question (❓): Why not add the `isMinifyEnabled` + `isShrinkResources` + `proguardFiles ` configuration on the root level `build.gradle.kts` file, just like it is done for the rest, to keep things consistent, there might be a reason I am not aware of: 🤔
`build.gradle.kts` (root)
```kts
plugins.withType<AppPl... | applicationId = project.property("applicationId").toString()
multiDexEnabled = true
}
sourceSets {
getByName("androidTest") {
assets.srcDir(files("$rootDir/modules/services/model/schemas"))
}
}
buildFeatures {
buildConfig = true
viewBinding =... | @@ -38,6 +38,20 @@ android {
manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher_3"
}
+ maybeCreate("prototype").apply { | app/build.gradle.kts | 26 | Kotlin | 0.929 | performance | 1,258 | 51 | 51 | false | Add prototype build type | 4,518 | Automattic/pocket-casts-android | 1,688 | Kotlin | ParaskP7 | MiSikora |
}
buildFeatures {
buildConfig = true
viewBinding = true
compose = true
}
buildTypes {
named("debug") {
manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher_radioactive"
}
named("debugProd") {
manifestPlaceholders["appIcon"] = "... | Question (❓): Do we need to add this `proguard-rules.pro` if we then (kind of) overwrite that with the next `proguard-rules-no-obfuscate.pro` file? 🤔 | }
buildFeatures {
buildConfig = true
viewBinding = true
compose = true
}
buildTypes {
named("debug") {
manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher_radioactive"
}
named("debugProd") {
manifestPlaceholders["appIcon"] = "... | @@ -38,6 +38,20 @@ android {
manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher_3"
}
+ maybeCreate("prototype").apply {
+ manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher_prototype"
+
+ isMinifyEnabled = true
+ isShrinkResources = true
+ ... | app/build.gradle.kts | 26 | Kotlin | 0.5 | suggestion | 150 | 51 | 51 | false | Add prototype build type | 4,518 | Automattic/pocket-casts-android | 1,688 | Kotlin | ParaskP7 | MiSikora |
val serverListUrlProd = "\"https://lists.pocketcasts.com\""
val serverListHostProd = "\"lists.pocketcasts.com\""
val serverShortUrlProd = "\"https://pca.st\""
val serverShortHostProd = "\"pca.st\""
val serverWebPlayerHostProd = "\"play.pocketcasts.com\""
val webBaseHostProd = "\"pocketcasts.com\... | Praise (❤️): Another good thing done, thanks! 😄 | targetCompatibility = JavaVersion.toVersion(javaTarget.target)
}
setCompileSdkVersion(project.property("compileSdkVersion") as Int)
defaultConfig {
minSdk = project.property("minSdkVersion") as Int
targetSdk = project.property("target... | @@ -253,6 +243,19 @@ subprojects {
buildConfigField("String", "META_APP_ID", "\"${project.property("metaAppId")}\"")
buildConfigField("String", "APPS_FLYER_KEY", "\"${project.property("appsFlyerKey")}\"")
+ buildConfigField("String", "SERVER_MAIN_URL", "\"https://refre... | build.gradle.kts | 26 | Kotlin | 0.071 | suggestion | 47 | 51 | 51 | false | Add prototype build type | 4,518 | Automattic/pocket-casts-android | 1,688 | Kotlin | ParaskP7 | MiSikora |
viewBinding = true
compose = true
}
buildTypes {
named("debug") {
manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher_radioactive"
}
named("debugProd") {
manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher_radioactive"
}
na... | Info (ℹ️): Noted, thanks! 🥇
`./gradlew automotive:assemblePrototype`
```
FAILURE: Build failed with an exception.
* What went wrong:
Cannot locate tasks that match 'automotive:assemblePrototype' as task 'assemblePrototype' not found in project ':automotive'.
``` | viewBinding = true
compose = true
}
buildTypes {
named("debug") {
manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher_radioactive"
}
named("debugProd") {
manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher_radioactive"
}
na... | @@ -41,6 +41,12 @@ android {
}
}
+androidComponents {
+ beforeVariants { builder ->
+ builder.enable = builder.buildType != "prototype" | automotive/build.gradle.kts | 26 | Kotlin | 0.929 | bug | 273 | 51 | 51 | false | Add prototype build type | 4,518 | Automattic/pocket-casts-android | 1,688 | Kotlin | ParaskP7 | MiSikora |
if (!file("${project.rootDir}/sentry.properties").exists()) {
println("WARNING: Sentry configuration file 'sentry.properties' not found. The ProGuard mapping files won't be uploaded.")
}
}
}
buildFeatures {
buildConfig = true
viewBinding = true
... | Info (ℹ️): Noted, thanks! 🥇
`./gradlew wear:assemblePrototype`
```
FAILURE: Build failed with an exception.
* What went wrong:
Cannot locate tasks that match 'wear:assemblePrototype' as task 'assemblePrototype' not found in project ':wear'.
``` |
if (!file("${project.rootDir}/sentry.properties").exists()) {
println("WARNING: Sentry configuration file 'sentry.properties' not found. The ProGuard mapping files won't be uploaded.")
}
}
}
buildFeatures {
buildConfig = true
viewBinding = true
... | @@ -51,6 +51,12 @@ android {
}
}
+androidComponents {
+ beforeVariants { builder ->
+ builder.enable = builder.buildType != "prototype" | wear/build.gradle.kts | 26 | Kotlin | 0.929 | bug | 255 | 51 | 51 | false | Add prototype build type | 4,518 | Automattic/pocket-casts-android | 1,688 | Kotlin | ParaskP7 | MiSikora |
implementation(platform(libs.compose.bom))
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.preference.ktx)
implementation(libs.coil)
implementation(libs.coil.compose)
implementation(libs.compose.activity)
implementation(libs.compose.animation)
implementation(libs.com... | The commented-out dependency should be removed instead of being left as a comment. If it needs to be kept for reference, consider adding a TODO comment explaining why.
```suggestion
``` | implementation(platform(libs.compose.bom))
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.preference.ktx)
implementation(libs.coil)
implementation(libs.coil.compose)
implementation(libs.compose.activity)
implementation(libs.compose.animation)
implementation(libs.com... | @@ -67,14 +67,17 @@ dependencies {
implementation(libs.navigation.compose)
implementation(libs.navigation.fragment.ktx)
implementation(libs.navigation.ui.ktx)
- implementation(libs.play.auth)
+ // implementation(libs.play.auth) | modules/features/account/build.gradle.kts | 26 | Kotlin | 0.786 | suggestion | 186 | 51 | 51 | false | [CredentialManager Migration] Migrate from GoogleSingIn on phone | 4,523 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
) {
LoginWithPhoneScreen(
onLoginClick = { navController.popBackStack() },
)
}
composable(
route = AuthenticationNavRoutes.LOGIN_WITH_GOOGLE,
) {
LoginWithGoogleScreen(
successContent = {
... | The `photoUrl` is being converted to string unconditionally, but when `it?.photoUrl` is null, this will result in 'null' string instead of null value. Should use `it?.photoUrl?.toString()` to preserve null values.
```suggestion
googleSignInSuccessScreen(GoogleAccountData(name = it?.givenName.orEmpty... | ) {
LoginWithEmailScreen(
onSignInSuccess = onEmailSignInSuccess,
)
}
composable(
route = AuthenticationNavRoutes.LOGIN_WITH_PHONE,
) {
LoginWithPhoneScreen(
onLoginClick = { navController.popBackStack() },
... | @@ -63,7 +68,23 @@ fun NavGraphBuilder.authenticationNavGraph(
route = AuthenticationNavRoutes.LOGIN_WITH_GOOGLE,
) {
LoginWithGoogleScreen(
- signInSuccessScreen = googleSignInSuccessScreen,
+ successContent = {
+ googleSignInSuccessSc... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/authentication/AuthenticationNavGraph.kt | 26 | Kotlin | 1 | suggestion | 366 | 33 | 51 | false | [CredentialManager] Use Google login on WearOS | 4,528 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
@HiltViewModel
class LoginWithGoogleViewModel @Inject constructor(
private val podcastManager: PodcastManager,
private val syncManager: SyncManager,
@ApplicationContext context: Context,
) : ViewModel() {
sealed interface Stat... | ℹ️ This annotation looks misplaced. It doesn't enforce any checks and comes from Hilt to be used for DI. If APIs require an activity's context why not pass in an activity here? | import javax.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
@HiltViewModel
class LoginWithGoogleViewModel @Inject constructor(
private val podcastManager: PodcastManager,
private val syncManager: SyncManager,
@Applic... | @@ -0,0 +1,110 @@
+package au.com.shiftyjelly.pocketcasts.wear.ui.authentication
+
+import android.content.Context
+import androidx.credentials.CredentialManager
+import androidx.credentials.CustomCredential
+import androidx.credentials.GetCredentialRequest
+import androidx.lifecycle.ViewModel
+import androidx.lifecycl... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/authentication/LoginWithGoogleViewModel.kt | 26 | Kotlin | 0.429 | question | 176 | 51 | 51 | false | [CredentialManager] Use Google login on WearOS | 4,528 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
successContent = {
googleSignInSuccessScreen(GoogleAccountData(name = it.name, avatarUrl = it.avatarUrl))
},
onError = {
navController.popBackStack()
navController.navigate(AuthenticationNavRoutes.LOGIN_WITH_GOOG... | Using Toast directly in a Composable violates Compose best practices. Consider moving this side effect to a LaunchedEffect or passing an event handler to handle UI notifications at a higher level. | composable(
route = AuthenticationNavRoutes.LOGIN_WITH_GOOGLE,
) {
val activity = LocalActivity.current
var showErrorToast by remember { mutableStateOf(false) }
LaunchedEffect(activity, showErrorToast) {
if (showErrorToast) {
... | @@ -62,8 +70,29 @@ fun NavGraphBuilder.authenticationNavGraph(
composable(
route = AuthenticationNavRoutes.LOGIN_WITH_GOOGLE,
) {
+ val activity = LocalActivity.current
LoginWithGoogleScreen(
- signInSuccessScreen = googleSignInSuccessScreen,
+ ... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/authentication/AuthenticationNavGraph.kt | 26 | Kotlin | 0.571 | suggestion | 196 | 27 | 41 | false | [CredentialManager] Use Google login on WearOS | 4,528 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
@file:Suppress("DEPRECATION")
package au.com.shiftyjelly.pocketcasts.wear.ui.authentication
import android.widget.Toast
import androidx.activity.compose.LocalActivity
import androidx.compose.runtime.Composable
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigati... | [nitpick] The nullable chain `it?.givenName.orEmpty()` could be simplified to `it?.givenName ?: \"\"` for better readability and consistency with the avatarUrl handling pattern.
```suggestion
googleSignInSuccessScreen(GoogleAccountData(name = it?.givenName ?: "", avatarUrl = it?.photoUrl?.toString()... | if (showErrorToast) {
Toast.makeText(activity, LR.string.onboarding_continue_with_google_error, Toast.LENGTH_SHORT).show()
}
}
LoginWithGoogleScreen(
successContent = {
googleSignInSuccessScreen(GoogleAccoun... | @@ -62,8 +70,29 @@ fun NavGraphBuilder.authenticationNavGraph(
composable(
route = AuthenticationNavRoutes.LOGIN_WITH_GOOGLE,
) {
+ val activity = LocalActivity.current
LoginWithGoogleScreen(
- signInSuccessScreen = googleSignInSuccessScreen,
+ ... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/authentication/AuthenticationNavGraph.kt | 26 | Kotlin | 1 | suggestion | 326 | 101 | 33 | false | [CredentialManager] Use Google login on WearOS | 4,528 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
@file:Suppress("DEPRECATION")
package au.com.shiftyjelly.pocketcasts.wear.ui.authentication
import android.widget.Toast
import androidx.activity.compose.LocalActivity
import androidx.compose.runtime.Composable
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigati... | [nitpick] The inline object creation with null-safe operators makes this line hard to read. Consider extracting this logic into a helper function or using a more explicit approach to handle the nullable GoogleSignInAccount. | if (showErrorToast) {
Toast.makeText(activity, LR.string.onboarding_continue_with_google_error, Toast.LENGTH_SHORT).show()
}
}
LoginWithGoogleScreen(
successContent = {
googleSignInSuccessScreen(GoogleAccoun... | @@ -62,8 +70,29 @@ fun NavGraphBuilder.authenticationNavGraph(
composable(
route = AuthenticationNavRoutes.LOGIN_WITH_GOOGLE,
) {
+ val activity = LocalActivity.current
LoginWithGoogleScreen(
- signInSuccessScreen = googleSignInSuccessScreen,
+ ... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/authentication/AuthenticationNavGraph.kt | 26 | Kotlin | 0.643 | refactor | 223 | 101 | 33 | false | [CredentialManager] Use Google login on WearOS | 4,528 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
onSignInSuccess = onEmailSignInSuccess,
)
}
composable(
route = AuthenticationNavRoutes.LOGIN_WITH_PHONE,
) {
LoginWithPhoneScreen(
onLoginClick = { navController.popBackStack() },
)
}
composable(
... | Using Toast directly in Compose is not recommended. Consider using a SnackbarHost or other Compose-native UI feedback mechanism, or move this logic to the ViewModel to emit UI events. |
composable(
route = AuthenticationNavRoutes.LOGIN_WITH_EMAIL,
) {
LoginWithEmailScreen(
onSignInSuccess = onEmailSignInSuccess,
)
}
composable(
route = AuthenticationNavRoutes.LOGIN_WITH_PHONE,
) {
Logi... | @@ -62,8 +70,29 @@ fun NavGraphBuilder.authenticationNavGraph(
composable(
route = AuthenticationNavRoutes.LOGIN_WITH_GOOGLE,
) {
+ val activity = LocalActivity.current
LoginWithGoogleScreen(
- signInSuccessScreen = googleSignInSuccessScreen,
+ ... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/authentication/AuthenticationNavGraph.kt | 26 | Kotlin | 0.429 | refactor | 183 | 44 | 51 | false | [CredentialManager] Use Google login on WearOS | 4,528 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
val playlists = smartPlaylistManager.findPlaylistsToSyncBlocking()
for (playlist in playlists) {
val fields = JSONObject()
if (playlist.manual) {
continue
}
try {
fields.put("uuid", playlist... | This should be `playlist.icon.id` instead of `playlist.icon`. The current code is passing the `PlaylistIcon` object instead of its underlying integer ID value.
```suggestion
fields.put("icon_id", playlist.icon.id)
``` | val playlists = smartPlaylistManager.findPlaylistsToSyncBlocking()
for (playlist in playlists) {
val fields = JSONObject()
if (playlist.manual) {
continue
}
try {
fields.put("uuid", playlist... | @@ -415,7 +415,7 @@ class PodcastSyncProcess(
fields.put("manual", "0")
fields.put("sort_position", playlist.sortPosition)
fields.put("sort_type", playlist.sortType.serverId)
- fields.put("icon_id", playlist.iconId)
+ f... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/sync/PodcastSyncProcess.kt | 26 | Kotlin | 0.857 | suggestion | 237 | 51 | 51 | false | Add PlaylistIcon type | 4,529 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
package au.com.shiftyjelly.pocketcasts.repositories.di
import android.content.Context
import au.com.shiftyjelly.pocketcasts.repositories.playlist.DefaultPlaylistsStartupInitializer
import dagger.hilt.EntryPoint
import dagger.hilt.InstallIn
import dagger.hilt.android.EntryPointAccessors
import dagger.hilt.components.Si... | The function name has a typo: "initialzierEntryPoint" should be "initializerEntryPoint" (missing 'i' after 'initial').
```suggestion
internal fun Context.initializerEntryPoint() = EntryPointAccessors.fromApplication<InitializerEntryPoint>(this)
``` | package au.com.shiftyjelly.pocketcasts.repositories.di
import android.content.Context
import au.com.shiftyjelly.pocketcasts.repositories.playlist.DefaultPlaylistsStartupInitializer
import dagger.hilt.EntryPoint
import dagger.hilt.InstallIn
import dagger.hilt.android.EntryPointAccessors
import dagger.hilt.components.Si... | @@ -10,7 +10,7 @@ import dagger.hilt.components.SingletonComponent
@EntryPoint
@InstallIn(SingletonComponent::class)
interface InitializerEntryPoint {
- fun inject(initializer: DefaultPlaylistsStartupInitializater)
+ fun inject(initializer: DefaultPlaylistsStartupInitializer)
}
internal fun Context.initial... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/di/InitializerEntryPoint.kt | 16 | Kotlin | 0.857 | suggestion | 248 | 17 | 17 | false | Use playlists nomenclature in the whole app | 4,532 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
/**
* Value for {@link #CONTENT_STYLE_PLAYABLE_HINT} and {@link #CONTENT_STYLE_BROWSABLE_HINT} that
* hints the corresponding items should be presented as grids. */
const val CONTENT_STYLE_GRID_ITEM_HINT_VALUE = 2
private const val EPISODE_LIMIT = 100
@AndroidEntryPoint
open class PlaybackService :
MediaBr... | There is a typo in the variable name. `playlistManger` should be `playlistManager`.
```suggestion
@Inject lateinit var playlistManager: PlaylistManager
``` |
/**
* Value for {@link #CONTENT_STYLE_PLAYABLE_HINT} and {@link #CONTENT_STYLE_BROWSABLE_HINT} that
* hints the corresponding items should be presented as grids. */
const val CONTENT_STYLE_GRID_ITEM_HINT_VALUE = 2
private const val EPISODE_LIMIT = 100
@AndroidEntryPoint
open class PlaybackService :
MediaBr... | @@ -123,7 +129,7 @@ open class PlaybackService :
@Inject lateinit var userEpisodeManager: UserEpisodeManager
- @Inject lateinit var smartPlaylistManager: SmartPlaylistManager
+ @Inject lateinit var playlistManger: PlaylistManager | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/PlaybackService.kt | 26 | Kotlin | 0.929 | suggestion | 159 | 51 | 51 | false | Support playlists in Android Auto and Automotive | 4,535 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
.subscribe()
} else {
currentTimeLeft = newTimeLeft
}
}
private fun cancelSleepTimer() {
sleepTimerDisposable?.dispose()
sleepTimerDisposable = null
currentTimeLeft = ZERO
}
protected suspend fun getPlaylistPreviews(): List<PlaylistPr... | The variable name `playlistManger` should be `playlistManager` (consistent with the typo in the injected property). | .subscribe()
} else {
currentTimeLeft = newTimeLeft
}
}
private fun cancelSleepTimer() {
sleepTimerDisposable?.dispose()
sleepTimerDisposable = null
currentTimeLeft = ZERO
}
protected suspend fun getPlaylistPreviews(): List<PlaylistPr... | @@ -739,4 +762,24 @@ open class PlaybackService :
sleepTimerDisposable = null
currentTimeLeft = ZERO
}
+
+ protected suspend fun getPlaylistPreviews(): List<PlaylistPreview> {
+ val playlists = playlistManger.playlistPreviewsFlow().first()
+ return if (FeatureFlag.isEnabled(Featu... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/PlaybackService.kt | 26 | Kotlin | 0.714 | suggestion | 115 | 33 | 33 | false | Support playlists in Android Auto and Automotive | 4,535 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
if (currentTimeLeft <= ZERO) {
LogBuffer.i(LogBuffer.TAG_PLAYBACK, "Paused from sleep timer.")
CoroutineScope(Dispatchers.Main).launch {
Toast.makeText(applicationContext, applicationContext.getString(R.string.player_sleep_... | The variable name `playlistManger` should be `playlistManager` (consistent with the typo in the injected property). |
if (currentTimeLeft <= ZERO) {
LogBuffer.i(LogBuffer.TAG_PLAYBACK, "Paused from sleep timer.")
CoroutineScope(Dispatchers.Main).launch {
Toast.makeText(applicationContext, applicationContext.getString(R.string.player_sleep_... | @@ -739,4 +762,24 @@ open class PlaybackService :
sleepTimerDisposable = null
currentTimeLeft = ZERO
}
+
+ protected suspend fun getPlaylistPreviews(): List<PlaylistPreview> {
+ val playlists = playlistManger.playlistPreviewsFlow().first() | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/PlaybackService.kt | 26 | Kotlin | 0.714 | suggestion | 115 | 45 | 45 | false | Support playlists in Android Auto and Automotive | 4,535 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
val episodes: List<PodcastEpisode>,
) : UiState()
}
private val playlistFlow = when (playlistType) {
Playlist.Type.Manual -> playlistManager.manualPlaylistFlow(playlistUuid)
Playlist.Type.Smart -> playlistManager.smartPlaylistFlow(playlistUuid)
null -> flowOf(null)
... | This line references `PlaylistsViewModel.UiState.Loading` but should reference `UiState.Loading` from the current class. The initial state should be of the correct type.
```suggestion
.stateIn(viewModelScope, SharingStarted.Lazily, UiState.Loading)
``` | ) : UiState()
}
private val playlistFlow = when (playlistType) {
Playlist.Type.Manual -> playlistManager.manualPlaylistFlow(playlistUuid)
Playlist.Type.Smart -> playlistManager.smartPlaylistFlow(playlistUuid)
null -> flowOf(null)
}
val uiState = playlistFlow
.ma... | @@ -0,0 +1,68 @@
+package au.com.shiftyjelly.pocketcasts.wear.ui.playlist
+
+import androidx.lifecycle.SavedStateHandle
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import au.com.shiftyjelly.pocketcasts.models.entity.PodcastEpisode
+import au.com.shiftyjelly.pocketcasts.models.to.Play... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/playlist/PlaylistViewModel.kt | 26 | Kotlin | 1 | suggestion | 260 | 30 | 29 | false | Add playlists Wear support | 4,536 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import au.com.shiftyjelly.pocketcasts.models.entity.PodcastEpisode
import au.com.shiftyjelly.pocketcasts.models.to.PlaylistEpisode
import au.com.shiftyjelly.pocketcasts.preferences.Settings
import au.... | ```suggestion
private val playlistType = Playlist.Type.fromValue(savedStateHandle[PlaylistScreen.ARGUMENT_PLAYLIST_TYPE] ?: "")
``` | import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import au.com.shiftyjelly.pocketcasts.models.entity.PodcastEpisode
import au.com.shiftyjelly.pocketcasts.models.to.PlaylistEpisode
import au.com.shiftyjelly.pocketcasts.preferences.Settings
import au.... | @@ -0,0 +1,67 @@
+package au.com.shiftyjelly.pocketcasts.wear.ui.playlist
+
+import androidx.lifecycle.SavedStateHandle
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import au.com.shiftyjelly.pocketcasts.models.entity.PodcastEpisode
+import au.com.shiftyjelly.pocketcasts.models.to.Play... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/playlist/PlaylistViewModel.kt | 26 | Kotlin | 0.857 | suggestion | 135 | 51 | 51 | false | Add playlists Wear support | 4,536 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | MiSikora |
.collect { upNextQueue ->
_state.update {
it.copy(upNextQueue = upNextQueue)
}
}
}
}
fun onShown() {
analyticsTracker.track(AnalyticsEvent.WEAR_MAIN_LIST_SHOWN)
}
fun onNowPlayingClicked() {... | The method is renamed to `onPlaylistsClicked()` but still tracks the FILTERS_TAPPED event. This creates inconsistent analytics data when playlists functionality is used.
```suggestion
analyticsTracker.track(AnalyticsEvent.WEAR_MAIN_LIST_PLAYLISTS_TAPPED)
``` | .collect { upNextQueue ->
_state.update {
it.copy(upNextQueue = upNextQueue)
}
}
}
}
fun onShown() {
analyticsTracker.track(AnalyticsEvent.WEAR_MAIN_LIST_SHOWN)
}
fun onNowPlayingClicked() {... | @@ -64,7 +64,7 @@ class WatchListScreenViewModel @Inject constructor(
analyticsTracker.track(AnalyticsEvent.WEAR_MAIN_LIST_DOWNLOADS_TAPPED)
}
- fun onFiltersClicked() {
+ fun onPlaylistsClicked() {
analyticsTracker.track(AnalyticsEvent.WEAR_MAIN_LIST_FILTERS_TAPPED) | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/WatchListScreenViewModel.kt | 26 | Kotlin | 0.857 | suggestion | 266 | 37 | 37 | false | Add playlists Wear support | 4,536 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
import android.app.Application
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import au.com.shiftyjelly.pocketcasts.localization.R
import au.com.shiftyjelly.pocketcasts.taskerplugin.base.ViewModelBase
import au.com.shiftyjelly.pocketcasts.taskerplugin.base.hilt.smartPlaylistManager
import ... | The return type has changed from nullable to non-nullable (`Flow<List<String>>?` to `Flow<List<String>>`), which could be a breaking change if callers expect nullable returns.
```suggestion
override fun getPossibleValues(): Flow<List<String>>? {
``` |
import android.app.Application
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import au.com.shiftyjelly.pocketcasts.localization.R
import au.com.shiftyjelly.pocketcasts.taskerplugin.base.ViewModelBase
import au.com.shiftyjelly.pocketcasts.taskerplugin.base.hilt.playlistManager
import au.co... | @@ -24,8 +24,8 @@ class ViewModelConfigPlayPlaylist @Inject constructor(
private inner class InputField constructor(@StringRes labelResId: Int, @DrawableRes iconResId: Int, valueGetter: InputPlayPlaylist.() -> String?, valueSetter: InputPlayPlaylist.(String?) -> Unit) : InputFieldBase<String>(labelResId, iconRes... | modules/features/taskerplugin/src/main/java/au/com/shiftyjelly/pocketcasts/taskerplugin/playplaylist/config/ViewModelConfigPlayPlaylist.kt | 26 | Kotlin | 1 | suggestion | 257 | 35 | 35 | false | Update Tasker to use playlists | 4,546 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
package au.com.shiftyjelly.pocketcasts.taskerplugin.queryfilterepisodes
import android.content.Context
import au.com.shiftyjelly.pocketcasts.taskerplugin.base.OutputQueryEpisodes
import au.com.shiftyjelly.pocketcasts.taskerplugin.base.hilt.episodeManager
import au.com.shiftyjelly.pocketcasts.taskerplugin.base.hilt.pla... | The logic has changed from checking `nullIfEmpty` first then trimming, to trimming first then checking `nullIfEmpty`. This could affect behavior when input contains only whitespace characters.
```suggestion
val titleOrId = input.regular.titleOrId.nullIfEmpty?.trim() ?: return TaskerPluginResultSucess()
``` | package au.com.shiftyjelly.pocketcasts.taskerplugin.queryfilterepisodes
import android.content.Context
import au.com.shiftyjelly.pocketcasts.models.to.PlaylistEpisode
import au.com.shiftyjelly.pocketcasts.taskerplugin.base.OutputQueryEpisodes
import au.com.shiftyjelly.pocketcasts.taskerplugin.base.findPlaylist
import ... | @@ -1,25 +1,33 @@
package au.com.shiftyjelly.pocketcasts.taskerplugin.queryfilterepisodes
import android.content.Context
+import au.com.shiftyjelly.pocketcasts.models.to.PlaylistEpisode
import au.com.shiftyjelly.pocketcasts.taskerplugin.base.OutputQueryEpisodes
-import au.com.shiftyjelly.pocketcasts.taskerplugin.b... | modules/features/taskerplugin/src/main/java/au/com/shiftyjelly/pocketcasts/taskerplugin/queryfilterepisodes/ActionRunnerQueryFilterEpisodes.kt | 20 | Kotlin | 1 | suggestion | 315 | 26 | 34 | false | Update Tasker to use playlists | 4,546 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
}
} else {
_state.value = State.Failed.GoogleLoginUnavailable
}
}
private suspend fun signInWithGoogleToken(
idToken: String,
) {
val loginResult = syncManager.loginWithGoogle(idToken, SignInSource.UserInitiated.Watch)
when (loginResult) {
... | The password login failure is only logged but doesn't update the UI state, unlike the Google login which sets `_state.value = State.Failed.Other` on failure. Consider updating the state to provide user feedback on password login failures. | }
} else {
_state.value = State.Failed.GoogleLoginUnavailable
}
}
private suspend fun signInWithGoogleToken(
idToken: String,
) {
val loginResult = syncManager.loginWithGoogle(idToken, SignInSource.UserInitiated.Watch)
when (loginResult) {
... | @@ -111,13 +127,27 @@ class LoginWithGoogleViewModel @Inject constructor(
) {
val loginResult = syncManager.loginWithGoogle(idToken, SignInSource.UserInitiated.Watch)
when (loginResult) {
+ is LoginResult.Success -> {
+ podcastManager.refreshPodcastsAfterSignIn()
+ ... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/authentication/LoginWithGoogleViewModel.kt | 26 | Kotlin | 0.643 | bug | 238 | 36 | 38 | false | Enable stored passwords on WearOS to sign in with | 4,548 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
private suspend fun signInWithGoogleToken(
idToken: String,
) {
val loginResult = syncManager.loginWithGoogle(idToken, SignInSource.UserInitiated.Watch)
when (loginResult) {
is LoginResult.Success -> {
podcastManager.refreshPodcastsAfterSignIn()
}
... | The password login failure is only logged but doesn't update the UI state, unlike the Google login which sets `_state.value = State.Failed.Other` on failure. Consider updating the state to provide user feedback on password login failures.
```suggestion
LogBuffer.i(LogBuffer.TAG_BACKGROUND_TASKS, "Failed... | private suspend fun signInWithGoogleToken(
idToken: String,
) {
val loginResult = syncManager.loginWithGoogle(idToken, SignInSource.UserInitiated.Watch)
when (loginResult) {
is LoginResult.Success -> {
podcastManager.refreshPodcastsAfterSignIn()
}
... | @@ -111,13 +127,27 @@ class LoginWithGoogleViewModel @Inject constructor(
) {
val loginResult = syncManager.loginWithGoogle(idToken, SignInSource.UserInitiated.Watch)
when (loginResult) {
+ is LoginResult.Success -> {
+ podcastManager.refreshPodcastsAfterSignIn()
+ ... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/authentication/LoginWithGoogleViewModel.kt | 26 | Kotlin | 0.857 | bug | 433 | 30 | 32 | false | Enable stored passwords on WearOS to sign in with | 4,548 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
package au.com.shiftyjelly.pocketcasts.wear.ui.authentication
import android.app.Activity
import android.content.Context
import androidx.credentials.CredentialManager
import androidx.credentials.CustomCredential
import androidx.credentials.GetCredentialRequest
import androidx.credentials.exceptions.NoCredentialExcepti... | The signInWithGoogle function is missing handling for LoginResult.Success case. This creates inconsistent behavior compared to the signInWithPassword function which handles both success and failure cases. | }.onFailure {
LogBuffer.e(LogBuffer.TAG_CRASH, it, "Unable to sign in with Google One Tap")
_state.value = if (it is NoCredentialException) {
State.Failed.GoogleLoginUnavailable
} else {
State.Fai... | @@ -111,13 +127,29 @@ class LoginWithGoogleViewModel @Inject constructor(
) {
val loginResult = syncManager.loginWithGoogle(idToken, SignInSource.UserInitiated.Watch)
when (loginResult) {
+ is LoginResult.Success -> {
+ podcastManager.refreshPodcastsAfterSignIn()
+ ... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/authentication/LoginWithGoogleViewModel.kt | 26 | Kotlin | 0.571 | bug | 204 | 124 | 46 | false | Enable stored passwords on WearOS to sign in with | 4,548 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
package au.com.shiftyjelly.pocketcasts.models.to
sealed class SearchAutoCompleteItem {
data class Term(val term: String)
data class Podcast(val uuid: String, val title: String, val author: String)
} | The nested data classes should extend the parent sealed class. Add ': SearchAutoCompleteItem()' to both Term and Podcast class declarations.
```suggestion
data class Term(val term: String) : SearchAutoCompleteItem()
data class Podcast(val uuid: String, val title: String, val author: String) : SearchAutoComplete... | package au.com.shiftyjelly.pocketcasts.models.to
sealed class SearchAutoCompleteItem {
data class Term(val term: String) : SearchAutoCompleteItem()
data class Podcast(val uuid: String, val title: String, val author: String) : SearchAutoCompleteItem()
}
| @@ -0,0 +1,6 @@
+package au.com.shiftyjelly.pocketcasts.models.to
+
+sealed class SearchAutoCompleteItem {
+ data class Term(val term: String)
+ data class Podcast(val uuid: String, val title: String, val author: String) | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/to/SearchAutoCompleteItem.kt | 5 | Kotlin | 1 | security | 330 | 6 | 7 | false | [Improved Search] Implement autocomplete | 4,550 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
package au.com.shiftyjelly.pocketcasts.repositories.search
import au.com.shiftyjelly.pocketcasts.models.to.SearchAutoCompleteItem
import au.com.shiftyjelly.pocketcasts.preferences.Settings
import au.com.shiftyjelly.pocketcasts.servers.search.AutoCompleteResult
import au.com.shiftyjelly.pocketcasts.servers.search.Searc... | The explicit cast 'as SearchAutoCompleteItem' is unnecessary since both branches of the when expression already return SearchAutoCompleteItem types. Remove the cast for cleaner code.
```suggestion
}
``` | package au.com.shiftyjelly.pocketcasts.repositories.search
import au.com.shiftyjelly.pocketcasts.models.to.SearchAutoCompleteItem
import au.com.shiftyjelly.pocketcasts.preferences.Settings
import au.com.shiftyjelly.pocketcasts.servers.search.AutoCompleteResult
import au.com.shiftyjelly.pocketcasts.servers.search.Searc... | @@ -0,0 +1,35 @@
+package au.com.shiftyjelly.pocketcasts.repositories.search
+
+import au.com.shiftyjelly.pocketcasts.models.to.SearchAutoCompleteItem
+import au.com.shiftyjelly.pocketcasts.preferences.Settings
+import au.com.shiftyjelly.pocketcasts.servers.search.AutoCompleteResult
+import au.com.shiftyjelly.pocketcas... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/search/SearchAutoCompleteManagerImpl.kt | 21 | Kotlin | 1 | suggestion | 214 | 35 | 28 | false | [Improved Search] Implement autocomplete | 4,550 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
package au.com.shiftyjelly.pocketcasts.repositories.search
import au.com.shiftyjelly.pocketcasts.models.to.SearchAutoCompleteItem
import io.reactivex.Observable
interface SearchAutoCompleteManager {
suspend fun autoCompleteSearch(term: String): List<SearchAutoCompleteItem>
fun autoCompleteSearchRxObservable(t... | ℹ️ I think this should be moved out of this interface since we want to write the new code using coroutines only. The `suspend -> Rx` conversion can be handled at the call site using `rxObservable`, as you’re already doing in the implementation. Adding functions like this bloats the interface unnecessarily. | package au.com.shiftyjelly.pocketcasts.repositories.search
import au.com.shiftyjelly.pocketcasts.models.to.SearchAutoCompleteItem
interface SearchAutoCompleteManager {
suspend fun autoCompleteSearch(term: String): List<SearchAutoCompleteItem>
}
| @@ -0,0 +1,9 @@
+package au.com.shiftyjelly.pocketcasts.repositories.search
+
+import au.com.shiftyjelly.pocketcasts.models.to.SearchAutoCompleteItem
+import io.reactivex.Observable
+
+interface SearchAutoCompleteManager {
+ suspend fun autoCompleteSearch(term: String): List<SearchAutoCompleteItem>
+ fun autoComp... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/search/SearchAutoCompleteManager.kt | 8 | Kotlin | 0.786 | suggestion | 307 | 9 | 8 | false | [Improved Search] Implement autocomplete | 4,550 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
package au.com.shiftyjelly.pocketcasts.servers.search
import retrofit2.http.GET
import retrofit2.http.Query
interface SearchService {
@GET("/autocomplete/search")
suspend fun autoCompleteSearch(
@Query("q") query: String,
@Query("termsLimit") terms: Int,
@Query("podcastsLimit") podcast... | ❓ Could we use the full names for the parameters as well? Instead of `terms`, `termsLimit`? `autoCompleteSearch(terms = 5, podcasts = 6)` doesn't read clearly. | package au.com.shiftyjelly.pocketcasts.servers.search
import retrofit2.http.GET
import retrofit2.http.Query
interface SearchService {
@GET("/autocomplete/search")
suspend fun autoCompleteSearch(
@Query("q") query: String,
@Query("termsLimit") termsLimit: Int,
@Query("podcastsLimit") po... | @@ -0,0 +1,14 @@
+package au.com.shiftyjelly.pocketcasts.servers.search
+
+import retrofit2.http.GET
+import retrofit2.http.Query
+
+interface SearchService {
+ @GET("/autocomplete/search")
+ suspend fun autoCompleteSearch(
+ @Query("q") query: String,
+ @Query("termsLimit") terms: Int,
+ @Qu... | modules/services/servers/src/main/java/au/com/shiftyjelly/pocketcasts/servers/search/SearchService.kt | 11 | Kotlin | 0.714 | suggestion | 159 | 14 | 15 | false | [Improved Search] Implement autocomplete | 4,550 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
package au.com.shiftyjelly.pocketcasts.servers.discover
import au.com.shiftyjelly.pocketcasts.models.to.SearchAutoCompleteItem
data class AutoCompleteSearch(
val searchTerm: String = "",
val error: Throwable? = null,
val results: List<SearchAutoCompleteItem> = emptyList()
) | ❓ Shouldn't this class be also a sealed type? Without a sealed type we run into exhaustiveness issues, which otherwise are guarded by the compiler. | package au.com.shiftyjelly.pocketcasts.servers.discover
import au.com.shiftyjelly.pocketcasts.models.to.SearchAutoCompleteItem
import java.io.Serializable
sealed interface AutoCompleteSearch : Serializable {
val searchTerm: String
data class Error(
override val searchTerm: String,
val error: ... | @@ -0,0 +1,9 @@
+package au.com.shiftyjelly.pocketcasts.servers.discover
+
+import au.com.shiftyjelly.pocketcasts.models.to.SearchAutoCompleteItem
+
+data class AutoCompleteSearch(
+ val searchTerm: String = "",
+ val error: Throwable? = null,
+ val results: List<SearchAutoCompleteItem> = emptyList()
+) | modules/services/servers/src/main/java/au/com/shiftyjelly/pocketcasts/servers/discover/AutoCompleteSearch.kt | 9 | Kotlin | 0.571 | suggestion | 147 | 9 | 19 | false | [Improved Search] Implement autocomplete | 4,550 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
return Retrofit.Builder()
.addConverterFactory(ProtoConverterFactory.create())
.addConverterFactory(MoshiConverterFactory.create(moshi))
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.baseUrl(baseUrl)
.client(okHttp... | 💡 I would consider putting it as a property of a companion object for `AutoCompleteResult`. This way it will be more visible if any changes are needed due to new search result types, etc.
Alternatively we could consider adding `moshi-sealed` to automate adapter generation - https://github.com/ZacSweers/MoshiX/tree/... | .addConverterFactory(ProtoConverterFactory.create())
.addConverterFactory(MoshiConverterFactory.create(moshi))
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.baseUrl(baseUrl)
.client(okHttpClient)
.build()
... | @@ -78,6 +81,11 @@ class ServersModule {
.add(AccessToken::class.java, AccessToken.Adapter)
.add(RefreshToken::class.java, RefreshToken.Adapter)
.add(BlazeAdLocation::class.java, BlazeAdLocationMoshiAdapter())
+ .add(
+ PolymorphicJsonAdapterFactory.of(Au... | modules/services/servers/src/main/java/au/com/shiftyjelly/pocketcasts/servers/di/ServersModule.kt | 26 | Kotlin | 0.786 | suggestion | 420 | 51 | 51 | false | [Improved Search] Implement autocomplete | 4,550 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
.map { podcast ->
podcast.isSubscribed = true
FolderItem.Podcast(podcast)
}
.toList()
podcastSearch
.zipWith(folderSearch) { podcasts, folders ->
(podc... | ℹ️ I think this can be expressed as `.debounce(200L, TimeUnit.MILLISECONDS)`. The overload that uses `Observable` is useful when there is a need for different debounce values based on the input. Something like:
```kotlin
debounce { query ->
if (query.isEmpty()) {
Observable.just(1L)
} else {
... | .map { podcast ->
podcast.isSubscribed = true
FolderItem.Podcast(podcast)
}
.toList()
podcastSearch
.zipWith(folderSearch) { podcasts, folders ->
(podc... | @@ -101,6 +106,34 @@ class SearchHandler @Inject constructor(
.toObservable()
.map { podcasts -> podcasts.map(Podcast::uuid).toHashSet() }
+ private val autoCompleteResults = searchQuery
+ .subscribeOn(Schedulers.io())
+ .map { it.string.trim() }
+ .debounce {
+ Ob... | modules/features/search/src/main/java/au/com/shiftyjelly/pocketcasts/search/SearchHandler.kt | 26 | Kotlin | 0.857 | suggestion | 385 | 51 | 51 | false | [Improved Search] Implement autocomplete | 4,550 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
}
.toList()
podcastSearch
.zipWith(folderSearch) { podcasts, folders ->
(podcasts + folders).sortedBy { PodcastsSortType.cleanStringForSort(it.title) }
}
.toObservable()
... | The autocomplete should be instantaneous according to the PR description, but this code applies a 200ms debounce which contradicts that requirement. Remove the debounce to make autocomplete truly instantaneous.
```suggestion
``` | .flatMapObservable { Observable.fromIterable(it) }
.filter { it.title.contains(query, ignoreCase = true) || it.author.contains(query, ignoreCase = true) }
.map { podcast ->
podcast.isSubscribed = true
FolderItem.... | @@ -101,6 +106,32 @@ class SearchHandler @Inject constructor(
.toObservable()
.map { podcasts -> podcasts.map(Podcast::uuid).toHashSet() }
+ private val autoCompleteResults = searchQuery
+ .subscribeOn(Schedulers.io())
+ .map { it.string.trim() }
+ .debounce(200L, TimeUnit.MI... | modules/features/search/src/main/java/au/com/shiftyjelly/pocketcasts/search/SearchHandler.kt | 26 | Kotlin | 0.857 | suggestion | 229 | 51 | 51 | false | [Improved Search] Implement autocomplete | 4,550 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
import io.reactivex.rxkotlin.Observables
import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit
import javax.inject.Inject
import kotlin.math.roundToInt
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.rx2.asObservable
data class EpisodeRowData(
val downloadProgress: Int,
... | Using rxMaybe with a suspending function call without proper coroutine context could cause issues. Consider using rxSingle or ensuring the coroutine context is properly handled. | import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit
import javax.inject.Inject
import kotlin.math.roundToInt
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.rx2.asObservable
import kotlinx.coroutines.rx2.rxMaybe
data class EpisodeRowData(
val downloadProgress: Int,
v... | @@ -38,69 +38,67 @@ class EpisodeRowDataProvider @Inject constructor(
private val settings: Settings,
) {
fun episodeRowDataObservable(episodeUuid: String): Observable<EpisodeRowData> {
- return episodeManager.findEpisodeByUuidRxFlowable(episodeUuid)
+ return rxMaybe { episodeManager.findEpisod... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/podcast/EpisodeRowData.kt | 26 | Kotlin | 0.571 | suggestion | 177 | 51 | 51 | false | Fix download status updates | 4,552 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
open suspend fun deleteAllPlaylistsIn(uuids: Collection<String>) {
uuids.chunked(AppDatabase.SQLITE_BIND_ARG_LIMIT).forEach { chunk ->
deleteAllPlaylistsInUnsafe(chunk)
}
}
@Query("DELETE FROM manual_playlist_episodes WHERE playlist_uuid IS :playlistUuid")
abstract suspend f... | [nitpick] Using `IS NOT 0` for boolean comparison is non-standard. Consider using `= 1` or `!= 0` for better readability and consistency with typical SQL boolean expressions.
```suggestion
WHEN playlist.showArchivedEpisodes != 0 OR podcastEpisode.archived IS 0
``` | open suspend fun deleteAllPlaylistsIn(uuids: Collection<String>) {
uuids.chunked(AppDatabase.SQLITE_BIND_ARG_LIMIT).forEach { chunk ->
deleteAllPlaylistsInUnsafe(chunk)
}
}
@Query("DELETE FROM manual_playlist_episodes WHERE playlist_uuid IS :playlistUuid")
abstract suspend f... | @@ -207,7 +207,13 @@ abstract class PlaylistDao {
SELECT
COUNT(*) AS episode_count,
SUM(IFNULL(podcastEpisode.archived, 0)) AS archived_episode_count,
- SUM(MAX(0, IFNULL(podcastEpisode.duration, 0) - IFNULL(podcastEpisode.played_up_to, 0))) AS time_left
+ SUM(
+ ... | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/PlaylistDao.kt | 26 | Kotlin | 1 | suggestion | 278 | 51 | 51 | false | Improve playlist's time left calculation | 4,559 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
text = stringResource(LR.string.winback_offer_help_description),
color = MaterialTheme.theme.colors.primaryText02,
)
}
}
}
}
@Composable
private fun ContinueToCancellation(
onClick: () -> Unit,
modifier: Modifier = Modifier,
) {
... | The TextH30 component is missing the `textAlign = TextAlign.Center` and `modifier = Modifier.fillMaxWidth()` properties that ensure proper text alignment within the button.
```suggestion
color = MaterialTheme.theme.colors.primaryIcon01,
modifier = Modifier.fillMaxWidth(),
textAlign =... | TextH60(
text = stringResource(LR.string.winback_offer_help_description),
color = MaterialTheme.theme.colors.primaryText02,
)
}
}
}
}
@Composable
private fun ContinueToCancellation(
onClick: () -> Unit,
modifier: Mo... | @@ -169,15 +170,18 @@ private fun ContinueToCancellation(
onClick: () -> Unit,
modifier: Modifier = Modifier,
) {
- Box(
+ OutlinedButton(
modifier = modifier
- .clickable(onClick = onClick)
- .semantics(mergeDescendants = true) { role = Role.Button },
+ .fillM... | modules/features/profile/src/main/java/au/com/shiftyjelly/pocketcasts/profile/winback/CancelOfferPage.kt | 26 | Kotlin | 0.786 | suggestion | 342 | 51 | 51 | false | Update Winback UI | 4,561 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
package au.com.shiftyjelly.pocketcasts.models.db.dao
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import androidx.room.Update
import au.com.shiftyjelly.pocketcasts.models.db.AppDataba... | The `kotlin.jvm.Throws` import is added but not used in this diff. Consider removing this unused import unless it's used elsewhere in the file.
```suggestion
``` | package au.com.shiftyjelly.pocketcasts.models.db.dao
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import androidx.room.Update
import au.com.shiftyjelly.pocketcasts.models.db.AppDataba... | @@ -14,6 +17,7 @@ import io.reactivex.Completable
import io.reactivex.Flowable
import io.reactivex.Maybe
import java.util.Date
+import kotlin.jvm.Throws | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/UserEpisodeDao.kt | 20 | Kotlin | 0.786 | suggestion | 162 | 45 | 45 | false | Fix user episodes query args binding | 4,562 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
package au.com.shiftyjelly.pocketcasts.utils.coroutines
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.async
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
class SyncedAction<InputT, OutputT>(... | ⛏️ personal opinion:`InputT` and `OutputT` sounds a bit wacky to me, I'd rather name them `XType` or just use `In` and `Out` | package au.com.shiftyjelly.pocketcasts.utils.coroutines
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.async
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
class SyncedAction<InputType, Output... | @@ -0,0 +1,38 @@
+package au.com.shiftyjelly.pocketcasts.utils.coroutines
+
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.CoroutineStart
+import kotlinx.coroutines.Deferred
+import kotlinx.coroutines.async
+import kotlinx.coroutines.sync.Mutex
+import kotlinx.coroutines.sync.withLock
+
+class Syn... | modules/services/utils/src/main/java/au/com/shiftyjelly/pocketcasts/utils/coroutines/SyncedAction.kt | 10 | Kotlin | 0.714 | suggestion | 124 | 35 | 35 | false | Minimize fetch subscription status call count | 4,568 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest
import org.junit.Assert.assertEquals
import org.junit.Test
@OptIn(ExperimentalCoroutinesApi::class)
class SyncedActionTest {
@Test
fun `return the result`() = runTest {
val action = SyncedAction<Unit, Int> { 100 }
... | The assertion parameters are in the wrong order. According to JUnit convention, the expected value should come first. This should be `assertEquals(1, counter)`.
```suggestion
assertEquals(1, counter)
``` | import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest
import org.junit.Assert.assertEquals
import org.junit.Test
@OptIn(ExperimentalCoroutinesApi::class)
class SyncedActionTest {
@Test
fun `return the result`() = runTest {
val action = SyncedAction<Unit, Int> { 100 }
... | @@ -0,0 +1,45 @@
+package au.com.shiftyjelly.pocketcasts.utils.coroutines
+
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.async
+import kotlinx.coroutines.awaitAll
+import kotlinx.coroutines.test.advanceUntilIdle
+import kotlinx.coroutines.test.runTest
+import org.junit.Assert.assertEq... | modules/services/utils/src/test/java/au/com/shiftyjelly/pocketcasts/utils/coroutines/SyncedActionTest.kt | 26 | Kotlin | 0.857 | bug | 211 | 41 | 41 | false | Minimize fetch subscription status call count | 4,568 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
return buildList {
add(publicUserAgentInterceptor.toClientInterceptor())
add(i18nInterceptor.toClientInterceptor())
add(cacheControlTranscriptsInterceptor.toClientInterceptor())
add(crashLoggingInterceptor.toClientInterceptor())
if (BuildConfig.DEBUG)... | I noticed that the headers are being sent to third parties when an episode is played. For privacy reasons, we should limit these requests to our own servers only. | ): List<OkHttpInterceptor> {
return buildList {
add(publicUserAgentInterceptor.toClientInterceptor())
add(i18nInterceptor.toClientInterceptor())
add(cacheControlTranscriptsInterceptor.toClientInterceptor())
add(crashLoggingInterceptor.toClientInterceptor())
... | @@ -215,9 +248,12 @@ object InterceptorModule {
@Provides
@Player
- fun providePlayerInterceptors(): List<OkHttpInterceptor> {
+ fun providePlayerInterceptors(
+ @I18nInterceptor i18nInterceptor: Interceptor,
+ ): List<OkHttpInterceptor> {
return buildList {
add(publicU... | modules/services/servers/src/main/java/au/com/shiftyjelly/pocketcasts/servers/di/InterceptorModule.kt | 26 | Kotlin | 0.429 | suggestion | 162 | 51 | 51 | false | Add i18n headers | 4,580 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | MiSikora |
private fun createUiState(
shelfItems: List<ShelfItem>,
shelfUpNext: UpNextQueue.State,
isTranscriptAvailable: Boolean,
): UiState {
val episode = (shelfUpNext as? UpNextQueue.State.Loaded)?.episode
return uiState.value.copy(
shelfItems = shelfItems.filter { i... | The collect operation will continue indefinitely unless cancelled. Consider using `first()` or `take(1)` since you only need the initial chapter state to determine visibility. |
private fun createUiState(
shelfItems: List<ShelfItem>,
shelfUpNext: UpNextQueue.State,
isTranscriptAvailable: Boolean,
): UiState {
val episode = (shelfUpNext as? UpNextQueue.State.Loaded)?.episode
return uiState.value.copy(
shelfItems = shelfItems.filter { ... | @@ -116,10 +118,12 @@ class ShelfSharedViewModel @Inject constructor(
}
}
- fun onSleepClick(source: ShelfItemSource) {
+ fun onSleepClick(source: ShelfItemSource, episode: PodcastEpisode) {
trackShelfAction(ShelfItem.Sleep, source)
viewModelScope.launch {
- _navigatio... | modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/viewmodel/ShelfSharedViewModel.kt | 26 | Kotlin | 0.571 | suggestion | 175 | 51 | 51 | false | fix(sleep): bring terminology in line with iOS app | 4,584 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
viewModel.sleepTimeLeftText.observe(viewLifecycleOwner) { sleepTime ->
binding?.sleepTime?.text = sleepTime
}
viewModel.sleepCustomTimeText.observe(viewLifecycleOwner) { customTimeText ->
binding?.labelCustom?.text = customTimeText
}
viewModel.sleepEndO... | Line 201 is overridden by line 207 which sets the same view's visibility based on additional conditions. Consider consolidating these visibility rules to avoid confusion.
```suggestion
``` |
viewModel.sleepTimeLeftText.observe(viewLifecycleOwner) { sleepTime ->
binding?.sleepTime?.text = sleepTime
}
viewModel.sleepCustomTimeText.observe(viewLifecycleOwner) { customTimeText ->
binding?.labelCustom?.text = customTimeText
}
viewModel.sleepEndO... | @@ -187,11 +197,14 @@ class SleepFragment : BaseDialogFragment() {
viewModel.isSleepRunning.observe(viewLifecycleOwner) { isSleepRunning ->
binding?.sleepSetup?.isVisible = !isSleepRunning
binding?.sleepRunning?.isVisible = isSleepRunning
+ binding?.sleepSetupChapter?.isVis... | modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/SleepFragment.kt | 26 | Kotlin | 0.786 | suggestion | 189 | 51 | 51 | false | fix(sleep): bring terminology in line with iOS app | 4,584 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
import com.google.android.material.bottomsheet.BottomSheetDialog
import dagger.hilt.android.AndroidEntryPoint
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.rxkotlin.subscribeBy
import io.reactivex.schedulers.Schedul... | 💡 We could replace this with the [recently added](https://github.com/Automattic/pocket-casts-android/pull/4569) extensions. | import com.google.android.material.bottomsheet.BottomSheetDialog
import dagger.hilt.android.AndroidEntryPoint
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.rxkotlin.subscribeBy
import io.reactivex.schedulers.Schedul... | @@ -52,6 +55,8 @@ class SleepFragment : BaseDialogFragment() {
private var binding: FragmentSleepBinding? = null
private var disposable: Disposable? = null
+ private val args get() = requireNotNull(arguments?.let { BundleCompat.getParcelable(it, NEW_INSTANCE_ARG, Args::class.java) }) | modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/SleepFragment.kt | 26 | Kotlin | 0.571 | suggestion | 123 | 51 | 51 | false | fix(sleep): bring terminology in line with iOS app | 4,584 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
iconId = IR.drawable.ic_download_failed_row,
iconTint = primaryIcon02Tint,
)
} else if (episode.episodeStatus == EpisodeStatusEnum.WAITING_FOR_POWER) {
bindStatus(
text = context.getString(LR.string.episode_row_waiting_for_power),
... | [nitpick] This formatting change from '. ' to ' · ' appears unrelated to the main fix for row data observation. Consider separating UI formatting changes into a separate commit or PR to maintain clear change intent.
```suggestion
text = "$archivedString. ${timeLeft.text}",
``` | iconId = IR.drawable.ic_download_failed_row,
iconTint = primaryIcon02Tint,
)
} else if (episode.episodeStatus == EpisodeStatusEnum.WAITING_FOR_POWER) {
bindStatus(
text = context.getString(LR.string.episode_row_waiting_for_power),
... | @@ -236,7 +241,7 @@ abstract class BaseEpisodeViewHolder<T : Any>(
val archivedString = context.getString(LR.string.archived)
val timeLeft = TimeHelper.getTimeLeft(episode.playedUpToMs, episode.durationMs.toLong(), episode.isInProgress, context)
bindStatus(
- text =... | modules/features/podcasts/src/main/java/au/com/shiftyjelly/pocketcasts/podcasts/view/podcast/BaseEpisodeViewHolder.kt | 26 | Kotlin | 0.857 | suggestion | 293 | 51 | 51 | false | Bind observing row data after disposing it | 4,585 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
package au.com.shiftyjelly.pocketcasts.models.type
import au.com.shiftyjelly.pocketcasts.models.entity.PodcastEpisode
import java.sql.Date
import org.junit.Assert.assertEquals
import org.junit.Test
class UpNextSortTypeTest {
@Test
fun `sort newest to oldest`() {
val episodes = listOf(
Podc... | Using `java.sql.Date` instead of `java.util.Date` is unusual for test data. Consider using `java.util.Date` or `java.time.Instant` for better compatibility and modern practices.
```suggestion
import java.util.Date
``` | package au.com.shiftyjelly.pocketcasts.models.type
import au.com.shiftyjelly.pocketcasts.models.entity.PodcastEpisode
import java.util.Date
import org.junit.Assert.assertEquals
import org.junit.Test
class UpNextSortTypeTest {
@Test
fun `sort newest to oldest`() {
val episodes = listOf(
Pod... | @@ -0,0 +1,112 @@
+package au.com.shiftyjelly.pocketcasts.models.type
+
+import au.com.shiftyjelly.pocketcasts.models.entity.PodcastEpisode
+import java.sql.Date | modules/services/model/src/test/java/au/com/shiftyjelly/pocketcasts/models/type/UpNextSortTypeTest.kt | 4 | Kotlin | 0.857 | suggestion | 217 | 29 | 29 | false | Add Up Next Sorting | 4,586 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
package au.com.shiftyjelly.pocketcasts.models.db.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import au.com.shiftyjelly.pocketcasts.models.entity.BaseEpisode
import au.com.shiftyjelly.pocketcasts.models.enti... | The Transaction import is added but not used in the visible diff. If this import is not used elsewhere in the file, it should be removed to avoid unnecessary imports.
```suggestion
``` | package au.com.shiftyjelly.pocketcasts.models.db.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import au.com.shiftyjelly.pocketcasts.models.entity.BaseEpisode
import au.com.shiftyjelly.pocketcasts.models.entity.UpNextChange
@Dao
abstract cl... | @@ -4,6 +4,7 @@ import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
+import androidx.room.Transaction | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/UpNextChangeDao.kt | 7 | Kotlin | 0.786 | suggestion | 185 | 32 | 32 | false | Add Up Next Sorting | 4,586 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
import au.com.shiftyjelly.pocketcasts.repositories.download.DownloadManager
import au.com.shiftyjelly.pocketcasts.repositories.podcast.EpisodeManager
import au.com.shiftyjelly.pocketcasts.repositories.sync.SyncManager
import au.com.shiftyjelly.pocketcasts.repositories.sync.UpNextSyncWorker
import au.com.shiftyjelly.poc... | Adding @Singleton annotation changes the lifecycle of this class. Ensure this change is intentional and doesn't conflict with existing dependency injection configuration, as UpNextQueueImpl may have been designed to have a different scope.
```suggestion
``` | import au.com.shiftyjelly.pocketcasts.repositories.download.DownloadManager
import au.com.shiftyjelly.pocketcasts.repositories.podcast.EpisodeManager
import au.com.shiftyjelly.pocketcasts.repositories.sync.SyncManager
import au.com.shiftyjelly.pocketcasts.repositories.sync.UpNextSyncWorker
import au.com.shiftyjelly.poc... | @@ -27,13 +28,16 @@ import io.reactivex.schedulers.Schedulers
import java.util.Collections
import java.util.concurrent.TimeUnit
import javax.inject.Inject
+import javax.inject.Singleton
import kotlin.coroutines.CoroutineContext
import kotlin.random.Random
import kotlinx.coroutines.CoroutineScope
import kotlinx.c... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/UpNextQueueImpl.kt | 26 | Kotlin | 1 | security | 258 | 51 | 51 | false | Add Up Next Sorting | 4,586 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
package au.com.shiftyjelly.pocketcasts.repositories.sync.data
import androidx.room.withTransaction
import au.com.shiftyjelly.pocketcasts.models.db.AppDatabase
import au.com.shiftyjelly.pocketcasts.models.entity.ManualPlaylistEpisode
import au.com.shiftyjelly.pocketcasts.models.entity.PlaylistEntity
import au.com.shift... | The import `com.google.protobuf.value` is unused and should be removed. The code uses `boolValue` which is already imported.
```suggestion
``` | package au.com.shiftyjelly.pocketcasts.repositories.sync.data
import androidx.room.withTransaction
import au.com.shiftyjelly.pocketcasts.models.db.AppDatabase
import au.com.shiftyjelly.pocketcasts.models.entity.ManualPlaylistEpisode
import au.com.shiftyjelly.pocketcasts.models.entity.PlaylistEntity
import au.com.shift... | @@ -14,6 +14,7 @@ import com.google.protobuf.boolValue
import com.google.protobuf.int32Value
import com.google.protobuf.int64Value
import com.google.protobuf.stringValue
+import com.google.protobuf.value | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/sync/data/PlaylistSync.kt | 17 | Kotlin | 0.786 | suggestion | 143 | 42 | 42 | false | Sync playlist show archived setting | 4,589 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
private val searchHistoryManager: SearchHistoryManager,
private val podcastManager: PodcastManager,
private val analyticsTracker: AnalyticsTracker,
private val episodeManager: EpisodeManager,
) : ViewModel() {
var isFragmentChangingConfigurations: Boolean = false
var showSearchHistory: Boolean =... | If you put the phone in aeroplane mode, this is fired with every character press. I'm not sure if that is correct or not, but it seems like a lot of events. | private val searchHistoryManager: SearchHistoryManager,
private val podcastManager: PodcastManager,
private val analyticsTracker: AnalyticsTracker,
private val episodeManager: EpisodeManager,
) : ViewModel() {
var isFragmentChangingConfigurations: Boolean = false
var showSearchHistory: Boolean =... | @@ -53,6 +53,18 @@ class SearchViewModel @Inject constructor(
.collect { operation ->
_state.update {
if (it is SearchUiState.Idle || it is SearchUiState.Suggestions) {
+ when (operation) {
+ ... | modules/features/search/src/main/java/au/com/shiftyjelly/pocketcasts/search/SearchViewModel.kt | 26 | Kotlin | 0.357 | suggestion | 157 | 51 | 51 | false | [Improved Search] Analytics | 4,593 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | sztomek |
package au.com.shiftyjelly.pocketcasts.models.type
import au.com.shiftyjelly.pocketcasts.localization.R
import au.com.shiftyjelly.pocketcasts.models.entity.Podcast
import au.com.shiftyjelly.pocketcasts.models.to.FolderItem
import au.com.shiftyjelly.pocketcasts.models.type.PodcastsSortType.entries
import au.com.shiftyj... | There is no need to ignore the case for this regex as the title is always lowercased first. | package au.com.shiftyjelly.pocketcasts.models.type
import au.com.shiftyjelly.pocketcasts.localization.R
import au.com.shiftyjelly.pocketcasts.models.entity.Podcast
import au.com.shiftyjelly.pocketcasts.models.to.FolderItem
import au.com.shiftyjelly.pocketcasts.utils.extensions.removeAccents
import au.com.shiftyjelly.p... | @@ -12,9 +12,9 @@ import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import java.util.Locale
-private val replaceTheRegex = "^the ".toRegex(RegexOption.IGNORE_CASE)
+private val replaceTheRegex = "^the ".toRegex() | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/type/PodcastsSortType.kt | 15 | Kotlin | 0.214 | suggestion | 91 | 40 | 40 | false | Fix podcast title sort with accents | 4,594 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | geekygecko |
abstract class LockableListAdapter<T, VH : RecyclerView.ViewHolder>(
callback: DiffUtil.ItemCallback<T>,
) : ListAdapter<T, VH>(callback) {
internal var isLocked: Boolean = false
internal fun forceSubmitList(list: List<T>?) {
super.submitList(list)
}
override fun submitList(list: List<T>?... | Corrected spelling of 'onStarDragging' to 'onStartDragging'.
```suggestion
fun onStartDragging()
``` |
abstract class LockableListAdapter<T, VH : RecyclerView.ViewHolder>(
callback: DiffUtil.ItemCallback<T>,
) : ListAdapter<T, VH>(callback) {
internal var isLocked: Boolean = false
internal fun forceSubmitList(list: List<T>?) {
super.submitList(list)
}
override fun submitList(list: List<T>?... | @@ -0,0 +1,124 @@
+package au.com.shiftyjelly.pocketcasts.views.adapter
+
+import android.view.HapticFeedbackConstants
+import androidx.recyclerview.widget.DiffUtil
+import androidx.recyclerview.widget.ItemTouchHelper
+import androidx.recyclerview.widget.ListAdapter
+import androidx.recyclerview.widget.RecyclerView
+im... | modules/services/views/src/main/java/au/com/shiftyjelly/pocketcasts/views/adapter/LockableListAdapter.kt | 26 | Kotlin | 0.714 | suggestion | 108 | 51 | 51 | false | Fix podcasts page drag & drop issues | 4,596 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
class LockingDragAndDropCallback<T>(
private val scope: CoroutineScope,
private val adapter: LockableListAdapter<T, *>,
private val commitItems: suspend (List<T>) -> Unit,
) : ItemTouchHelper.Callback() {
private var lastDraggedPosition = RecyclerView.NO_POSITION
private var lastTargetPosition = Rec... | Corrected spelling of 'onStarDragging' to 'onStartDragging'. | class LockingDragAndDropCallback<T>(
private val scope: CoroutineScope,
private val adapter: LockableListAdapter<T, *>,
private val commitItems: suspend (List<T>) -> Unit,
) : ItemTouchHelper.Callback() {
private var lastDraggedPosition = RecyclerView.NO_POSITION
private var lastTargetPosition = Rec... | @@ -0,0 +1,124 @@
+package au.com.shiftyjelly.pocketcasts.views.adapter
+
+import android.view.HapticFeedbackConstants
+import androidx.recyclerview.widget.DiffUtil
+import androidx.recyclerview.widget.ItemTouchHelper
+import androidx.recyclerview.widget.ListAdapter
+import androidx.recyclerview.widget.RecyclerView
+im... | modules/services/views/src/main/java/au/com/shiftyjelly/pocketcasts/views/adapter/LockableListAdapter.kt | 26 | Kotlin | 0.214 | nitpick | 60 | 51 | 51 | false | Fix podcasts page drag & drop issues | 4,596 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
podcastUuids = podcastUuids,
badgeCount = badgeCount,
badgeType = badgeType,
podcastGridLayout = podcastGridLayout,
onClick = { onFolderClick(folder) },
... | Corrected spelling of 'onStarDragging' to 'onStartDragging'.
```suggestion
override fun onStartDragging() = Unit
``` | podcastUuids = podcastUuids,
badgeCount = badgeCount,
badgeType = badgeType,
podcastGridLayout = podcastGridLayout,
onClick = { onFolderClick(folder) },
... | @@ -85,9 +85,9 @@ class FolderViewHolder(
}
}
- override fun onItemDrag() = Unit
+ override fun onStarDragging() = Unit | modules/features/podcasts/src/main/java/au/com/shiftyjelly/pocketcasts/podcasts/view/podcasts/FolderViewHolder.kt | 26 | Kotlin | 0.714 | suggestion | 120 | 51 | 51 | false | Fix podcasts page drag & drop issues | 4,596 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
private fun ComposeView.setBadgeContent(
count: Int,
badgeType: BadgeType,
) {
setContentWithViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow) {
AppTheme(theme.activeTheme) {
CountBadge(
... | Corrected spelling of 'onStarDragging' to 'onStartDragging'.
```suggestion
override fun onStartDragging() = Unit
``` | private fun ComposeView.setBadgeContent(
count: Int,
badgeType: BadgeType,
) {
setContentWithViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow) {
AppTheme(theme.activeTheme) {
CountBadge(
... | @@ -239,22 +235,9 @@ class FolderAdapter(
}
}
- override fun onItemDrag() {
- AnimatorSet().apply {
- val elevation = ObjectAnimator.ofPropertyValuesHolder(itemView, PropertyValuesHolder.ofFloat(View.TRANSLATION_Z, 16.dpToPx(itemView.resources.displayMetrics).toF... | modules/features/podcasts/src/main/java/au/com/shiftyjelly/pocketcasts/podcasts/view/podcasts/FolderAdapter.kt | 26 | Kotlin | 0.714 | suggestion | 124 | 36 | 36 | false | Fix podcasts page drag & drop issues | 4,596 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
package au.com.shiftyjelly.pocketcasts.podcasts.view.podcasts
import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.cardview.widget.CardView
import androidx.compose.foundation.layout.offset
import androidx.co... | I removed this because it doesn't work. We would have to animate `CardView`'s elevation here but this conflicts with the badge UI. | package au.com.shiftyjelly.pocketcasts.podcasts.view.podcasts
import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.cardview.widget.CardView
import androidx.compose.foundation.layout.offset
import androidx.co... | @@ -239,22 +235,9 @@ class FolderAdapter(
}
}
- override fun onItemDrag() {
- AnimatorSet().apply {
- val elevation = ObjectAnimator.ofPropertyValuesHolder(itemView, PropertyValuesHolder.ofFloat(View.TRANSLATION_Z, 16.dpToPx(itemView.resources.displayMetrics).toF... | modules/features/podcasts/src/main/java/au/com/shiftyjelly/pocketcasts/podcasts/view/podcasts/FolderAdapter.kt | 26 | Kotlin | 0.571 | suggestion | 130 | 248 | 248 | false | Fix podcasts page drag & drop issues | 4,596 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | MiSikora |
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material.MaterialT... | This import appears to be unused and unrelated to the changes in this file. It should be removed.
```suggestion
``` | import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material.MaterialTheme
import androidx.compose.ui.Modifier
import android... | @@ -23,6 +29,7 @@ import au.com.shiftyjelly.pocketcasts.preferences.Settings
import au.com.shiftyjelly.pocketcasts.ui.helper.ColorUtils
import au.com.shiftyjelly.pocketcasts.views.fragments.BaseDialogFragment
import dagger.hilt.android.AndroidEntryPoint
+import java.nio.file.WatchEvent | modules/features/podcasts/src/main/java/au/com/shiftyjelly/pocketcasts/podcasts/view/folders/FolderCreateFragment.kt | 26 | Kotlin | 0.786 | suggestion | 116 | 51 | 51 | false | Fix navigation bar padding in folders flow | 4,597 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
import au.com.shiftyjelly.pocketcasts.preferences.Settings
import au.com.shiftyjelly.pocketcasts.images.R as IR
import au.com.shiftyjelly.pocketcasts.localization.R as LR
@Composable
fun FolderEditPodcastsPage(
settings: Settings,
fragmentManager: FragmentManager,
viewModel: FolderEditViewModel,
onClos... | The `onNextClick` parameter was removed from the `PageList` function call but the function signature still expects it. This creates an inconsistency between the function definition and its usage. | import au.com.shiftyjelly.pocketcasts.podcasts.view.components.LargePageTitle
import au.com.shiftyjelly.pocketcasts.preferences.Settings
import au.com.shiftyjelly.pocketcasts.images.R as IR
import au.com.shiftyjelly.pocketcasts.localization.R as LR
@Composable
fun FolderEditPodcastsPage(
settings: Settings,
fr... | @@ -70,7 +71,6 @@ fun FolderEditPodcastsPage(
)
PageList(
state = state,
- onNextClick = onNextClick,
onSortClick = { | modules/features/podcasts/src/main/java/au/com/shiftyjelly/pocketcasts/podcasts/view/folders/FolderEditPodcastsPage.kt | 26 | Kotlin | 0.571 | style | 195 | 51 | 51 | false | Fix navigation bar padding in folders flow | 4,597 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
}
}
}
when (signInState) {
is SignInState.SignedOut -> Unit // Do nothing
is SignInState.SignedIn -> {
val subscription = signInState.subscription
if (subscription == null) {
// This gets the user back to the start destination if they... | The magic number 16 and the truncation lengths (6 characters from start and end) should be extracted as named constants to improve code maintainability and make the truncation logic more configurable. | }
}
}
when (signInState) {
is SignInState.SignedOut -> Unit // Do nothing
is SignInState.SignedIn -> {
val subscription = signInState.subscription
if (subscription == null) {
// This gets the user back to the start destination if they... | @@ -347,7 +347,16 @@ private fun WearApp(
if (popped) {
ScrollToTop.initiate(navController)
}
- val message = stringResource(LR.string.log_in_free_acccount, signInState.email)
+ val email = if (signInState.email.length > 16) {
+ ... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/MainActivity.kt | 26 | Kotlin | 0.5 | refactor | 200 | 51 | 51 | false | Google login tweaks | 4,598 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
composable(
route = EffectsScreen.ROUTE,
) {
EffectsScreen()
}
}
}
when (signInState) {
is SignInState.SignedOut -> Unit // Do nothing
is SignInState.SignedIn -> {
val subscription = signInState.subscripti... | ```suggestion
append("…")
```
We can use ellipsis `…` instead of 3 dots `...`. |
composable(
route = EffectsScreen.ROUTE,
) {
EffectsScreen()
}
}
}
when (signInState) {
is SignInState.SignedOut -> Unit // Do nothing
is SignInState.SignedIn -> {
val subscription = signInState.subscripti... | @@ -347,7 +347,16 @@ private fun WearApp(
if (popped) {
ScrollToTop.initiate(navController)
}
- val message = stringResource(LR.string.log_in_free_acccount, signInState.email)
+ val email = if (signInState.email.length > 16) {
+ ... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/MainActivity.kt | 26 | Kotlin | 0.786 | suggestion | 107 | 51 | 51 | false | Google login tweaks | 4,598 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
}
}
}
when (signInState) {
is SignInState.SignedOut -> Unit // Do nothing
is SignInState.SignedIn -> {
val subscription = signInState.subscription
if (subscription == null) {
// This gets the user back to the start destination if they... | The magic numbers 16, 6, and 6 should be extracted as named constants to improve code readability and maintainability. | }
}
}
when (signInState) {
is SignInState.SignedOut -> Unit // Do nothing
is SignInState.SignedIn -> {
val subscription = signInState.subscription
if (subscription == null) {
// This gets the user back to the start destination if they... | @@ -347,7 +347,16 @@ private fun WearApp(
if (popped) {
ScrollToTop.initiate(navController)
}
- val message = stringResource(LR.string.log_in_free_acccount, signInState.email)
+ val email = if (signInState.email.length > 16) {
+ ... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/MainActivity.kt | 26 | Kotlin | 0.429 | refactor | 118 | 51 | 51 | false | Google login tweaks | 4,598 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
import au.com.shiftyjelly.pocketcasts.compose.adaptive.isAtMostMediumHeight
import au.com.shiftyjelly.pocketcasts.compose.buttons.RowButton
import au.com.shiftyjelly.pocketcasts.compose.components.PagerDotIndicator
import au.com.shiftyjelly.pocketcasts.compose.components.TextH10
import au.com.shiftyjelly.pocketcasts.co... | [nitpick] 64.dp is a magic number; consider extracting it to a named constant or design token (e.g., a dimension resource or theme spacing) to make intent clearer and easier to adjust across the app. | import au.com.shiftyjelly.pocketcasts.compose.components.PagerDotIndicator
import au.com.shiftyjelly.pocketcasts.compose.components.TextH10
import au.com.shiftyjelly.pocketcasts.compose.components.TextP40
import au.com.shiftyjelly.pocketcasts.compose.preview.ThemePreviewParameterProvider
import au.com.shiftyjelly.pocke... | @@ -57,25 +54,20 @@ internal fun OnboardingPage(
HorizontalPager(
state = pagerState,
verticalAlignment = Alignment.Top,
- contentPadding = PaddingValues(
- top = 16.dp + if (windowSizeClass.isAtMostMediumHeight()) 48.dp else 0.dp,
- ),
+ ... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/OnboardingPage.kt | 26 | Kotlin | 0.429 | refactor | 199 | 51 | 51 | false | Align playlist onboarding to the top | 4,614 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
else -> error("Unknown onboarding page: $index")
}
}
Spacer(
modifier = Modifier.height(16.dp),
)
PagerDotIndicator(
state = pagerState,
activeDotColor = MaterialTheme.theme.colors.primaryText01,
)
Spacer(
... | [nitpick] By removing the verticalArrangement parameter, OnboardingContent is now less flexible. Consider reintroducing it with a default value (e.g., verticalArrangement: Arrangement.Vertical = Arrangement.Top) and pass it through to retain configurability while keeping the new default behavior. | activeDotColor = MaterialTheme.theme.colors.primaryText01,
)
Spacer(
modifier = Modifier.height(24.dp),
)
RowButton(
text = stringResource(LR.string.got_it),
includePadding = false,
onClick = onGotItClick,
modifier =... | @@ -107,12 +99,11 @@ private fun OnboardingContent(
@DrawableRes imageId: Int,
title: String,
description: String,
- verticalArrangement: Arrangement.Vertical,
modifier: Modifier = Modifier,
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
- verticalArrangemen... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/OnboardingPage.kt | 26 | Kotlin | 0.5 | suggestion | 297 | 51 | 51 | false | Align playlist onboarding to the top | 4,614 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
appDatabase: AppDatabase,
@DefaultDispatcher computationDispatcher: CoroutineDispatcher,
settings: Settings,
clock: Clock,
) : this(
appDatabase = appDatabase,
computationContext = computationDispatcher,
settings = settings,
clock = clock,
smar... | The return type should be `StateFlow<List<String>?>` instead of `MutableStateFlow<List<String>?>` to prevent external callers from modifying the flow's value. The same issue exists for `getEpisodeCountFlow`. | appDatabase = appDatabase,
computationContext = computationDispatcher,
settings = settings,
clock = clock,
smartEpisodeLimit = SMART_PLAYLIST_EPISODE_LIMIT,
manualEpisodeLimit = MANUAL_PLAYLIST_EPISODE_LIMIT,
)
private val playlistDao = appDatabase.playlistDao()
... | @@ -102,53 +97,33 @@ class PlaylistManagerImpl(
}
}
- private val previewMetadataCache = ConcurrentHashMap<String, CachedMetadata>()
+ private val artworkCache = ConcurrentHashMap<String, MutableStateFlow<List<String>?>>()
+ private val episodeCountCache = ConcurrentHashMap<String, MutableState... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playlist/PlaylistManagerImpl.kt | 26 | Kotlin | 0.786 | suggestion | 207 | 51 | 51 | false | Split artwork and episode count caching | 4,615 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
) : this(
appDatabase = appDatabase,
computationContext = computationDispatcher,
settings = settings,
clock = clock,
smartEpisodeLimit = SMART_PLAYLIST_EPISODE_LIMIT,
manualEpisodeLimit = MANUAL_PLAYLIST_EPISODE_LIMIT,
)
private val playlistDao = appDatabase.... | The return type should be `StateFlow<Int?>` instead of `MutableStateFlow<Int?>` to prevent external callers from modifying the flow's value.
```suggestion
override fun getEpisodeCountFlow(playlistUuid: String): StateFlow<Int?> {
``` | smartEpisodeLimit = SMART_PLAYLIST_EPISODE_LIMIT,
manualEpisodeLimit = MANUAL_PLAYLIST_EPISODE_LIMIT,
)
private val playlistDao = appDatabase.playlistDao()
private val episodeDao = appDatabase.episodeDao()
private val podcastDao = appDatabase.podcastDao()
override fun playlistPrevi... | @@ -102,53 +97,33 @@ class PlaylistManagerImpl(
}
}
- private val previewMetadataCache = ConcurrentHashMap<String, CachedMetadata>()
+ private val artworkCache = ConcurrentHashMap<String, MutableStateFlow<List<String>?>>()
+ private val episodeCountCache = ConcurrentHashMap<String, MutableState... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playlist/PlaylistManagerImpl.kt | 26 | Kotlin | 1 | suggestion | 236 | 51 | 51 | false | Split artwork and episode count caching | 4,615 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
binding.content.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
updateToolbarAlpha()
}
})
binding.content.addOnLayoutChangeListener { _, _, _, _,... | The condition `episodeCount <= 0` should be `episodeCount == 0` since episode counts cannot be negative. Using `<= 0` suggests the possibility of negative values which is misleading.
```suggestion
episodeCount == 0 -> {
``` | binding.content.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
updateToolbarAlpha()
}
})
binding.content.addOnLayoutChangeListener { _, _, _, _,... | @@ -436,19 +436,26 @@ class PlaylistFragment :
if (parentFragmentManager.findFragmentByTag("confirm_and_play") != null) {
return
}
- if (viewModel.shouldShowPlayAllWarning()) {
- val episodeCount = viewModel.uiState.value.playlist?.episodes.orEmpty().size
- va... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/PlaylistFragment.kt | 26 | Kotlin | 0.857 | suggestion | 235 | 51 | 51 | false | Show snackbar when there are no episodes | 4,619 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
AddEpisodesColumn(
uiState = uiState,
useEpisodeArtwork = useEpisodeArtwork,
onAddEpisode = { episode -> onAddEpisode(episode.uuid) },
modifier = Modifier
.fillMaxSize()
.imePa... | The folder name is directly inserted into the URL without encoding. If the name contains special characters like '/', it will break the route structure. Use URL encoding (e.g., `Uri.encode(name)`) when constructing the route and decode it when extracting from arguments. | val podcastUuid = arguments.requireString(AddEpisodesRoutes.PODCAST_UUID_ARG)
val uiState by episodesFlow(podcastUuid).collectAsState()
AddEpisodesColumn(
uiState = uiState,
useEpisodeArtwork = useEpisodeArtwork,
... | @@ -222,13 +228,14 @@ internal object AddEpisodesRoutes {
private const val FOLDER_BASE = "folder"
const val FOLDER_UUID_ARG = "uuid"
- const val FOLDER = "$FOLDER_BASE/{$FOLDER_UUID_ARG}"
+ const val FOLDER_NAME_ARG = "name"
+ const val FOLDER = "$FOLDER_BASE/{$FOLDER_UUID_ARG}/{$FOLDER_NAME_ARG}"... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/manual/AddEpisodesPage.kt | 26 | Kotlin | 0.643 | refactor | 270 | 30 | 33 | false | Display folder title in the playlist flow | 4,626 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
@HiltViewModel
class LoginViewModel @Inject constructor(
private val analyticsTracker: AnalyticsTracker,
private val credentialRequest: GetCredentialRequest,
@ApplicationContext context: Context,
) : ViewModel() {
private val credentialManager: CredentialManager by lazy { CredentialManager.create(contex... | This code launches a nested coroutine within an already-launched coroutine (lines 31 and 35), which is redundant. Remove the inner viewModelScope.launch and execute the prepareGetCredential directly within the outer launch block.
```suggestion
runCatching {
credentialManager.prepareG... | @HiltViewModel
class LoginViewModel @Inject constructor(
private val analyticsTracker: AnalyticsTracker,
private val credentialRequest: GetCredentialRequest,
@ApplicationContext context: Context,
) : ViewModel() {
private val credentialManager: CredentialManager by lazy { CredentialManager.create(contex... | @@ -1,22 +1,47 @@
package au.com.shiftyjelly.pocketcasts.wear.ui.authentication
+import android.content.Context
+import android.os.Build
+import androidx.credentials.CredentialManager
+import androidx.credentials.GetCredentialRequest
import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
imp... | wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/authentication/LoginViewModel.kt | 26 | Kotlin | 1 | security | 469 | 39 | 37 | false | WearOS login improvements | 4,631 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | sztomek |
color = MaterialTheme.theme.colors.primaryText02,
modifier = Modifier.widthIn(max = 280.dp),
)
}
Spacer(
modifier = Modifier.width(16.dp),
)
Switch(
checked = useAllPodcasts,
onCheckedChange = null,
)... | The `LaunchedEffect` is triggered by mapping all podcast UUIDs, which creates a new list on every recomposition. This can cause unnecessary scroll resets when the podcast list hasn't actually changed (e.g., during theme changes or other state updates). Consider using `derivedStateOf` to track only meaningful changes to... | modifier = Modifier.widthIn(max = 280.dp),
)
}
Spacer(
modifier = Modifier.width(16.dp),
)
Switch(
checked = useAllPodcasts,
onCheckedChange = null,
)
}
}
@Composable
private fun PodcastsColumn(
useAllPodcas... | @@ -196,9 +214,16 @@ private fun PodcastsColumn(
bottomPadding: Dp,
modifier: Modifier = Modifier,
) {
+ val listState = rememberLazyListState()
+ LaunchedEffect(podcasts.map { it.uuid }) { | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/smart/PodcastsRulePage.kt | 26 | Kotlin | 1 | suggestion | 464 | 51 | 51 | false | Add search field to podcasts Smart Rule | 4,634 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
container: ViewGroup?,
savedInstanceState: Bundle?,
) = content {
DialogBox(
modifier = Modifier.nestedScroll(rememberNestedScrollInteropConnection()),
) {
val navController = rememberNavController()
val listener = rememberNavigationListener()
... | Using a fallback `rememberTextFieldState()` when `podcastSearchState` is null creates an inconsistent state that won't be connected to the ViewModel. If `podcastSearchState` can be null, the UI should handle this case explicitly rather than creating a disconnected local state. Consider making `podcastSearchState` non-n... | container: ViewGroup?,
savedInstanceState: Bundle?,
) = content {
DialogBox(
modifier = Modifier.nestedScroll(rememberNestedScrollInteropConnection()),
) {
val navController = rememberNavController()
val listener = rememberNavigationListener()
... | @@ -72,6 +74,7 @@ internal class EditRulesFragment : BaseDialogFragment() {
followedPodcasts = uiState.followedPodcasts,
starredEpisodeCount = uiState.starredEpisodeCount,
useEpisodeArtwork = uiState.useEpisodeArtwork,
+ podcastSearchStat... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/smart/EditRulesFragment.kt | 26 | Kotlin | 1 | suggestion | 489 | 51 | 51 | false | Add search field to podcasts Smart Rule | 4,634 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
override fun onIncrementMaxDuration() = viewModel.incrementMaxDuration()
override fun onUseDownloadStatus(downloadStatus: DownloadStatusRule) = viewModel.useDownloadStatus(downloadStatus)
override fun onUseMediaType(mediaType: MediaTypeRule) = viewModel.useMediaType(mediaType)
... | Unsafe call on nullable type. The `podcastSearchState` field is non-nullable in EditRulesViewModel, so this null-safe operator is unnecessary and may hide issues. Change to `viewModel.podcastSearchState.textState.clearText()`.
```suggestion
viewModel.podcastSearchState.textState.clearText()
``` | override fun onIncrementMaxDuration() = viewModel.incrementMaxDuration()
override fun onUseDownloadStatus(downloadStatus: DownloadStatusRule) = viewModel.useDownloadStatus(downloadStatus)
override fun onUseMediaType(mediaType: MediaTypeRule) = viewModel.useMediaType(mediaType)
... | @@ -127,14 +130,15 @@ internal class EditRulesFragment : BaseDialogFragment() {
}
@Composable
- private fun ClearTransientRulesStateEffect(navController: NavController) {
+ private fun ClearTransientStateEffect(navController: NavController) {
var currentRoute by rememberSaveable { mutableStat... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/smart/EditRulesFragment.kt | 26 | Kotlin | 1 | suggestion | 315 | 48 | 48 | false | Add search field to podcasts Smart Rule | 4,634 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.se... | This import appears to be unused. The code uses `TextFieldState` and `SearchFieldState`, but not `SearchState` from the transcripts module.
```suggestion
``` | import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.se... | @@ -42,13 +50,16 @@ import au.com.shiftyjelly.pocketcasts.compose.AppThemeWithBackground
import au.com.shiftyjelly.pocketcasts.compose.PreviewRegularDevice
import au.com.shiftyjelly.pocketcasts.compose.components.FadedLazyColumn
import au.com.shiftyjelly.pocketcasts.compose.components.PodcastImageDeprecated
+import ... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/smart/PodcastsRulePage.kt | 26 | Kotlin | 0.786 | suggestion | 158 | 51 | 51 | false | Add search field to podcasts Smart Rule | 4,634 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
FROM manual_playlist_episodes AS manual_episode
WHERE NOT EXISTS(
SELECT 1
FROM podcast_episodes AS podcast_episode
WHERE podcast_episode.uuid IS manual_episode.episode_uuid
)
""",
)
abstract suspend fun getAllMissingManualEpisodes(): List<ManualPlayli... | The LIKE pattern for "the %" prefix detection is case-sensitive but searches on clean_title which may contain mixed case. This could cause inconsistent sorting when podcast titles start with "The", "THE", or "the". Consider using `LIKE 'the %'` with COLLATE NOCASE or convert to uppercase for consistent prefix detection... | FROM manual_playlist_episodes AS manual_episode
WHERE NOT EXISTS(
SELECT 1
FROM podcast_episodes AS podcast_episode
WHERE podcast_episode.uuid IS manual_episode.episode_uuid
)
""",
)
abstract suspend fun getAllMissingManualEpisodes(): List<ManualPlayli... | @@ -317,8 +317,11 @@ abstract class PlaylistDao {
WHEN :includeInFolders IS NOT 0 THEN 1
ELSE folder.deleted IS NOT 0
END)
- AND podcast.title LIKE '%' || :searchTerm || '%' ESCAPE '\' COLLATE NOCASE
- ORDER BY podcast.title ASC
+ AND podcast.clean_title LI... | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/PlaylistDao.kt | 26 | Kotlin | 0.786 | security | 321 | 51 | 51 | false | Add search field to podcasts Smart Rule | 4,634 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
ELSE folder.deleted IS NOT 0
END)
AND podcast.title LIKE '%' || :searchTerm || '%' ESCAPE '\' COLLATE NOCASE
ORDER BY podcast.title ASC
""",
)
internal abstract suspend fun getAllPodcastPlaylistSources(
includeInFolders: Boolean,
searchTerm: String,
... | The LIKE pattern for "the %" prefix detection is case-sensitive but searches on clean_title which may contain mixed case. This could cause inconsistent sorting when podcast titles start with "The", "THE", or "the". Consider using `LIKE 'the %'` with COLLATE NOCASE or convert to uppercase for consistent prefix detection... | ELSE folder.deleted IS NOT 0
END)
AND podcast.clean_title LIKE '%' || :searchTerm || '%' ESCAPE '\'
ORDER BY (CASE
WHEN podcast.clean_title LIKE 'the %' THEN SUBSTR(podcast.clean_title, 5)
ELSE podcast.clean_title
END) ASC
""",
)
internal a... | @@ -333,8 +336,11 @@ abstract class PlaylistDao {
WHERE
podcast.subscribed IS NOT 0
AND podcast.folder_uuid IS (:folderUuid)
- AND podcast.title LIKE '%' || :searchTerm || '%' ESCAPE '\' COLLATE NOCASE
- ORDER BY podcast.title ASC
+ AND podcast.clean_title LIKE '%... | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/PlaylistDao.kt | 26 | Kotlin | 0.786 | security | 321 | 51 | 51 | false | Add search field to podcasts Smart Rule | 4,634 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
import io.reactivex.Maybe
import io.reactivex.Single
import java.util.Date
import kotlinx.coroutines.flow.Flow
@Dao
abstract class PodcastDao {
@Transaction
@Query("SELECT * FROM podcasts WHERE uuid IN (:uuids)")
abstract suspend fun findAllIn(uuids: Collection<String>): List<Podcast>
@Transaction
... | The LIKE pattern for "the %" prefix detection is case-sensitive but searches on clean_title which may contain mixed case. This could cause inconsistent sorting when podcast titles start with "The", "THE", or "the". Consider using `LIKE 'the %'` with COLLATE NOCASE or convert to uppercase for consistent prefix detection... | import io.reactivex.Flowable
import io.reactivex.Maybe
import io.reactivex.Single
import java.util.Date
import kotlinx.coroutines.flow.Flow
@Dao
abstract class PodcastDao {
@Transaction
@Query("SELECT * FROM podcasts WHERE uuid IN (:uuids)")
abstract suspend fun findAllIn(uuids: Collection<String>): List<P... | @@ -36,8 +37,24 @@ abstract class PodcastDao {
abstract fun findSubscribedBlocking(): List<Podcast>
@Transaction
- @Query("SELECT * FROM podcasts WHERE subscribed = 1 ORDER BY LOWER(title) ASC")
- abstract fun findSubscribedFlow(): Flow<List<Podcast>>
+ @Query(
+ """
+ SELECT *
+ ... | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/PodcastDao.kt | 26 | Kotlin | 1 | security | 422 | 51 | 51 | false | Add search field to podcasts Smart Rule | 4,634 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
"""
SELECT
folder.uuid,
folder.name,
folder.color
FROM
folders AS folder
WHERE
folder.deleted IS 0
AND (
SELECT
COUNT(*)
FROM
podcasts AS podcast
WHERE ... | The search query uses clean_name for folders but the ORDER BY clause checks for "the %" prefix which is case-sensitive. This inconsistency may cause incorrect sorting when folder names start with different cases of "the". Consider applying COLLATE NOCASE to the prefix check or converting to uppercase. | ): List<ManualPlaylistPodcastSource> {
val escapedTerm = searchTerm.escapeLike('\\')
return getPodcastPlaylistSourcesForFolderUnsafe(folderUuid, escapedTerm)
}
@Query(
"""
SELECT
folder.uuid,
folder.name,
folder.color
FROM
... | @@ -370,7 +376,7 @@ abstract class PlaylistDao {
AND podcast.folder_uuid IS folder.uuid
) > 0
AND (
- folder.name LIKE '%' || :searchTerm || '%' ESCAPE '\' COLLATE NOCASE
+ folder.clean_name LIKE '%' || :searchTerm || '%' ESCAPE '\' | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/PlaylistDao.kt | 26 | Kotlin | 0.5 | bug | 302 | 51 | 51 | false | Add search field to podcasts Smart Rule | 4,634 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
@Query(
"""
SELECT episode.*
FROM podcast_episodes AS episode
WHERE
episode.podcast_id IS :podcastUuid
AND episode.uuid NOT IN (
SELECT manual_episode.episode_uuid
FROM manual_playlist_episodes AS manual_episode
WHERE manual_e... | The LIKE pattern for "the %" prefix detection is case-sensitive but searches on cleanTitle which may contain mixed case. This could cause inconsistent sorting when episode titles start with "The", "THE", or "the". Consider using `LIKE 'the %'` with COLLATE NOCASE or convert to uppercase for consistent prefix detection.... | ).map(ManualPlaylistPodcastSource::uuid),
)
}
} else {
emptyList()
}
return podcasts + folders
}
@Query(
"""
SELECT episode.*
FROM podcast_episodes AS episode
WHERE
episode.podcast_id I... | @@ -423,11 +431,14 @@ abstract class PlaylistDao {
FROM manual_playlist_episodes AS manual_episode
WHERE manual_episode.playlist_uuid IS :playlistUuid AND manual_episode.podcast_uuid IS :podcastUuid
)
- AND episode.title LIKE '%' || :searchTerm || '%' ESCAPE '\' COLLATE NOC... | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/PlaylistDao.kt | 26 | Kotlin | 0.857 | security | 437 | 51 | 51 | false | Add search field to podcasts Smart Rule | 4,634 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
if (!requireActivity().isChangingConfigurations) {
viewModel.trackEditDismissed()
}
}
private fun openDownloadLimit() {
if (parentFragmentManager.findFragmentByTag("auto_download_limit") != null) {
return
}
DownloadLimitFragment().show(parentFragm... | The dialog tag should be 'delete_playlist_confirmation' to match the check on line 94, not 'confirm_play_all'.
```suggestion
dialog.show(parentFragmentManager, "delete_playlist_confirmation")
``` | if (!requireActivity().isChangingConfigurations) {
viewModel.trackEditDismissed()
}
}
private fun openDownloadLimit() {
if (parentFragmentManager.findFragmentByTag("auto_download_limit") != null) {
return
}
DownloadLimitFragment().show(parentFragm... | @@ -84,4 +89,20 @@ internal class SettingsFragment : BaseFragment() {
}
DownloadLimitFragment().show(parentFragmentManager, "auto_download_limit")
}
+
+ private fun openDeleteConfirmation() {
+ if (parentFragmentManager.findFragmentByTag("delete_playlist_confirmation") != null) {
+ ... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/SettingsFragment.kt | 26 | Kotlin | 0.857 | suggestion | 203 | 29 | 29 | false | Add delete playlist option | 4,635 | Automattic/pocket-casts-android | 1,688 | Kotlin | Copilot | MiSikora |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.