From 623410b47ca59c72a09ffe6807de625904977ee6 Mon Sep 17 00:00:00 2001 From: Tsanie Lily Date: Sat, 16 May 2020 20:48:12 +0800 Subject: [PATCH] fix: r-18 tag in some pages --- Pixiview/Illust/IllustCollectionPage.cs | 3 +++ Pixiview/Utils/IllustData.cs | 10 ++++++++++ Pixiview/Utils/IllustLegacy.cs | 15 +++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Pixiview/Illust/IllustCollectionPage.cs b/Pixiview/Illust/IllustCollectionPage.cs index eb3c309..1e07d89 100644 --- a/Pixiview/Illust/IllustCollectionPage.cs +++ b/Pixiview/Illust/IllustCollectionPage.cs @@ -618,6 +618,7 @@ namespace Pixiview.Illust { now = new IllustCollection(now.Concat(collection)); } + IllustCollection = now; return now; } @@ -764,6 +765,8 @@ namespace Pixiview.Illust [JsonProperty] public bool IsRestrict { get; set; } [JsonProperty] + public string[] Tags { get; set; } + [JsonProperty] public string ProfileUrl { get; set; } [JsonProperty] public string UserId { get; set; } diff --git a/Pixiview/Utils/IllustData.cs b/Pixiview/Utils/IllustData.cs index 5230626..500a8f0 100644 --- a/Pixiview/Utils/IllustData.cs +++ b/Pixiview/Utils/IllustData.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using Newtonsoft.Json; using Pixiview.Illust; using Xamarin.Forms; @@ -56,6 +57,7 @@ namespace Pixiview.Utils Image = image, ImageUrl = urls?.x360 ?? url, IsRestrict = xRestrict == 1, + Tags = tags ?? new string[0], ProfileUrl = profileImageUrl, UserId = userId, UserName = userName, @@ -173,6 +175,14 @@ namespace Pixiview.Utils item.IllustType = (IllustType)illustType; item.ImageUrl = urls?.regular; item.IsRestrict = xRestrict == 1; + if (tags != null && tags.tags != null) + { + item.Tags = tags.tags.Where(t => t.locked).Select(t => t.tag).ToArray(); + } + else + { + item.Tags = new string[0]; + } item.UserId = userId; item.UserName = userName; item.Width = width; diff --git a/Pixiview/Utils/IllustLegacy.cs b/Pixiview/Utils/IllustLegacy.cs index 6f1e403..99a6ca5 100644 --- a/Pixiview/Utils/IllustLegacy.cs +++ b/Pixiview/Utils/IllustLegacy.cs @@ -1,4 +1,5 @@ -using Pixiview.Illust; +using System.Linq; +using Pixiview.Illust; namespace Pixiview.Utils { @@ -81,6 +82,15 @@ namespace Pixiview.Utils { type = 0; } + bool restrict; + if (tags != null && tags.Contains("R-18")) + { + restrict = true; + } + else + { + restrict = false; + } return new IllustItem { Id = illust_id.ToString(), @@ -88,7 +98,8 @@ namespace Pixiview.Utils RankTitle = $"#{rank} {title}", IllustType = (IllustType)type, ImageUrl = url, - //IsRestrict = xRestrict == 1, + IsRestrict = restrict, + Tags = tags ?? new string[0], ProfileUrl = profile_img, UserId = user_id.ToString(), UserName = user_name,