Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Commit

Permalink
fix: 视频/直播贴屏蔽
Browse files Browse the repository at this point in the history
  • Loading branch information
HuanCheng65 committed Sep 30, 2023
1 parent fdd0a2d commit b91e23f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ object FrsPageRepository {
.map { response ->
if (response.data_ == null) throw TiebaUnknownException
val userList = response.data_.user_list
val threadList = response.data_.thread_list.map { threadInfo ->
threadInfo.copy(author = userList.find { it.id == threadInfo.authorId })
}
val threadList = response.data_.thread_list
.map { threadInfo ->
threadInfo.copy(author = userList.find { it.id == threadInfo.authorId })
}
.filter { !App.INSTANCE.appPreferences.blockVideo || it.videoInfo == null }
.filter { it.ala_info == null } // 去他妈的直播
response.copy(data_ = response.data_.copy(thread_list = threadList))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ class PersonalizedViewModel @Inject constructor() :
PersonalizedRepository
.personalizedFlow(1, 1)
.map<PersonalizedResponse, PersonalizedPartialChange.Refresh> { response ->
val data = response.toData().filter {
!App.INSTANCE.appPreferences.blockVideo || it.get { videoInfo } == null
}
val data = response.toData()
.filter {
!App.INSTANCE.appPreferences.blockVideo || it.get { videoInfo } == null
}
.filter { it.get { ala_info } == null }
val threadPersonalizedData = response.data_?.thread_personalized ?: emptyList()
PersonalizedPartialChange.Refresh.Success(
data = data.map { thread ->
Expand All @@ -90,9 +92,11 @@ class PersonalizedViewModel @Inject constructor() :
PersonalizedRepository
.personalizedFlow(2, page)
.map<PersonalizedResponse, PersonalizedPartialChange.LoadMore> { response ->
val data = response.toData().filter {
!App.INSTANCE.appPreferences.blockVideo || it.get { videoInfo } == null
}
val data = response.toData()
.filter {
!App.INSTANCE.appPreferences.blockVideo || it.get { videoInfo } == null
}
.filter { it.get { ala_info } == null }
val threadPersonalizedData = response.data_?.thread_personalized ?: emptyList()
PersonalizedPartialChange.LoadMore.Success(
currentPage = page,
Expand Down

0 comments on commit b91e23f

Please sign in to comment.