-
Notifications
You must be signed in to change notification settings - Fork 443
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
Updated Content #699
Comments
Hey @majidsaleem105, I'll ask a few questions to get a better sense of the setup in your app -
|
Hey @gavirawson-apple, Q: How and when are you generating the event query? var query = OCKTaskQuery(for: date) Q: Are you using a pre-packaged CareKit view controller or custom code? Q: Can you share the code you're using to fetch and display the tasks? Please let me know if you any additional information. Thanks,
|
Hey @gavirawson-apple, Any suggestions? Thanks,
|
Hey @gavirawson-apple, Please guide us on how we can resolve this issue. Thanks,
|
@majidsaleem105 thanks for the additional info. It looks to me like the pull to refresh feature implemented in the You can likely confirm if that's the underlying issue by looking at the calendar on the top of the |
Thanks, @gavirawson-apple, for your reply. That's correct. We want to use the new date after the midnight passes. Also, the calendar shows the old day selected after midnight if we don't swipe out of the app and bring it from the opened apps from the background. I'll go ahead and confirm the selected day again and let you know. Thank You.
|
As long as the correct tasks for the selected day are shown, there might not be a bug lurking here. If the displayed tasks do not correspond to the selected day, there's certainly a bug. If you'd like to refresh the selected date after midnight passes, I'd recommend hooking into this notification. A notification will get published around when midnight passes, and you can then go and refresh the selected date to match the current date. |
Hey @gavirawson-apple, I've verified that the top calendar shows yesterday as selected after midnight passes. I used the following line of code in the then This way, it simply refreshes the screen with the old date instead of the new date. Can you guide me if I'm using it inaccurately? Kind Regards,
|
What does you implementation of |
After making your suggested changes, dayChanged function will look like this: @objc func dayChanged(_ notification: Notification) { Am I using it in the correct way? |
Looks right to me! Does that fix your issue? |
Thanks, @gavirawson-apple but it didn't fix my problem. It still shows content from the last day. |
I've tried this out in the CareKitSample app and it seems to be working. Try cloning that project and opening override func viewDidLoad() {
super.viewDidLoad()
let changeNotificationName = UIApplication.significantTimeChangeNotification
NotificationCenter.default.addObserver(self, selector: #selector(selectCurrentDate), name: changeNotificationName, object: nil)
// ...
}
@objc private func selectCurrentDate() {
selectDate(Date(), animated: true)
} I'm not exactly sure why it's not working in your app. Is the code set up in a similar way as the snippet above? Are there any major differences that may be interfering here? |
Hey @majidsaleem105, did this solve your issue or are you still hitting a problem? |
Hey @gavirawson-apple, I am sorry for the delayed reply. I was super busy with other stuff and couldn't spare time to validate this yet. I'll try this and keep you posted. Thanks a lot for your time and for sharing this sample.
|
No problem at all! Take your time, just wanted to check in. We're here if you need us. |
Hi @gavirawson-apple,
We're using the CareKit 2.0 version and facing a strange issue. If we open the app, use it for a while to complete some of the tasks, and leave it open in the background. Now, suppose we do not open the app until midnight, and the date changes. If we open the app the next morning, it shows the events from the previous date instead of today's event. It shows the completed event from yesterday instead of incomplete events for today.
We have implemented the pull-down refresh feature to sync the tasks with the server and reload the screen, but it doesn't help to bring the events of the current day. We have to swipe out of the app and open it again to see today's events/tasks.
Can you please advise us on this?
How can we resolve this problem?
Thank You,
The text was updated successfully, but these errors were encountered: