Skip to content

Commit c8caf48

Browse files
authored
Merge pull request #9230 from Stypox/duplicate-feed-videos
Fix duplicate videos in feed group "All"
2 parents 1de662f + 57d2fe1 commit c8caf48

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

app/src/main/java/org/schabi/newpipe/database/feed/dao/FeedDAO.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ abstract class FeedDAO {
4848
ON s.uid = f.stream_id
4949
5050
LEFT JOIN feed_group_subscription_join fgs
51-
ON fgs.subscription_id = f.subscription_id
51+
ON (
52+
:groupId <> ${FeedGroupEntity.GROUP_ALL_ID}
53+
AND fgs.subscription_id = f.subscription_id
54+
)
5255
5356
WHERE (
5457
:groupId = ${FeedGroupEntity.GROUP_ALL_ID}

app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import com.xwray.groupie.viewbinding.GroupieViewHolder
2727
import icepick.State
2828
import io.reactivex.rxjava3.disposables.CompositeDisposable
2929
import org.schabi.newpipe.R
30-
import org.schabi.newpipe.database.feed.model.FeedGroupEntity
30+
import org.schabi.newpipe.database.feed.model.FeedGroupEntity.Companion.GROUP_ALL_ID
3131
import org.schabi.newpipe.databinding.DialogTitleBinding
3232
import org.schabi.newpipe.databinding.FeedItemCarouselBinding
3333
import org.schabi.newpipe.databinding.FragmentSubscriptionBinding
@@ -276,14 +276,8 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
276276
}
277277
}
278278
carouselAdapter.setOnItemLongClickListener { item, _ ->
279-
if ((
280-
item is FeedGroupCardItem &&
281-
item.groupId == FeedGroupEntity.GROUP_ALL_ID
282-
) ||
283-
(
284-
item is FeedGroupCardGridItem &&
285-
item.groupId == FeedGroupEntity.GROUP_ALL_ID
286-
)
279+
if ((item is FeedGroupCardItem && item.groupId == GROUP_ALL_ID) ||
280+
(item is FeedGroupCardGridItem && item.groupId == GROUP_ALL_ID)
287281
) {
288282
return@setOnItemLongClickListener false
289283
}
@@ -437,10 +431,10 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
437431
clear()
438432
if (listViewMode) {
439433
add(FeedGroupAddNewItem())
440-
add(FeedGroupCardItem(-1, getString(R.string.all), FeedGroupIcon.RSS))
434+
add(FeedGroupCardItem(GROUP_ALL_ID, getString(R.string.all), FeedGroupIcon.RSS))
441435
} else {
442436
add(FeedGroupAddNewGridItem())
443-
add(FeedGroupCardGridItem(-1, getString(R.string.all), FeedGroupIcon.RSS))
437+
add(FeedGroupCardGridItem(GROUP_ALL_ID, getString(R.string.all), FeedGroupIcon.RSS))
444438
}
445439
addAll(groups)
446440
}

0 commit comments

Comments
 (0)