nextcloud / ios

📱 Nextcloud iOS App
https://itunes.apple.com/us/app/nextcloud/id1125420102
GNU General Public License v3.0
1.94k stars 876 forks source link

[Feature] Two-way Sync #2670

Open AndyXheli opened 10 months ago

AndyXheli commented 10 months ago

Default one-way sync: assets sync from Photos to Server only. One-way smart sync: assets deleted from Server aren't re-synced from cloud. Two-way sync: assets deleted in Photos are deleted from server . Assets deleted from server are deleted in Photos. I would at least ask for the one-way smart sync; without that

AndyXheli commented 10 months ago

The common issue that i see is that if a user saves the photo from nextcloud to photos and if you have autoupload on its going to reupload the same photo again and then users get stuck with many dups. it would be nice to have some sort of rule that if the file already exist in nextcloud dont sync it or place them in a state that users need to verify.

ne20002 commented 10 months ago

It's basically two different features.

AndyXheli commented 10 months ago

@ne20002 Check out https://github.com/immich-app/ their app syncs with the ios photos app and the server and tells the users what on the server and whats on the iphone and you can mark it as download and it will show on the iphone photos. It actually a really cool product ive been testing it. I think Nextcloud should looking into something similar to Immich.

ne20002 commented 10 months ago

I'll give it try. As far as I know, an app can't remove files from photo roll without a popup confirming this action (which prevents a sync in background).

If immich is offering the requested functionality, why should Nextcloud implement this as well? Seems to be unnecessarily duplicated functionality.

AndyXheli commented 10 months ago

Well it nice to have one system that dose it all right ? Why have a system for photo storge and a system for file storge when you can have one system that dose best of both worlds.

ne20002 commented 10 months ago

There I have different opinion. Basic pattern: separation of concerns. I would go for the current upload with the Nextcloud app and for photo albums syncing with immich or some other app and a Nextcloud server app as backend for those.

AndyXheli commented 10 months ago

But Nextcloud client dose not detect duplicate Photos properly.

Example:

User download file from Shared Photos into iphone > auto upload is on Nextcloud client detect new phone or video and reuploads it into default Photos folder. Now the users need to delete all the photos that where reuploaded but already exist in Nextcloud Under Shared Photos Folder. This is not ideal for users and it dose not make sense as to why the files keeps getting reuploaded when the file already exist on the server.

There has to be a better way to sync photos then this.

ne20002 commented 10 months ago

I believe the original intention of the Nextcloud auto upload was work as a upload/backup solution so a upload is triggered on every add to the photo roll. The user may then delete photos on the device to save space. Syncing is a completely different use case. I would leave this to other app with other backends including e.g. albums and tagging. I doubt both features can work together side by side so if a user wants syncing, he may need to disable auto upload.

Also, the auto upload is DAV based and limited to that. A media collection with syncing both ways may need a completely different api.

zeratax commented 5 months ago

a proper sync feature is exactly what’s needed to replace icloud. sure you could probably set up this immich project to do that. but that requires access to the nextcloud server, which many nextcloud users don’t have. this is obviously desirable functionality for a cloud storage app, since i can already sync any other folder and this is also possible in the android app.

AndyXheli commented 1 month ago

@zeratax i would agree with you!! The hope is for nextcloud to support this feature

marinofaggiana commented 1 month ago

Hi !! it's a bit difficult ... the point is that an item on Apple devices has a code that is not sent to the server, so even if I want to delete a photo on the server then on the client I need that code ... moreover it is not possible for third-party apps (not Apple) to delete an item silently, a view always appears asking for permission (as it already does now) ... in short it is not an operation that can, at least for now, be done.

AndyXheli commented 1 month ago

Thanks for the update, @marinofaggiana!

I’m looking for a way to address duplicate photos between my iPhone and the Nextcloud server. Specifically, I want to avoid having the Nextcloud client re-upload photos that are already on the server.

Here’s the scenario: I have a photo stored in a folder on Nextcloud. I save that photo to my iPhone or iPad. When the Nextcloud client detects this new photo on my device, it re-uploads it to the server, leading to duplicates.

Is there a method to implement a sync that compares data between the iPhone and the Nextcloud server to eliminate these duplicates? I'm not necessarily looking for a full two-way sync but rather a solution that prevents this duplication issue.

Does this make sense? If you have any suggestions or solutions, I’d appreciate it!

marinofaggiana commented 1 month ago

@AndyXheli are you speaking via code ?

AndyXheli commented 1 month ago

@marinofaggiana Yes, via code.

I was looking at that immich-app and the Synology photos client and that how it seems they are doing it and i wonder what they are doing in the code

marinofaggiana commented 1 month ago

I don't know the Synology synchronizer... actually the filename would be enough (if it's already present, don't send it again) ?

AndyXheli commented 1 month ago

Hmm im not sure.

So For example i have a photo on the iphone named Photos IMG_0621 and it has been uploaded on my nextcloud as 24-08-17 09-30-43 0621.jpg. So I selected Save Live Photo to Photo Album on the nextcloud client and it saved it back down to my iphone and it has a new file name and now i see two of the same photos under my iphone and now i also see that the photo has been reuploaded as 24-08-17 09-30-43 73BB.jpg under nextcloud

image

Would there be a way to add something in the code if the ios client detects that the photo, videos been download or saved from the nextcloud client to not reuploaded it back to NC from that device ? What do you think ?

marinofaggiana commented 1 month ago

No, I was talking about how (simply) Synology did it, with Nextcloud you should use the original filename maybe even comparing some "internal metadata" to be sure it's the same photo...

AndyXheli commented 1 month ago

Oh i see what your talking about! Yea i think that would be cool if that can be done

marinofaggiana commented 1 month ago

let's say it could only work if you use the original filename and "deposit" the photos in the same folder structure... checking if the photo already exists by searching the entire server before uploading it would be too expensive.

AndyXheli commented 1 month ago

hmm what about if users have photos outside of the "Photos" folder lets say they also have another folder called Shared Photos. how would that work or can there be a metadata search or when the client i setup the photos tab its already looking that all the photos and folders so would there be a way to cache that locally and nextcloud client check local cache or would that be a nightmare ?

marinofaggiana commented 1 month ago

Locally you don't have everything ... you have a part or rather you have the part you looked at but if you clear the cache or reinstall the app .... It would not be reliable

AndyXheli commented 1 month ago

Ahhh okay! Hmmmm what do you think the best option would be then? or do you want to think about it ?