fix: removed unused banners
This commit is contained in:
parent
2d5d02fd67
commit
76e11e5a3e
3 changed files with 2 additions and 43 deletions
|
@ -1429,15 +1429,10 @@ Page(page:$page,perPage:50) {
|
||||||
"""{
|
"""{
|
||||||
favoriteAnime:${userFavMediaQuery(true, 1, id)}
|
favoriteAnime:${userFavMediaQuery(true, 1, id)}
|
||||||
favoriteManga:${userFavMediaQuery(false, 1, id)}
|
favoriteManga:${userFavMediaQuery(false, 1, id)}
|
||||||
animeMediaList:${bannerImageQuery("ANIME", id)}
|
|
||||||
mangaMediaList:${bannerImageQuery("MANGA", id)}
|
|
||||||
}""".trimIndent(), force = true
|
}""".trimIndent(), force = true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bannerImageQuery(type: String, id: Int?): String {
|
|
||||||
return """MediaListCollection(userId: ${id}, type: $type, chunk:1,perChunk:25, sort: [SCORE_DESC,UPDATED_TIME_DESC]) { lists { entries{ media { id bannerImage } } } }"""
|
|
||||||
}
|
|
||||||
|
|
||||||
suspend fun getNotifications(id: Int, page: Int = 1, resetNotification: Boolean = true): NotificationResponse? {
|
suspend fun getNotifications(id: Int, page: Int = 1, resetNotification: Boolean = true): NotificationResponse? {
|
||||||
val reset = if (resetNotification) "true" else "false"
|
val reset = if (resetNotification) "true" else "false"
|
||||||
|
|
|
@ -60,45 +60,36 @@ class AnilistHomeViewModel : ViewModel() {
|
||||||
MutableLiveData<ArrayList<Media>>(null)
|
MutableLiveData<ArrayList<Media>>(null)
|
||||||
|
|
||||||
fun getAnimeContinue(): LiveData<ArrayList<Media>> = animeContinue
|
fun getAnimeContinue(): LiveData<ArrayList<Media>> = animeContinue
|
||||||
suspend fun setAnimeContinue() = animeContinue.postValue(Anilist.query.continueMedia("ANIME"))
|
|
||||||
|
|
||||||
private val animeFav: MutableLiveData<ArrayList<Media>> =
|
private val animeFav: MutableLiveData<ArrayList<Media>> =
|
||||||
MutableLiveData<ArrayList<Media>>(null)
|
MutableLiveData<ArrayList<Media>>(null)
|
||||||
|
|
||||||
fun getAnimeFav(): LiveData<ArrayList<Media>> = animeFav
|
fun getAnimeFav(): LiveData<ArrayList<Media>> = animeFav
|
||||||
suspend fun setAnimeFav() = animeFav.postValue(Anilist.query.favMedia(true))
|
|
||||||
|
|
||||||
private val animePlanned: MutableLiveData<ArrayList<Media>> =
|
private val animePlanned: MutableLiveData<ArrayList<Media>> =
|
||||||
MutableLiveData<ArrayList<Media>>(null)
|
MutableLiveData<ArrayList<Media>>(null)
|
||||||
|
|
||||||
fun getAnimePlanned(): LiveData<ArrayList<Media>> = animePlanned
|
fun getAnimePlanned(): LiveData<ArrayList<Media>> = animePlanned
|
||||||
suspend fun setAnimePlanned() =
|
|
||||||
animePlanned.postValue(Anilist.query.continueMedia("ANIME", true))
|
|
||||||
|
|
||||||
private val mangaContinue: MutableLiveData<ArrayList<Media>> =
|
private val mangaContinue: MutableLiveData<ArrayList<Media>> =
|
||||||
MutableLiveData<ArrayList<Media>>(null)
|
MutableLiveData<ArrayList<Media>>(null)
|
||||||
|
|
||||||
fun getMangaContinue(): LiveData<ArrayList<Media>> = mangaContinue
|
fun getMangaContinue(): LiveData<ArrayList<Media>> = mangaContinue
|
||||||
suspend fun setMangaContinue() = mangaContinue.postValue(Anilist.query.continueMedia("MANGA"))
|
|
||||||
|
|
||||||
private val mangaFav: MutableLiveData<ArrayList<Media>> =
|
private val mangaFav: MutableLiveData<ArrayList<Media>> =
|
||||||
MutableLiveData<ArrayList<Media>>(null)
|
MutableLiveData<ArrayList<Media>>(null)
|
||||||
|
|
||||||
fun getMangaFav(): LiveData<ArrayList<Media>> = mangaFav
|
fun getMangaFav(): LiveData<ArrayList<Media>> = mangaFav
|
||||||
suspend fun setMangaFav() = mangaFav.postValue(Anilist.query.favMedia(false))
|
|
||||||
|
|
||||||
private val mangaPlanned: MutableLiveData<ArrayList<Media>> =
|
private val mangaPlanned: MutableLiveData<ArrayList<Media>> =
|
||||||
MutableLiveData<ArrayList<Media>>(null)
|
MutableLiveData<ArrayList<Media>>(null)
|
||||||
|
|
||||||
fun getMangaPlanned(): LiveData<ArrayList<Media>> = mangaPlanned
|
fun getMangaPlanned(): LiveData<ArrayList<Media>> = mangaPlanned
|
||||||
suspend fun setMangaPlanned() =
|
|
||||||
mangaPlanned.postValue(Anilist.query.continueMedia("MANGA", true))
|
|
||||||
|
|
||||||
private val recommendation: MutableLiveData<ArrayList<Media>> =
|
private val recommendation: MutableLiveData<ArrayList<Media>> =
|
||||||
MutableLiveData<ArrayList<Media>>(null)
|
MutableLiveData<ArrayList<Media>>(null)
|
||||||
|
|
||||||
fun getRecommendation(): LiveData<ArrayList<Media>> = recommendation
|
fun getRecommendation(): LiveData<ArrayList<Media>> = recommendation
|
||||||
suspend fun setRecommendation() = recommendation.postValue(Anilist.query.recommendations())
|
|
||||||
|
|
||||||
suspend fun initHomePage() {
|
suspend fun initHomePage() {
|
||||||
val res = Anilist.query.initHomePage()
|
val res = Anilist.query.initHomePage()
|
||||||
|
@ -406,11 +397,6 @@ class ProfileViewModel : ViewModel() {
|
||||||
|
|
||||||
fun getAnimeFav(): LiveData<ArrayList<Media>> = animeFav
|
fun getAnimeFav(): LiveData<ArrayList<Media>> = animeFav
|
||||||
|
|
||||||
private val listImages: MutableLiveData<ArrayList<String?>> =
|
|
||||||
MutableLiveData<ArrayList<String?>>(arrayListOf())
|
|
||||||
|
|
||||||
fun getListImages(): LiveData<ArrayList<String?>> = listImages
|
|
||||||
|
|
||||||
suspend fun setData(id: Int) {
|
suspend fun setData(id: Int) {
|
||||||
val res = Anilist.query.initProfilePage(id)
|
val res = Anilist.query.initProfilePage(id)
|
||||||
val mangaList = res?.data?.favoriteManga?.favourites?.manga?.edges?.mapNotNull {
|
val mangaList = res?.data?.favoriteManga?.favourites?.manga?.edges?.mapNotNull {
|
||||||
|
@ -426,30 +412,11 @@ class ProfileViewModel : ViewModel() {
|
||||||
}
|
}
|
||||||
animeFav.postValue(ArrayList(animeList ?: arrayListOf()))
|
animeFav.postValue(ArrayList(animeList ?: arrayListOf()))
|
||||||
|
|
||||||
val bannerImages = arrayListOf<String?>(null, null)
|
|
||||||
val animeRandom = res?.data?.animeMediaList?.lists?.mapNotNull {
|
|
||||||
it.entries?.mapNotNull { entry ->
|
|
||||||
val imageUrl = entry.media?.bannerImage
|
|
||||||
if (imageUrl != null && imageUrl != "null") imageUrl
|
|
||||||
else null
|
|
||||||
}
|
|
||||||
}?.flatten()?.randomOrNull()
|
|
||||||
bannerImages[0] = animeRandom
|
|
||||||
val mangaRandom = res?.data?.mangaMediaList?.lists?.mapNotNull {
|
|
||||||
it.entries?.mapNotNull { entry ->
|
|
||||||
val imageUrl = entry.media?.bannerImage
|
|
||||||
if (imageUrl != null && imageUrl != "null") imageUrl
|
|
||||||
else null
|
|
||||||
}
|
|
||||||
}?.flatten()?.randomOrNull()
|
|
||||||
bannerImages[1] = mangaRandom
|
|
||||||
listImages.postValue(bannerImages)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun refresh() {
|
fun refresh() {
|
||||||
mangaFav.postValue(mangaFav.value)
|
mangaFav.postValue(mangaFav.value)
|
||||||
animeFav.postValue(animeFav.value)
|
animeFav.postValue(animeFav.value)
|
||||||
listImages.postValue(listImages.value)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -147,10 +147,7 @@ class Query {
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Data(
|
data class Data(
|
||||||
@SerialName("favoriteAnime") val favoriteAnime: ani.dantotsu.connections.anilist.api.User?,
|
@SerialName("favoriteAnime") val favoriteAnime: ani.dantotsu.connections.anilist.api.User?,
|
||||||
@SerialName("favoriteManga") val favoriteManga: ani.dantotsu.connections.anilist.api.User?,
|
@SerialName("favoriteManga") val favoriteManga: ani.dantotsu.connections.anilist.api.User?)
|
||||||
@SerialName("animeMediaList") val animeMediaList: ani.dantotsu.connections.anilist.api.MediaListCollection?,
|
|
||||||
@SerialName("mangaMediaList") val mangaMediaList: ani.dantotsu.connections.anilist.api.MediaListCollection?
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
@Serializable
|
@Serializable
|
||||||
data class AnimeList(
|
data class AnimeList(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue