nextcloud / nextcloud/ios

Open files do not refresh after a sync

Open
#925 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
2.5k
Forks
1k
Avg merge
2d 18h
Merged PRs (30d)
13

Description

Expected behaviour

If I view a text file and a sync happens in the background while I'm viewing it, I expect the file to display any sync updates from the server immediately. This is the behavior of other syncing apps I have used before Nextcloud.

Actual behaviour

When changes are downloaded in the background, the file I'm viewing doesn't get refreshed. The only way to see the changes are to back out and re-open the file, assuming you are even aware that changes have been synced (nothing tells you this happened).

This can result in data loss because the app does not seem to handle local-server file conflicts (see #903).

Steps to reproduce

Since cell service can be slow or spotty in some areas, it's possible to view a file before the latest version has been downloaded from the server. We will simulate this problem:

  1. Create a test text file and view it so it is cached locally on your phone. Close the app.
  2. Make some edits to the text file from another device and sync it to the server.
  3. Now, imagine it's a day later and you're traveling. Turn on airplane mode and disable wifi to simulate a spotty/slow cell connection.
  4. Open Nextcloud on your phone and view the test file. You'll be looking at an outdated version without the edits from step 2 due to the simulated slow/spotty connection.
  5. Turn off airplane mode/enable wifi to simulate the cell connection restoring.
  6. The changes from step 2 will sync in the background, but the file does not update while you're viewing it. Nothing tells you that changes have been synced.
  7. At this point, if you edit the outdated file you're viewing and save it, the changes that were synced in the background will be overwritten and lost.

This issue can be partially mitigated if the viewed file refreshes as soon as a sync happens in the background. But, in cases where cell service is too slow or nonexistent, the sync may not happen for the current session and data loss can still easily occur. To fully mitigate this and other issues like it (#904), I beg you to also consider supporting local to server file conflicts.

iOS version

12.4

App version

2.23.8 / 2.24.0b6

Server configuration

Operating system: Ubuntu 18.04.3

Web server: Apache

Database: mysql v5.7.27

PHP version: 7.2.20

Nextcloud version: 16.0.3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the background sync flow and how the currently viewed text file is loaded and refreshed in the iOS app. Reproduce the listed offline/online sequence with a cached file and edits from another device. Done means a background download refreshes the open file without requiring navigation, and the behavior is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.