@@ -20,7 +20,7 @@ namespace Files.App.Utils.Storage
20
20
{
21
21
public sealed class FilesystemHelpers : IFilesystemHelpers
22
22
{
23
- private readonly IWindowsRecycleBinService WindowsRecycleBinService = Ioc . Default . GetRequiredService < IWindowsRecycleBinService > ( ) ;
23
+ private readonly IStorageTrashBinService StorageTrashBinService = Ioc . Default . GetRequiredService < IStorageTrashBinService > ( ) ;
24
24
private readonly static StatusCenterViewModel _statusCenterViewModel = Ioc . Default . GetRequiredService < StatusCenterViewModel > ( ) ;
25
25
26
26
private IShellPage associatedInstance ;
@@ -91,8 +91,8 @@ public async Task<ReturnResult> DeleteItemsAsync(IEnumerable<IStorageItemWithPat
91
91
92
92
var returnStatus = ReturnResult . InProgress ;
93
93
94
- var deleteFromRecycleBin = source . Select ( item => item . Path ) . Any ( WindowsRecycleBinService . IsRecycled ) ;
95
- var canBeSentToBin = ! deleteFromRecycleBin && await WindowsRecycleBinService . IsRecyclableAsync ( source . FirstOrDefault ( ) ? . Path ) ;
94
+ var deleteFromRecycleBin = source . Select ( item => item . Path ) . Any ( StorageTrashBinService . IsUnderTrashBin ) ;
95
+ var canBeSentToBin = ! deleteFromRecycleBin && await StorageTrashBinService . CanGoTrashBin ( source . FirstOrDefault ( ) ? . Path ) ;
96
96
97
97
if ( showDialog is DeleteConfirmationPolicies . Always ||
98
98
showDialog is DeleteConfirmationPolicies . PermanentOnly &&
@@ -103,9 +103,9 @@ showDialog is DeleteConfirmationPolicies.PermanentOnly &&
103
103
104
104
foreach ( var src in source )
105
105
{
106
- if ( WindowsRecycleBinService . IsRecycled ( src . Path ) )
106
+ if ( StorageTrashBinService . IsUnderTrashBin ( src . Path ) )
107
107
{
108
- binItems ??= await WindowsRecycleBinService . GetAllRecycleBinFoldersAsync ( ) ;
108
+ binItems ??= await StorageTrashBinService . GetAllRecycleBinFoldersAsync ( ) ;
109
109
110
110
// Might still be null because we're deserializing the list from Json
111
111
if ( ! binItems . IsEmpty ( ) )
@@ -364,9 +364,9 @@ public async Task<ReturnResult> CopyItemsFromClipboard(DataPackageView packageVi
364
364
List < ShellFileItem > ? binItems = null ;
365
365
foreach ( var item in source )
366
366
{
367
- if ( WindowsRecycleBinService . IsRecycled ( item . Path ) )
367
+ if ( StorageTrashBinService . IsUnderTrashBin ( item . Path ) )
368
368
{
369
- binItems ??= await WindowsRecycleBinService . GetAllRecycleBinFoldersAsync ( ) ;
369
+ binItems ??= await StorageTrashBinService . GetAllRecycleBinFoldersAsync ( ) ;
370
370
if ( ! binItems . IsEmpty ( ) ) // Might still be null because we're deserializing the list from Json
371
371
{
372
372
var matchingItem = binItems . FirstOrDefault ( x => x . RecyclePath == item . Path ) ; // Get original file name
@@ -512,9 +512,9 @@ public async Task<ReturnResult> MoveItemsFromClipboard(DataPackageView packageVi
512
512
List < ShellFileItem > ? binItems = null ;
513
513
foreach ( var item in source )
514
514
{
515
- if ( WindowsRecycleBinService . IsRecycled ( item . Path ) )
515
+ if ( StorageTrashBinService . IsUnderTrashBin ( item . Path ) )
516
516
{
517
- binItems ??= await WindowsRecycleBinService . GetAllRecycleBinFoldersAsync ( ) ;
517
+ binItems ??= await StorageTrashBinService . GetAllRecycleBinFoldersAsync ( ) ;
518
518
if ( ! binItems . IsEmpty ( ) ) // Might still be null because we're deserializing the list from Json
519
519
{
520
520
var matchingItem = binItems . FirstOrDefault ( x => x . RecyclePath == item . Path ) ; // Get original file name
@@ -637,7 +637,7 @@ public async Task<ReturnResult> RecycleItemsFromClipboard(DataPackageView packag
637
637
var source = await GetDraggedStorageItems ( packageView ) ;
638
638
ReturnResult returnStatus = ReturnResult . InProgress ;
639
639
640
- source = source . Where ( x => ! WindowsRecycleBinService . IsRecycled ( x . Path ) ) ; // Can't recycle items already in recyclebin
640
+ source = source . Where ( x => ! StorageTrashBinService . IsUnderTrashBin ( x . Path ) ) ; // Can't recycle items already in recyclebin
641
641
returnStatus = await DeleteItemsAsync ( source , showDialog , false , registerHistory ) ;
642
642
643
643
return returnStatus ;
0 commit comments