-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Added support to undo & redo file operations #2358
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
Conversation
This PR contains complete Undo, Redo functionallity. This PR is compatible with newest commit without merge issues. Please be aware that there still might be some bugs out there that sild in unnoticed.
Had this commented out because it wouldn't let me compile
The PR is Ready to be reviewed |
Files/Filesystem/StorageHistory/Helpers/StorageHistoryHelpers.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @d2dyno1 this is coming along nicely!
Some testing resulted in the following issues:
- crash deleting from recycle bin
2020-11-16 23:37:51.9637|ERROR|Files.App|Accesso negato. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))|System.UnauthorizedAccessException: Accesso negato. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at Files.Helpers.StorageItemHelpers.ToStorageItemCollection(IEnumerable`1 listedItems)
at Files.Views.Pages.ModernShellPage.KeyboardAccelerator_Invoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
at System.Threading.WinRTSynchronizationContextBase.Invoker.InvokeCore() - crash on drag and drop after hovering on a folder (and so navigating to it)
2020-11-16 23:39:21.3476|ERROR|Files.App|Object reference not set to an instance of an object.|System.NullReferenceException: Object reference not set to an instance of an object.
at Files.Filesystem.FilesystemHelpers.MoveItemAsync(IStorageItem source, String destination, Boolean registerHistory)
at Files.Filesystem.FilesystemHelpers.MoveItemsFromClipboard(DataPackageView packageView, String destination, Boolean registerHistory)
at Files.Filesystem.FilesystemHelpers.PerformOperationTypeAsync(DataPackageOperation operation, DataPackageView packageView, String destination, Boolean registerHistory)
at Files.BaseLayout.List_Drop(Object sender, DragEventArgs e)
at System.Threading.WinRTSynchronizationContextBase.Invoker.InvokeCore() - cltr-x copies instead of cutting
- cannot copy paste shortcut (.lnk) files
- crash pasting file to windows folder
2020-11-16 23:46:15.5820|ERROR|Files.App|Object reference not set to an instance of an object.|System.NullReferenceException: Object reference not set to an instance of an object.
at Files.Filesystem.FilesystemOperations.CopyAsync(IStorageItem source, String destination, IProgress1 progress, IProgress
1 errorCode, CancellationToken cancellationToken)
at Files.Filesystem.FilesystemHelpers.CopyItemAsync(IStorageItem source, String destination, Boolean registerHistory)
at Files.Filesystem.FilesystemHelpers.CopyItemsFromClipboard(DataPackageView packageView, String destination, Boolean registerHistory)
at Files.Filesystem.FilesystemHelpers.PerformOperationTypeAsync(DataPackageOperation operation, DataPackageView packageView, String destination, Boolean registerHistory)
at Files.Interacts.Interaction.PasteItem()
at System.Threading.WinRTSynchronizationContextBase.Invoker.InvokeCore() - does not copy files to usb connected android phone anymore
- crash when (this is difficult XD):
- copypaste a file to its same folder
- rename new file to something else
- ctrlz
- ctrlz
- ctrly
2020-11-16 23:35:48.9522|ERROR|Files.App|Impossibile trovare il file specificato. (Exception from HRESULT: 0x80070002)|System.IO.FileNotFoundException: Impossibile trovare il file specificato. (Exception from HRESULT: 0x80070002)
at Files.Helpers.StorageItemHelpers.ToStorageItem(String path)
at Files.Filesystem.FilesystemHistory.StorageHistoryOperations.Redo(IStorageHistory history)
at Files.Filesystem.FilesystemHistory.StorageHistoryHelpers.Redo()
at Files.Views.Pages.ModernShellPage.KeyboardAccelerator_Invoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
at System.Threading.WinRTSynchronizationContextBase.Invoker.InvokeCore()
Looks like I'll be busy... |
Are you trying to cast spells with this combination? 😆 |
Here are all the changes requested:
I'll report progress on them once they're completed * - TBD |
Delete dialog now works correctly. Files no longer crash when deleting from Recycle Bin. CTRL+X now moves items instead copying. Renamed Status enum to ReturnResult. Added SafeStorageItemHelpers class. Utilized FilesystemTasks on both StorageItemHelpers and SafeStorageItemHelpers
@gave92 Hmmm... It doesn't seem to crash for me
|
@d2dyno1 I'll check again 👍 |
Thanks for your work on this, I can confirm that many issues have been resolved. From testing the updated PR:
|
Code optimizations + I've created a little problem for myself in a StorageItemHelpers.ToStorageItem
Ok, I got around my issue, but it'd be way cleaner if |
@d2dyno1 glad you solved it. But making IStorageItemWithPath implement IStorageItem is something that we can totally consider. |
Changed private member names to camelCase
Resolved build error, fixed witchcraft combination. Added even more null checks
Files/Filesystem/StorageHistory/Helpers/StorageHistoryHelpers.cs
Outdated
Show resolved
Hide resolved
Files/Filesystem/StorageHistory/Helpers/StorageHistoryHelpers.cs
Outdated
Show resolved
Hide resolved
50th comment! |
👍 |
@d2dyno1
|
@d2dyno1 By the way, when renaming item several times and trying doing undo several times, it reverts only last change. |
@d2dyno1 Steps:
|
Fixed an issue where, restoring a folder that contained items within in, would not restore the items. Rewritten the App.StorageHistoryIndex (once again)
@tsvietOK Everything should be working now |
I'd like to thank everyone who helped me with this PR. Without you, this PR wouldn't be as it is now! Thanks, |
This PR features complete Undo, Redo functionality. This PR is compatible with newest commit without merge issues. Please be aware that there still might be some bugs out there that sild in unnoticed.
Resolves #1975
Closes #2250