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));
}
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; }

View File

@ -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;

View File

@ -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,