Skip to content
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

Automatically enable and disable widget's CloudKit sync based on sync notifications #96

Open
skjiisa opened this issue Jun 15, 2024 · 0 comments

Comments

@skjiisa
Copy link
Owner

skjiisa commented Jun 15, 2024

I'm definitely going to need to experiment with this, but I believe NSPersistentStoreRemoteChange will be fired whenever Core Data receives changes from CloudKit, including when it does a fresh sync on app launch. Right now, the widget always tries to manually pull from CloudKit to display the most up-to-date info possible, and only falls back to the local disk if the connection fails. I don't have data on this, but I would assume most users do not use Tickmate on multiple devices, and thus that sync every time the widget reloads is unnecessary. So what could be done instead, is have a property in the shared User Defaults that marks the last time a remote change was synced, and if one has never happened, or happened long enough ago, the widget doesn't bother with the CloudKit sync and just loads the data locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant