{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/firefox-ios/issues/188","labels_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/188/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/188/comments","events_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/188/events","html_url":"https://github.com/mozilla/firefox-ios/pull/188","id":59200388,"number":188,"title":"Bug 1134796 - Create horizontally scrolling search engine row","user":{"login":"thebnich","id":1093266,"avatar_url":"https://avatars.githubusercontent.com/u/1093266?v=3","gravatar_id":"","url":"https://api.github.com/users/thebnich","html_url":"https://github.com/thebnich","followers_url":"https://api.github.com/users/thebnich/followers","following_url":"https://api.github.com/users/thebnich/following{/other_user}","gists_url":"https://api.github.com/users/thebnich/gists{/gist_id}","starred_url":"https://api.github.com/users/thebnich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thebnich/subscriptions","organizations_url":"https://api.github.com/users/thebnich/orgs","repos_url":"https://api.github.com/users/thebnich/repos","events_url":"https://api.github.com/users/thebnich/events{/privacy}","received_events_url":"https://api.github.com/users/thebnich/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-27T07:29:20Z","updated_at":"2015-03-02T23:22:26Z","closed_at":"2015-03-02T22:55:39Z","pull_request":{"url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/188","html_url":"https://github.com/mozilla/firefox-ios/pull/188","diff_url":"https://github.com/mozilla/firefox-ios/pull/188.diff","patch_url":"https://github.com/mozilla/firefox-ios/pull/188.patch"},"body":"This one ended up being more of a timesink than expected. Lots of lessons learned here:\r\n\r\n* `UITableViewController` is pretty limited, as we've been discussing over the past few days. The first commit here drops the `UITableViewController` subclassing in favor of a standard `UIViewController` with a `UITableView` subview.\r\n\r\n* When the screen is larger than the full set of engines, I figured we'd want to center the set of buttons instead of having the list anchored to the bottom left. That turned out to be a bit tricky with autolayout, but I managed to get it working with some of the lesser used constraints (`greaterThanOrEqualTo` and `lessThanOrEqualTo` mixed with priorities).\r\n\r\n* The only way to get the keyboard height is to add an observer to `NSNotificationCenter`, listening for `keyboardWillShow`/`keyboardWillHide`. But the keyboard is already showing when we add the `SearchViewController` since typing is what makes it appear, so that means the keyboard height must be known beforehand (since we won't get another notification). To manage this, I created a `KeyboardWatcher` utility class that anyone can hook into. A couple advantages:\r\n  1. `KeyboardWatcher` always keeps track of the keyboard state, so we can just read the keyboard height when its needed without worrying about missed notifications.\r\n  1. It contains a lot of the boilerplate for notification registration, reading the notification info, etc., so implementing a `KeyboardWatcherDelegate` should be more straightforward than dealing with `NSNotificationCenter` directly.\r\n\r\n* Finally, getting the animation constants from the notification info was a bear. Seems like it should be straightforward since we can get the constant via `userInfo[UIKeyboardAnimationCurveUserInfoKey]`, except this animation isn't exposed, so calling `UIViewAnimationCurve(rawValue: value)` returns `nil`! To get the proper `UIViewAnimationCurve`, we therefore need to create a dummy curve, then operate on an unsafe pointer to that dummy’s reference to change its value."},"comment":{"url":"https://api.github.com/repos/mozilla/firefox-ios/issues/comments/76849524","html_url":"https://github.com/mozilla/firefox-ios/pull/188#issuecomment-76849524","issue_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/188","id":76849524,"user":{"login":"thebnich","id":1093266,"avatar_url":"https://avatars.githubusercontent.com/u/1093266?v=3","gravatar_id":"","url":"https://api.github.com/users/thebnich","html_url":"https://github.com/thebnich","followers_url":"https://api.github.com/users/thebnich/followers","following_url":"https://api.github.com/users/thebnich/following{/other_user}","gists_url":"https://api.github.com/users/thebnich/gists{/gist_id}","starred_url":"https://api.github.com/users/thebnich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thebnich/subscriptions","organizations_url":"https://api.github.com/users/thebnich/orgs","repos_url":"https://api.github.com/users/thebnich/repos","events_url":"https://api.github.com/users/thebnich/events{/privacy}","received_events_url":"https://api.github.com/users/thebnich/received_events","type":"User","site_admin":false},"created_at":"2015-03-02T23:22:26Z","updated_at":"2015-03-02T23:22:26Z","body":"> Using these formatted strings for localized strings is probably a bad idea. It removes the ability to reorder the arguments.\r\n\r\nFiled [bug 1138711](https://bugzilla.mozilla.org/show_bug.cgi?id=1138711).\r\n\r\n> These wil need an active/hover state. Make sure its filed at least.\r\n\r\nFiled [bug 1138713](https://bugzilla.mozilla.org/show_bug.cgi?id=1138713)."}}