{"action":"created","comment":{"url":"https://api.github.com/repos/material-components/material-components-ios/pulls/comments/144651606","pull_request_review_id":69343957,"id":144651606,"diff_hunk":"@@ -0,0 +1,200 @@\n+/*\n+ Copyright 2017-present the Material Components for iOS authors. All Rights Reserved.\n+\n+ Licensed under the Apache License, Version 2.0 (the \"License\");\n+ you may not use this file except in compliance with the License.\n+ You may obtain a copy of the License at\n+\n+ http://www.apache.org/licenses/LICENSE-2.0\n+\n+ Unless required by applicable law or agreed to in writing, software\n+ distributed under the License is distributed on an \"AS IS\" BASIS,\n+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ See the License for the specific language governing permissions and\n+ limitations under the License.\n+ */\n+\n+import UIKit\n+\n+import MaterialComponents.MaterialDialogs\n+\n+class MDCCatalogDebugSetting {\n+  init(title: String) {\n+    self.title = title\n+  }\n+\n+  public var title: String\n+  public var setter: (Bool) -> Void = { _ in }\n+  public var getter: () -> Bool = { false }\n+}\n+\n+class MDCCatalogDebugAlert: UICollectionViewController {\n+  fileprivate var settings = [MDCCatalogDebugSetting]()\n+\n+  fileprivate let layout = UICollectionViewFlowLayout()\n+  fileprivate let dialogTransitionController = MDCDialogTransitionController()\n+\n+  fileprivate var numberOfRows: Int {\n+    return settings.count + 1\n+  }\n+  fileprivate var dismissCellRow: Int {\n+    return settings.count\n+  }\n+\n+  override var preferredContentSize: CGSize {\n+    get { return CGSize.init(width: 400, height: self.numberOfRows * 44) }\n+    set { super.preferredContentSize = newValue }\n+  }\n+\n+  required init?(coder aDecoder: NSCoder) {\n+    fatalError(\"init(coder:) has not been implemented\")\n+  }\n+\n+  init(settings: [MDCCatalogDebugSetting]) {\n+    self.settings = settings\n+\n+    layout.minimumLineSpacing = 0\n+    layout.minimumInteritemSpacing = 0\n+\n+    super.init(collectionViewLayout: layout)\n+\n+    self.transitioningDelegate = dialogTransitionController\n+    self.modalPresentationStyle = .custom\n+  }\n+\n+  override func viewDidLoad() {\n+    super.viewDidLoad()\n+\n+    self.collectionView?.backgroundColor = UIColor.white\n+    self.collectionView?.register(MDCCatalogDebugToggleCell.self,\n+                                  forCellWithReuseIdentifier: \"toggle\")\n+    self.collectionView?.register(MDCCatalogDebugDismissCell.self,\n+                                  forCellWithReuseIdentifier: \"dismiss\")\n+  }\n+\n+  override func viewWillLayoutSubviews() {\n+    super.viewWillLayoutSubviews()\n+\n+    layout.itemSize = CGSize.init(width: self.view.frame.width, height: 44)\n+  }\n+\n+  override func collectionView(_ collectionView: UICollectionView,\n+                               cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n+    if indexPath.row == self.dismissCellRow {\n+      return collectionView.dequeueReusableCell(withReuseIdentifier: \"dismiss\", for: indexPath)\n+    }\n+    let cell = collectionView.dequeueReusableCell(withReuseIdentifier: \"toggle\", for: indexPath)\n+    if let cell = cell as? MDCCatalogDebugToggleCell {\n+      cell.setting = settings[indexPath.row]\n+    }\n+    return cell\n+  }\n+\n+  override func collectionView(_ collectionView: UICollectionView,\n+                               numberOfItemsInSection section: Int) -> Int {\n+    return self.numberOfRows\n+  }\n+\n+  override func collectionView(_ collectionView: UICollectionView,\n+                               didSelectItemAt indexPath: IndexPath) {\n+    if indexPath.row == self.dismissCellRow {\n+      self.dismiss(animated: true, completion: nil)\n+    }\n+  }\n+}\n+\n+fileprivate class MDCCatalogDebugToggleCell: UICollectionViewCell {\n+  private var _setting: MDCCatalogDebugSetting?\n+  var setting: MDCCatalogDebugSetting? {\n+    get {\n+      return _setting\n+    }\n+    set {\n+      _setting = newValue\n+      if let setting = _setting {\n+        label.text = setting.title\n+        toggleSwitch.isOn = setting.getter()\n+      }\n+    }\n+  }\n+\n+  let label = UILabel()\n+  let toggleSwitch = UISwitch()\n+\n+  required init?(coder aDecoder: NSCoder) {\n+    fatalError(\"init(coder:) has not been implemented\")\n+  }\n+\n+  override init(frame: CGRect) {\n+    super.init(frame: frame)\n+    contentView.addSubview(label)\n+    contentView.addSubview(toggleSwitch)\n+\n+    toggleSwitch.addTarget(self, action:#selector(switchToggled(sender:)), for: .touchUpInside)\n+  }\n+\n+  override func layoutSubviews() {\n+    super.layoutSubviews()\n+\n+    let width = self.contentView.bounds.width\n+    let height = self.contentView.bounds.height\n+\n+    let switchSize = toggleSwitch.sizeThatFits(self.contentView.bounds.size)\n+    toggleSwitch.frame = CGRect.init(x: width - switchSize.width - 10,\n+                                     y: (height - switchSize.height)/2.0,","path":"catalog/MDCCatalog/MDCCatalogDebugAlert.swift","position":null,"original_position":144,"commit_id":"ee7ae0c60dca526cd4d782b2d3f58695fbf1d490","original_commit_id":"f941c4ca9fd46a3f4794c851319bea046eb441bf","user":{"login":"samnm","id":1251373,"avatar_url":"https://avatars2.githubusercontent.com/u/1251373?v=4","gravatar_id":"","url":"https://api.github.com/users/samnm","html_url":"https://github.com/samnm","followers_url":"https://api.github.com/users/samnm/followers","following_url":"https://api.github.com/users/samnm/following{/other_user}","gists_url":"https://api.github.com/users/samnm/gists{/gist_id}","starred_url":"https://api.github.com/users/samnm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samnm/subscriptions","organizations_url":"https://api.github.com/users/samnm/orgs","repos_url":"https://api.github.com/users/samnm/repos","events_url":"https://api.github.com/users/samnm/events{/privacy}","received_events_url":"https://api.github.com/users/samnm/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2017-10-13T20:36:26Z","updated_at":"2017-10-13T20:36:26Z","html_url":"https://github.com/material-components/material-components-ios/pull/2179#discussion_r144651606","pull_request_url":"https://api.github.com/repos/material-components/material-components-ios/pulls/2179","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/material-components/material-components-ios/pulls/comments/144651606"},"html":{"href":"https://github.com/material-components/material-components-ios/pull/2179#discussion_r144651606"},"pull_request":{"href":"https://api.github.com/repos/material-components/material-components-ios/pulls/2179"}},"in_reply_to_id":144648318},"pull_request":{"url":"https://api.github.com/repos/material-components/material-components-ios/pulls/2179","id":146543682,"html_url":"https://github.com/material-components/material-components-ios/pull/2179","diff_url":"https://github.com/material-components/material-components-ios/pull/2179.diff","patch_url":"https://github.com/material-components/material-components-ios/pull/2179.patch","issue_url":"https://api.github.com/repos/material-components/material-components-ios/issues/2179","number":2179,"state":"open","locked":false,"title":"[Catalog] Debug UI for showing touches and safeAreaInsets","user":{"login":"samnm","id":1251373,"avatar_url":"https://avatars2.githubusercontent.com/u/1251373?v=4","gravatar_id":"","url":"https://api.github.com/users/samnm","html_url":"https://github.com/samnm","followers_url":"https://api.github.com/users/samnm/followers","following_url":"https://api.github.com/users/samnm/following{/other_user}","gists_url":"https://api.github.com/users/samnm/gists{/gist_id}","starred_url":"https://api.github.com/users/samnm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samnm/subscriptions","organizations_url":"https://api.github.com/users/samnm/orgs","repos_url":"https://api.github.com/users/samnm/repos","events_url":"https://api.github.com/users/samnm/events{/privacy}","received_events_url":"https://api.github.com/users/samnm/received_events","type":"User","site_admin":false},"body":"This PR replaces the triple-tap to show touches, with triple tap to display debug UI. Within the debug UI you can choose to show touches, show safeAreaInsets or not show the UI again until next restart.","created_at":"2017-10-13T20:06:15Z","updated_at":"2017-10-13T20:36:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5790f2e39a2316f665f7a4c0299ed4f4a2e3e521","assignee":{"login":"samnm","id":1251373,"avatar_url":"https://avatars2.githubusercontent.com/u/1251373?v=4","gravatar_id":"","url":"https://api.github.com/users/samnm","html_url":"https://github.com/samnm","followers_url":"https://api.github.com/users/samnm/followers","following_url":"https://api.github.com/users/samnm/following{/other_user}","gists_url":"https://api.github.com/users/samnm/gists{/gist_id}","starred_url":"https://api.github.com/users/samnm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samnm/subscriptions","organizations_url":"https://api.github.com/users/samnm/orgs","repos_url":"https://api.github.com/users/samnm/repos","events_url":"https://api.github.com/users/samnm/events{/privacy}","received_events_url":"https://api.github.com/users/samnm/received_events","type":"User","site_admin":false},"assignees":[{"login":"samnm","id":1251373,"avatar_url":"https://avatars2.githubusercontent.com/u/1251373?v=4","gravatar_id":"","url":"https://api.github.com/users/samnm","html_url":"https://github.com/samnm","followers_url":"https://api.github.com/users/samnm/followers","following_url":"https://api.github.com/users/samnm/following{/other_user}","gists_url":"https://api.github.com/users/samnm/gists{/gist_id}","starred_url":"https://api.github.com/users/samnm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samnm/subscriptions","organizations_url":"https://api.github.com/users/samnm/orgs","repos_url":"https://api.github.com/users/samnm/repos","events_url":"https://api.github.com/users/samnm/events{/privacy}","received_events_url":"https://api.github.com/users/samnm/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/material-components/material-components-ios/pulls/2179/commits","review_comments_url":"https://api.github.com/repos/material-components/material-components-ios/pulls/2179/comments","review_comment_url":"https://api.github.com/repos/material-components/material-components-ios/pulls/comments{/number}","comments_url":"https://api.github.com/repos/material-components/material-components-ios/issues/2179/comments","statuses_url":"https://api.github.com/repos/material-components/material-components-ios/statuses/ee7ae0c60dca526cd4d782b2d3f58695fbf1d490","head":{"label":"samnm:debug-insets","ref":"debug-insets","sha":"ee7ae0c60dca526cd4d782b2d3f58695fbf1d490","user":{"login":"samnm","id":1251373,"avatar_url":"https://avatars2.githubusercontent.com/u/1251373?v=4","gravatar_id":"","url":"https://api.github.com/users/samnm","html_url":"https://github.com/samnm","followers_url":"https://api.github.com/users/samnm/followers","following_url":"https://api.github.com/users/samnm/following{/other_user}","gists_url":"https://api.github.com/users/samnm/gists{/gist_id}","starred_url":"https://api.github.com/users/samnm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samnm/subscriptions","organizations_url":"https://api.github.com/users/samnm/orgs","repos_url":"https://api.github.com/users/samnm/repos","events_url":"https://api.github.com/users/samnm/events{/privacy}","received_events_url":"https://api.github.com/users/samnm/received_events","type":"User","site_admin":false},"repo":{"id":77934569,"name":"material-components-ios","full_name":"samnm/material-components-ios","owner":{"login":"samnm","id":1251373,"avatar_url":"https://avatars2.githubusercontent.com/u/1251373?v=4","gravatar_id":"","url":"https://api.github.com/users/samnm","html_url":"https://github.com/samnm","followers_url":"https://api.github.com/users/samnm/followers","following_url":"https://api.github.com/users/samnm/following{/other_user}","gists_url":"https://api.github.com/users/samnm/gists{/gist_id}","starred_url":"https://api.github.com/users/samnm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samnm/subscriptions","organizations_url":"https://api.github.com/users/samnm/orgs","repos_url":"https://api.github.com/users/samnm/repos","events_url":"https://api.github.com/users/samnm/events{/privacy}","received_events_url":"https://api.github.com/users/samnm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/samnm/material-components-ios","description":"Modular and customizable Material Design UI components for iOS","fork":true,"url":"https://api.github.com/repos/samnm/material-components-ios","forks_url":"https://api.github.com/repos/samnm/material-components-ios/forks","keys_url":"https://api.github.com/repos/samnm/material-components-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/samnm/material-components-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/samnm/material-components-ios/teams","hooks_url":"https://api.github.com/repos/samnm/material-components-ios/hooks","issue_events_url":"https://api.github.com/repos/samnm/material-components-ios/issues/events{/number}","events_url":"https://api.github.com/repos/samnm/material-components-ios/events","assignees_url":"https://api.github.com/repos/samnm/material-components-ios/assignees{/user}","branches_url":"https://api.github.com/repos/samnm/material-components-ios/branches{/branch}","tags_url":"https://api.github.com/repos/samnm/material-components-ios/tags","blobs_url":"https://api.github.com/repos/samnm/material-components-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/samnm/material-components-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/samnm/material-components-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/samnm/material-components-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/samnm/material-components-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/samnm/material-components-ios/languages","stargazers_url":"https://api.github.com/repos/samnm/material-components-ios/stargazers","contributors_url":"https://api.github.com/repos/samnm/material-components-ios/contributors","subscribers_url":"https://api.github.com/repos/samnm/material-components-ios/subscribers","subscription_url":"https://api.github.com/repos/samnm/material-components-ios/subscription","commits_url":"https://api.github.com/repos/samnm/material-components-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/samnm/material-components-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/samnm/material-components-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/samnm/material-components-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/samnm/material-components-ios/contents/{+path}","compare_url":"https://api.github.com/repos/samnm/material-components-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/samnm/material-components-ios/merges","archive_url":"https://api.github.com/repos/samnm/material-components-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/samnm/material-components-ios/downloads","issues_url":"https://api.github.com/repos/samnm/material-components-ios/issues{/number}","pulls_url":"https://api.github.com/repos/samnm/material-components-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/samnm/material-components-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/samnm/material-components-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/samnm/material-components-ios/labels{/name}","releases_url":"https://api.github.com/repos/samnm/material-components-ios/releases{/id}","deployments_url":"https://api.github.com/repos/samnm/material-components-ios/deployments","created_at":"2017-01-03T16:36:52Z","updated_at":"2017-01-03T16:39:21Z","pushed_at":"2017-10-13T20:36:22Z","git_url":"git://github.com/samnm/material-components-ios.git","ssh_url":"git@github.com:samnm/material-components-ios.git","clone_url":"https://github.com/samnm/material-components-ios.git","svn_url":"https://github.com/samnm/material-components-ios","homepage":"","size":441917,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"material-components:develop","ref":"develop","sha":"7c5ef7d03ef78b2f013cbb7912c2ccd2e7b85109","user":{"login":"material-components","id":19478152,"avatar_url":"https://avatars3.githubusercontent.com/u/19478152?v=4","gravatar_id":"","url":"https://api.github.com/users/material-components","html_url":"https://github.com/material-components","followers_url":"https://api.github.com/users/material-components/followers","following_url":"https://api.github.com/users/material-components/following{/other_user}","gists_url":"https://api.github.com/users/material-components/gists{/gist_id}","starred_url":"https://api.github.com/users/material-components/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/material-components/subscriptions","organizations_url":"https://api.github.com/users/material-components/orgs","repos_url":"https://api.github.com/users/material-components/repos","events_url":"https://api.github.com/users/material-components/events{/privacy}","received_events_url":"https://api.github.com/users/material-components/received_events","type":"Organization","site_admin":false},"repo":{"id":43820219,"name":"material-components-ios","full_name":"material-components/material-components-ios","owner":{"login":"material-components","id":19478152,"avatar_url":"https://avatars3.githubusercontent.com/u/19478152?v=4","gravatar_id":"","url":"https://api.github.com/users/material-components","html_url":"https://github.com/material-components","followers_url":"https://api.github.com/users/material-components/followers","following_url":"https://api.github.com/users/material-components/following{/other_user}","gists_url":"https://api.github.com/users/material-components/gists{/gist_id}","starred_url":"https://api.github.com/users/material-components/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/material-components/subscriptions","organizations_url":"https://api.github.com/users/material-components/orgs","repos_url":"https://api.github.com/users/material-components/repos","events_url":"https://api.github.com/users/material-components/events{/privacy}","received_events_url":"https://api.github.com/users/material-components/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/material-components/material-components-ios","description":"Modular and customizable Material Design UI components for iOS","fork":false,"url":"https://api.github.com/repos/material-components/material-components-ios","forks_url":"https://api.github.com/repos/material-components/material-components-ios/forks","keys_url":"https://api.github.com/repos/material-components/material-components-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/material-components/material-components-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/material-components/material-components-ios/teams","hooks_url":"https://api.github.com/repos/material-components/material-components-ios/hooks","issue_events_url":"https://api.github.com/repos/material-components/material-components-ios/issues/events{/number}","events_url":"https://api.github.com/repos/material-components/material-components-ios/events","assignees_url":"https://api.github.com/repos/material-components/material-components-ios/assignees{/user}","branches_url":"https://api.github.com/repos/material-components/material-components-ios/branches{/branch}","tags_url":"https://api.github.com/repos/material-components/material-components-ios/tags","blobs_url":"https://api.github.com/repos/material-components/material-components-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/material-components/material-components-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/material-components/material-components-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/material-components/material-components-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/material-components/material-components-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/material-components/material-components-ios/languages","stargazers_url":"https://api.github.com/repos/material-components/material-components-ios/stargazers","contributors_url":"https://api.github.com/repos/material-components/material-components-ios/contributors","subscribers_url":"https://api.github.com/repos/material-components/material-components-ios/subscribers","subscription_url":"https://api.github.com/repos/material-components/material-components-ios/subscription","commits_url":"https://api.github.com/repos/material-components/material-components-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/material-components/material-components-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/material-components/material-components-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/material-components/material-components-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/material-components/material-components-ios/contents/{+path}","compare_url":"https://api.github.com/repos/material-components/material-components-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/material-components/material-components-ios/merges","archive_url":"https://api.github.com/repos/material-components/material-components-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/material-components/material-components-ios/downloads","issues_url":"https://api.github.com/repos/material-components/material-components-ios/issues{/number}","pulls_url":"https://api.github.com/repos/material-components/material-components-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/material-components/material-components-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/material-components/material-components-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/material-components/material-components-ios/labels{/name}","releases_url":"https://api.github.com/repos/material-components/material-components-ios/releases{/id}","deployments_url":"https://api.github.com/repos/material-components/material-components-ios/deployments","created_at":"2015-10-07T14:12:39Z","updated_at":"2017-10-13T07:05:09Z","pushed_at":"2017-10-13T20:36:24Z","git_url":"git://github.com/material-components/material-components-ios.git","ssh_url":"git@github.com:material-components/material-components-ios.git","clone_url":"https://github.com/material-components/material-components-ios.git","svn_url":"https://github.com/material-components/material-components-ios","homepage":"","size":442030,"stargazers_count":1598,"watchers_count":1598,"language":"Objective-C","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":201,"mirror_url":null,"open_issues_count":356,"forks":201,"open_issues":356,"watchers":1598,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/material-components/material-components-ios/pulls/2179"},"html":{"href":"https://github.com/material-components/material-components-ios/pull/2179"},"issue":{"href":"https://api.github.com/repos/material-components/material-components-ios/issues/2179"},"comments":{"href":"https://api.github.com/repos/material-components/material-components-ios/issues/2179/comments"},"review_comments":{"href":"https://api.github.com/repos/material-components/material-components-ios/pulls/2179/comments"},"review_comment":{"href":"https://api.github.com/repos/material-components/material-components-ios/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/material-components/material-components-ios/pulls/2179/commits"},"statuses":{"href":"https://api.github.com/repos/material-components/material-components-ios/statuses/ee7ae0c60dca526cd4d782b2d3f58695fbf1d490"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"samnm"}}