Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/Files.App/Data/Items/OpenSourceLibraryItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

namespace Files.App.Data.Items
{
/// <summary>
/// Represents an item for open source library shown on <see cref="Views.Settings.AboutPage"/>.
/// </summary>
public class OpenSourceLibraryItem
{
/// <summary>
/// Gets the URL that navigates to the open source library.
/// </summary>
public string Url { get; } = "";

/// <summary>
/// Gets the name of the open source library.
/// </summary>
public string Name { get; } = "";

/// <summary>
/// Initializes an instance of <see cref="OpenSourceLibraryItem"/> class.
/// </summary>
/// <param name="url">The URL</param>
/// <param name="name">The name</param>
public OpenSourceLibraryItem(string url, string name)
{
Url = url;
Name = name;
}
}
}
4 changes: 0 additions & 4 deletions src/Files.App/Files.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@
<Content Include="7z64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\.github\NOTICE.md">
<Link>NOTICE.md</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Assets\Resources\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -1820,8 +1820,8 @@
<data name="CompatibilityNoReducedColor" xml:space="preserve">
<value>No reduced color</value>
</data>
<data name="ThirdPartyLicenses" xml:space="preserve">
<value>Third party licenses</value>
<data name="ThirdPartyLibraries" xml:space="preserve">
<value>Third party libraries</value>
</data>
<data name="SettingsSetAsDefaultFileManagerDescription" xml:space="preserve">
<value>This option modifies the system registry and can have unexpected side effects on your device. Continue at your own risk.</value>
Expand Down
77 changes: 52 additions & 25 deletions src/Files.App/ViewModels/Settings/AboutViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,25 @@

namespace Files.App.ViewModels.Settings
{
/// <summary>
/// Represents view model of <see cref="Views.Settings.AboutPage"/>.
/// </summary>
public sealed class AboutViewModel : ObservableObject
{
protected readonly IFileTagsSettingsService FileTagsSettingsService = Ioc.Default.GetRequiredService<IFileTagsSettingsService>();
// Properties

public string Version
=> string.Format($"{"SettingsAboutVersionTitle".GetLocalizedResource()} {AppVersion.Major}.{AppVersion.Minor}.{AppVersion.Build}.{AppVersion.Revision}");

public string AppName
=> Package.Current.DisplayName;

public PackageVersion AppVersion
=> Package.Current.Id.Version;

public ObservableCollection<OpenSourceLibraryItem> OpenSourceLibraries { get; }

// Commands

public ICommand CopyAppVersionCommand { get; }
public ICommand CopyWindowsVersionCommand { get; }
Expand All @@ -27,15 +43,42 @@ public sealed class AboutViewModel : ObservableObject
public ICommand OpenPrivacyPolicyCommand { get; }
public ICommand OpenCrowdinCommand { get; }

private string _ThirdPartyNotices = string.Empty;
public string ThirdPartyNotices
{
get => _ThirdPartyNotices;
set => SetProperty(ref _ThirdPartyNotices, value);
}
// Constructor

/// <summary>
/// Initializes an instance of <see cref="AboutViewModel"/> class.
/// </summary>
public AboutViewModel()
{
OpenSourceLibraries =
[
new ("https://github.com/omar/ByteSize", "ByteSize"),
new ("https://github.com/CommunityToolkit/dotnet", "CommunityToolkit.Mvvm"),
new ("https://github.com/DiscUtils/DiscUtils", "DiscUtils.Udf"),
new ("https://github.com/robinrodricks/FluentFTP", "FluentFTP"),
new ("https://github.com/rickyah/ini-parser", "INI File Parser"),
new ("https://github.com/libgit2/libgit2sharp", "libgit2sharp"),
new ("https://github.com/mbdavid/LiteDB", "LiteDB"),
new ("https://github.com/beto-rodriguez/LiveCharts2", "LiveCharts2"),
new ("https://github.com/jeffijoe/messageformat.net", "MessageFormat"),
new ("https://github.com/dotnet/efcore", "EF Core for SQLite"),
new ("https://github.com/dotnet/runtime", "Microsoft.Extensions"),
new ("https://github.com/files-community/SevenZipSharp", "SevenZipSharp"),
new ("https://sourceforge.net/projects/sevenzip", "7zip"),
new ("https://github.com/ericsink/SQLitePCL.raw", "PCL for SQLite"),
new ("https://github.com/microsoft/WindowsAppSDK", "WindowsAppSDK"),
new ("https://github.com/microsoft/microsoft-ui-xaml", "WinUI 3"),
new ("https://github.com/microsoft/Win2D", "Win2D"),
new ("https://github.com/CommunityToolkit/WindowsCommunityToolkit", "Windows Community Toolkit 7.x"),
new ("https://github.com/mono/taglib-sharp", "TagLibSharp"),
new ("https://github.com/Tulpep/Active-Directory-Object-Picker", "ActiveDirectoryObjectPicker"),
new ("https://github.com/dotMorten/WinUIEx", "WinUIEx"),
new ("https://github.com/dahall/Vanara", "Vanara"),
new ("https://github.com/PowerShell/MMI", "MMI"),
new ("https://github.com/microsoft/CsWin32", "CsWin32"),
new ("https://github.com/microsoft/CsWinRT", "CsWinRT"),
];

CopyAppVersionCommand = new RelayCommand(CopyAppVersion);
CopyWindowsVersionCommand = new RelayCommand(CopyWindowsVersion);
SupportUsCommand = new AsyncRelayCommand(SupportUs);
Expand All @@ -49,6 +92,8 @@ public AboutViewModel()
OpenCrowdinCommand = new AsyncRelayCommand(DoOpenCrowdin);
}

// Methods

private async Task<bool> OpenLogLocation()
{
await Launcher.LaunchFolderAsync(ApplicationData.Current.LocalFolder).AsTask();
Expand Down Expand Up @@ -95,7 +140,6 @@ public Task DoOpenPrivacyPolicy()
return Launcher.LaunchUriAsync(new Uri(Constants.ExternalUrl.PrivacyPolicyUrl)).AsTask();
}


public Task DoOpenCrowdin()
{
return Launcher.LaunchUriAsync(new Uri(Constants.ExternalUrl.CrowdinUrl)).AsTask();
Expand Down Expand Up @@ -128,12 +172,6 @@ public Task SupportUs()
return Launcher.LaunchUriAsync(new Uri(Constants.ExternalUrl.SupportUsUrl)).AsTask();
}

public async Task LoadThirdPartyNoticesAsync()
{
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(Constants.DocsPath.ThirdPartyNoticePath));
ThirdPartyNotices = await FileIO.ReadTextAsync(file);
}

public string GetAppVersion()
{
return string.Format($"{AppVersion.Major}.{AppVersion.Minor}.{AppVersion.Build}.{AppVersion.Revision}");
Expand All @@ -151,16 +189,5 @@ public string GetVersionsQueryString()
query["windows_version"] = GetWindowsVersion();
return query.ToString() ?? string.Empty;
}

public string Version
{
get
{
return string.Format($"{"SettingsAboutVersionTitle".GetLocalizedResource()} {AppVersion.Major}.{AppVersion.Minor}.{AppVersion.Build}.{AppVersion.Revision}");
}
}

public string AppName => Package.Current.DisplayName;
public PackageVersion AppVersion => Package.Current.Id.Version;
}
}
33 changes: 22 additions & 11 deletions src/Files.App/Views/Settings/AboutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dataitems="using:Files.App.Data.Items"
xmlns:helpers="using:Files.App.Helpers"
xmlns:local="using:Files.App.UserControls.Settings"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Expand Down Expand Up @@ -181,21 +182,31 @@
</local:SettingsBlockControl>

<!-- Third Party Licenses -->
<local:SettingsBlockControl
Title="{helpers:ResourceString Name=ThirdPartyLicenses}"
HorizontalAlignment="Stretch"
Click="ThirdPartyLicenses_Click">
<local:SettingsBlockControl Title="{helpers:ResourceString Name=ThirdPartyLibraries}">
<local:SettingsBlockControl.Icon>
<FontIcon Glyph="&#xE90F;" />
</local:SettingsBlockControl.Icon>
<local:SettingsBlockControl.ExpandableContent>
<ScrollViewer Height="400">
<controls:MarkdownTextBlock
Margin="10"
Background="Transparent"
LinkClicked="MarkdownTextBlock_LinkClicked"
Text="{x:Bind ViewModel.ThirdPartyNotices, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</ScrollViewer>
<ItemsRepeater Margin="54,12,12,12" ItemsSource="{x:Bind ViewModel.OpenSourceLibraries, Mode=OneWay}">
<ItemsRepeater.ItemTemplate>
<DataTemplate x:DataType="dataitems:OpenSourceLibraryItem">
<TextBlock Margin="4,0" VerticalAlignment="Center">
<Hyperlink NavigateUri="{x:Bind Url}" UnderlineStyle="None">
<Run Text="{x:Bind Name}" />
</Hyperlink>
</TextBlock>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
<ItemsRepeater.Layout>
<UniformGridLayout
ItemsStretch="Fill"
MaximumRowsOrColumns="6"
MinColumnSpacing="8"
MinItemWidth="200"
MinRowSpacing="8"
Orientation="Horizontal" />
</ItemsRepeater.Layout>
</ItemsRepeater>
</local:SettingsBlockControl.ExpandableContent>
</local:SettingsBlockControl>

Expand Down
14 changes: 0 additions & 14 deletions src/Files.App/Views/Settings/AboutPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

using CommunityToolkit.WinUI.UI.Controls;
using Microsoft.UI.Xaml.Controls;
using Windows.System;

namespace Files.App.Views.Settings
{
Expand All @@ -13,17 +11,5 @@ public AboutPage()
{
InitializeComponent();
}

private async void ThirdPartyLicenses_Click(object sender, bool e)
{
if (e && string.IsNullOrEmpty(ViewModel.ThirdPartyNotices))
await ViewModel.LoadThirdPartyNoticesAsync();
}

private async void MarkdownTextBlock_LinkClicked(object sender, LinkClickedEventArgs e)
{
if (Uri.TryCreate(e.Link, UriKind.Absolute, out Uri? link))
await Launcher.LaunchUriAsync(link);
}
}
}