Skip to content

Commit 247be77

Browse files
committed
Merge branch 'main' of https://github.com/files-community/Files into default_layout
2 parents 78a168a + 77a6d2b commit 247be77

File tree

59 files changed

+704
-496
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+704
-496
lines changed

Files.sln

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Microsoft Visual Studio Solution File, Format Version 12.00
32
# Visual Studio Version 16
43
VisualStudioVersion = 16.0.31911.196

builds/azure-pipelines-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
solution: '**/*.wapproj'
116116
platform: 'x86'
117117
configuration: '$(buildConfiguration)'
118-
msbuildArguments: '/t:build;_GenerateAppxPackage /p:AppxLogTelemetryFromSideloadingScript=False /p:GenerateAppInstallerFile=True /p:AppInstallerUri=https://cdn.files.community/files/${{parameters.releaseBranch}}/ /p:AppInstallerCheckForUpdateFrequency=OnApplicationRun /p:AppInstallerUpdateFrequency=1 /p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="$(appxPackageDir)" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=Sideload /p:AppxPackageSigningEnabled=true /p:PackageCertificateKeyFile="$(caCertificate.secureFilePath)" /p:PackageCertificatePassword="$(signingCert.password)" /p:PackageCertificateThumbprint=""'
118+
msbuildArguments: '/t:build;_GenerateAppxPackage /p:AppxLogTelemetryFromSideloadingScript=False /p:GenerateAppInstallerFile=True /p:AppInstallerUri=https://cdn.files.community/files/${{parameters.releaseBranch}}/ /p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="$(appxPackageDir)" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=Sideload /p:AppxPackageSigningEnabled=true /p:PackageCertificateKeyFile="$(caCertificate.secureFilePath)" /p:PackageCertificatePassword="$(signingCert.password)" /p:PackageCertificateThumbprint=""'
119119
maximumCpuCount: true
120120

121121
- task: CopyFiles@2

src/Files.Backend/Services/Settings/ILayoutSettingsService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public interface ILayoutSettingsService : IBaseSettingsService, INotifyPropertyC
3838

3939
SortOption DefaultDirectorySortOption { get; set; }
4040

41+
bool DefaultSortDirectoriesAlongsideFiles { get; set; }
42+
4143
GroupOption DefaultDirectoryGroupOption { get; set; }
4244
}
4345
}

src/Files.Backend/Services/Settings/IPreferencesSettingsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public interface IPreferencesSettingsService : IBaseSettingsService, INotifyProp
3939
/// Gets or sets a value indicating whether or not to display dot files.
4040
/// </summary>
4141
bool ShowDotFiles{ get; set; }
42-
42+
4343
/// <summary>
4444
/// Gets or sets a value indicating whether or not files should be sorted together with folders.
4545
/// </summary>

src/Files.Package/Package.appinstaller

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
Uri="{MainPackageUri}"/>
1010

1111
<UpdateSettings>
12-
<OnLaunch HoursBetweenUpdateChecks="0"/>
1312
<AutomaticBackgroundTask/>
1413
</UpdateSettings>
1514

src/Files.Shared/Enums/FileOperationType.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ namespace Files.Shared.Enums
55
/// <summary>
66
/// Type of operation on Files filesystem that took place
77
/// </summary>
8-
[Flags]
98
public enum FileOperationType : byte
109
{
1110
/// <summary>

src/Files.Shared/Enums/ReturnResult.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ namespace Files.Shared.Enums
55
/// <summary>
66
/// Contains all kinds of return status
77
/// </summary>
8-
[Flags]
98
public enum ReturnResult : byte
109
{
1110
/// <summary>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
3+
namespace Files.Shared.Services.DateTimeFormatter
4+
{
5+
public interface IDateTimeFormatter
6+
{
7+
string Name { get; }
8+
9+
string ToShortLabel(DateTimeOffset offset);
10+
string ToLongLabel(DateTimeOffset offset);
11+
12+
ITimeSpanLabel ToTimeSpanLabel(DateTimeOffset offset);
13+
}
14+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Files.Shared.Enums;
2+
3+
namespace Files.Shared.Services.DateTimeFormatter
4+
{
5+
public interface IDateTimeFormatterFactory
6+
{
7+
IDateTimeFormatter GetDateTimeFormatter(TimeStyle timeStyle);
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Files.Shared.Services.DateTimeFormatter
2+
{
3+
public interface ITimeSpanLabel
4+
{
5+
string Text { get; }
6+
string Glyph { get; }
7+
int Index { get; }
8+
}
9+
}

src/Files.Uwp/App.xaml.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
using Files.Backend.Services.Settings;
44
using Files.Shared;
55
using Files.Shared.Extensions;
6+
using Files.Shared.Services.DateTimeFormatter;
67
using Files.Uwp.CommandLine;
78
using Files.Uwp.Controllers;
89
using Files.Uwp.Filesystem;
910
using Files.Uwp.Filesystem.FilesystemHistory;
1011
using Files.Uwp.Helpers;
1112
using Files.Uwp.ServicesImplementation;
13+
using Files.Uwp.ServicesImplementation.DateTimeFormatter;
1214
using Files.Uwp.ServicesImplementation.Settings;
1315
using Files.Uwp.UserControls.MultitaskingControl;
1416
using Files.Uwp.ViewModels;
@@ -121,6 +123,8 @@ private IServiceProvider ConfigureServices()
121123
.AddSingleton<IThreadingService, ThreadingService>()
122124
.AddSingleton<ILocalizationService, LocalizationService>()
123125
.AddSingleton<IUpdateService, UpdateService>()
126+
.AddSingleton<IDateTimeFormatterFactory, DateTimeFormatterFactory>()
127+
.AddSingleton<IDateTimeFormatter, UserDateTimeFormatter>()
124128

125129
// TODO(i): FileSystem operations:
126130
// (IFilesystemHelpersService, IFilesystemOperationsService)
@@ -176,18 +180,19 @@ private static async Task StartAppCenter()
176180
private static async Task InitializeAppComponentsAsync()
177181
{
178182
var userSettingsService = Ioc.Default.GetRequiredService<IUserSettingsService>();
183+
var appearanceSettingsService = userSettingsService.AppearanceSettingsService;
179184

180185
// Start off a list of tasks we need to run before we can continue startup
181186
await Task.Run(async () =>
182187
{
183188
await Task.WhenAll(
184189
StartAppCenter(),
185-
DrivesManager.EnumerateDrivesAsync(),
186-
CloudDrivesManager.EnumerateDrivesAsync(),
187-
LibraryManager.EnumerateLibrariesAsync(),
188-
NetworkDrivesManager.EnumerateDrivesAsync(),
189-
WSLDistroManager.EnumerateDrivesAsync(),
190-
FileTagsManager.EnumerateFileTagsAsync(),
190+
DrivesManager.UpdateDrivesAsync(),
191+
OptionalTask(CloudDrivesManager.UpdateDrivesAsync(), appearanceSettingsService.ShowCloudDrivesSection),
192+
LibraryManager.UpdateLibrariesAsync(),
193+
OptionalTask(NetworkDrivesManager.UpdateDrivesAsync(), appearanceSettingsService.ShowNetworkDrivesSection),
194+
OptionalTask(WSLDistroManager.UpdateDrivesAsync(), appearanceSettingsService.ShowWslSection),
195+
OptionalTask(FileTagsManager.UpdateFileTagsAsync(), appearanceSettingsService.ShowFileTagsSection),
191196
SidebarPinnedController.InitializeAsync()
192197
);
193198
await Task.WhenAll(
@@ -205,6 +210,14 @@ await Task.WhenAll(
205210
var updateService = Ioc.Default.GetRequiredService<IUpdateService>();
206211
await updateService.CheckForUpdates();
207212
await updateService.DownloadMandatoryUpdates();
213+
214+
static async Task OptionalTask(Task task, bool condition)
215+
{
216+
if (condition)
217+
{
218+
await task;
219+
}
220+
}
208221
}
209222

210223
private void OnLeavingBackground(object sender, LeavingBackgroundEventArgs e)

src/Files.Uwp/BaseLayout.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ public abstract class BaseLayout : Page, IBaseLayout, INotifyPropertyChanged
6767
{
6868
AlwaysExpanded = true,
6969
};
70-
public Microsoft.UI.Xaml.Controls.CommandBarFlyout BaseContextMenuFlyout { get; set; } = new Microsoft.UI.Xaml.Controls.CommandBarFlyout();
70+
public Microsoft.UI.Xaml.Controls.CommandBarFlyout BaseContextMenuFlyout { get; set; } = new Microsoft.UI.Xaml.Controls.CommandBarFlyout()
71+
{
72+
AlwaysExpanded = true,
73+
};
7174

7275
public BaseLayoutCommandsViewModel CommandsViewModel { get; protected set; }
7376

src/Files.Uwp/Converters/DateTimeOffsetToString.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
using System;
1+
using CommunityToolkit.Mvvm.DependencyInjection;
2+
using Files.Shared.Services.DateTimeFormatter;
3+
using System;
24
using Windows.UI.Xaml.Data;
35

46
namespace Files.Uwp.Converters
57
{
68
internal class DateTimeOffsetToString : IValueConverter
79
{
10+
private static readonly IDateTimeFormatter formatter = Ioc.Default.GetService<IDateTimeFormatter>();
11+
812
public object Convert(object value, Type targetType, object parameter, string language)
913
{
1014
if (value is null)
1115
{
1216
return string.Empty;
1317
}
14-
return (Extensions.DateTimeExtensions.GetFriendlyDateFromFormat((DateTimeOffset)value, true));
18+
return formatter.ToLongLabel((DateTimeOffset)value);
1519
}
1620

1721
public object ConvertBack(object value, Type targetType, object parameter, string language)

src/Files.Uwp/Extensions/DateTimeExtensions.cs

Lines changed: 0 additions & 153 deletions
This file was deleted.

src/Files.Uwp/Files.Uwp.csproj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@
158158
</Compile>
159159
<Compile Include="EventArguments\Bundles\BundlesOpenPathEventArgs.cs" />
160160
<Compile Include="EventArguments\LayoutPreferenceEventArgs.cs" />
161-
<Compile Include="Extensions\DateTimeExtensions.cs" />
162161
<Compile Include="Extensions\EnumExtensions.cs" />
163162
<Compile Include="Extensions\ImageSourceExtensions.cs" />
164163
<Compile Include="Extensions\KeyboardAcceleratorExtensions.cs" />
@@ -246,6 +245,12 @@
246245
<Compile Include="Serialization\Implementation\DefaultSettingsSerializer.cs" />
247246
<Compile Include="Serialization\ISettingsSerializer.cs" />
248247
<Compile Include="Serialization\ISettingsSharingContext.cs" />
248+
<Compile Include="ServicesImplementation\DateTimeFormatter\AbstractDateTimeFormatter.cs" />
249+
<Compile Include="ServicesImplementation\DateTimeFormatter\ApplicationDateTimeFormatter.cs" />
250+
<Compile Include="ServicesImplementation\DateTimeFormatter\DateTimeFormatterFactory.cs" />
251+
<Compile Include="ServicesImplementation\DateTimeFormatter\UniversalDateTimeFormatter.cs" />
252+
<Compile Include="ServicesImplementation\DateTimeFormatter\SystemDateTimeFormatter.cs" />
253+
<Compile Include="ServicesImplementation\DateTimeFormatter\UserDateTimeFormatter.cs" />
249254
<Compile Include="ServicesImplementation\DialogService.cs" />
250255
<Compile Include="ServicesImplementation\ImagingService.cs" />
251256
<Compile Include="ServicesImplementation\LocalizationService.cs" />
@@ -1510,7 +1515,7 @@
15101515
<Version>4.5.1</Version>
15111516
</PackageReference>
15121517
<PackageReference Include="Microsoft.Data.Sqlite.Core">
1513-
<Version>6.0.4</Version>
1518+
<Version>6.0.5</Version>
15141519
</PackageReference>
15151520
<PackageReference Include="Microsoft.Extensions.DependencyInjection">
15161521
<Version>6.0.0</Version>

0 commit comments

Comments
 (0)