You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using Datastore inside our app to get offline capability, which works really well.
Now we want to implement possibilities to capture images offline and upload it to the cloud, when a valid connection is established.
My suggestion is to store images on the local disc and listen to the Amplify.Hub to trigger some kind of upload function, when the hub invokes syncing. Is there maybe a better approach or even a best practice?
The text was updated successfully, but these errors were encountered:
If you're uploading files to the cloud, you'll want to investigate Amplify Storage. You can listen to the Amplify Hub events and then trigger appropriate Storage operations when the sync starts. We're working on a PR that will better explain the Hub Events so you can find the right one for your needs--my initial thought is that you'd want to listen for syncQueriesReady to ensure that all your model changes are up to date locally.
As far as best practices go: since we don't support Complex Objects in DataStore, it's really up to you how you want to reference the objects to the DataStore record. At a bare minimum, you'll need something by which you can derive the object's key, and you'll need to make sure your app uploads the object with appropriate access levels (protected, private, public) for your use case. Make sure you know how you want to handle error cases and consistency as well: e.g., should you wait to fire a mutation until the upload succeeds? Should a data model be changed to reflect a new status if the upload fails? Or are the objects and models loosely coupled enough that they don't need to be synchronized?
We are using Datastore inside our app to get offline capability, which works really well.
Now we want to implement possibilities to capture images offline and upload it to the cloud, when a valid connection is established.
My suggestion is to store images on the local disc and listen to the
Amplify.Hub
to trigger some kind of upload function, when the hub invokes syncing. Is there maybe a better approach or even a best practice?The text was updated successfully, but these errors were encountered: