{"action":"opened","number":366,"pull_request":{"url":"https://api.github.com/repos/jdg/MBProgressHUD/pulls/366","id":66724715,"html_url":"https://github.com/jdg/MBProgressHUD/pull/366","diff_url":"https://github.com/jdg/MBProgressHUD/pull/366.diff","patch_url":"https://github.com/jdg/MBProgressHUD/pull/366.patch","issue_url":"https://api.github.com/repos/jdg/MBProgressHUD/issues/366","number":366,"state":"open","locked":false,"title":"Don't depend on `finished` from animation completion block","user":{"login":"yas375","id":217368,"avatar_url":"https://avatars.githubusercontent.com/u/217368?v=3","gravatar_id":"","url":"https://api.github.com/users/yas375","html_url":"https://github.com/yas375","followers_url":"https://api.github.com/users/yas375/followers","following_url":"https://api.github.com/users/yas375/following{/other_user}","gists_url":"https://api.github.com/users/yas375/gists{/gist_id}","starred_url":"https://api.github.com/users/yas375/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yas375/subscriptions","organizations_url":"https://api.github.com/users/yas375/orgs","repos_url":"https://api.github.com/users/yas375/repos","events_url":"https://api.github.com/users/yas375/events{/privacy}","received_events_url":"https://api.github.com/users/yas375/received_events","type":"User","site_admin":false},"body":"Steps to reproduce in the sample app\r\n\r\n1. Tap on a \"Determinate mode\" to bring the HUD\r\n2. While the HUS is still presented background the app\r\n3. Wait for 5 seconds until the HUD should have disappered\r\n4. Foreground the app\r\n\r\nExpected: no HUD, you can interact with the app.\r\nResult without this: you can't interact with the app.\r\n\r\nYou could probably reproduce it in other apps using this library by backgrounding the app while the HUD is presented and then foregrounding it after `MBProgressHUD#hideAnimated:` is called. Unless you specify \r\n\r\nIt happens because HUD wasn't removed from its superview. And it wasn't removed because the app was in background when `hideAnimated:` was called and animation wasn't finished.\r\n\r\n---\r\n\r\nFrom what I [found](https://github.com/jdg/MBProgressHUD/commit/f39a83aef637b3c6fb0c1adc160b8cbb894a7b9a) the `finished` parameter was used to avoid removing the HUD from view hierarchy if it gets `showAnimated:` shortly after `hideAnimated`. BTW, unit tests are really helpful for understanding reasoning behind some changes 👍 \r\n\r\nI think this shouldn't depend on `finished` passed into completionBlock by `UIView+animateWithDuration:...`. As we've explored `finished` will be false when `hideAnimated:` was called when the app was in background.\r\n\r\nInstead, we can use property the library already has:\r\n\r\n```objective-c\r\n- (void)showAnimated:(BOOL)animated {\r\n    // ...\r\n    self.finished = NO;\r\n    // ...\r\n}\r\n\r\n- (void)hideAnimated:(BOOL)animated {\r\n    // ...\r\n    self.finished = YES;\r\n    // ...\r\n}\r\n```\r\n\r\nPassing unit tests prove that we are still getting the behavior we need when we reuse the HUD shortly after calling `hideAnimated` (`testAnimatedImmediateHudReuse` test).\r\n\r\nI've also tried to right a unit test for the error case I've described above, but didn't figure out how to make `UIView+animateWithDuration:...` call completion block with `finished` equal false. ","created_at":"2016-04-16T02:12:43Z","updated_at":"2016-04-16T02:12:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jdg/MBProgressHUD/pulls/366/commits","review_comments_url":"https://api.github.com/repos/jdg/MBProgressHUD/pulls/366/comments","review_comment_url":"https://api.github.com/repos/jdg/MBProgressHUD/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jdg/MBProgressHUD/issues/366/comments","statuses_url":"https://api.github.com/repos/jdg/MBProgressHUD/statuses/78153d66bafb5f036b9861548da438f50b1fe99e","head":{"label":"carezone:yas-animation-interruption","ref":"yas-animation-interruption","sha":"78153d66bafb5f036b9861548da438f50b1fe99e","user":{"login":"carezone","id":445750,"avatar_url":"https://avatars.githubusercontent.com/u/445750?v=3","gravatar_id":"","url":"https://api.github.com/users/carezone","html_url":"https://github.com/carezone","followers_url":"https://api.github.com/users/carezone/followers","following_url":"https://api.github.com/users/carezone/following{/other_user}","gists_url":"https://api.github.com/users/carezone/gists{/gist_id}","starred_url":"https://api.github.com/users/carezone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carezone/subscriptions","organizations_url":"https://api.github.com/users/carezone/orgs","repos_url":"https://api.github.com/users/carezone/repos","events_url":"https://api.github.com/users/carezone/events{/privacy}","received_events_url":"https://api.github.com/users/carezone/received_events","type":"Organization","site_admin":false},"repo":{"id":56357945,"name":"MBProgressHUD","full_name":"carezone/MBProgressHUD","owner":{"login":"carezone","id":445750,"avatar_url":"https://avatars.githubusercontent.com/u/445750?v=3","gravatar_id":"","url":"https://api.github.com/users/carezone","html_url":"https://github.com/carezone","followers_url":"https://api.github.com/users/carezone/followers","following_url":"https://api.github.com/users/carezone/following{/other_user}","gists_url":"https://api.github.com/users/carezone/gists{/gist_id}","starred_url":"https://api.github.com/users/carezone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carezone/subscriptions","organizations_url":"https://api.github.com/users/carezone/orgs","repos_url":"https://api.github.com/users/carezone/repos","events_url":"https://api.github.com/users/carezone/events{/privacy}","received_events_url":"https://api.github.com/users/carezone/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/carezone/MBProgressHUD","description":"MBProgressHUD + Customizations","fork":true,"url":"https://api.github.com/repos/carezone/MBProgressHUD","forks_url":"https://api.github.com/repos/carezone/MBProgressHUD/forks","keys_url":"https://api.github.com/repos/carezone/MBProgressHUD/keys{/key_id}","collaborators_url":"https://api.github.com/repos/carezone/MBProgressHUD/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/carezone/MBProgressHUD/teams","hooks_url":"https://api.github.com/repos/carezone/MBProgressHUD/hooks","issue_events_url":"https://api.github.com/repos/carezone/MBProgressHUD/issues/events{/number}","events_url":"https://api.github.com/repos/carezone/MBProgressHUD/events","assignees_url":"https://api.github.com/repos/carezone/MBProgressHUD/assignees{/user}","branches_url":"https://api.github.com/repos/carezone/MBProgressHUD/branches{/branch}","tags_url":"https://api.github.com/repos/carezone/MBProgressHUD/tags","blobs_url":"https://api.github.com/repos/carezone/MBProgressHUD/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/carezone/MBProgressHUD/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/carezone/MBProgressHUD/git/refs{/sha}","trees_url":"https://api.github.com/repos/carezone/MBProgressHUD/git/trees{/sha}","statuses_url":"https://api.github.com/repos/carezone/MBProgressHUD/statuses/{sha}","languages_url":"https://api.github.com/repos/carezone/MBProgressHUD/languages","stargazers_url":"https://api.github.com/repos/carezone/MBProgressHUD/stargazers","contributors_url":"https://api.github.com/repos/carezone/MBProgressHUD/contributors","subscribers_url":"https://api.github.com/repos/carezone/MBProgressHUD/subscribers","subscription_url":"https://api.github.com/repos/carezone/MBProgressHUD/subscription","commits_url":"https://api.github.com/repos/carezone/MBProgressHUD/commits{/sha}","git_commits_url":"https://api.github.com/repos/carezone/MBProgressHUD/git/commits{/sha}","comments_url":"https://api.github.com/repos/carezone/MBProgressHUD/comments{/number}","issue_comment_url":"https://api.github.com/repos/carezone/MBProgressHUD/issues/comments{/number}","contents_url":"https://api.github.com/repos/carezone/MBProgressHUD/contents/{+path}","compare_url":"https://api.github.com/repos/carezone/MBProgressHUD/compare/{base}...{head}","merges_url":"https://api.github.com/repos/carezone/MBProgressHUD/merges","archive_url":"https://api.github.com/repos/carezone/MBProgressHUD/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/carezone/MBProgressHUD/downloads","issues_url":"https://api.github.com/repos/carezone/MBProgressHUD/issues{/number}","pulls_url":"https://api.github.com/repos/carezone/MBProgressHUD/pulls{/number}","milestones_url":"https://api.github.com/repos/carezone/MBProgressHUD/milestones{/number}","notifications_url":"https://api.github.com/repos/carezone/MBProgressHUD/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/carezone/MBProgressHUD/labels{/name}","releases_url":"https://api.github.com/repos/carezone/MBProgressHUD/releases{/id}","deployments_url":"https://api.github.com/repos/carezone/MBProgressHUD/deployments","created_at":"2016-04-16T00:50:13Z","updated_at":"2016-04-16T00:50:14Z","pushed_at":"2016-04-16T01:43:33Z","git_url":"git://github.com/carezone/MBProgressHUD.git","ssh_url":"git@github.com:carezone/MBProgressHUD.git","clone_url":"https://github.com/carezone/MBProgressHUD.git","svn_url":"https://github.com/carezone/MBProgressHUD","homepage":"http://www.bukovinski.com/","size":917,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jdg:master","ref":"master","sha":"605f9d762ec5a924a5a2b8331d1aa7595a17ab8e","user":{"login":"jdg","id":6725,"avatar_url":"https://avatars.githubusercontent.com/u/6725?v=3","gravatar_id":"","url":"https://api.github.com/users/jdg","html_url":"https://github.com/jdg","followers_url":"https://api.github.com/users/jdg/followers","following_url":"https://api.github.com/users/jdg/following{/other_user}","gists_url":"https://api.github.com/users/jdg/gists{/gist_id}","starred_url":"https://api.github.com/users/jdg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdg/subscriptions","organizations_url":"https://api.github.com/users/jdg/orgs","repos_url":"https://api.github.com/users/jdg/repos","events_url":"https://api.github.com/users/jdg/events{/privacy}","received_events_url":"https://api.github.com/users/jdg/received_events","type":"User","site_admin":false},"repo":{"id":215047,"name":"MBProgressHUD","full_name":"jdg/MBProgressHUD","owner":{"login":"jdg","id":6725,"avatar_url":"https://avatars.githubusercontent.com/u/6725?v=3","gravatar_id":"","url":"https://api.github.com/users/jdg","html_url":"https://github.com/jdg","followers_url":"https://api.github.com/users/jdg/followers","following_url":"https://api.github.com/users/jdg/following{/other_user}","gists_url":"https://api.github.com/users/jdg/gists{/gist_id}","starred_url":"https://api.github.com/users/jdg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdg/subscriptions","organizations_url":"https://api.github.com/users/jdg/orgs","repos_url":"https://api.github.com/users/jdg/repos","events_url":"https://api.github.com/users/jdg/events{/privacy}","received_events_url":"https://api.github.com/users/jdg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jdg/MBProgressHUD","description":"MBProgressHUD + Customizations","fork":false,"url":"https://api.github.com/repos/jdg/MBProgressHUD","forks_url":"https://api.github.com/repos/jdg/MBProgressHUD/forks","keys_url":"https://api.github.com/repos/jdg/MBProgressHUD/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jdg/MBProgressHUD/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jdg/MBProgressHUD/teams","hooks_url":"https://api.github.com/repos/jdg/MBProgressHUD/hooks","issue_events_url":"https://api.github.com/repos/jdg/MBProgressHUD/issues/events{/number}","events_url":"https://api.github.com/repos/jdg/MBProgressHUD/events","assignees_url":"https://api.github.com/repos/jdg/MBProgressHUD/assignees{/user}","branches_url":"https://api.github.com/repos/jdg/MBProgressHUD/branches{/branch}","tags_url":"https://api.github.com/repos/jdg/MBProgressHUD/tags","blobs_url":"https://api.github.com/repos/jdg/MBProgressHUD/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jdg/MBProgressHUD/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jdg/MBProgressHUD/git/refs{/sha}","trees_url":"https://api.github.com/repos/jdg/MBProgressHUD/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jdg/MBProgressHUD/statuses/{sha}","languages_url":"https://api.github.com/repos/jdg/MBProgressHUD/languages","stargazers_url":"https://api.github.com/repos/jdg/MBProgressHUD/stargazers","contributors_url":"https://api.github.com/repos/jdg/MBProgressHUD/contributors","subscribers_url":"https://api.github.com/repos/jdg/MBProgressHUD/subscribers","subscription_url":"https://api.github.com/repos/jdg/MBProgressHUD/subscription","commits_url":"https://api.github.com/repos/jdg/MBProgressHUD/commits{/sha}","git_commits_url":"https://api.github.com/repos/jdg/MBProgressHUD/git/commits{/sha}","comments_url":"https://api.github.com/repos/jdg/MBProgressHUD/comments{/number}","issue_comment_url":"https://api.github.com/repos/jdg/MBProgressHUD/issues/comments{/number}","contents_url":"https://api.github.com/repos/jdg/MBProgressHUD/contents/{+path}","compare_url":"https://api.github.com/repos/jdg/MBProgressHUD/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jdg/MBProgressHUD/merges","archive_url":"https://api.github.com/repos/jdg/MBProgressHUD/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jdg/MBProgressHUD/downloads","issues_url":"https://api.github.com/repos/jdg/MBProgressHUD/issues{/number}","pulls_url":"https://api.github.com/repos/jdg/MBProgressHUD/pulls{/number}","milestones_url":"https://api.github.com/repos/jdg/MBProgressHUD/milestones{/number}","notifications_url":"https://api.github.com/repos/jdg/MBProgressHUD/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jdg/MBProgressHUD/labels{/name}","releases_url":"https://api.github.com/repos/jdg/MBProgressHUD/releases{/id}","deployments_url":"https://api.github.com/repos/jdg/MBProgressHUD/deployments","created_at":"2009-05-31T21:45:41Z","updated_at":"2016-04-15T23:45:54Z","pushed_at":"2016-04-05T11:17:35Z","git_url":"git://github.com/jdg/MBProgressHUD.git","ssh_url":"git@github.com:jdg/MBProgressHUD.git","clone_url":"https://github.com/jdg/MBProgressHUD.git","svn_url":"https://github.com/jdg/MBProgressHUD","homepage":"http://www.bukovinski.com/","size":1502,"stargazers_count":10788,"watchers_count":10788,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2833,"mirror_url":null,"open_issues_count":28,"forks":2833,"open_issues":28,"watchers":10788,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jdg/MBProgressHUD/pulls/366"},"html":{"href":"https://github.com/jdg/MBProgressHUD/pull/366"},"issue":{"href":"https://api.github.com/repos/jdg/MBProgressHUD/issues/366"},"comments":{"href":"https://api.github.com/repos/jdg/MBProgressHUD/issues/366/comments"},"review_comments":{"href":"https://api.github.com/repos/jdg/MBProgressHUD/pulls/366/comments"},"review_comment":{"href":"https://api.github.com/repos/jdg/MBProgressHUD/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jdg/MBProgressHUD/pulls/366/commits"},"statuses":{"href":"https://api.github.com/repos/jdg/MBProgressHUD/statuses/78153d66bafb5f036b9861548da438f50b1fe99e"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":4,"deletions":4,"changed_files":1}}