Refactored core
UI navigation framework Related Work Items: #408, #414, #416
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
using System.Linq;
|
||||
using Microsoft.Toolkit.Uwp.Notifications;
|
||||
using Google.Apis.Blogger.v3.Data;
|
||||
using Windows.UI.Notifications;
|
||||
using AngleSharp.Html.Parser;
|
||||
|
||||
namespace FoxTube.Utils
|
||||
{
|
||||
public static class ToastTemplates
|
||||
{
|
||||
public static ToastNotification GetBlogpostToast(Post post)
|
||||
{
|
||||
ToastContent toastContent = new ToastContent
|
||||
{
|
||||
Visual = new ToastVisual
|
||||
{
|
||||
BindingGeneric = new ToastBindingGeneric
|
||||
{
|
||||
Children =
|
||||
{
|
||||
new AdaptiveText
|
||||
{
|
||||
Text = new BindableString(post.Title)
|
||||
},
|
||||
new AdaptiveText()
|
||||
{
|
||||
Text = new BindableString(new HtmlParser().ParseDocument(post.Content).QuerySelector("p").TextContent),
|
||||
HintMaxLines = 2
|
||||
}
|
||||
},
|
||||
AppLogoOverride = new ToastGenericAppLogo
|
||||
{
|
||||
Source = post.Author.Image.Url,
|
||||
HintCrop = ToastGenericAppLogoCrop.Circle
|
||||
}
|
||||
}
|
||||
},
|
||||
Launch = $"Settings/Inbox/{post.Id}",
|
||||
ActivationType = ToastActivationType.Foreground
|
||||
};
|
||||
|
||||
if (post.Images.Count > 0)
|
||||
toastContent.Visual.BindingGeneric.HeroImage = new ToastGenericHeroImage
|
||||
{
|
||||
Source = post.Images.FirstOrDefault()?.Url
|
||||
};
|
||||
|
||||
return new ToastNotification(toastContent.GetXml());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user