-
Notifications
You must be signed in to change notification settings - Fork 201
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
Serialized show, update and dismiss actions. #22
base: master
Are you sure you want to change the base?
Conversation
Thanks! |
It seems okay, but the [KVNProgress showWithStatus:@"show"];
[KVNProgress updateStatus:@"test"]; // never occurs Also, if this flow appears: [KVNProgress showWithStatus:@"show"];
[KVNProgress dismiss];
[KVNProgress showWithStatus:@"test"];
[KVNProgress dismiss]; What the user should see is the "show", then the "test" on the HUD and then, and only then, the It's a good start, but I don't want to rush before pushing this to master and Cocoapods. |
Kevin, I expected that we would have to use our own changes until you were John On Thu, Jan 29, 2015 at 4:19 PM, Kevin Hirsch [email protected]
|
Thank you for fixing the first issue!
|
Kevin, I pushed up a fix for the update defect. It wasn't the semaphore, but For the other case you bring up I'm not actually sure that swallowing the John On Thu, Jan 29, 2015 at 4:19 PM, Kevin Hirsch [email protected]
|
Why did you add this? For the case: show, dismiss, show, dismiss, after thinking about it, you might be correct because if the two shows are on different views, the flow has to dismiss the first show before showing the second one. I have to say I find the code a little bit complicated to read now, thus to maintain. I'm not a fan of doing things such: [NSThread sleepForTimeInterval:delay]; dispatch_async([self sharedView].queue, ^{
dispatch_sync(dispatch_get_main_queue(), ^{
// update progress Would it not be better to have something like operations that are just waiting for executing (being showed) with a "smart" queue that will handle the order of executing those operations, taking care of the minimum display times and, of course, of the synchronization of all operations to avoid issues like a never dismissing HUD: #15.
What do you think about this idea? |
Kevin, Yes, that sounds good. That means rewriting to use an NSOperationQueue and John On Fri, Jan 30, 2015 at 9:24 AM, Kevin Hirsch [email protected]
|
Yes, that means write a similar queue like I was thinking of maybe a custom queue object that will mimic the
Does it seems a good implementation to you? |
Kevin, Sorry I didn't get back to you earlier, yesterday was a busy day. Your I'll think about this some more, and possibly try a new implementation if I John On Fri, Jan 30, 2015 at 10:35 AM, Kevin Hirsch [email protected]
|
Kevin,
I have made changes to serialize the show, update, and dismiss actions by using a dispatch_queue and a semaphore. This does not change your api, but does introduce slight semantic change, because now there is a minimum duration for any show or update action. I could add logic to make updates check how long the dialog has been showing, but wanted to keep the flow as simple as possible to start.
Let me know what you think,
John