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

Update after Event Changes #267

Closed
justdan0227 opened this issue Mar 30, 2016 · 18 comments
Closed

Update after Event Changes #267

justdan0227 opened this issue Mar 30, 2016 · 18 comments
Labels

Comments

@justdan0227
Copy link

How do you get the calendar to refresh when we've update the Array backing events / dots?

@dbmrq
Copy link
Contributor

dbmrq commented Mar 30, 2016

calendarView.contentController.refreshPresentedMonth(), I think.
This should be better documented.

@elsesiy
Copy link
Member

elsesiy commented Mar 30, 2016

@justdan0227 Yes it's as described by @danielbmarques. If you've further remarks, please let me know otherwise closed.

@elsesiy elsesiy closed this as completed Mar 30, 2016
@dbmrq
Copy link
Contributor

dbmrq commented Mar 30, 2016

@elsesiy One problem with this is that it literally refreshes just the presented month, so if there are changes in the previous or next month they aren't refreshed.

I'm sorry for pointing out so many problems. Great work on this library overall, though. I love it. :)

@elsesiy
Copy link
Member

elsesiy commented Mar 30, 2016

@danielbmarques Thank you and no worries, it's fine :) You're absolutely right, as the signature states this func only refreshes the presented month. We should definitely add a func to update all months at once but one could circumenvent the issue by calling refresh if the month was changed...

@dbmrq
Copy link
Contributor

dbmrq commented Mar 30, 2016

@elsesiy When refreshing a month has little overhead that's fine, but sometimes it might not be a good idea to refresh it every time the month is changed.
Also, wouldn't it be better if the dot marker setup for previous and next months were done asynchronously? Maybe I'd find it better even for the current month – I'd prefer the dot markers to take a little longer to show than for the whole calendar to seem unresponsive –, but that's debatable.

@elsesiy
Copy link
Member

elsesiy commented Mar 30, 2016

@danielbmarques In general I'd agree with you, it was just a proposal for a quick fix, since I don't known when I'll have the time to add the desired functionality ;) Yup, async would be way better, even though it's debatable how useful a calendar without the annotations is in the first place..

@dbmrq
Copy link
Contributor

dbmrq commented Mar 30, 2016

Ok, then. Thanks again. I'll try to help as much as I can. :)

@justdan0227
Copy link
Author

Close. This "sort of works". So if my calendar uses shouldDisplayOnDayView to show if a calendar entry exists in my DB, new "events" are added just fine. However if I delete an event from the DB and then call refreshPresentedMonth, it does not clear the existing dayview even though i return false for the non db entries.

@elsesiy
Copy link
Member

elsesiy commented Mar 30, 2016

@justdan0227 I assume that you're not directly writing the database instead you might use a List or an Array as a temp storage. After removing the database entry, are you also refreshing the array/list? I'm doing the exact same thing in my app and it works flawlessly..

@justdan0227
Copy link
Author

Uggg.. how embarrassing! Yep didn't clear out the array when I read back from the DB! Thanks. One more question but I'll pose in another issue. Thanks!

@elsesiy
Copy link
Member

elsesiy commented Mar 30, 2016

@justdan0227 You're welcome!

@dbmrq
Copy link
Contributor

dbmrq commented Mar 30, 2016

@elsesiy Now I actually tried calling refresh when a month is changed and the dotViews still aren't refreshed for the month right after and right before. :/

That's because on didShowNextMonthView and didShowPreviousMonthView the presented month is still the last month, not the month that's actually showing. I try printing calendarView.contentController.presentedMonthView.date.month inside each method and the month is still the last month.

This makes the dot markers nearly useless, I can never be sure if they're shown correctly, so they just can't be trusted.
I'm trying to make a refresh function that really refreshes every month, but I couldn't figure it out so far.

The current function does this:

for weekV in presentedMonthView.weekViews {
    for dayView in weekV.dayViews {
        // …
    }
}

I tried changing it to:

for view in calendarView.subviews {
    if let dayView = view as? DayView {
        // …
    }
}

But it doesn't work.

Toggling the presented date always refreshes the whole thing, I think it's because of this:

monthViews[previous]?.removeFromSuperview()
monthViews[following]?.removeFromSuperview()
insertMonthView(getPreviousMonth(date), withIdentifier: previous)
insertMonthView(getFollowingMonth(date), withIdentifier: following)

But I couldn't figure out how to do just that to refresh the dot markers, and I'm not sure if it's the best way to accomplish that. Any suggestions?

In the meanwhile, I think this issue should be reopened.

@patchthecode
Copy link

@danielbmarques man! you find so many errors. I wish i had someone like you to take a quick look at my stuff on github >_<

@dbmrq
Copy link
Contributor

dbmrq commented Apr 3, 2016

@patchthecode Haha, I'm even feeling a little bad about it. I'm too much of a perfectionist.

@aalfath
Copy link

aalfath commented Jul 3, 2016

I have the same issue: the dot markers for previous and next month are not shown correctly.

Anyway awesome library guys, I am still learning but so far the Demo project helps a lot!

@stale
Copy link

stale bot commented Mar 8, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days. Thank you for your contributions.

@stale stale bot added the Stale label Mar 8, 2018
@stale
Copy link

stale bot commented Mar 16, 2018

This issue has been automatically closed because it has been inactive for 45 days.

@stale stale bot closed this as completed Mar 16, 2018
@Mathitos
Copy link

this issue was fixed?

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

No branches or pull requests

6 participants