windows-universal icon indicating copy to clipboard operation
windows-universal copied to clipboard

Implement the function to synchronize selected directories in the background

Open SunboX opened this issue 9 years ago • 12 comments

SunboX avatar Nov 09 '16 19:11 SunboX

I'll have a try on that:

  1. Context menu for directories to sync
  2. When clicking that context menu, user needs to select a target folder on his/her device
  3. Add folder to FutureAccessList (to make it readable for Background Task)
  4. Create BackgroundTask running every x Minutes to compare synced directories with local copies

Another approach would be to use the Cached File Updater Contract (see https://dzone.com/articles/how-use-cached-file-updater) to always sync files before reading or after writing them on the device, but as I understand that's more useful if you edit a file from nextcloud and want to upload the updated content afterwards, without saving it locally.

TheScientist avatar Nov 23 '16 08:11 TheScientist

Hey, nice!

Your suggested behavior sounds good. But we should also find a solution for syncing folders that are only on the device by now (and not in the cloud). Additionally there should be a way to remove the sync of a folder.

SunboX avatar Nov 23 '16 08:11 SunboX

Started with some basic stuff like adding menuflyout item and saving information for the folders to synchronize in db. If someone is interested, the branch is linked above.

TheScientist avatar Dec 03 '16 14:12 TheScientist

Manual sync working (mostly). Next:

  • Error handling
  • Move code to background Task

TheScientist avatar Dec 18 '16 14:12 TheScientist

Has somebody an idea how to handle conflicts, e.g. file has changes locally and remotely? The easiest option to implement would be to use a default option (selectable in settings) like:

  • prefer remote file
  • prefer local file
  • prefer latest modified date

The other option would be to ask the user for every conflicted file. Maybe a separate page containing all conflicts with the above options to solve them or even a comparison view.

What do you think?

TheScientist avatar Dec 19 '16 10:12 TheScientist

I would prefer the second option, a separate site with all conflicts listed, so you can choose the resolution by file (or select all files). But I'm open for discussion. 😄

Btw., great work! 👍

SunboX avatar Dec 19 '16 10:12 SunboX

I'd like to ask you for testing the current state. Manual sync is finished from my perspective but may needs more error handling. I'll start to put all needed code in a background task library next week. This will also include common code like DirectoryService and ClientService. It would be possible to merge the current state into master - manual sync is better than none :)

TheScientist avatar Feb 18 '17 13:02 TheScientist

Hey, this sounds great! I havn't much time the next days. Let's see, maybe I find some time on the weekend. Thanks a lot for your work, this feature is really great and necessary. 👍

SunboX avatar Feb 21 '17 13:02 SunboX

Finally I got some time to try it out. Looks good to me! Maybe we should show a message box / a local push, if the app gets supended during synchronisation. So the user knows that it didn't finish and he has to restart it manually. This happens for example if the lock screen appears during sync (because synchronisation takes a long time).

Could you do a merge request for the current functionality?

Btw. do you know some nicer way to rely on SQLite? Maybe using NuGet? So we can avoid such things: https://github.com/SunboX/windows-universal/commit/b162478a08963a0f3855014052492f9ca0d3cc15

Maybe @altima knows a better way to do this?

SunboX avatar Mar 07 '17 16:03 SunboX

I think the anniversairy update sdk contains sqlite, so we could remove the dependency if we update the min Version for the app. I'll add the info when the app/sync get's suspended and create a pull request afterwards. But it won't be until next weekend.

TheScientist avatar Mar 12 '17 12:03 TheScientist

I think the anniversairy update sdk contains sqlite, so we could remove the dependency if we update the min Version for the app.

Ok, let's do this with the next app version (1.2.x) not the current one (1.1.0), so the users will have a bit more time to upgrade. 😄 By now I'm fine with using the UWP SQLite thing.

I'll add the info when the app/sync get's suspended and create a pull request afterwards. But it won't be until next weekend.

That's great, I also need some more time for the final 1.1.0 stuff. So no hurry, let me know if you have something I can merge. Would be nice to have this functionality in the app version 1.1.0.

SunboX avatar Mar 13 '17 09:03 SunboX

This issue can be closed, as we have #108 and #187

TheScientist avatar Jun 11 '17 13:06 TheScientist