{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/comments/25186394","id":25186394,"diff_hunk":"@@ -6,98 +6,44 @@ import UIKit\n \n import Storage\n \n-class HistoryPanel: UITableViewController, HomePanel {\n-    private let CELL_IDENTIFIER = \"HISTORY_CELL\"\n-    private let HEADER_IDENTIFIER = \"HISTORY_HEADER\"\n-\n-    var history: Cursor? = nil\n-    var _profile: Profile? = nil\n-    weak var delegate: HomePanelDelegate? = nil\n-\n-    var profile: Profile! {\n-        get {\n-            return _profile\n-        }\n-\n-        set (profile) {\n-            self._profile = profile\n-\n-            let opts = QueryOptions()\n-            opts.sort = .LastVisit\n-\n-            profile.history.get(opts, complete: { (data: Cursor) -> Void in\n-                if data.status != .Success {\n-                    println(\"Err: \\(data.statusMessage)\")\n-                } else {\n-                    self.history = data\n-                    self.tableView.reloadData()\n-                }\n-            })\n-        }\n-    }\n-\n-    override func viewDidLoad() {\n-        super.viewDidLoad()\n-\n-        tableView.registerClass(TwoLineCell.self, forCellReuseIdentifier: CELL_IDENTIFIER)\n-    }\n-\n-    override func didReceiveMemoryWarning() {\n-        super.didReceiveMemoryWarning()\n-    }\n-\n-    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n-        if var hist = self.history {\n-            return hist.count\n-        }\n-        return 0\n+class HistoryPanel: HomePanelTableViewController {\n+    override func reloadData() {\n+        let opts = QueryOptions()\n+        opts.sort = .LastVisit\n+        profile.history.get(opts, complete: { (data: Cursor) -> Void in\n+            self.refreshControl?.endRefreshing()\n+            self.data = data\n+            self.tableView.reloadData()\n+        })\n     }\n \n     override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {\n-        var cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier(CELL_IDENTIFIER) as UITableViewCell\n-\n-        if var hist = self.history {\n-            if let site = hist[indexPath.row] as? Site {\n-                cell.textLabel?.text = site.title\n-                cell.detailTextLabel?.text = site.url\n-                if let img = site.icon? {\n-                    let imgURL = NSURL(string: img.url)\n-                    cell.imageView?.sd_setImageWithURL(imgURL, placeholderImage: self.profile.favicons.defaultIcon)\n-                } else {\n-                    cell.imageView?.image = self.profile.favicons.defaultIcon\n-                }\n+        let cell = super.tableView(tableView, cellForRowAtIndexPath: indexPath) as UITableViewCell!\n+        if let site = data[indexPath.row] as? Site {\n+            cell.textLabel?.text = site.title\n+            cell.detailTextLabel?.text = site.url\n+            if let img = site.icon? {\n+                let imgURL = NSURL(string: img.url)\n+                cell.imageView?.sd_setImageWithURL(imgURL, placeholderImage: self.profile.favicons.defaultIcon)\n+            } else {\n+                cell.imageView?.image = self.profile.favicons.defaultIcon\n             }\n         }\n \n         return cell\n     }\n \n-    override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {\n-        return 0\n-    }\n-\n-    override func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {\n-        return 0\n-    }\n-\n-    override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {\n-        return nil\n-    }\n-\n     override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {\n-        if var hist = self.history {\n-            if let site = hist[indexPath.row] as? Site {\n-                if let url = NSURL(string: site.url) {\n-                    delegate?.homePanel(didSubmitURL: NSURL(string: site.url)!)\n-                } else {\n-                    println(\"Error creating url for \\(site.url)\")\n-                }\n+        if let site = data[indexPath.row] as? Site {\n+            if let url = NSURL(string: site.url) {\n+                delegate?.homePanel(didSubmitURL: NSURL(string: site.url)!)","path":"Client/Frontend/Home/HistoryPanel.swift","position":110,"original_position":110,"commit_id":"e007fba10296522cbe30697ede74548a342e5c46","original_commit_id":"e007fba10296522cbe30697ede74548a342e5c46","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},"body":"<code>NSURL(string: site.url)!</code> -> <code>url</code>","created_at":"2015-02-23T18:11:34Z","updated_at":"2015-02-23T18:11:34Z","html_url":"https://github.com/mozilla/firefox-ios/pull/168#discussion_r25186394","pull_request_url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/168","_links":{"self":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/comments/25186394"},"html":{"href":"https://github.com/mozilla/firefox-ios/pull/168#discussion_r25186394"},"pull_request":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/168"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/168","id":29735028,"html_url":"https://github.com/mozilla/firefox-ios/pull/168","diff_url":"https://github.com/mozilla/firefox-ios/pull/168.diff","patch_url":"https://github.com/mozilla/firefox-ios/pull/168.patch","issue_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/168","number":168,"state":"open","locked":false,"title":"Bug 1135249 - Hide keyboard when I scroll on the homescreen","user":{"login":"wesj","id":1117644,"avatar_url":"https://avatars.githubusercontent.com/u/1117644?v=3","gravatar_id":"","url":"https://api.github.com/users/wesj","html_url":"https://github.com/wesj","followers_url":"https://api.github.com/users/wesj/followers","following_url":"https://api.github.com/users/wesj/following{/other_user}","gists_url":"https://api.github.com/users/wesj/gists{/gist_id}","starred_url":"https://api.github.com/users/wesj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wesj/subscriptions","organizations_url":"https://api.github.com/users/wesj/orgs","repos_url":"https://api.github.com/users/wesj/repos","events_url":"https://api.github.com/users/wesj/events{/privacy}","received_events_url":"https://api.github.com/users/wesj/received_events","type":"User","site_admin":false},"body":"This turns out to be a one line thing, except we'd have to do it in every panel. I took the chance to move all of the duplicated functionality from all of these that I could into one class. That guy HomePanelTableViewController, basically stubs out all the same basic functionality for tables. They all use the same cell and header types, they all dismiss the keyboard when they're dragged, they all support pull to refresh, etc. I even moved the SearchViewController which might be a bit contentious, since its a bit of a different beast. I think this will be useful when we start adding the footer buttons as well though (i.e. we can make this not a TableViewController if we want without having to update every class separately). Also, I deleted all the unused xibs.","created_at":"2015-02-20T22:00:59Z","updated_at":"2015-02-23T18:11:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/168/commits","review_comments_url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/168/comments","review_comment_url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/168/comments","statuses_url":"https://api.github.com/repos/mozilla/firefox-ios/statuses/e007fba10296522cbe30697ede74548a342e5c46","head":{"label":"wesj:keyboard","ref":"keyboard","sha":"e007fba10296522cbe30697ede74548a342e5c46","user":{"login":"wesj","id":1117644,"avatar_url":"https://avatars.githubusercontent.com/u/1117644?v=3","gravatar_id":"","url":"https://api.github.com/users/wesj","html_url":"https://github.com/wesj","followers_url":"https://api.github.com/users/wesj/followers","following_url":"https://api.github.com/users/wesj/following{/other_user}","gists_url":"https://api.github.com/users/wesj/gists{/gist_id}","starred_url":"https://api.github.com/users/wesj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wesj/subscriptions","organizations_url":"https://api.github.com/users/wesj/orgs","repos_url":"https://api.github.com/users/wesj/repos","events_url":"https://api.github.com/users/wesj/events{/privacy}","received_events_url":"https://api.github.com/users/wesj/received_events","type":"User","site_admin":false},"repo":{"id":27951196,"name":"firefox-ios-1","full_name":"wesj/firefox-ios-1","owner":{"login":"wesj","id":1117644,"avatar_url":"https://avatars.githubusercontent.com/u/1117644?v=3","gravatar_id":"","url":"https://api.github.com/users/wesj","html_url":"https://github.com/wesj","followers_url":"https://api.github.com/users/wesj/followers","following_url":"https://api.github.com/users/wesj/following{/other_user}","gists_url":"https://api.github.com/users/wesj/gists{/gist_id}","starred_url":"https://api.github.com/users/wesj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wesj/subscriptions","organizations_url":"https://api.github.com/users/wesj/orgs","repos_url":"https://api.github.com/users/wesj/repos","events_url":"https://api.github.com/users/wesj/events{/privacy}","received_events_url":"https://api.github.com/users/wesj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wesj/firefox-ios-1","description":"Firefox for iOS","fork":true,"url":"https://api.github.com/repos/wesj/firefox-ios-1","forks_url":"https://api.github.com/repos/wesj/firefox-ios-1/forks","keys_url":"https://api.github.com/repos/wesj/firefox-ios-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wesj/firefox-ios-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wesj/firefox-ios-1/teams","hooks_url":"https://api.github.com/repos/wesj/firefox-ios-1/hooks","issue_events_url":"https://api.github.com/repos/wesj/firefox-ios-1/issues/events{/number}","events_url":"https://api.github.com/repos/wesj/firefox-ios-1/events","assignees_url":"https://api.github.com/repos/wesj/firefox-ios-1/assignees{/user}","branches_url":"https://api.github.com/repos/wesj/firefox-ios-1/branches{/branch}","tags_url":"https://api.github.com/repos/wesj/firefox-ios-1/tags","blobs_url":"https://api.github.com/repos/wesj/firefox-ios-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wesj/firefox-ios-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wesj/firefox-ios-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/wesj/firefox-ios-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wesj/firefox-ios-1/statuses/{sha}","languages_url":"https://api.github.com/repos/wesj/firefox-ios-1/languages","stargazers_url":"https://api.github.com/repos/wesj/firefox-ios-1/stargazers","contributors_url":"https://api.github.com/repos/wesj/firefox-ios-1/contributors","subscribers_url":"https://api.github.com/repos/wesj/firefox-ios-1/subscribers","subscription_url":"https://api.github.com/repos/wesj/firefox-ios-1/subscription","commits_url":"https://api.github.com/repos/wesj/firefox-ios-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/wesj/firefox-ios-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/wesj/firefox-ios-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/wesj/firefox-ios-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/wesj/firefox-ios-1/contents/{+path}","compare_url":"https://api.github.com/repos/wesj/firefox-ios-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wesj/firefox-ios-1/merges","archive_url":"https://api.github.com/repos/wesj/firefox-ios-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wesj/firefox-ios-1/downloads","issues_url":"https://api.github.com/repos/wesj/firefox-ios-1/issues{/number}","pulls_url":"https://api.github.com/repos/wesj/firefox-ios-1/pulls{/number}","milestones_url":"https://api.github.com/repos/wesj/firefox-ios-1/milestones{/number}","notifications_url":"https://api.github.com/repos/wesj/firefox-ios-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wesj/firefox-ios-1/labels{/name}","releases_url":"https://api.github.com/repos/wesj/firefox-ios-1/releases{/id}","created_at":"2014-12-13T05:57:28Z","updated_at":"2015-02-20T01:52:02Z","pushed_at":"2015-02-20T22:09:30Z","git_url":"git://github.com/wesj/firefox-ios-1.git","ssh_url":"git@github.com:wesj/firefox-ios-1.git","clone_url":"https://github.com/wesj/firefox-ios-1.git","svn_url":"https://github.com/wesj/firefox-ios-1","homepage":"","size":17088,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"4a1cefde27e6a4ae558ea2e63e58184b5d68c399","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":26133979,"name":"firefox-ios","full_name":"mozilla/firefox-ios","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/firefox-ios","description":"Firefox for iOS","fork":false,"url":"https://api.github.com/repos/mozilla/firefox-ios","forks_url":"https://api.github.com/repos/mozilla/firefox-ios/forks","keys_url":"https://api.github.com/repos/mozilla/firefox-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/firefox-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/firefox-ios/teams","hooks_url":"https://api.github.com/repos/mozilla/firefox-ios/hooks","issue_events_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/firefox-ios/events","assignees_url":"https://api.github.com/repos/mozilla/firefox-ios/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/firefox-ios/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/firefox-ios/tags","blobs_url":"https://api.github.com/repos/mozilla/firefox-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/firefox-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/firefox-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/firefox-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/firefox-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/firefox-ios/languages","stargazers_url":"https://api.github.com/repos/mozilla/firefox-ios/stargazers","contributors_url":"https://api.github.com/repos/mozilla/firefox-ios/contributors","subscribers_url":"https://api.github.com/repos/mozilla/firefox-ios/subscribers","subscription_url":"https://api.github.com/repos/mozilla/firefox-ios/subscription","commits_url":"https://api.github.com/repos/mozilla/firefox-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/firefox-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/firefox-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/firefox-ios/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/firefox-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/firefox-ios/merges","archive_url":"https://api.github.com/repos/mozilla/firefox-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/firefox-ios/downloads","issues_url":"https://api.github.com/repos/mozilla/firefox-ios/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/firefox-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/firefox-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/firefox-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/firefox-ios/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/firefox-ios/releases{/id}","created_at":"2014-11-03T19:07:02Z","updated_at":"2015-02-23T15:50:37Z","pushed_at":"2015-02-23T15:50:37Z","git_url":"git://github.com/mozilla/firefox-ios.git","ssh_url":"git@github.com:mozilla/firefox-ios.git","clone_url":"https://github.com/mozilla/firefox-ios.git","svn_url":"https://github.com/mozilla/firefox-ios","homepage":"","size":23016,"stargazers_count":2927,"watchers_count":2927,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":467,"mirror_url":null,"open_issues_count":15,"forks":467,"open_issues":15,"watchers":2927,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/168"},"html":{"href":"https://github.com/mozilla/firefox-ios/pull/168"},"issue":{"href":"https://api.github.com/repos/mozilla/firefox-ios/issues/168"},"comments":{"href":"https://api.github.com/repos/mozilla/firefox-ios/issues/168/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/168/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/168/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/firefox-ios/statuses/e007fba10296522cbe30697ede74548a342e5c46"}}}}