fix: r-18 tag in some pages

This commit is contained in:
Tsanie Lily 2020-05-16 20:48:12 +08:00
parent 350ef14647
commit 623410b47c
3 changed files with 26 additions and 2 deletions

View File

@ -618,6 +618,7 @@ namespace Pixiview.Illust
{ {
now = new IllustCollection(now.Concat(collection)); now = new IllustCollection(now.Concat(collection));
} }
IllustCollection = now;
return now; return now;
} }
@ -764,6 +765,8 @@ namespace Pixiview.Illust
[JsonProperty] [JsonProperty]
public bool IsRestrict { get; set; } public bool IsRestrict { get; set; }
[JsonProperty] [JsonProperty]
public string[] Tags { get; set; }
[JsonProperty]
public string ProfileUrl { get; set; } public string ProfileUrl { get; set; }
[JsonProperty] [JsonProperty]
public string UserId { get; set; } public string UserId { get; set; }

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
using Pixiview.Illust; using Pixiview.Illust;
using Xamarin.Forms; using Xamarin.Forms;
@ -56,6 +57,7 @@ namespace Pixiview.Utils
Image = image, Image = image,
ImageUrl = urls?.x360 ?? url, ImageUrl = urls?.x360 ?? url,
IsRestrict = xRestrict == 1, IsRestrict = xRestrict == 1,
Tags = tags ?? new string[0],
ProfileUrl = profileImageUrl, ProfileUrl = profileImageUrl,
UserId = userId, UserId = userId,
UserName = userName, UserName = userName,
@ -173,6 +175,14 @@ namespace Pixiview.Utils
item.IllustType = (IllustType)illustType; item.IllustType = (IllustType)illustType;
item.ImageUrl = urls?.regular; item.ImageUrl = urls?.regular;
item.IsRestrict = xRestrict == 1; 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.UserId = userId;
item.UserName = userName; item.UserName = userName;
item.Width = width; item.Width = width;

View File

@ -1,4 +1,5 @@
using Pixiview.Illust; using System.Linq;
using Pixiview.Illust;
namespace Pixiview.Utils namespace Pixiview.Utils
{ {
@ -81,6 +82,15 @@ namespace Pixiview.Utils
{ {
type = 0; type = 0;
} }
bool restrict;
if (tags != null && tags.Contains("R-18"))
{
restrict = true;
}
else
{
restrict = false;
}
return new IllustItem return new IllustItem
{ {
Id = illust_id.ToString(), Id = illust_id.ToString(),
@ -88,7 +98,8 @@ namespace Pixiview.Utils
RankTitle = $"#{rank} {title}", RankTitle = $"#{rank} {title}",
IllustType = (IllustType)type, IllustType = (IllustType)type,
ImageUrl = url, ImageUrl = url,
//IsRestrict = xRestrict == 1, IsRestrict = restrict,
Tags = tags ?? new string[0],
ProfileUrl = profile_img, ProfileUrl = profile_img,
UserId = user_id.ToString(), UserId = user_id.ToString(),
UserName = user_name, UserName = user_name,