nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.32k stars 1.78k forks source link

Automatic file update detection: better inform user how this works #7885

Open volhovm opened 3 years ago

volhovm commented 3 years ago

Steps to reproduce

  1. Download a file using android client
  2. Update&save it locally, e.g. add an annotation to a pdf
  3. Verify that the file in the nextcloud dir (on the disk) is actually updated

Expected behaviour

Actual behaviour

Environment data

Android version: miui 10.3.2.0

Device model: mipad 4

Stock or customized system:

Nextcloud app version: 3.14.3

Nextcloud server version:

Reverse proxy:

tobiasKaminsky commented 3 years ago

I see on my server that Android app periodically checks for those files/folders. Can you also check this? Either in nextcloud.log or access log of nginx/Apache.

volhovm commented 3 years ago

No, I don't see such a behaviour. I get many logs associated with the event of opening the file on my phone/tablet (this issue exits on both), but I can't see anything else afterwards. As I said, it seems that files are updated on the disk, but android app does not see the change. Under the name of the file, in android "list" view, I see "N minutes ago", as if I hadn't made the change seconds ago. When I click on the file again, it reopens it considering my changes, and this label switches to "seconds ago", and then everything syncs. If I merely reopen/save/edit file on my local android storage, nextcloud does not see it.

radry commented 3 years ago

Apparenlty the app doesn't automatically synchronate remote folders. It seems to me the "synchronize" feature is merely a "make available offline" feature in the app.

That means local changes or additions to a "synced" folder do in fact not get synced. Neither do changes of the remote folders content get synced automatically to the android device. Although it shows you the changes in the app (new files and folders that appeared on the remot server) BUT it doesn't download /sync them automatically. You have to sync manually every time and it only works to DOWNLOAD. It never UPLOADS anything from the android device. (Unless you set up a auto upload folder but that's another issue again)

volhovm commented 3 years ago

I was strongly under the impression that this type of behaviour existed before in the app. I think I even tested it:

I was reading PDFs and saving annotations, and it worked just fine, I could finish reading on my tablet and then the changes would automatically appear on my computer (given that my pdf viewer saves the file automatically from time to time, and when I lock the device).

volhovm commented 3 years ago

Hm. I set up "automatic upload" feature on the whole big folder with my pdf files and it seems to work. Takes a while to detect the change (like, 5 mins), but overall better than nothing. Was this always the only way to do this, and what I said before is just a false memory?

radry commented 3 years ago

Hm. I set up "automatic upload" feature on the whole big folder with my pdf files and it seems to work. Takes a while to detect the change (like, 5 mins), but overall better than nothing. Was this always the only way to do this, and what I said before is just a false memory?

This is something different. The "Automatic upload" function as you describe only uploads local files. This works and also detects new files. It doesn't download new files on the remote location.
OP wants that files that have been downloaded from the server get uploaded (synced) after they have changed.

volhovm commented 3 years ago

I'm not quite sure. I agree with you, but in reality what happens is that when the file is updated in nextcloud, the local file in the android/data/ directory is deleted/changed, so my pdf reader refuses to open it and I open it using the nextcloud app again. Not sure how consistent this is, or whether this is actually even a feature.

But yes, ideally I'd like to have a full sync for a chosen directory.

radry commented 3 years ago

You might be right. I haven't tried deleting a file on the server that has been "auto uploaded" via the app. But when you create a "auto upload" folder pair, it doesn't download existing files from remote to local, it will only upload local files to the server. It's aparently only one way sync from mobile(local) to remote for backup purposes.

tobiasKaminsky commented 3 years ago

We have a background job that runs every 15min if you are connected to wifi. Then this checks every downloaded file and syncs it, if needed.

@volhovm do you have wifi enabled and connected?

volhovm commented 3 years ago

Yes, I'm using wifi for this because of the intuitive suspicion it's only wifi-related, but it's good to confirm :). Would it be possible to have a setting to decrease this timing to some lower value, like 1 minute? Also, are there any logs I can check to see if this job succeeds?

tobiasKaminsky commented 3 years ago

Would it be possible to have a setting to decrease this timing to some lower value, like 1 minute?

We try to avoid having too many settings, but try to use a sane default.

Also, are there any logs I can check to see if this job succeeds?

Settings -> Logs if your are on RC / beta program.

jeffWelling commented 3 years ago

Can I recommend notifying the user regarding this 15min delay in syncing? Or perhaps the job could trigger immediately when the user hits Save?

Eg when I tell the app to auto-upload a folder, maybe a little notification saying something like "Please wait 15min for the scheduled job to run" or just have the job trigger immediately?

I had no idea it only runs every 15min until I read this, I've been trying to figure out why autoupload isn't working and now I'm left wondering if I just tested it before the job ran. From the number of people reporting autoupload problems on this Issues page I'm thinking it's likely not me but now I have to do another round of testing to find out.

My testing methodology was to turn on autoupload for some folders, and then check the server storage in the WebUI. I see the space hasn't changed, and there are no files in the Upload section on my phone, and there's no indication of any background job that is scheduled to run either. I think it's fair to arrive at the conclusion that the feature was broken in this situation, even if it wasn't, because it didn't do what was expected. It violated the principle of least astonishment.

I understand wanting to use sane defaults to avoid options-overload but.. this has not lead to a great experience for me so far.

tobiasKaminsky commented 3 years ago

I changed title, as this is indeed something we need to clarify for the user.

b-pfl commented 3 years ago

Is there a way to monitor on Android if a file is modified (what about https://developer.android.com/reference/android/os/FileObserver?)? If such a method exists, the NC client could subscibe to the "modified" event and immediately trigger a synchronization?

Btw: I experienced the same confusion as I was expecting a behavior as explained in this post.