In the app, every page has a “Continue” or “Proceed” button that triggers an API call to save the form data to the database. However, there’s an issue when the page has an image capture field.
For example, if I click a photo using the camera task and tap the tick button to confirm the image, the image gets uploaded to the server immediately. But if I don’t press the “Save” button on that page and kill the app, the form data isn’t saved.
Later, when I reopen the app from the drafts, the data on that page is empty because the “Save” button wasn’t pressed earlier. But the image is already on the server. Still, the app shows 0 uploaded images, because the local path (or reference to the uploaded image) wasn’t saved locally.
This causes a mismatch: the image exists on the server, but it’s not linked to the draft.
What is the best way to handle this kind of inconsistency? Is there a better approach to prevent such issues?