Skip to content

Commit 65ee0b1

Browse files
authored
Code Quality: Removed NOTICE.md link from Files.App.csproj (#15542)
1 parent 6cdfc46 commit 65ee0b1

File tree

6 files changed

+108
-56
lines changed

6 files changed

+108
-56
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (c) 2024 Files Community
2+
// Licensed under the MIT License. See the LICENSE.
3+
4+
namespace Files.App.Data.Items
5+
{
6+
/// <summary>
7+
/// Represents an item for open source library shown on <see cref="Views.Settings.AboutPage"/>.
8+
/// </summary>
9+
public class OpenSourceLibraryItem
10+
{
11+
/// <summary>
12+
/// Gets the URL that navigates to the open source library.
13+
/// </summary>
14+
public string Url { get; } = "";
15+
16+
/// <summary>
17+
/// Gets the name of the open source library.
18+
/// </summary>
19+
public string Name { get; } = "";
20+
21+
/// <summary>
22+
/// Initializes an instance of <see cref="OpenSourceLibraryItem"/> class.
23+
/// </summary>
24+
/// <param name="url">The URL</param>
25+
/// <param name="name">The name</param>
26+
public OpenSourceLibraryItem(string url, string name)
27+
{
28+
Url = url;
29+
Name = name;
30+
}
31+
}
32+
}

src/Files.App/Files.App.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@
4848
<Content Include="7z64.dll">
4949
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
5050
</Content>
51-
<Content Include="..\..\.github\NOTICE.md">
52-
<Link>NOTICE.md</Link>
53-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
54-
</Content>
5551
<Content Update="Assets\Resources\**">
5652
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
5753
</Content>

src/Files.App/Strings/en-US/Resources.resw

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,8 +1844,8 @@
18441844
<data name="CompatibilityNoReducedColor" xml:space="preserve">
18451845
<value>No reduced color</value>
18461846
</data>
1847-
<data name="ThirdPartyLicenses" xml:space="preserve">
1848-
<value>Third party licenses</value>
1847+
<data name="ThirdPartyLibraries" xml:space="preserve">
1848+
<value>Third party libraries</value>
18491849
</data>
18501850
<data name="SettingsSetAsDefaultFileManagerDescription" xml:space="preserve">
18511851
<value>This option modifies the system registry and can have unexpected side effects on your device. Continue at your own risk.</value>

src/Files.App/ViewModels/Settings/AboutViewModel.cs

Lines changed: 52 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,25 @@
1111

1212
namespace Files.App.ViewModels.Settings
1313
{
14+
/// <summary>
15+
/// Represents view model of <see cref="Views.Settings.AboutPage"/>.
16+
/// </summary>
1417
public sealed class AboutViewModel : ObservableObject
1518
{
16-
protected readonly IFileTagsSettingsService FileTagsSettingsService = Ioc.Default.GetRequiredService<IFileTagsSettingsService>();
19+
// Properties
20+
21+
public string Version
22+
=> string.Format($"{"SettingsAboutVersionTitle".GetLocalizedResource()} {AppVersion.Major}.{AppVersion.Minor}.{AppVersion.Build}.{AppVersion.Revision}");
23+
24+
public string AppName
25+
=> Package.Current.DisplayName;
26+
27+
public PackageVersion AppVersion
28+
=> Package.Current.Id.Version;
29+
30+
public ObservableCollection<OpenSourceLibraryItem> OpenSourceLibraries { get; }
31+
32+
// Commands
1733

1834
public ICommand CopyAppVersionCommand { get; }
1935
public ICommand CopyWindowsVersionCommand { get; }
@@ -27,15 +43,42 @@ public sealed class AboutViewModel : ObservableObject
2743
public ICommand OpenPrivacyPolicyCommand { get; }
2844
public ICommand OpenCrowdinCommand { get; }
2945

30-
private string _ThirdPartyNotices = string.Empty;
31-
public string ThirdPartyNotices
32-
{
33-
get => _ThirdPartyNotices;
34-
set => SetProperty(ref _ThirdPartyNotices, value);
35-
}
46+
// Constructor
3647

48+
/// <summary>
49+
/// Initializes an instance of <see cref="AboutViewModel"/> class.
50+
/// </summary>
3751
public AboutViewModel()
3852
{
53+
OpenSourceLibraries =
54+
[
55+
new ("https://github.com/omar/ByteSize", "ByteSize"),
56+
new ("https://github.com/CommunityToolkit/dotnet", "CommunityToolkit.Mvvm"),
57+
new ("https://github.com/DiscUtils/DiscUtils", "DiscUtils.Udf"),
58+
new ("https://github.com/robinrodricks/FluentFTP", "FluentFTP"),
59+
new ("https://github.com/rickyah/ini-parser", "INI File Parser"),
60+
new ("https://github.com/libgit2/libgit2sharp", "libgit2sharp"),
61+
new ("https://github.com/mbdavid/LiteDB", "LiteDB"),
62+
new ("https://github.com/beto-rodriguez/LiveCharts2", "LiveCharts2"),
63+
new ("https://github.com/jeffijoe/messageformat.net", "MessageFormat"),
64+
new ("https://github.com/dotnet/efcore", "EF Core for SQLite"),
65+
new ("https://github.com/dotnet/runtime", "Microsoft.Extensions"),
66+
new ("https://github.com/files-community/SevenZipSharp", "SevenZipSharp"),
67+
new ("https://sourceforge.net/projects/sevenzip", "7zip"),
68+
new ("https://github.com/ericsink/SQLitePCL.raw", "PCL for SQLite"),
69+
new ("https://github.com/microsoft/WindowsAppSDK", "WindowsAppSDK"),
70+
new ("https://github.com/microsoft/microsoft-ui-xaml", "WinUI 3"),
71+
new ("https://github.com/microsoft/Win2D", "Win2D"),
72+
new ("https://github.com/CommunityToolkit/WindowsCommunityToolkit", "Windows Community Toolkit 7.x"),
73+
new ("https://github.com/mono/taglib-sharp", "TagLibSharp"),
74+
new ("https://github.com/Tulpep/Active-Directory-Object-Picker", "ActiveDirectoryObjectPicker"),
75+
new ("https://github.com/dotMorten/WinUIEx", "WinUIEx"),
76+
new ("https://github.com/dahall/Vanara", "Vanara"),
77+
new ("https://github.com/PowerShell/MMI", "MMI"),
78+
new ("https://github.com/microsoft/CsWin32", "CsWin32"),
79+
new ("https://github.com/microsoft/CsWinRT", "CsWinRT"),
80+
];
81+
3982
CopyAppVersionCommand = new RelayCommand(CopyAppVersion);
4083
CopyWindowsVersionCommand = new RelayCommand(CopyWindowsVersion);
4184
SupportUsCommand = new AsyncRelayCommand(SupportUs);
@@ -49,6 +92,8 @@ public AboutViewModel()
4992
OpenCrowdinCommand = new AsyncRelayCommand(DoOpenCrowdin);
5093
}
5194

95+
// Methods
96+
5297
private async Task<bool> OpenLogLocation()
5398
{
5499
await Launcher.LaunchFolderAsync(ApplicationData.Current.LocalFolder).AsTask();
@@ -95,7 +140,6 @@ public Task DoOpenPrivacyPolicy()
95140
return Launcher.LaunchUriAsync(new Uri(Constants.ExternalUrl.PrivacyPolicyUrl)).AsTask();
96141
}
97142

98-
99143
public Task DoOpenCrowdin()
100144
{
101145
return Launcher.LaunchUriAsync(new Uri(Constants.ExternalUrl.CrowdinUrl)).AsTask();
@@ -128,12 +172,6 @@ public Task SupportUs()
128172
return Launcher.LaunchUriAsync(new Uri(Constants.ExternalUrl.SupportUsUrl)).AsTask();
129173
}
130174

131-
public async Task LoadThirdPartyNoticesAsync()
132-
{
133-
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(Constants.DocsPath.ThirdPartyNoticePath));
134-
ThirdPartyNotices = await FileIO.ReadTextAsync(file);
135-
}
136-
137175
public string GetAppVersion()
138176
{
139177
return string.Format($"{AppVersion.Major}.{AppVersion.Minor}.{AppVersion.Build}.{AppVersion.Revision}");
@@ -151,16 +189,5 @@ public string GetVersionsQueryString()
151189
query["windows_version"] = GetWindowsVersion();
152190
return query.ToString() ?? string.Empty;
153191
}
154-
155-
public string Version
156-
{
157-
get
158-
{
159-
return string.Format($"{"SettingsAboutVersionTitle".GetLocalizedResource()} {AppVersion.Major}.{AppVersion.Minor}.{AppVersion.Build}.{AppVersion.Revision}");
160-
}
161-
}
162-
163-
public string AppName => Package.Current.DisplayName;
164-
public PackageVersion AppVersion => Package.Current.Id.Version;
165192
}
166193
}

src/Files.App/Views/Settings/AboutPage.xaml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
66
xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
77
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
8+
xmlns:dataitems="using:Files.App.Data.Items"
89
xmlns:helpers="using:Files.App.Helpers"
910
xmlns:local="using:Files.App.UserControls.Settings"
1011
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -181,21 +182,31 @@
181182
</local:SettingsBlockControl>
182183

183184
<!-- Third Party Licenses -->
184-
<local:SettingsBlockControl
185-
Title="{helpers:ResourceString Name=ThirdPartyLicenses}"
186-
HorizontalAlignment="Stretch"
187-
Click="ThirdPartyLicenses_Click">
185+
<local:SettingsBlockControl Title="{helpers:ResourceString Name=ThirdPartyLibraries}">
188186
<local:SettingsBlockControl.Icon>
189187
<FontIcon Glyph="&#xE90F;" />
190188
</local:SettingsBlockControl.Icon>
191189
<local:SettingsBlockControl.ExpandableContent>
192-
<ScrollViewer Height="400">
193-
<controls:MarkdownTextBlock
194-
Margin="10"
195-
Background="Transparent"
196-
LinkClicked="MarkdownTextBlock_LinkClicked"
197-
Text="{x:Bind ViewModel.ThirdPartyNotices, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
198-
</ScrollViewer>
190+
<ItemsRepeater Margin="54,12,12,12" ItemsSource="{x:Bind ViewModel.OpenSourceLibraries, Mode=OneWay}">
191+
<ItemsRepeater.ItemTemplate>
192+
<DataTemplate x:DataType="dataitems:OpenSourceLibraryItem">
193+
<TextBlock Margin="4,0" VerticalAlignment="Center">
194+
<Hyperlink NavigateUri="{x:Bind Url}" UnderlineStyle="None">
195+
<Run Text="{x:Bind Name}" />
196+
</Hyperlink>
197+
</TextBlock>
198+
</DataTemplate>
199+
</ItemsRepeater.ItemTemplate>
200+
<ItemsRepeater.Layout>
201+
<UniformGridLayout
202+
ItemsStretch="Fill"
203+
MaximumRowsOrColumns="6"
204+
MinColumnSpacing="8"
205+
MinItemWidth="200"
206+
MinRowSpacing="8"
207+
Orientation="Horizontal" />
208+
</ItemsRepeater.Layout>
209+
</ItemsRepeater>
199210
</local:SettingsBlockControl.ExpandableContent>
200211
</local:SettingsBlockControl>
201212

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Copyright (c) 2024 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using CommunityToolkit.WinUI.UI.Controls;
54
using Microsoft.UI.Xaml.Controls;
6-
using Windows.System;
75

86
namespace Files.App.Views.Settings
97
{
@@ -13,17 +11,5 @@ public AboutPage()
1311
{
1412
InitializeComponent();
1513
}
16-
17-
private async void ThirdPartyLicenses_Click(object sender, bool e)
18-
{
19-
if (e && string.IsNullOrEmpty(ViewModel.ThirdPartyNotices))
20-
await ViewModel.LoadThirdPartyNoticesAsync();
21-
}
22-
23-
private async void MarkdownTextBlock_LinkClicked(object sender, LinkClickedEventArgs e)
24-
{
25-
if (Uri.TryCreate(e.Link, UriKind.Absolute, out Uri? link))
26-
await Launcher.LaunchUriAsync(link);
27-
}
2814
}
2915
}

0 commit comments

Comments
 (0)