QField icon indicating copy to clipboard operation
QField copied to clipboard

Use QNetworkInformation to queue QFieldCloud pushes offline and resume when back online

Open kaustuvpokharel opened this issue 1 month ago • 1 comments

This change makes projectPush() network aware. When the device is offline, pushes are queued instead of expiring/timing out, and are automatically retried once the network becomes active again

Details

  • Use QNetworkInformation::Reachability (when available) to decide if the network looks active enough for a cloud push.
  • If the network is not active:
  • Store the requested push in a small in-memory queue keyed by projectId (merging shouldDownloadUpdates if multiple requests arrive for the same project).
  • Emit a warning() message: “Network is not currently active. We will push the changes automatically once you are back online.”
  • When reachability changes back to an active state, the queued pushes are flushed by recalling projectPush() for each queued project.
  • If QNetworkInformation or Reachability is not supported, behaviour stays unchanged (we dont block any pushes)

Behaviour notes

  • We still respect the existing ProjectStatus::Idle check before pushing
  • No changes to the QML API surface, the existing warning signal is used to show the message to the user

https://github.com/user-attachments/assets/c1545f8c-22ab-4187-92be-9be88d2a7746

kaustuvpokharel avatar Dec 12 '25 03:12 kaustuvpokharel

🎉 Ta-daaa, freshly created APKs are available for 53d278a2819a4168da0e554bebb63be49852589e: arm64-android

Other architectures

qfield-fairy avatar Dec 12 '25 04:12 qfield-fairy

🍎 MacOS DMG universal builds

Download a MacOS DMG universal build of this PR for testing. (Built from commit 53d278a2819a4168da0e554bebb63be49852589e)

🐧 Linux AppImage builds

Download a Linux AppImage build of this PR for testing. (Built from commit 53d278a2819a4168da0e554bebb63be49852589e)

🪟 Windows builds

Download a Windows build of this PR for testing. (Built from commit 53d278a2819a4168da0e554bebb63be49852589e)

qfield-fairy avatar Dec 16 '25 06:12 qfield-fairy