How update view automatically dailyPageViewController screen?
majidsaleem105 opened this issue · 5 comments
Hi Everyone,
I used Synchronized View Controllers to build the home page of my app. I'm facing an issue that if I add or remove any task from the store, I've to manually do a pull to refresh
to display/remove the tasks from the list.
It shows an empty card if I remove a task from the store. I've to do a pull to refresh
manually to remove this empty card from the list.
Thanks in advance!
- Majid S.
Which "fetchAndObserveEvents" method is being called on the task controller? If the variety that requires a task query is used, the controller will not synchronize with the desired tasks if they aren't yet in the store. It's a known issue that we are planning on fixing.
Try using the variety that accepts task IDs and let me know if that solves the issue you're seeing:
fetchAndObserveEvents(forTaskIDs:eventQuery:)
I tried fetchAndObserveEvents
but it didn't affect anything. You can review the code here https://gist.github.com/majidsaleem105/f0f861db28ef42be13f3d65b40694db0
Also, a separate question:
Is there a way that we could add a Wait / Loading screen to sync the data between server and app before landing on the CareViewController screen?
Because sometimes the syncing APIs take a moment to get the information from the server.
Thanks,
- Majid S.
Adding a new task
In that gist, it looks to me like this is the setup:
- Fetch all tasks from the store
- Create a custom task view controller for each task
- Subscribe to task/event changes
If the task doesn't exist in step 1, it can't be fetched from the store. That's likely why you're not seeing that task card show up immediately when the task is added.
Deleting a task
When a task is deleted in this setup, it's expected that the contents of the card are empty.
Next steps
These are known pain points when it comes to building out a more custom list of tasks, and it's something we're working towards fixing. In the meantime, if you'd like you can try something a bit experimental. You can try building out a collection/table view controller that has an OCKTaskController
. The controller can be used to fetch and subscribe to events. When new events are received (added/updated/deleted), you can update the data source for the collection/table view. This route is in contrast to the current setup here in which a collection view controller has multiple task view controllers.
Thanks, @gavirawson-apple for your reply.
- I've implemented an alternate solution to resolve this issue by calling the reload function in the ViewDidLoad function.
Sounds great!