Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Sponsor opens a window with every way to support Filee
KnifeLemonac15f5c8c28e
diff --git a/.github/FUNDING.yml b/.github/FUNDING.ymlindex 8aea5eaa..8e3094e5 100644--- a/.github/FUNDING.yml+++ b/.github/FUNDING.yml@@ -1,2 +1,4 @@github: KnifeLemon-custom: ["https://fairy.hada.io/@filee"]+patreon: KnifeLemon+ko_fi: knifelemon+custom: ["https://fairy.hada.io/@filee", "https://paypal.me/knifelemon"]diff --git a/README.ko.md b/README.ko.mdindex 47a8cb60..06da47e4 100644--- a/README.ko.md+++ b/README.ko.md@@ -216,14 +216,26 @@ dotnet testPR 환영해요. 시작하기 좋은 작업은 [변환기 추가](docs/ADDING-A-CONVERTER.md)와 [언어 추가](docs/ADDING-A-LANGUAGE.md)예요.Filee가 쓸만하다면 ⭐ 하나가 다른 사람들이 Filee를 찾는 데 도움이 돼요.-Filee는 앞으로도 무료예요. 개발을 응원하고 싶다면 [Fairy](https://fairy.hada.io/@filee)나-[GitHub Sponsors](https://github.com/sponsors/KnifeLemon)로 후원할 수 있어요.+Filee는 앞으로도 무료예요. 개발을 응원하고 싶다면 [후원하기](#후원하기)를 봐 주세요.## 코드 서명 정책Filee의 코드 서명 정책(Code signing policy)과 개인정보 처리 방침은 [영문 README](README.md#code-signing-policy)에있어요. Filee는 파일을 업로드하지 않고, 사용 기록도 보내지 않아요.+## 후원하기++Filee는 앞으로도 무료예요. 개발을 응원하고 싶다면 편한 방법으로 후원해 주세요.+국내 카드·간편결제는 [Fairy](https://fairy.hada.io/@filee)에서 할 수 있어요. 감사합니다!++<p align="center">+ <a href="https://github.com/sponsors/KnifeLemon"><img src="https://img.shields.io/badge/GitHub%20Sponsors-EA4AAA?style=for-the-badge&logo=githubsponsors&logoColor=white" alt="GitHub Sponsors"></a>+ <a href="https://patreon.com/KnifeLemon"><img src="https://img.shields.io/badge/Patreon-000000?style=for-the-badge&logo=patreon&logoColor=white" alt="Patreon"></a>+ <a href="https://ko-fi.com/knifelemon"><img src="https://img.shields.io/badge/Ko--fi-FF6433?style=for-the-badge&logo=kofi&logoColor=white" alt="Ko-fi"></a>+ <a href="https://paypal.me/knifelemon"><img src="https://img.shields.io/badge/PayPal-002991?style=for-the-badge&logo=paypal&logoColor=white" alt="PayPal"></a>+ <a href="https://fairy.hada.io/@filee"><img src="https://img.shields.io/badge/Fairy-2E9E6B?style=for-the-badge" alt="Fairy"></a>+</p>+## 라이선스MIT. 포함된 서드파티 구성요소는 각자의 라이선스를 따르고, [THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md)에 정리되어 있어요.diff --git a/README.md b/README.mdindex 6705aea8..df2ad67e 100644--- a/README.md+++ b/README.md@@ -220,8 +220,7 @@ package. More in [CONTRIBUTING.md](CONTRIBUTING.md#linux-and-macos-development).Pull requests are welcome. Good first steps are [adding a converter](docs/ADDING-A-CONVERTER.md) and[adding a language](docs/ADDING-A-LANGUAGE.md). If Filee saves you some clicks, a ⭐ helps other people find it.-Filee is free and stays free. If you'd like to support its development, you can sponsor it on-[GitHub Sponsors](https://github.com/sponsors/KnifeLemon) (or [Fairy](https://fairy.hada.io/@filee) from Korea).+Filee is free and stays free. If you'd like to support its development, see [Sponsor](#sponsor).## Code signing policy@@ -248,6 +247,19 @@ It connects to the internet only:[`engines.json`](src/Filee.Engines/Infrastructure/engines.json).- when you click a link, which opens your web browser.+## Sponsor++Filee is free and stays free. If you'd like to support its development, pick whichever way suits you+([Fairy](https://fairy.hada.io/@filee) takes Korean cards and easy-pay). Thank you!++<p align="center">+ <a href="https://github.com/sponsors/KnifeLemon"><img src="https://img.shields.io/badge/GitHub%20Sponsors-EA4AAA?style=for-the-badge&logo=githubsponsors&logoColor=white" alt="GitHub Sponsors"></a>+ <a href="https://patreon.com/KnifeLemon"><img src="https://img.shields.io/badge/Patreon-000000?style=for-the-badge&logo=patreon&logoColor=white" alt="Patreon"></a>+ <a href="https://ko-fi.com/knifelemon"><img src="https://img.shields.io/badge/Ko--fi-FF6433?style=for-the-badge&logo=kofi&logoColor=white" alt="Ko-fi"></a>+ <a href="https://paypal.me/knifelemon"><img src="https://img.shields.io/badge/PayPal-002991?style=for-the-badge&logo=paypal&logoColor=white" alt="PayPal"></a>+ <a href="https://fairy.hada.io/@filee"><img src="https://img.shields.io/badge/Fairy-2E9E6B?style=for-the-badge" alt="Fairy"></a>+</p>+## LicenseMIT. Bundled third-party components keep their own licenses, listed in [THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md).diff --git a/README.zh-CN.md b/README.zh-CN.mdindex 4fab6d80..745c4ab5 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -204,13 +204,25 @@ dotnet test欢迎提交 Pull Request。适合入门的任务:[添加转换器](docs/ADDING-A-CONVERTER.md)和[添加语言](docs/ADDING-A-LANGUAGE.md)。如果 Filee 帮你省了时间,点个 ⭐ 能让更多人发现它。-Filee 免费,并将一直免费。想支持开发的话,可以通过 [GitHub Sponsors](https://github.com/sponsors/KnifeLemon) 赞助。+Filee 免费,并将一直免费。想支持开发的话,请看[赞助](#赞助)。## 代码签名政策Filee 的代码签名政策(Code signing policy)和隐私政策见[英文 README](README.md#code-signing-policy)。Filee 不会上传文件,也不会发送任何使用数据。+## 赞助++Filee 免费,并将一直免费。想支持开发的话,选一种方便的方式即可。谢谢!++<p align="center">+ <a href="https://github.com/sponsors/KnifeLemon"><img src="https://img.shields.io/badge/GitHub%20Sponsors-EA4AAA?style=for-the-badge&logo=githubsponsors&logoColor=white" alt="GitHub Sponsors"></a>+ <a href="https://patreon.com/KnifeLemon"><img src="https://img.shields.io/badge/Patreon-000000?style=for-the-badge&logo=patreon&logoColor=white" alt="Patreon"></a>+ <a href="https://ko-fi.com/knifelemon"><img src="https://img.shields.io/badge/Ko--fi-FF6433?style=for-the-badge&logo=kofi&logoColor=white" alt="Ko-fi"></a>+ <a href="https://paypal.me/knifelemon"><img src="https://img.shields.io/badge/PayPal-002991?style=for-the-badge&logo=paypal&logoColor=white" alt="PayPal"></a>+ <a href="https://fairy.hada.io/@filee"><img src="https://img.shields.io/badge/Fairy-2E9E6B?style=for-the-badge" alt="Fairy"></a>+</p>+## 许可证MIT。随附的第三方组件遵循各自的许可证,详见 [THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md)。diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.mdindex e4cd41a7..a8ca94ba 100644--- a/THIRD-PARTY-NOTICES.md+++ b/THIRD-PARTY-NOTICES.md@@ -89,3 +89,7 @@ programs inside it are Inno Setup's.| Noto Sans, Noto Sans KR, Noto Sans SC | SIL Open Font License 1.1 | https://github.com/notofonts || Test fonts in `tests/Filee.Engines.Tests/Fonts` (subsets of Noto Sans and Noto Sans KR; not shipped) | SIL Open Font License 1.1 | see `OFL.txt` in that folder || Material Design Icons (Pictogrammers) | Apache-2.0 | https://pictogrammers.com |+| Simple Icons 16.35.0 (GitHub Sponsors, Patreon, Ko-fi and PayPal logos in the Sponsor window) | CC0-1.0 | https://simpleicons.org |++The GitHub Sponsors, Patreon, Ko-fi and PayPal names and logos are trademarks of their owners and are used only to link+to each service.diff --git a/src/Filee.App/App.axaml b/src/Filee.App/App.axamlindex f3d5f05f..fbc42fe1 100644--- a/src/Filee.App/App.axaml+++ b/src/Filee.App/App.axaml@@ -14,6 +14,7 @@<ResourceDictionary><ResourceDictionary.MergedDictionaries><ResourceInclude Source="avares://Filee/Styles/Icons.axaml" />+ <ResourceInclude Source="avares://Filee/Styles/Brands.axaml" /></ResourceDictionary.MergedDictionaries></ResourceDictionary></Application.Resources>diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.jsonindex 5574c844..a858d1b4 100644--- a/src/Filee.App/Assets/i18n/en.json+++ b/src/Filee.App/Assets/i18n/en.json@@ -475,6 +475,14 @@"about.support_title": "Help Filee grow","about.support_text": "Filee is free and open source. A star on GitHub, a bug report, a feature idea or a sponsorship all help it get better and reach more people.","about.sponsor": "Sponsor",+ "sponsor.title": "Sponsor Filee",+ "sponsor.lead": "Filee is free and stays free. If you'd like to support its development, pick whichever way suits you.",+ "sponsor.note.github": "Monthly or one-time, by card through GitHub",+ "sponsor.note.fairy": "Korean cards and easy-pay",+ "sponsor.note.patreon": "Monthly membership",+ "sponsor.note.kofi": "A one-time coffee, no account needed",+ "sponsor.note.paypal": "Any amount with PayPal",+ "sponsor.star": "A ⭐ on GitHub costs nothing and helps other people find Filee.","feedback.notice_title": "Is Filee helping you?","feedback.notice_text": "A star on GitHub helps other people find Filee. Problems and ideas are welcome too.","feedback.star": "Star on GitHub",diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.jsonindex e60b3710..62c82f2e 100644--- a/src/Filee.App/Assets/i18n/ko.json+++ b/src/Filee.App/Assets/i18n/ko.json@@ -475,6 +475,14 @@"about.support_title": "Filee 응원하기","about.support_text": "Filee는 무료 오픈소스예요. GitHub 별, 버그 신고, 기능 제안, 후원 모두 Filee가 나아지고 더 많은 분께 알려지는 데 큰 힘이 돼요.","about.sponsor": "후원하기",+ "sponsor.title": "Filee 후원하기",+ "sponsor.lead": "Filee는 앞으로도 무료예요. 편한 방법으로 개발을 응원해 주세요.",+ "sponsor.note.github": "GitHub에서 카드로 매월 또는 한 번",+ "sponsor.note.fairy": "국내 카드·간편결제",+ "sponsor.note.patreon": "매월 멤버십",+ "sponsor.note.kofi": "가입 없이 커피 한 잔",+ "sponsor.note.paypal": "PayPal로 원하는 금액",+ "sponsor.star": "돈이 들지 않는 GitHub ⭐도 다른 분들이 Filee를 찾는 데 큰 도움이 돼요.","feedback.notice_title": "Filee가 도움이 되고 있나요?","feedback.notice_text": "GitHub에 별(⭐)을 남겨 주시면 다른 분들이 Filee를 찾는 데 큰 도움이 돼요. 불편한 점이나 원하는 기능도 알려 주세요.","feedback.star": "GitHub에서 별 주기",diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.jsonindex 6540f1b5..14353441 100644--- a/src/Filee.App/Assets/i18n/zh-CN.json+++ b/src/Filee.App/Assets/i18n/zh-CN.json@@ -475,6 +475,14 @@"about.support_title": "支持 Filee","about.support_text": "Filee 免费开源。在 GitHub 上点星、报告错误、提出功能建议或赞助,都能帮助它变得更好、让更多人知道。","about.sponsor": "赞助",+ "sponsor.title": "赞助 Filee",+ "sponsor.lead": "Filee 免费,并将一直免费。想支持开发的话,选一种方便的方式即可。",+ "sponsor.note.github": "通过 GitHub 用银行卡按月或一次性赞助",+ "sponsor.note.fairy": "韩国银行卡和快捷支付",+ "sponsor.note.patreon": "按月会员",+ "sponsor.note.kofi": "无需注册,请喝一杯咖啡",+ "sponsor.note.paypal": "用 PayPal 支付任意金额",+ "sponsor.star": "在 GitHub 点个 ⭐ 不花钱,也能让更多人发现 Filee。","feedback.notice_title": "Filee 对你有帮助吗?","feedback.notice_text": "在 GitHub 上点个星(⭐)能帮助更多人发现 Filee。也欢迎反馈问题或提出想法。","feedback.star": "在 GitHub 上点星",diff --git a/src/Filee.App/Services/SponsorLinks.cs b/src/Filee.App/Services/SponsorLinks.csnew file mode 100644index 00000000..0fac5d7f--- /dev/null+++ b/src/Filee.App/Services/SponsorLinks.cs@@ -0,0 +1,30 @@+// Where "Sponsor" can lead: the sidebar button and the About page open a window with these, the way that suits the+// language first (Korean cards and easy-pay through Fairy in Korean, GitHub Sponsors otherwise).++namespace Filee.App.Services;++/// <summary>One way to support Filee.</summary>+/// <param name="Id">Also the suffix of its description string, <c>sponsor.note.{Id}</c>.</param>+/// <param name="Icon">Key of the logo geometry (Styles/Brands.axaml, or Icon.Heart).</param>+/// <param name="Color">Brand colour behind the white logo.</param>+public sealed record SponsorLink(string Id, string Name, string Url, string Icon, string Color);++public static class SponsorLinks+{+ public const string GitHubSponsorsUrl = "https://github.com/sponsors/KnifeLemon";+ public const string FairyUrl = "https://fairy.hada.io/@filee";+ public const string PatreonUrl = "https://patreon.com/KnifeLemon";+ public const string KoFiUrl = "https://ko-fi.com/knifelemon";+ public const string PayPalUrl = "https://paypal.me/knifelemon";++ private static readonly SponsorLink GitHub = new("github", "GitHub Sponsors", GitHubSponsorsUrl, "Brand.GitHubSponsors", "#BF3989");+ private static readonly SponsorLink Fairy = new("fairy", "Fairy", FairyUrl, "Icon.Heart", "#2E9E6B");+ private static readonly SponsorLink Patreon = new("patreon", "Patreon", PatreonUrl, "Brand.Patreon", "#141518");+ private static readonly SponsorLink KoFi = new("kofi", "Ko-fi", KoFiUrl, "Brand.KoFi", "#FF5E5B");+ private static readonly SponsorLink PayPal = new("paypal", "PayPal", PayPalUrl, "Brand.PayPal", "#003087");++ /// <summary>Every way, the one that suits <paramref name="language"/> first.</summary>+ public static IReadOnlyList<SponsorLink> For(string language) => language == "ko"+ ? [Fairy, GitHub, Patreon, KoFi, PayPal]+ : [GitHub, Patreon, KoFi, PayPal, Fairy];+}diff --git a/src/Filee.App/Styles/Brands.axaml b/src/Filee.App/Styles/Brands.axamlnew file mode 100644index 00000000..2c0fec63--- /dev/null+++ b/src/Filee.App/Styles/Brands.axaml@@ -0,0 +1,11 @@+<!--+ Brand logos (24×24) from Simple Icons 16.35.0 (CC0-1.0, https://simpleicons.org), used only to link to each+ service. The marks belong to their owners (GitHub, Patreon, Ko-fi, PayPal).+-->+<ResourceDictionary xmlns="https://github.com/avaloniaui"+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">+ <StreamGeometry x:Key="Brand.GitHubSponsors">M17.625 1.499c-2.32 0-4.354 1.203-5.625 3.03-1.271-1.827-3.305-3.03-5.625-3.03C3.129 1.499 0 4.253 0 8.249c0 4.275 3.068 7.847 5.828 10.227a33.14 33.14 0 0 0 5.616 3.876l.028.017.008.003-.001.003c.163.085.342.126.521.125.179.001.358-.041.521-.125l-.001-.003.008-.003.028-.017a33.14 33.14 0 0 0 5.616-3.876C20.932 16.096 24 12.524 24 8.249c0-3.996-3.129-6.75-6.375-6.75zm-.919 15.275a30.766 30.766 0 0 1-4.703 3.316l-.004-.002-.004.002a30.955 30.955 0 0 1-4.703-3.316c-2.677-2.307-5.047-5.298-5.047-8.523 0-2.754 2.121-4.5 4.125-4.5 2.06 0 3.914 1.479 4.544 3.684.143.495.596.797 1.086.796.49.001.943-.302 1.085-.796.63-2.205 2.484-3.684 4.544-3.684 2.004 0 4.125 1.746 4.125 4.5 0 3.225-2.37 6.216-5.048 8.523z</StreamGeometry>+ <StreamGeometry x:Key="Brand.Patreon">M22.957 7.21c-.004-3.064-2.391-5.576-5.191-6.482-3.478-1.125-8.064-.962-11.384.604C2.357 3.231 1.093 7.391 1.046 11.54c-.039 3.411.302 12.396 5.369 12.46 3.765.047 4.326-4.804 6.068-7.141 1.24-1.662 2.836-2.132 4.801-2.618 3.376-.836 5.678-3.501 5.673-7.031Z</StreamGeometry>+ <StreamGeometry x:Key="Brand.KoFi">M11.351 2.715c-2.7 0-4.986.025-6.83.26C2.078 3.285 0 5.154 0 8.61c0 3.506.182 6.13 1.585 8.493 1.584 2.701 4.233 4.182 7.662 4.182h.83c4.209 0 6.494-2.234 7.637-4a9.5 9.5 0 0 0 1.091-2.338C21.792 14.688 24 12.22 24 9.208v-.415c0-3.247-2.13-5.507-5.792-5.87-1.558-.156-2.65-.208-6.857-.208m0 1.947c4.208 0 5.09.052 6.571.182 2.624.311 4.13 1.584 4.13 4v.39c0 2.156-1.792 3.844-3.87 3.844h-.935l-.156.649c-.208 1.013-.597 1.818-1.039 2.546-.909 1.428-2.545 3.064-5.922 3.064h-.805c-2.571 0-4.831-.883-6.078-3.195-1.09-2-1.298-4.155-1.298-7.506 0-2.181.857-3.402 3.012-3.714 1.533-.233 3.559-.26 6.39-.26m6.547 2.287c-.416 0-.65.234-.65.546v2.935c0 .311.234.545.65.545 1.324 0 2.051-.754 2.051-2s-.727-2.026-2.052-2.026m-10.39.182c-1.818 0-3.013 1.48-3.013 3.142 0 1.533.858 2.857 1.949 3.897.727.701 1.87 1.429 2.649 1.896a1.47 1.47 0 0 0 1.507 0c.78-.467 1.922-1.195 2.623-1.896 1.117-1.039 1.974-2.364 1.974-3.897 0-1.662-1.247-3.142-3.039-3.142-1.065 0-1.792.545-2.338 1.298-.493-.753-1.246-1.298-2.312-1.298</StreamGeometry>+ <StreamGeometry x:Key="Brand.PayPal">M15.607 4.653H8.941L6.645 19.251H1.82L4.862 0h7.995c3.754 0 6.375 2.294 6.473 5.513-.648-.478-2.105-.86-3.722-.86m6.57 5.546c0 3.41-3.01 6.853-6.958 6.853h-2.493L11.595 24H6.74l1.845-11.538h3.592c4.208 0 7.346-3.634 7.153-6.949a5.24 5.24 0 0 1 2.848 4.686M9.653 5.546h6.408c.907 0 1.942.222 2.363.541-.195 2.741-2.655 5.483-6.441 5.483H8.714Z</StreamGeometry>+</ResourceDictionary>diff --git a/src/Filee.App/ViewModels/MainWindowViewModel.cs b/src/Filee.App/ViewModels/MainWindowViewModel.csindex 94339b20..c64dcc4f 100644--- a/src/Filee.App/ViewModels/MainWindowViewModel.cs+++ b/src/Filee.App/ViewModels/MainWindowViewModel.cs@@ -34,9 +34,6 @@ public sealed partial class MainWindowViewModel : ObservableObject/// <summary>The repository, for the GitHub button above the version.</summary>public string RepositoryUrl => UpdateService.RepositoryUrl;- /// <summary>Where the Sponsor button above the version leads in the current language.</summary>- public string SponsorUrl => AboutPageViewModel.SponsorUrlFor(_loc.Language);-public MainWindowViewModel(IServiceProvider services, ILocalizer loc, UpdateService updates){_services = services;diff --git a/src/Filee.App/ViewModels/Pages/AboutPageViewModel.cs b/src/Filee.App/ViewModels/Pages/AboutPageViewModel.csindex 46205f2c..22a84c49 100644--- a/src/Filee.App/ViewModels/Pages/AboutPageViewModel.cs+++ b/src/Filee.App/ViewModels/Pages/AboutPageViewModel.cs@@ -29,16 +29,6 @@ public sealed partial class AboutPageViewModel : ObservableObject, IDisposablepublic string Version { get; }public string RepositoryUrl { get; } = UpdateService.RepositoryUrl;- /// <summary>Sponsoring in Korean goes to Fairy (Korean cards and easy-pay), otherwise to GitHub Sponsors.</summary>- public const string FairyUrl = "https://fairy.hada.io/@filee";-- public const string GitHubSponsorsUrl = "https://github.com/sponsors/KnifeLemon";-- /// <summary>Where "Sponsor" leads in the current language.</summary>- public string SponsorUrl => SponsorUrlFor(_loc.Language);-- public static string SponsorUrlFor(string language) => language == "ko" ? FairyUrl : GitHubSponsorsUrl;-/// <summary>The page is rebuilt on every visit; the update service lives on.</summary>public void Dispose() => _updates.PropertyChanged -= OnUpdatesChanged;diff --git a/src/Filee.App/Views/MainWindow.axaml.cs b/src/Filee.App/Views/MainWindow.axaml.csindex 9c287a63..eeed08a7 100644--- a/src/Filee.App/Views/MainWindow.axaml.cs+++ b/src/Filee.App/Views/MainWindow.axaml.cs@@ -2,6 +2,7 @@ using Avalonia.Controls;using Avalonia.Interactivity;using Filee.App.Services;using Filee.App.ViewModels;+using Filee.Core.Localization;namespace Filee.App.Views;@@ -19,11 +20,8 @@ public partial class MainWindow : Windowawait Launcher.LaunchUriAsync(new Uri(vm.RepositoryUrl));}- private async void OnSponsor(object? sender, RoutedEventArgs e)- {- if (DataContext is MainWindowViewModel vm)- await Launcher.LaunchUriAsync(new Uri(vm.SponsorUrl));- }+ private async void OnSponsor(object? sender, RoutedEventArgs e) =>+ await SponsorWindow.Create(AppHost.Get<ILocalizer>()).ShowDialog(this);/// <summary>Closing the window keeps Filee running in the tray (Quit is in the tray menu).</summary>protected override void OnClosing(WindowClosingEventArgs e)diff --git a/src/Filee.App/Views/Pages/AboutPage.axaml.cs b/src/Filee.App/Views/Pages/AboutPage.axaml.csindex 39f6ab52..4b79c09a 100644--- a/src/Filee.App/Views/Pages/AboutPage.axaml.cs+++ b/src/Filee.App/Views/Pages/AboutPage.axaml.cs@@ -1,6 +1,8 @@using Avalonia.Controls;using Avalonia.Interactivity;+using Filee.App.Services;using Filee.App.ViewModels.Pages;+using Filee.Core.Localization;namespace Filee.App.Views.Pages;@@ -19,8 +21,8 @@ public partial class AboutPage : UserControlprivate async void OnSponsor(object? sender, RoutedEventArgs e){- if (DataContext is AboutPageViewModel vm && TopLevel.GetTopLevel(this) is { } top)- await top.Launcher.LaunchUriAsync(new Uri(vm.SponsorUrl));+ if (TopLevel.GetTopLevel(this) is Window owner)+ await SponsorWindow.Create(AppHost.Get<ILocalizer>()).ShowDialog(owner);}private async void OnIssue(object? sender, RoutedEventArgs e)diff --git a/src/Filee.App/Views/SponsorWindow.axaml b/src/Filee.App/Views/SponsorWindow.axamlnew file mode 100644index 00000000..214894e4--- /dev/null+++ b/src/Filee.App/Views/SponsorWindow.axaml@@ -0,0 +1,55 @@+<!-- "Sponsor": the ways to support Filee, each with its logo and what it is good for. Opened from the sidebar button+ and the About page; choosing one opens it in the browser. -->+<Window xmlns="https://github.com/avaloniaui"+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"+ xmlns:v="using:Filee.App.Views"+ x:Class="Filee.App.Views.SponsorWindow"+ Title="{DynamicResource sponsor.title}"+ Icon="avares://Filee/Assets/Icons/filee.ico"+ Width="420"+ SizeToContent="Height"+ CanResize="False"+ WindowStartupLocation="CenterOwner"+ ShowInTaskbar="False">+ <Window.Styles>+ <Style Selector="Button.way">+ <Setter Property="HorizontalAlignment" Value="Stretch" />+ <Setter Property="HorizontalContentAlignment" Value="Stretch" />+ <Setter Property="Padding" Value="10,9" />+ <Setter Property="Background" Value="{DynamicResource SurfaceAltBrush}" />+ <Setter Property="BorderThickness" Value="0" />+ </Style>+ </Window.Styles>+ <StackPanel Margin="22" Spacing="14">+ <StackPanel Spacing="4">+ <TextBlock Classes="h2" Text="{DynamicResource sponsor.title}" />+ <TextBlock Classes="caption" TextWrapping="Wrap" Text="{DynamicResource sponsor.lead}" />+ </StackPanel>+ <ItemsControl x:Name="Ways">+ <ItemsControl.ItemsPanel>+ <ItemsPanelTemplate>+ <StackPanel Spacing="6" />+ </ItemsPanelTemplate>+ </ItemsControl.ItemsPanel>+ <ItemsControl.ItemTemplate>+ <DataTemplate x:DataType="v:SponsorWay">+ <Button Classes="way" Click="OnChoose" Tag="{Binding Url}" ToolTip.Tip="{Binding Url}">+ <DockPanel>+ <Border DockPanel.Dock="Left" Width="36" Height="36" CornerRadius="9" Margin="0,0,12,0"+ Background="{Binding Color}">+ <PathIcon Width="19" Height="19" Data="{Binding Icon}" Foreground="White" />+ </Border>+ <PathIcon DockPanel.Dock="Right" Width="12" Height="12" Opacity="0.55"+ Data="{StaticResource Icon.ChevronRight}" VerticalAlignment="Center" />+ <StackPanel VerticalAlignment="Center" Spacing="1">+ <TextBlock Text="{Binding Name}" FontWeight="SemiBold" />+ <TextBlock Classes="caption" Text="{Binding Note}" TextWrapping="Wrap" />+ </StackPanel>+ </DockPanel>+ </Button>+ </DataTemplate>+ </ItemsControl.ItemTemplate>+ </ItemsControl>+ <TextBlock Classes="caption" TextWrapping="Wrap" Text="{DynamicResource sponsor.star}" />+ </StackPanel>+</Window>diff --git a/src/Filee.App/Views/SponsorWindow.axaml.cs b/src/Filee.App/Views/SponsorWindow.axaml.csnew file mode 100644index 00000000..198dda42--- /dev/null+++ b/src/Filee.App/Views/SponsorWindow.axaml.cs@@ -0,0 +1,41 @@+using Avalonia.Controls;+using Avalonia.Interactivity;+using Avalonia.Media;+using Filee.App.Services;+using Filee.Core.Localization;++namespace Filee.App.Views;++/// <summary>One row of the window: a <see cref="SponsorLink"/> with its note in the current language.</summary>+public sealed record SponsorWay(string Name, string Note, string Url, Geometry? Icon, IBrush Color);++/// <summary>Modal list of the ways to sponsor Filee. Choosing one opens it in the browser and closes the window.</summary>+public partial class SponsorWindow : Window+{+ public SponsorWindow()+ {+ InitializeComponent();+ Motion.Track(this);+ }++ /// <summary>The window with the ways for <paramref name="loc"/>'s language, the one that suits it first.</summary>+ public static SponsorWindow Create(ILocalizer loc)+ {+ var window = new SponsorWindow();+ window.Ways.ItemsSource = SponsorLinks.For(loc.Language)+ .Select(l => new SponsorWay(l.Name, loc[$"sponsor.note.{l.Id}"], l.Url,+ window.TryFindResource(l.Icon, out var icon) ? icon as Geometry : null,+ new SolidColorBrush(Color.Parse(l.Color))))+ .ToList();+ return window;+ }++ private async void OnChoose(object? sender, RoutedEventArgs e)+ {+ if ((sender as Control)?.Tag is string url)+ {+ await Launcher.LaunchUriAsync(new Uri(url));+ Close();+ }+ }+}diff --git a/tests/Filee.App.Tests/AboutSponsorTests.cs b/tests/Filee.App.Tests/AboutSponsorTests.csdeleted file mode 100644index 7a9bacf0..00000000--- a/tests/Filee.App.Tests/AboutSponsorTests.cs+++ /dev/null@@ -1,24 +0,0 @@-// "Sponsor" on the About page leads to Fairy in Korean (Korean cards and easy-pay) and to GitHub Sponsors otherwise.--using Avalonia.Headless.XUnit;-using Filee.App.Services;-using Filee.App.ViewModels.Pages;-using Filee.Core.Localization;-using Filee.Core.Settings;--namespace Filee.App.Tests;--public class AboutSponsorTests-{- [AvaloniaTheory]- [InlineData("ko", AboutPageViewModel.FairyUrl)]- [InlineData("en", AboutPageViewModel.GitHubSponsorsUrl)]- [InlineData("zh-CN", AboutPageViewModel.GitHubSponsorsUrl)]- public void Sponsor_leads_where_the_language_can_pay(string language, string url)- {- TestServices.EnsureInitialized(language);- using var about = new AboutPageViewModel(AppHost.Get<ILocalizer>(), AppHost.Get<UserDataStore>(), AppHost.Get<UpdateService>());-- Assert.Equal(url, about.SponsorUrl);- }-}diff --git a/tests/Filee.App.Tests/RenderTests.cs b/tests/Filee.App.Tests/RenderTests.csindex da2c5167..26c886bb 100644--- a/tests/Filee.App.Tests/RenderTests.cs+++ b/tests/Filee.App.Tests/RenderTests.cs@@ -361,6 +361,19 @@ public class RenderTestswindow.Close();}+ [AvaloniaTheory]+ [InlineData("en")]+ [InlineData("ko")]+ public void Sponsor_window_renders(string language)+ {+ TestServices.EnsureInitialized(language);+ var window = Filee.App.Views.SponsorWindow.Create(AppHost.Get<Filee.Core.Localization.ILocalizer>());+ window.Show();+ Pump();+ Save(window, $"window-sponsor-{language}.png");+ window.Close();+ }+[AvaloniaTheory][InlineData("en")][InlineData("ko")]diff --git a/tests/Filee.App.Tests/SponsorTests.cs b/tests/Filee.App.Tests/SponsorTests.csnew file mode 100644index 00000000..cc59e1eb--- /dev/null+++ b/tests/Filee.App.Tests/SponsorTests.cs@@ -0,0 +1,44 @@+// "Sponsor" opens a window with every way to support Filee, the one that suits the language first: Fairy (Korean cards+// and easy-pay) in Korean, GitHub Sponsors otherwise.++using Avalonia.Headless.XUnit;+using Avalonia.Media;+using Filee.App.Services;+using Filee.App.Views;+using Filee.Core.Localization;++namespace Filee.App.Tests;++public class SponsorTests+{+ [AvaloniaTheory]+ [InlineData("ko", SponsorLinks.FairyUrl)]+ [InlineData("en", SponsorLinks.GitHubSponsorsUrl)]+ [InlineData("zh-CN", SponsorLinks.GitHubSponsorsUrl)]+ public void The_way_that_suits_the_language_comes_first(string language, string url)+ {+ var ways = SponsorLinks.For(language);++ Assert.Equal(url, ways[0].Url);+ Assert.Equal(5, ways.Select(w => w.Url).Distinct().Count());+ }++ [AvaloniaTheory]+ [InlineData("en")]+ [InlineData("ko")]+ [InlineData("zh-CN")]+ public void Every_way_has_its_logo_and_note(string language)+ {+ TestServices.EnsureInitialized(language);+ var window = SponsorWindow.Create(AppHost.Get<ILocalizer>());++ var ways = Assert.IsAssignableFrom<IEnumerable<SponsorWay>>(window.Ways.ItemsSource).ToList();+ Assert.Equal(5, ways.Count);+ Assert.All(ways, w =>+ {+ Assert.IsAssignableFrom<Geometry>(w.Icon);+ Assert.False(string.IsNullOrWhiteSpace(w.Note));+ Assert.DoesNotContain("sponsor.note.", w.Note);+ });+ }+}