-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent synchronization of user data #1829
Comments
This is an interesting use case... Per the current state, as long as API plugin is add and configured with correct configuration, DataStore will attempt data syncing on each DataStore API calls (e.g. save, delete, query etc.). There is no way to stop it permanently and programmatically. Your workaround is not working due to DynamoDB limitation, that a Scan operation originated from a sync query requires a range 1 to 1000000. Something I can think of now is to check user subscription tier, and then initialize and add API plugin based on the check. This requires to kill the App process and restart the App after user subscription tier changes. (your workaround also requires this as Amplify plugins are not re-configurable at runtime at this moment). Please feel free to file a feature request to stop DataStore sync permanently on demand. |
Alright, restarting the app might be the best solution I guess. Thank you! ... where do I pose the feature request? |
Further, it is written in this Flutter Doc: that also just subsets of data can be synced by providing certain sync expression when configuring the DataStore plugin. It is also said that these expressions can be re-evaluated at runtime by changing some parameter (in this case it is some threshold rating (int) of a post, changed from "at least 5" to "at least 1") and by calling By this, I think I should be able to get what I want....:
|
You can modify your original post in this issue as a feature request. :)
I personally not recommending using sync expressions for this purpose. Sync expressions cannot be used without cost, if you read the doc further you will notice the Scan vs Query operations on the sync query. |
This feature (or lack of currently) is what is stopping me from using the amplify packages. I think being able to turn on/off sync at runtime is critical for any app wanting to offer tiered services. Offline first is already supported (which I think is great and very appealing which is what brought me to solution in the first place) so this seems to be a next logical step. |
@scottbisaillon I understand. Historically, it's been a limitation of AppSync, but they recently released support for enhanced subscription filtering which would solve this problem. We are currently working on integrating it into the Amplify CLI and expect it to make possible this and many more use cases. |
Closing this issue in favor of this feature request tracking issue #1692 . |
Hello there,
I would like to only permit the synchronization of the data stored with DataStore if and only if the user bought premium access to the app.
As you can guess, the user must have some kind of authentication because he or she should be able to buy premium access. I do this using the cognito service granting the user an unique ID which is used during the purchasing process.
Now, I have the problem that as soon as the user logs in, the data is synchronized directly...
Hence, I tried to set the "syncMaxRecords" value to 0 when configuring the DataStore Pluging in the app:
This seems to be fine, although I receive some amplify error when the app "tries" to sync:
Is this the way to go??
Best regards
The text was updated successfully, but these errors were encountered: