File scoped namespaces

This commit is contained in:
Aleh Khantsevich
2025-02-16 11:35:43 +01:00
committed by GitHub
parent c1336428dc
commit d31d8f574e
617 changed files with 32118 additions and 32737 deletions

View File

@@ -1,16 +1,15 @@
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Models.Reader
{
public class FilterOption
{
public FilterOptionType Type { get; set; }
public string Title { get; set; }
namespace Wino.Core.Domain.Models.Reader;
public FilterOption(string title, FilterOptionType type)
{
Title = title;
Type = type;
}
public class FilterOption
{
public FilterOptionType Type { get; set; }
public string Title { get; set; }
public FilterOption(string title, FilterOptionType type)
{
Title = title;
Type = type;
}
}

View File

@@ -1,32 +1,31 @@
using System.Collections.Generic;
using MimeKit;
namespace Wino.Core.Domain.Models.Reader
namespace Wino.Core.Domain.Models.Reader;
/// <summary>
/// Final model to be passed to renderer page.
/// Data here are created based on rendering settings.
/// </summary>
public class MailRenderModel
{
/// <summary>
/// Final model to be passed to renderer page.
/// Data here are created based on rendering settings.
/// </summary>
public class MailRenderModel
public string RenderHtml { get; }
public MailRenderingOptions MailRenderingOptions { get; }
public List<MimePart> Attachments { get; set; } = [];
public UnsubscribeInfo UnsubscribeInfo { get; set; }
public MailRenderModel(string renderHtml, MailRenderingOptions mailRenderingOptions = null)
{
public string RenderHtml { get; }
public MailRenderingOptions MailRenderingOptions { get; }
public List<MimePart> Attachments { get; set; } = [];
public UnsubscribeInfo UnsubscribeInfo { get; set; }
public MailRenderModel(string renderHtml, MailRenderingOptions mailRenderingOptions = null)
{
RenderHtml = renderHtml;
MailRenderingOptions = mailRenderingOptions;
}
}
public class UnsubscribeInfo
{
public string HttpLink { get; set; }
public string MailToLink { get; set; }
public bool IsOneClick { get; set; }
public bool CanUnsubscribe => HttpLink != null || MailToLink != null;
RenderHtml = renderHtml;
MailRenderingOptions = mailRenderingOptions;
}
}
public class UnsubscribeInfo
{
public string HttpLink { get; set; }
public string MailToLink { get; set; }
public bool IsOneClick { get; set; }
public bool CanUnsubscribe => HttpLink != null || MailToLink != null;
}

View File

@@ -1,21 +1,20 @@
namespace Wino.Core.Domain.Models.Reader
namespace Wino.Core.Domain.Models.Reader;
/// <summary>
/// Rendering options for mail.
/// </summary>
public class MailRenderingOptions
{
/// <summary>
/// Rendering options for mail.
/// </summary>
public class MailRenderingOptions
{
private const bool DefaultLoadImageValue = true;
private const bool DefaultLoadStylesValue = true;
private const bool DefaultRenderPlaintextLinksValue = true;
private const bool DefaultLoadImageValue = true;
private const bool DefaultLoadStylesValue = true;
private const bool DefaultRenderPlaintextLinksValue = true;
public bool LoadImages { get; set; } = DefaultLoadImageValue;
public bool LoadStyles { get; set; } = DefaultLoadStylesValue;
public bool RenderPlaintextLinks { get; set; } = DefaultRenderPlaintextLinksValue;
public bool LoadImages { get; set; } = DefaultLoadImageValue;
public bool LoadStyles { get; set; } = DefaultLoadStylesValue;
public bool RenderPlaintextLinks { get; set; } = DefaultRenderPlaintextLinksValue;
// HtmlDocument.Load call is redundant if all the settings are in default values.
// Therefore we will purify the HTML only if needed.
// HtmlDocument.Load call is redundant if all the settings are in default values.
// Therefore we will purify the HTML only if needed.
public bool IsPurifyingNeeded() => LoadImages != DefaultLoadImageValue || LoadStyles != DefaultLoadStylesValue;
}
public bool IsPurifyingNeeded() => LoadImages != DefaultLoadImageValue || LoadStyles != DefaultLoadStylesValue;
}

View File

@@ -3,27 +3,26 @@ using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Comparers;
using Wino.Core.Domain.Models.MailItem;
namespace Wino.Core.Domain.Models.Reader
{
public class SortingOption
{
public SortingOptionType Type { get; set; }
public string Title { get; set; }
public IComparer<IMailItem> Comparer
{
get
{
if (Type == SortingOptionType.ReceiveDate)
return new DateComparer();
else
return new NameComparer();
}
}
namespace Wino.Core.Domain.Models.Reader;
public SortingOption(string title, SortingOptionType type)
public class SortingOption
{
public SortingOptionType Type { get; set; }
public string Title { get; set; }
public IComparer<IMailItem> Comparer
{
get
{
Title = title;
Type = type;
if (Type == SortingOptionType.ReceiveDate)
return new DateComparer();
else
return new NameComparer();
}
}
public SortingOption(string title, SortingOptionType type)
{
Title = title;
Type = type;
}
}

View File

@@ -1,16 +1,15 @@
using System.Text.Json.Serialization;
namespace Wino.Core.Domain.Models.Reader
{
/// <summary>
/// Used to pass messages from the webview to the app.
/// </summary>
public class WebViewMessage
{
[JsonPropertyName("type")]
public string Type { get; set; }
namespace Wino.Core.Domain.Models.Reader;
[JsonPropertyName("value")]
public string Value { get; set; }
}
/// <summary>
/// Used to pass messages from the webview to the app.
/// </summary>
public class WebViewMessage
{
[JsonPropertyName("type")]
public string Type { get; set; }
[JsonPropertyName("value")]
public string Value { get; set; }
}