Skip to content

Commit

Permalink
#912 推荐页视频右键快速设置过滤up主
Browse files Browse the repository at this point in the history
  • Loading branch information
ywmoyue committed Nov 13, 2024
1 parent ba7ae53 commit 79b4989
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/BiliLite.UWP/Pages/Home/RecommendPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ private async void ListMenu_ItemClick(object sender, ItemClickEventArgs e)
case "browser":
await Launcher.LaunchUriAsync(new Uri(threePoint.Url));
return;
case "fastFilter":
m_viewModel.AddFilterUser(threePoint.Subtitle);
return;
}
}

Expand Down
29 changes: 29 additions & 0 deletions src/BiliLite.UWP/ViewModels/Home/RecommendPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using BiliLite.Extensions;
using BiliLite.Models.Common;
using BiliLite.Models.Common.Recommend;
using BiliLite.Models.Common.Settings;
using BiliLite.Models.Exceptions;
using BiliLite.Models.Requests;
using BiliLite.Models.Requests.Api.Home;
Expand Down Expand Up @@ -179,6 +180,17 @@ public async Task GetRecommend(string idx = "0")
Type = "browser"
});
}

if (item.ThreePointV2 != null)
{
item.ThreePointV2.Insert(1, new RecommendThreePointV2ItemModel()
{
Idx = item.Idx,
Title = $"过滤UP主",
Subtitle = item.Args.UpName,
Type = "fastFilter"
});
}
}

recommendItems = m_contentFilterService.FilterRecommendItems(recommendItems);
Expand Down Expand Up @@ -276,6 +288,23 @@ public async Task Dislike(string idx, RecommendThreePointV2ItemModel threePointV
}
}

public void AddFilterUser(string name)
{
m_contentFilterService.AddRecommendFilterRule(new FilterRule()
{
FilterRuleType = FilterRuleType.Recommend,
FilterType = FilterType.Word,
ContentType = FilterContentType.User,
Enable = true,
Rule = name,
});
var filterItems = Items.Where(x => x.Args.UpName == name).ToList();
foreach (var filterItem in filterItems)
{
Items.Remove(filterItem);
}
}

#endregion
}
}

0 comments on commit 79b4989

Please sign in to comment.