{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/comments/79838059","id":79838059,"diff_hunk":"@@ -0,0 +1,182 @@\n+/* This Source Code Form is subject to the terms of the Mozilla Public\n+ * License, v. 2.0. If a copy of the MPL was not distributed with this\n+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n+\n+import Foundation\n+import Storage\n+\n+class BlurTableViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {\n+    var profile: Profile!\n+    var site: Site!\n+    var actions: [BlurTableViewAction] = []\n+    var tableView = UITableView()\n+    lazy var tapRecognizer: UITapGestureRecognizer = {\n+        let tapRecognizer = UITapGestureRecognizer()\n+        tapRecognizer.addTarget(self, action: #selector(BlurTableViewController.dismiss(_:)))\n+        tapRecognizer.numberOfTapsRequired = 1\n+        tapRecognizer.cancelsTouchesInView = false\n+        return tapRecognizer\n+    }()\n+\n+    lazy var visualEffectView : UIVisualEffectView = {\n+        let visualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .Light))\n+        visualEffectView.frame = self.view.bounds\n+        visualEffectView.alpha = 0.90\n+        return visualEffectView\n+    }()\n+\n+    lazy var bookmarkAction : BlurTableViewAction = {\n+        return BlurTableViewAction(title: NSLocalizedString(\"Bookmark\", comment: \"Context Menu Action for Activity Stream\"), iconString: \"action_bookmark\", handler: { action in\n+            let shareItem = ShareItem(url: self.site.url, title: self.site.title, favicon: self.site.icon)\n+            self.profile.bookmarks.shareItem(shareItem)\n+            if #available(iOS 9, *) {\n+                var userData = [QuickActions.TabURLKey: shareItem.url]\n+                if let title = shareItem.title {\n+                    userData[QuickActions.TabTitleKey] = title\n+                }\n+                QuickActions.sharedInstance.addDynamicApplicationShortcutItemOfType(.OpenLastBookmark,\n+                    withUserData: userData,\n+                    toApplication: UIApplication.sharedApplication())\n+            }\n+        })\n+    }()\n+\n+    lazy var deleteFromHistoryAction : BlurTableViewAction = {\n+        return BlurTableViewAction(title: NSLocalizedString(\"Delete from History\", comment: \"Context Menu Action for Activity Stream\"), iconString: \"action_delete\", handler: { action in\n+            self.profile.history.removeHistoryForURL(self.site.url)\n+        })\n+    }()\n+\n+    override func viewDidLoad() {\n+        super.viewDidLoad()\n+\n+        self.actions = [bookmarkAction, deleteFromHistoryAction]\n+        view.backgroundColor = UIColor.clearColor().colorWithAlphaComponent(0.4)\n+\n+        view.addGestureRecognizer(tapRecognizer)\n+\n+        view.addSubview(tableView)\n+        tableView.snp_makeConstraints { make in\n+            make.center.equalTo(self.view)\n+            make.width.equalTo(290)\n+            make.height.equalTo(73 + actions.count * 56)\n+        }\n+\n+        tableView.delegate = self\n+        tableView.dataSource = self\n+        tableView.keyboardDismissMode = UIScrollViewKeyboardDismissMode.OnDrag\n+        tableView.backgroundColor = UIConstants.PanelBackgroundColor\n+        tableView.scrollEnabled = false\n+        tableView.separatorColor = UIConstants.SeparatorColor\n+        tableView.layer.cornerRadius = 10\n+        tableView.registerClass(BlurTableViewCell.self, forCellReuseIdentifier: \"BlurTableViewCell\")\n+        tableView.registerClass(BlurTableViewHeaderCell.self, forCellReuseIdentifier: \"BlurTableViewHeaderCell\")\n+\n+        if #available(iOS 9, *) {\n+            tableView.cellLayoutMarginsFollowReadableWidth = false\n+        }\n+    }\n+\n+    func dismiss(gestureRecognizer: UIGestureRecognizer) {\n+        self.dismissViewControllerAnimated(true, completion: nil)\n+    }\n+\n+    deinit {\n+        // The view might outlive this view controller thanks to animations;\n+        // explicitly nil out its references to us to avoid crashes. Bug 1218826.\n+        tableView.dataSource = nil\n+        tableView.delegate = nil\n+    }\n+\n+    func numberOfSectionsInTableView(tableView: UITableView) -> Int {\n+        return 1\n+    }\n+\n+    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n+        return actions.count + 1\n+    }\n+\n+    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {\n+        if indexPath.row == 0 {\n+            return\n+        }\n+        let action = actions[indexPath.row - 1]\n+        return action.handler(action)\n+    }\n+\n+    func tableView(tableView: UITableView, hasFullWidthSeparatorForRowAtIndexPath indexPath: NSIndexPath) -> Bool {\n+        return true\n+    }\n+\n+    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {\n+        return indexPath.row == 0 ? 74 : 56\n+    }\n+\n+    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {\n+        if indexPath.row == 0 {\n+            let cell = tableView.dequeueReusableCellWithIdentifier(\"BlurTableViewHeaderCell\", forIndexPath: indexPath) as! BlurTableViewHeaderCell\n+            cell.preservesSuperviewLayoutMargins = false\n+            cell.separatorInset = UIEdgeInsetsZero\n+            cell.layoutMargins = UIEdgeInsetsZero\n+            cell.configureWithSite(site)\n+            return cell\n+        }\n+\n+        let cell = tableView.dequeueReusableCellWithIdentifier(\"BlurTableViewCell\", forIndexPath: indexPath) as! BlurTableViewCell\n+        let action = actions[indexPath.row - 1]\n+        cell.configureCell(action.title, imageString: action.iconString)\n+        return cell\n+    }\n+}\n+\n+class BlurTableViewHeaderCell: SimpleHighlightCell {","path":"Client/Frontend/Widgets/BlurTableViewController.swift","position":132,"original_position":132,"commit_id":"5d1835b5e4ddba3cdfbf60d3ef08617e3548f4d5","original_commit_id":"5d1835b5e4ddba3cdfbf60d3ef08617e3548f4d5","user":{"login":"sleroux","id":434322,"avatar_url":"https://avatars.githubusercontent.com/u/434322?v=3","gravatar_id":"","url":"https://api.github.com/users/sleroux","html_url":"https://github.com/sleroux","followers_url":"https://api.github.com/users/sleroux/followers","following_url":"https://api.github.com/users/sleroux/following{/other_user}","gists_url":"https://api.github.com/users/sleroux/gists{/gist_id}","starred_url":"https://api.github.com/users/sleroux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sleroux/subscriptions","organizations_url":"https://api.github.com/users/sleroux/orgs","repos_url":"https://api.github.com/users/sleroux/repos","events_url":"https://api.github.com/users/sleroux/events{/privacy}","received_events_url":"https://api.github.com/users/sleroux/received_events","type":"User","site_admin":false},"body":"I wonder if this subclass is needed. With autolayout, I think we can get away with just using the existing SimpleHighlightCell and add some properties to it to show/hide some labels which in turn set the height constraint to 0.","created_at":"2016-09-21T13:54:47Z","updated_at":"2016-09-21T14:01:32Z","html_url":"https://github.com/mozilla/firefox-ios/pull/2104#discussion_r79838059","pull_request_url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/2104","_links":{"self":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/comments/79838059"},"html":{"href":"https://github.com/mozilla/firefox-ios/pull/2104#discussion_r79838059"},"pull_request":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/2104"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/2104","id":86061641,"html_url":"https://github.com/mozilla/firefox-ios/pull/2104","diff_url":"https://github.com/mozilla/firefox-ios/pull/2104.diff","patch_url":"https://github.com/mozilla/firefox-ios/pull/2104.patch","issue_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/2104","number":2104,"state":"open","locked":false,"title":"Bug 1303880 - Implement UI (only) for context menu","user":{"login":"bkmunar","id":8356717,"avatar_url":"https://avatars.githubusercontent.com/u/8356717?v=3","gravatar_id":"","url":"https://api.github.com/users/bkmunar","html_url":"https://github.com/bkmunar","followers_url":"https://api.github.com/users/bkmunar/followers","following_url":"https://api.github.com/users/bkmunar/following{/other_user}","gists_url":"https://api.github.com/users/bkmunar/gists{/gist_id}","starred_url":"https://api.github.com/users/bkmunar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkmunar/subscriptions","organizations_url":"https://api.github.com/users/bkmunar/orgs","repos_url":"https://api.github.com/users/bkmunar/repos","events_url":"https://api.github.com/users/bkmunar/events{/privacy}","received_events_url":"https://api.github.com/users/bkmunar/received_events","type":"User","site_admin":false},"body":"1. Made a `BlurTableViewController` to act as the new Context menu for Activity stream\r\n2. Its data is powered by a list of `BlurTableViewActions` so that the menu can be configurable based on the context","created_at":"2016-09-20T21:41:03Z","updated_at":"2016-09-21T14:01:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7d458714038c33122f274881f5ea53131573b1ac","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/2104/commits","review_comments_url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/2104/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/2104/comments","statuses_url":"https://api.github.com/repos/mozilla/firefox-ios/statuses/5d1835b5e4ddba3cdfbf60d3ef08617e3548f4d5","head":{"label":"mozilla:bkmunar/asContextMenuUiOnly","ref":"bkmunar/asContextMenuUiOnly","sha":"5d1835b5e4ddba3cdfbf60d3ef08617e3548f4d5","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}","deployments_url":"https://api.github.com/repos/mozilla/firefox-ios/deployments","created_at":"2014-11-03T19:07:02Z","updated_at":"2016-09-21T13:35:22Z","pushed_at":"2016-09-21T13:43:38Z","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":307001,"stargazers_count":6206,"watchers_count":6206,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1256,"mirror_url":null,"open_issues_count":51,"forks":1256,"open_issues":51,"watchers":6206,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"aabbeca7a5a6d57bb902dc4a7da4c0ea5a6d390e","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}","deployments_url":"https://api.github.com/repos/mozilla/firefox-ios/deployments","created_at":"2014-11-03T19:07:02Z","updated_at":"2016-09-21T13:35:22Z","pushed_at":"2016-09-21T13:43:38Z","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":307001,"stargazers_count":6206,"watchers_count":6206,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1256,"mirror_url":null,"open_issues_count":51,"forks":1256,"open_issues":51,"watchers":6206,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/2104"},"html":{"href":"https://github.com/mozilla/firefox-ios/pull/2104"},"issue":{"href":"https://api.github.com/repos/mozilla/firefox-ios/issues/2104"},"comments":{"href":"https://api.github.com/repos/mozilla/firefox-ios/issues/2104/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/2104/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/2104/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/firefox-ios/statuses/5d1835b5e4ddba3cdfbf60d3ef08617e3548f4d5"}}}}
{"actor":{"display_login":"sleroux"}}