fix: adult only in recent too
This commit is contained in:
parent
f30e6b7809
commit
2d5d02fd67
1 changed files with 11 additions and 3 deletions
|
@ -5,6 +5,8 @@ import androidx.fragment.app.FragmentActivity
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
|
import androidx.webkit.internal.ApiFeature.P
|
||||||
|
import androidx.webkit.internal.StartupApiFeature
|
||||||
import ani.dantotsu.BuildConfig
|
import ani.dantotsu.BuildConfig
|
||||||
import ani.dantotsu.R
|
import ani.dantotsu.R
|
||||||
import ani.dantotsu.connections.discord.Discord
|
import ani.dantotsu.connections.discord.Discord
|
||||||
|
@ -207,16 +209,22 @@ class AnilistAnimeViewModel : ViewModel() {
|
||||||
val res = Anilist.query.loadAnimeList()?.data
|
val res = Anilist.query.loadAnimeList()?.data
|
||||||
|
|
||||||
val listOnly: Boolean = PrefManager.getVal(PrefName.RecentlyListOnly)
|
val listOnly: Boolean = PrefManager.getVal(PrefName.RecentlyListOnly)
|
||||||
|
val adultOnly: Boolean = PrefManager.getVal(PrefName.AdultOnly)
|
||||||
res?.apply{
|
res?.apply{
|
||||||
val idArr = mutableListOf<Int>()
|
val idArr = mutableListOf<Int>()
|
||||||
updated.postValue(recentUpdates?.airingSchedules?.mapNotNull {i ->
|
updated.postValue(recentUpdates?.airingSchedules?.mapNotNull {i ->
|
||||||
i.media?.let {
|
i.media?.let {
|
||||||
if (!idArr.contains(it.id))
|
if (!idArr.contains(it.id))
|
||||||
if (!listOnly && (it.countryOfOrigin == "JP" && (if (!Anilist.adult) it.isAdult == false else true)) || (listOnly && it.mediaListEntry != null)) {
|
if (!listOnly && it.countryOfOrigin == "JP" && Anilist.adult && adultOnly && it.isAdult == true) {
|
||||||
idArr.add(it.id)
|
idArr.add(it.id)
|
||||||
Media(it)
|
Media(it)
|
||||||
} else null
|
}else if (!listOnly && !adultOnly && (it.countryOfOrigin == "JP" && it.isAdult == false)){
|
||||||
|
idArr.add(it.id)
|
||||||
|
Media(it)
|
||||||
|
}else if ((listOnly && it.mediaListEntry != null)) {
|
||||||
|
idArr.add(it.id)
|
||||||
|
Media(it)
|
||||||
|
}else null
|
||||||
else null
|
else null
|
||||||
}
|
}
|
||||||
}?.toMutableList() ?: arrayListOf())
|
}?.toMutableList() ?: arrayListOf())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue