favorite & view page & etc.

This commit is contained in:
2021-08-12 16:27:42 +08:00
parent 3152f47db5
commit fa0b033f2a
33 changed files with 728 additions and 94 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Gallery.Util;
@ -8,14 +9,14 @@ using Xamarin.Forms;
namespace Gallery.Sources.Danbooru
{
public class GallerySource : IGallerySource
public class GallerySource : GallerySourceBase
{
public string Name => "Danbooru";
public string Route => "danbooru";
public string FlyoutIconKey => "Danbooru";
public string HomePage => "https://danbooru.donmai.us";
public override string Name => "Danbooru";
public override string Route => "danbooru";
public override string FlyoutIconKey => "Danbooru";
public override string HomePage => "https://danbooru.donmai.us";
public async Task<GalleryItem[]> GetRecentItemsAsync(int page)
public override async Task<IEnumerable<GalleryItem>> GetRecentItemsAsync(int page)
{
var url = $"https://danbooru.donmai.us/posts?page={page}";
var (result, error) = await NetHelper.RequestObject(url, @return: content => ResolveGalleryItems(content));
@ -47,7 +48,8 @@ namespace Gallery.Sources.Danbooru
Width = int.Parse(g[3].Value),
Height = int.Parse(g[4].Value),
UserId = g[6].Value,
Source = g[7].Value,
Source = Route,
SourceUrl = g[7].Value,
RawUrl = g[8].Value,
PreviewUrl = g[9].Value
};
@ -55,12 +57,12 @@ namespace Gallery.Sources.Danbooru
return items;
}
public void SetCookie()
public override void SetCookie()
{
throw new NotImplementedException();
}
public void InitDynamicResources(string family, ResourceDictionary light, ResourceDictionary dark)
public override void InitDynamicResources(string family, ResourceDictionary light, ResourceDictionary dark)
{
var icon = new FontImageSource
{