{"action":"created","issue":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3465","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3465/labels{/name}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3465/comments","events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3465/events","html_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3465","id":64594697,"number":3465,"title":"Unread notification tab bar icon changed to be orange dot","user":{"login":"oguzkocer","id":662023,"avatar_url":"https://avatars.githubusercontent.com/u/662023?v=3","gravatar_id":"","url":"https://api.github.com/users/oguzkocer","html_url":"https://github.com/oguzkocer","followers_url":"https://api.github.com/users/oguzkocer/followers","following_url":"https://api.github.com/users/oguzkocer/following{/other_user}","gists_url":"https://api.github.com/users/oguzkocer/gists{/gist_id}","starred_url":"https://api.github.com/users/oguzkocer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oguzkocer/subscriptions","organizations_url":"https://api.github.com/users/oguzkocer/orgs","repos_url":"https://api.github.com/users/oguzkocer/repos","events_url":"https://api.github.com/users/oguzkocer/events{/privacy}","received_events_url":"https://api.github.com/users/oguzkocer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/milestones/37","html_url":"https://github.com/wordpress-mobile/WordPress-iOS/milestones/5.1","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/milestones/37/labels","id":1031640,"number":37,"title":"5.1","description":"","creator":{"login":"jleandroperez","id":1195260,"avatar_url":"https://avatars.githubusercontent.com/u/1195260?v=3","gravatar_id":"","url":"https://api.github.com/users/jleandroperez","html_url":"https://github.com/jleandroperez","followers_url":"https://api.github.com/users/jleandroperez/followers","following_url":"https://api.github.com/users/jleandroperez/following{/other_user}","gists_url":"https://api.github.com/users/jleandroperez/gists{/gist_id}","starred_url":"https://api.github.com/users/jleandroperez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jleandroperez/subscriptions","organizations_url":"https://api.github.com/users/jleandroperez/orgs","repos_url":"https://api.github.com/users/jleandroperez/repos","events_url":"https://api.github.com/users/jleandroperez/events{/privacy}","received_events_url":"https://api.github.com/users/jleandroperez/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":1,"state":"open","created_at":"2015-03-20T20:20:04Z","updated_at":"2015-03-26T17:56:08Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-03-26T17:56:08Z","updated_at":"2015-03-27T18:15:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3465","html_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3465","diff_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3465.diff","patch_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3465.patch"},"body":"Closes #3263.\r\n\r\nThis PR removes the badge count in the notification tab and replaces it with an orange dot, which basically tells the user that there are some unread notifications he/she should look at.\r\n\r\nSome details:\r\n\r\n* The visibility of the dot is tightly coupled with the `[[UIApplication sharedApplication] applicationIconBadgeNumber]`. We basically hide if the badge number is zero and show it in other cases. If the icon was hidden, we'll also play a short scaling animation to get the user's attention.\r\n* I've considered a lot of different approaches and even tried some of them but I think the current solution is the best one when you consider the trade-offs.\r\n* The trickiest bit of this issue was the placement of the orange dot on top of the notification tab. Unfortunately, we can't just replace the icon for the tab, since we want to play an animation and Apple doesn't give us any way to get the position of the tab, so we need to manually calculate it.\r\n* In most cases the calculation is pretty simple, we just get the top position of the tabbar and use an offset to calculate the vertical position. Horizontal position is a little more complicated, we need take the extra space iPad and iPhone 6 Plus has before & after the tabbar. The horizontal position is calculated through the center of the tab, so we calculate the center position and then use an offset to pinpoint.\r\n* Finally, we need to update the position of the dot upon rotation and iOS7 & iOS8 uses different methods to achieve that.\r\n\r\nAll in all, I think this is a pretty good solution, but it's not perfect in any means. I really don't like that we have constants like `static NSInteger const kNotificationBadgeIconHorizontalOffsetForIPadInLandscape = 232;` or `static NSInteger const kNotificationBadgeIconHorizontalOffsetForIPhone6PlusInLandscape = 93;` but I think it was necessary in this case. Also, if the user doesn't allow us to send push notifications, this solution will not work. We have considered adding a fallback mechanism with @jleandroperez using Core Data but ultimately decided that it wouldn't be a good solution for our needs. Since, this was how the application was functioning before this issue, I assume it's fine to keep it like that.\r\n\r\nYou can find all the screenshots and a video of the scaling animation here: https://cloudup.com/cT0jCbGlYZx\r\n\r\n@diegoreymendez & @jleandroperez - Can I bother you with a review? It'd be great if you guys can give a whirl in your devices as well!\r\n\r\n@drw158 Could you take a look at the positioning of the dot in the screenshots? The horizontal offset from center is 10px if you're wondering. Also, please let me know if you have any questions related to the implementation details."},"comment":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/comments/87038277","html_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3465#issuecomment-87038277","issue_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3465","id":87038277,"user":{"login":"oguzkocer","id":662023,"avatar_url":"https://avatars.githubusercontent.com/u/662023?v=3","gravatar_id":"","url":"https://api.github.com/users/oguzkocer","html_url":"https://github.com/oguzkocer","followers_url":"https://api.github.com/users/oguzkocer/followers","following_url":"https://api.github.com/users/oguzkocer/following{/other_user}","gists_url":"https://api.github.com/users/oguzkocer/gists{/gist_id}","starred_url":"https://api.github.com/users/oguzkocer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oguzkocer/subscriptions","organizations_url":"https://api.github.com/users/oguzkocer/orgs","repos_url":"https://api.github.com/users/oguzkocer/repos","events_url":"https://api.github.com/users/oguzkocer/events{/privacy}","received_events_url":"https://api.github.com/users/oguzkocer/received_events","type":"User","site_admin":false},"created_at":"2015-03-27T18:15:03Z","updated_at":"2015-03-27T18:15:03Z","body":"@jleandroperez Yeap, I know it's AppStore safe :+1: I am just saying we're playing with something that's not open knowledge. So, there is no way to know if it'll fail later on. Having said that, it's not a big deal, I think it's just a matter of preference."}}