Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Quality: Cleaned up Files.Backend #12631

Merged
merged 10 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 0 additions & 1 deletion src/Files.App/Actions/FileSystem/CreateFolderAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Files.App.Contexts;
using Files.App.Extensions;
using Files.App.Helpers;
using Files.Backend.Enums;
using System.ComponentModel;
using System.Threading.Tasks;

Expand Down
3 changes: 0 additions & 3 deletions src/Files.App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
using Files.App.ViewModels;
using Files.App.ViewModels.Settings;
using Files.App.Views;
using Files.Backend.Enums;
using Files.Backend.Services;
using Files.Backend.Services.Settings;
using Files.Backend.Services.SizeProvider;
using Files.Sdk.Storage;
using Files.Shared;
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Data/Items/DriveItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License. See the LICENSE.

using ByteSizeLib;
using CommunityToolkit.WinUI;
using Files.App.Storage.WindowsStorage;
using Files.Sdk.Storage;
using Files.Sdk.Storage.Enums;
Expand All @@ -11,6 +10,7 @@
using Microsoft.UI.Xaml.Media.Imaging;
using Windows.Storage;
using Windows.Storage.Streams;
using ByteSize = ByteSizeLib.ByteSize;

namespace Files.App.Data.Items
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Files.Backend.Enums;
using Microsoft.UI.Xaml;

namespace Files.App.Data.Items
Expand Down
1 change: 0 additions & 1 deletion src/Files.App/Data/Models/BitmapImageModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Files.Backend.Models;
using Microsoft.UI.Xaml.Media.Imaging;

namespace Files.App.Data.Models
Expand Down
2 changes: 0 additions & 2 deletions src/Files.App/Data/Models/DrivesViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Files.Backend.Models;
using Files.Backend.Services;
using Files.Backend.Services.SizeProvider;
using Files.Sdk.Storage.LocatableStorage;
using Microsoft.Extensions.Logging;
Expand Down
10 changes: 0 additions & 10 deletions src/Files.App/Dialogs/CreateArchiveDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using CommunityToolkit.Mvvm.ComponentModel;
using Files.App.Extensions;
using Files.App.Filesystem;
using Files.App.Filesystem.Archive;
using Files.Backend.Models;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using Windows.Foundation.Metadata;

namespace Files.App.Dialogs
Expand Down
7 changes: 0 additions & 7 deletions src/Files.App/Dialogs/CredentialDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Files.Backend.SecureStore;
using Files.Backend.ViewModels.Dialogs;
using Files.Shared.Enums;
using Microsoft.UI.Xaml.Controls;
using System;
using System.Text;
using System.Threading.Tasks;

// The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238

namespace Files.App.Dialogs
{
Expand Down
3 changes: 0 additions & 3 deletions src/Files.App/Dialogs/DecompressArchiveDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
// Licensed under the MIT License. See the LICENSE.

using Files.App.ViewModels.Dialogs;
using Files.Backend.SecureStore;
using Microsoft.UI.Xaml.Controls;
using System.Text;

// The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238

namespace Files.App.Dialogs
{
public sealed partial class DecompressArchiveDialog : ContentDialog
Expand Down
4 changes: 1 addition & 3 deletions src/Files.App/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
// Licensed under the MIT License. See the LICENSE.

using ByteSizeLib;
using Files.Shared.Extensions;
using Microsoft.Windows.ApplicationModel.Resources;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using ByteSize = ByteSizeLib.ByteSize;

namespace Files.App.Extensions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ namespace Files.App.Filesystem
public interface IStorageItemWithPath
{
public string Name { get; }

public string Path { get; }

public IStorageItem Item { get; }

public FilesystemItemType ItemType { get; }
}
}
1 change: 0 additions & 1 deletion src/Files.App/Filesystem/WindowsStorageDeviceWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Files.App.Data.Items;
using Files.App.Helpers;
using Files.App.Helpers.MMI;
using Files.Backend.Models;
using Files.Sdk.Storage.LocatableStorage;
using Microsoft.Extensions.Logging;
using System;
Expand Down
18 changes: 17 additions & 1 deletion src/Files.App/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,25 @@
global using global::Files.App.Views;
global using global::Files.App.Views.LayoutModes;
global using global::Files.App.Views.Shells;
global using global::Files.Backend.Enums;

// Files.Backend
global using global::Files.Backend.CommandLine;
global using global::Files.Backend.Data.Enums;
global using global::Files.Backend.Data.Messages;
global using global::Files.Backend.Data.Models;
global using global::Files.Backend.Extensions;
global using global::Files.Backend.Helpers;
global using global::Files.Backend.Services;
global using global::Files.Backend.Services.Settings;
//global using global::Files.Backend.Services.SizeProvider;
global using global::Files.Backend.ViewModels;
global using global::Files.Backend.ViewModels.Dialogs;
global using global::Files.Backend.ViewModels.Dialogs.AddItemDialog;
global using global::Files.Backend.ViewModels.Dialogs.FileSystemDialog;
global using global::Files.Backend.ViewModels.FileTags;
global using global::Files.Backend.ViewModels.Widgets;

// Files.Shared
global using global::Files.Shared;
global using global::Files.Shared.Enums;
global using global::Files.Shared.Extensions;
Expand Down
10 changes: 2 additions & 8 deletions src/Files.App/Helpers/EnvHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using Files.Backend.Enums;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.ApplicationModel;
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

namespace Files.App.Helpers
{
Expand Down
3 changes: 0 additions & 3 deletions src/Files.App/Helpers/UIFilesystemHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
using Files.App.Dialogs;
using Files.App.Filesystem.StorageItems;
using Files.App.ViewModels.Dialogs;
using Files.Backend.Enums;
using Files.Backend.Extensions;
using Files.Backend.Services;
using Microsoft.Extensions.Logging;
using System.Collections.Concurrent;
using System.IO;
Expand Down
15 changes: 0 additions & 15 deletions src/Files.App/Interacts/BaseLayoutCommandImplementationModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,10 @@

#nullable disable warnings

using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.WinUI;
using Files.App.Extensions;
using Files.App.Filesystem;
using Files.App.Filesystem.StorageItems;
using Files.App.Helpers;
using Files.App.ServicesImplementation;
using Files.App.ViewModels;
using Files.App.Views;
using Files.Backend.Enums;
using Files.Shared;
using Files.Shared.Enums;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Input;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Windows.ApplicationModel.DataTransfer;
using Windows.ApplicationModel.DataTransfer.DragDrop;
using Windows.Storage;
Expand Down
10 changes: 0 additions & 10 deletions src/Files.App/ServicesImplementation/FileTagsService.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using CommunityToolkit.Mvvm.DependencyInjection;
using Files.App.Filesystem;
using Files.Backend.AppModels;
using Files.Backend.Services;
using Files.Backend.Services.Settings;
using Files.Backend.ViewModels.FileTags;
using Files.Sdk.Storage;
using Files.Sdk.Storage.Extensions;
using Files.Sdk.Storage.LocatableStorage;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;

namespace Files.App.ServicesImplementation
{
Expand Down
2 changes: 0 additions & 2 deletions src/Files.App/ServicesImplementation/ImagingService.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Files.Backend.Models;
using Files.Backend.Services;
using Files.Sdk.Storage;
using Files.Sdk.Storage.LocatableStorage;
using Windows.Storage.FileProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
using Files.App.Filesystem;
using Files.App.Helpers;
using Files.App.Storage.WindowsStorage;
using Files.Backend.Models;
using Files.Backend.Services;
using Files.Sdk.Storage.LocatableStorage;
using Files.Shared.Enums;
using Microsoft.Extensions.Logging;
Expand Down
2 changes: 0 additions & 2 deletions src/Files.App/ServicesImplementation/VolumeInfoFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Licensed under the MIT License. See the LICENSE.

using Files.App.Helpers;
using Files.Backend.Models;
using Files.Backend.Services;

namespace Files.App.ServicesImplementation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ private void MainPanel_SizeChanged(object sender, SizeChangedEventArgs e)
VisualStateManager.GoToState(this, stateToGoName, false);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Files.Backend.SecureStore;
using System.IO;
using System.Windows.Input;
using Windows.Storage;
Expand Down
7 changes: 4 additions & 3 deletions src/Files.App/ViewModels/Properties/HashesViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using CommunityToolkit.Mvvm.ComponentModel;
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.WinUI;
using Files.App.Extensions;
using Files.App.Filesystem;
using Files.Backend.Models;
using Files.Backend.Services.Settings;
using Files.Shared.Extensions;
using Files.Shared.Helpers;
using System;
Expand Down
12 changes: 4 additions & 8 deletions src/Files.App/ViewModels/Properties/Items/FolderProperties.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using ByteSizeLib;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.WinUI;
using Files.App.Extensions;
using Files.App.Filesystem;
using Files.App.Filesystem.StorageItems;
using Files.App.Helpers;
using Files.App.Shell;
using Microsoft.Extensions.Logging;
using Microsoft.UI.Dispatching;
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using ByteSize = ByteSizeLib.ByteSize;

namespace Files.App.ViewModels.Properties
{
Expand Down
12 changes: 3 additions & 9 deletions src/Files.App/ViewModels/Properties/MainPropertiesViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.Mvvm.Input;
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Files.App.Views.Properties;
using Files.Backend.Enums;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using System.Linq;
using System.Threading;
using Microsoft.UI.Xaml.Media.Animation;

namespace Files.App.ViewModels.Properties
Expand Down
8 changes: 4 additions & 4 deletions src/Files.App/ViewModels/Widgets/FileTagsItemViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Files.Backend.Models;
using Files.Sdk.Storage.Extensions;
using Files.Sdk.Storage.LocatableStorage;
using Files.Backend.Helpers;
using Files.App.UserControls.Widgets;

namespace Files.App.ViewModels.Widgets
{
public sealed partial class FileTagsItemViewModel : WidgetCardItem
{
private readonly ILocatableStorable _associatedStorable;
private readonly Func<string, Task> _openAction; // A workaround for lack of MVVM-compliant navigation support.
// This workaround must be kept until further refactor of navigation code is completed

// A workaround for lack of MVVM-compliant navigation support.
// This workaround must be kept until further refactor of navigation code is completed.
private readonly Func<string, Task> _openAction;

[ObservableProperty]
private IImageModel? _Icon;
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Views/Properties/HashesPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:datamodels="using:Files.Backend.Data.Models"
xmlns:helpers="using:Files.App.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="using:Files.Backend.Models"
xmlns:toolkitconverters="using:CommunityToolkit.WinUI.UI.Converters"
xmlns:vm="using:Files.App.ViewModels.Properties"
DataContext="{x:Bind HashesViewModel, Mode=OneWay}"
Expand Down Expand Up @@ -129,7 +129,7 @@

<!-- Template -->
<ListView.ItemTemplate>
<DataTemplate x:DataType="models:HashInfoItem">
<DataTemplate x:DataType="datamodels:HashInfoItem">
<ListViewItem IsSelected="{x:Bind IsSelected, Mode=TwoWay}" Visibility="{x:Bind IsEnabled, Mode=OneWay}">
<Grid ColumnSpacing="12">
<Grid.ColumnDefinitions>
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Views/Properties/HashesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e)

private void CopyHashButton_Click(object sender, RoutedEventArgs e)
{
var item = (Backend.Models.HashInfoItem)(((Button)sender).DataContext);
var item = (HashInfoItem)(((Button)sender).DataContext);

var dp = new Windows.ApplicationModel.DataTransfer.DataPackage();
dp.SetText(item.HashValue);
Expand Down
Loading