This implements features #595 and #1111. It's my first time working with TypeScript, PHP, and Vue, so this is still a draft. I'm aware there are many things that need refactoring.
This adds two new buttons to the "move" modal called “Move and Organize” and "Copy".
To implement these features, I needed to make a few changes:
To accommodate adding multiple buttons, I refactored the chooseNcFolder function slightly. It now takes a buttonFactory instead of type as the third argument. setTypewas deprecated anyway in getFilePickerBuilder. The default value still behaves the same (providing the "Choose" option) so it doesn't break anything. Other types need to be defined manually.
Another approach could have been to keep a memories-defined type enum, and have button implementations defined based on the type passed. However, determining which button was pressed would be trickier with multiple buttons. The current approach however needs more work in order to have different buttons than "Choose".
I didn't implement the "Move to x" when a folder is selected, since with 3 buttons this can add a lot of text.
To optimize the movement of files to different folders, I also created a movePhotosByDate function for dav. This function first creates the required directories, then moves the files.
Initially, I considered a more general movePhotosToDestinations function that takes a Map<Path, IPhotos[]>, but this would require additional calls to create all the directories, check if they exist, and then create them. However, this approach could also allow for user-defined structures.
By the way, the new copyPhotos and movePhotos functions are very similar and could be merged.
This implements features #595 and #1111. It's my first time working with TypeScript, PHP, and Vue, so this is still a draft. I'm aware there are many things that need refactoring.
This adds two new buttons to the "move" modal called “Move and Organize” and "Copy".
To implement these features, I needed to make a few changes:
chooseNcFolder
function slightly. It now takes abuttonFactory
instead oftype
as the third argument.setType
was deprecated anyway ingetFilePickerBuilder
. The default value still behaves the same (providing the "Choose" option) so it doesn't break anything. Other types need to be defined manually.movePhotosByDate
function fordav
. This function first creates the required directories, then moves the files.By the way, the new
copyPhotos
andmovePhotos
functions are very similar and could be merged.