feature: r-18 filter
This commit is contained in:
@@ -17,10 +17,6 @@ namespace Pixiview.Illust
|
||||
|
||||
protected override bool IsFavoriteVisible => false;
|
||||
|
||||
public override void OnUnload()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
//base.OnAppearing();
|
||||
|
@@ -443,7 +443,8 @@ namespace Pixiview.Illust
|
||||
lastUpdated = now;
|
||||
}
|
||||
|
||||
var data = DoGetIllustList(illustData).Where(i => i != null);
|
||||
var r18 = Configs.IsOnR18;
|
||||
var data = DoGetIllustList(illustData).Where(i => i != null && (r18 || !i.IsRestrict));
|
||||
|
||||
var collection = new IllustCollection(data);
|
||||
if (IsFavoriteVisible)
|
||||
|
@@ -14,7 +14,7 @@
|
||||
<Grid>
|
||||
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||
<StackLayout>
|
||||
<u:FlowLayout ItemsSource="{Binding Users}"
|
||||
<u:FlowLayout ItemsSource="{Binding Users}" IsVisible="{Binding UserRecommendsVisible}"
|
||||
HorizontalOptions="Fill" Column="{Binding UserColumns}"
|
||||
Margin="16" RowSpacing="16"
|
||||
ItemTemplate="{StaticResource userCardView}"/>
|
||||
|
@@ -15,6 +15,8 @@ namespace Pixiview.Illust
|
||||
nameof(Users), typeof(List<IllustUserItem>), typeof(RecommendsPage));
|
||||
public static readonly BindableProperty UserColumnsProperty = BindableProperty.Create(
|
||||
nameof(UserColumns), typeof(int), typeof(RecommendsPage), 1);
|
||||
public static readonly BindableProperty UserRecommendsVisibleProperty = BindableProperty.Create(
|
||||
nameof(UserRecommendsVisible), typeof(bool), typeof(RecommendsPage));
|
||||
|
||||
public List<IllustUserItem> Users
|
||||
{
|
||||
@@ -26,6 +28,11 @@ namespace Pixiview.Illust
|
||||
get => (int)GetValue(UserColumnsProperty);
|
||||
set => SetValue(UserColumnsProperty, value);
|
||||
}
|
||||
public bool UserRecommendsVisible
|
||||
{
|
||||
get => (bool)GetValue(UserRecommendsVisibleProperty);
|
||||
set => SetValue(UserRecommendsVisibleProperty, value);
|
||||
}
|
||||
|
||||
private readonly Command<IllustUserItem> commandUserTapped;
|
||||
|
||||
@@ -200,6 +207,7 @@ namespace Pixiview.Illust
|
||||
|
||||
private void DoLoadUserRecommendsData(IllustData data)
|
||||
{
|
||||
var r18 = Configs.IsOnR18;
|
||||
var defaultImage = StyleDefinition.DownloadBackground;
|
||||
var users = data.body.page.recommendUser.Select(u =>
|
||||
{
|
||||
@@ -229,6 +237,15 @@ namespace Pixiview.Illust
|
||||
item3 = data.body.thumbnails.illust.FirstOrDefault(l => l.illustId == id)?.ConvertToItem(defaultImage);
|
||||
}
|
||||
}
|
||||
if (!r18)
|
||||
{
|
||||
if (item1?.IsRestrict == true ||
|
||||
item2?.IsRestrict == true ||
|
||||
item3?.IsRestrict == true)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return new IllustUserItem
|
||||
{
|
||||
UserId = usrId,
|
||||
@@ -238,9 +255,10 @@ namespace Pixiview.Illust
|
||||
Image2Item = item2,
|
||||
Image3Item = item3
|
||||
};
|
||||
});
|
||||
}).Where(u => u != null);
|
||||
|
||||
var list = new List<IllustUserItem>(users);
|
||||
UserRecommendsVisible = list.Count > 0;
|
||||
Users = list;
|
||||
Illusts = IllustCollection;
|
||||
|
||||
|
Reference in New Issue
Block a user