{"action":"created","comment":{"url":"https://api.github.com/repos/jitsi/jitsi-meet/pulls/comments/171067285","pull_request_review_id":99831391,"id":171067285,"diff_hunk":"@@ -0,0 +1,295 @@\n+// @flow\n+import React, { Component } from 'react';\n+import {\n+    SafeAreaView,\n+    SectionList,\n+    Text,\n+    TouchableHighlight,\n+    View\n+} from 'react-native';\n+\n+import styles, { UNDERLAY_COLOR } from './styles';\n+\n+type Props = {\n+\n+    /**\n+     * Indicates if the list is disabled or not.\n+     */\n+    disabled: boolean,\n+\n+    /**\n+     * Function to be invoked when an item is pressed. The item's URL is passed.\n+     */\n+    onPress: Function,\n+\n+    /**\n+     * Function to be invoked when pull-to-refresh is perfoemrd.\n+     */\n+    onRefresh: Function,\n+\n+    /**\n+     * Sections to be rendered in the following format:\n+     *\n+     * [\n+     *   {\n+     *     title: string,               <- section title\n+     *     key: string,                 <- unique key for the section\n+     *     data: [                      <- Array of items in the section\n+     *       {\n+     *         colorBase: string,       <- the color base of the avatar\n+     *         title: string,           <- item title\n+     *         url: string,             <- item url\n+     *         lines: Array<string>     <- additional lines to be rendered\n+     *       }\n+     *     ]\n+     *   }\n+     * ]\n+     */\n+    sections: Array<Object>\n+}\n+\n+/**\n+ * Implements a general section list to display items that have a URL\n+ * propserty and navigates to (probably) meetings, such as the recent list\n+ * or the meeting list components.\n+ */\n+export default class NavigateSectionList extends Component<Props> {\n+    /**\n+     * Constructor of the NavigateSectionList component.\n+     *\n+     * @inheritdoc\n+     */\n+    constructor(props: Props) {\n+        super(props);\n+\n+        this._getAvatarColor = this._getAvatarColor.bind(this);\n+        this._getItemKey = this._getItemKey.bind(this);\n+        this._onPress = this._onPress.bind(this);\n+        this._onRefresh = this._onRefresh.bind(this);\n+        this._renderItem = this._renderItem.bind(this);\n+        this._renderItemLine = this._renderItemLine.bind(this);\n+        this._renderItemLines = this._renderItemLines.bind(this);\n+        this._renderSection = this._renderSection.bind(this);\n+    }\n+\n+    /**\n+     * Implements React's Component.render function.\n+     * Note: we don't use the refreshing value yet, because refreshing of these\n+     * lists is super quick, no need to complicate the code - yet.\n+     *\n+     * @inheritdoc\n+     */\n+    render() {\n+        const { sections } = this.props;\n+\n+        return (\n+            <SafeAreaView\n+                style = { styles.container } >\n+                <SectionList\n+                    keyExtractor = { this._getItemKey }\n+                    onRefresh = { this._onRefresh }\n+                    refreshing = { false }\n+                    renderItem = { this._renderItem }\n+                    renderSectionHeader = { this._renderSection }\n+                    sections = { sections }\n+                    style = { styles.list } />\n+            </SafeAreaView>\n+        );\n+    }\n+\n+    /**\n+     * Creates an empty section object.\n+     *\n+     * @private\n+     * @param {string} title - The title of the section.\n+     * @param {string} key - The key of the section. It must be unique.\n+     * @returns {Object}\n+     */\n+    static createSection(title, key) {\n+        return {\n+            data: [],\n+            key,\n+            title\n+        };\n+    }\n+\n+    _getAvatarColor: string => Object\n+\n+    /**\n+     * Returns a style (color) based on the string that determines the\n+     * color of the avatar.\n+     *\n+     * @param {string} colorBase - The string that is the base of the color.\n+     * @private\n+     * @returns {Object}\n+     */\n+    _getAvatarColor(colorBase) {\n+        if (!colorBase) {\n+            return null;\n+        }\n+\n+        let nameHash = 0;\n+\n+        for (let i = 0; i < colorBase.length; i++) {\n+            nameHash += colorBase.codePointAt(i);\n+        }\n+\n+        return styles[`avatarColor${(nameHash % 5) + 1}`];\n+    }\n+\n+    _getItemKey: (Object, number) => string;\n+\n+    /**\n+     * Generates a unique id to every item.\n+     *\n+     * @private\n+     * @param {Object} item - The item.\n+     * @param {number} index - The item index.\n+     * @returns {string}\n+     */\n+    _getItemKey(item, index) {\n+        return `${index}-${item.key}`;\n+    }\n+\n+    _onPress: string => Function\n+\n+    /**\n+     * Returns a function that is used in the onPress callback of the items.\n+     *\n+     * @private\n+     * @param {string} url - The URL of the item to navigate to.\n+     * @returns {Function}\n+     */\n+    _onPress(url) {\n+        return () => {\n+            const { disabled, onPress } = this.props;\n+\n+            !disabled && url && typeof onPress === 'function' && onPress(url);\n+        };\n+    }","path":"react/features/base/react/components/native/NavigateSectionList.js","position":169,"original_position":169,"commit_id":"02feea86d2b495ba098f877df9f7e476ed838539","original_commit_id":"02feea86d2b495ba098f877df9f7e476ed838539","user":{"login":"virtuacoplenny","id":1243084,"avatar_url":"https://avatars0.githubusercontent.com/u/1243084?v=4","gravatar_id":"","url":"https://api.github.com/users/virtuacoplenny","html_url":"https://github.com/virtuacoplenny","followers_url":"https://api.github.com/users/virtuacoplenny/followers","following_url":"https://api.github.com/users/virtuacoplenny/following{/other_user}","gists_url":"https://api.github.com/users/virtuacoplenny/gists{/gist_id}","starred_url":"https://api.github.com/users/virtuacoplenny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/virtuacoplenny/subscriptions","organizations_url":"https://api.github.com/users/virtuacoplenny/orgs","repos_url":"https://api.github.com/users/virtuacoplenny/repos","events_url":"https://api.github.com/users/virtuacoplenny/events{/privacy}","received_events_url":"https://api.github.com/users/virtuacoplenny/received_events","type":"User","site_admin":false},"body":"Why choose this implementation over passing this.props.onPress directly into TouchableHighlight?","created_at":"2018-02-27T21:10:58Z","updated_at":"2018-02-27T21:20:22Z","html_url":"https://github.com/jitsi/jitsi-meet/pull/2488#discussion_r171067285","pull_request_url":"https://api.github.com/repos/jitsi/jitsi-meet/pulls/2488","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/jitsi/jitsi-meet/pulls/comments/171067285"},"html":{"href":"https://github.com/jitsi/jitsi-meet/pull/2488#discussion_r171067285"},"pull_request":{"href":"https://api.github.com/repos/jitsi/jitsi-meet/pulls/2488"}}},"pull_request":{"url":"https://api.github.com/repos/jitsi/jitsi-meet/pulls/2488","id":169215810,"html_url":"https://github.com/jitsi/jitsi-meet/pull/2488","diff_url":"https://github.com/jitsi/jitsi-meet/pull/2488.diff","patch_url":"https://github.com/jitsi/jitsi-meet/pull/2488.patch","issue_url":"https://api.github.com/repos/jitsi/jitsi-meet/issues/2488","number":2488,"state":"open","locked":false,"title":"Calendar sync","user":{"login":"zbettenbuk","id":9974975,"avatar_url":"https://avatars0.githubusercontent.com/u/9974975?v=4","gravatar_id":"","url":"https://api.github.com/users/zbettenbuk","html_url":"https://github.com/zbettenbuk","followers_url":"https://api.github.com/users/zbettenbuk/followers","following_url":"https://api.github.com/users/zbettenbuk/following{/other_user}","gists_url":"https://api.github.com/users/zbettenbuk/gists{/gist_id}","starred_url":"https://api.github.com/users/zbettenbuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zbettenbuk/subscriptions","organizations_url":"https://api.github.com/users/zbettenbuk/orgs","repos_url":"https://api.github.com/users/zbettenbuk/repos","events_url":"https://api.github.com/users/zbettenbuk/events{/privacy}","received_events_url":"https://api.github.com/users/zbettenbuk/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-02-14T20:37:53Z","updated_at":"2018-02-27T21:20:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8373144dd4b2f80012b605651bfc6c781fac55e4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/jitsi/jitsi-meet/pulls/2488/commits","review_comments_url":"https://api.github.com/repos/jitsi/jitsi-meet/pulls/2488/comments","review_comment_url":"https://api.github.com/repos/jitsi/jitsi-meet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jitsi/jitsi-meet/issues/2488/comments","statuses_url":"https://api.github.com/repos/jitsi/jitsi-meet/statuses/02feea86d2b495ba098f877df9f7e476ed838539","head":{"label":"zbettenbuk:calendar-sync","ref":"calendar-sync","sha":"02feea86d2b495ba098f877df9f7e476ed838539","user":{"login":"zbettenbuk","id":9974975,"avatar_url":"https://avatars0.githubusercontent.com/u/9974975?v=4","gravatar_id":"","url":"https://api.github.com/users/zbettenbuk","html_url":"https://github.com/zbettenbuk","followers_url":"https://api.github.com/users/zbettenbuk/followers","following_url":"https://api.github.com/users/zbettenbuk/following{/other_user}","gists_url":"https://api.github.com/users/zbettenbuk/gists{/gist_id}","starred_url":"https://api.github.com/users/zbettenbuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zbettenbuk/subscriptions","organizations_url":"https://api.github.com/users/zbettenbuk/orgs","repos_url":"https://api.github.com/users/zbettenbuk/repos","events_url":"https://api.github.com/users/zbettenbuk/events{/privacy}","received_events_url":"https://api.github.com/users/zbettenbuk/received_events","type":"User","site_admin":false},"repo":{"id":113438639,"name":"jitsi-meet","full_name":"zbettenbuk/jitsi-meet","owner":{"login":"zbettenbuk","id":9974975,"avatar_url":"https://avatars0.githubusercontent.com/u/9974975?v=4","gravatar_id":"","url":"https://api.github.com/users/zbettenbuk","html_url":"https://github.com/zbettenbuk","followers_url":"https://api.github.com/users/zbettenbuk/followers","following_url":"https://api.github.com/users/zbettenbuk/following{/other_user}","gists_url":"https://api.github.com/users/zbettenbuk/gists{/gist_id}","starred_url":"https://api.github.com/users/zbettenbuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zbettenbuk/subscriptions","organizations_url":"https://api.github.com/users/zbettenbuk/orgs","repos_url":"https://api.github.com/users/zbettenbuk/repos","events_url":"https://api.github.com/users/zbettenbuk/events{/privacy}","received_events_url":"https://api.github.com/users/zbettenbuk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zbettenbuk/jitsi-meet","description":"Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.","fork":true,"url":"https://api.github.com/repos/zbettenbuk/jitsi-meet","forks_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/forks","keys_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/teams","hooks_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/hooks","issue_events_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/issues/events{/number}","events_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/events","assignees_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/assignees{/user}","branches_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/branches{/branch}","tags_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/tags","blobs_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/git/refs{/sha}","trees_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/statuses/{sha}","languages_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/languages","stargazers_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/stargazers","contributors_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/contributors","subscribers_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/subscribers","subscription_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/subscription","commits_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/commits{/sha}","git_commits_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/git/commits{/sha}","comments_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/comments{/number}","issue_comment_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/issues/comments{/number}","contents_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/contents/{+path}","compare_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/merges","archive_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/downloads","issues_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/issues{/number}","pulls_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/pulls{/number}","milestones_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/milestones{/number}","notifications_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/labels{/name}","releases_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/releases{/id}","deployments_url":"https://api.github.com/repos/zbettenbuk/jitsi-meet/deployments","created_at":"2017-12-07T10:47:22Z","updated_at":"2017-12-07T10:47:29Z","pushed_at":"2018-02-27T01:21:00Z","git_url":"git://github.com/zbettenbuk/jitsi-meet.git","ssh_url":"git@github.com:zbettenbuk/jitsi-meet.git","clone_url":"https://github.com/zbettenbuk/jitsi-meet.git","svn_url":"https://github.com/zbettenbuk/jitsi-meet","homepage":"https://jitsi.org/meet","size":24387,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jitsi:master","ref":"master","sha":"e2cf7a788dffd2ee6b9d6042af6f026665a58a59","user":{"login":"jitsi","id":3671647,"avatar_url":"https://avatars2.githubusercontent.com/u/3671647?v=4","gravatar_id":"","url":"https://api.github.com/users/jitsi","html_url":"https://github.com/jitsi","followers_url":"https://api.github.com/users/jitsi/followers","following_url":"https://api.github.com/users/jitsi/following{/other_user}","gists_url":"https://api.github.com/users/jitsi/gists{/gist_id}","starred_url":"https://api.github.com/users/jitsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jitsi/subscriptions","organizations_url":"https://api.github.com/users/jitsi/orgs","repos_url":"https://api.github.com/users/jitsi/repos","events_url":"https://api.github.com/users/jitsi/events{/privacy}","received_events_url":"https://api.github.com/users/jitsi/received_events","type":"Organization","site_admin":false},"repo":{"id":15225670,"name":"jitsi-meet","full_name":"jitsi/jitsi-meet","owner":{"login":"jitsi","id":3671647,"avatar_url":"https://avatars2.githubusercontent.com/u/3671647?v=4","gravatar_id":"","url":"https://api.github.com/users/jitsi","html_url":"https://github.com/jitsi","followers_url":"https://api.github.com/users/jitsi/followers","following_url":"https://api.github.com/users/jitsi/following{/other_user}","gists_url":"https://api.github.com/users/jitsi/gists{/gist_id}","starred_url":"https://api.github.com/users/jitsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jitsi/subscriptions","organizations_url":"https://api.github.com/users/jitsi/orgs","repos_url":"https://api.github.com/users/jitsi/repos","events_url":"https://api.github.com/users/jitsi/events{/privacy}","received_events_url":"https://api.github.com/users/jitsi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jitsi/jitsi-meet","description":"Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.","fork":false,"url":"https://api.github.com/repos/jitsi/jitsi-meet","forks_url":"https://api.github.com/repos/jitsi/jitsi-meet/forks","keys_url":"https://api.github.com/repos/jitsi/jitsi-meet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jitsi/jitsi-meet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jitsi/jitsi-meet/teams","hooks_url":"https://api.github.com/repos/jitsi/jitsi-meet/hooks","issue_events_url":"https://api.github.com/repos/jitsi/jitsi-meet/issues/events{/number}","events_url":"https://api.github.com/repos/jitsi/jitsi-meet/events","assignees_url":"https://api.github.com/repos/jitsi/jitsi-meet/assignees{/user}","branches_url":"https://api.github.com/repos/jitsi/jitsi-meet/branches{/branch}","tags_url":"https://api.github.com/repos/jitsi/jitsi-meet/tags","blobs_url":"https://api.github.com/repos/jitsi/jitsi-meet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jitsi/jitsi-meet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jitsi/jitsi-meet/git/refs{/sha}","trees_url":"https://api.github.com/repos/jitsi/jitsi-meet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jitsi/jitsi-meet/statuses/{sha}","languages_url":"https://api.github.com/repos/jitsi/jitsi-meet/languages","stargazers_url":"https://api.github.com/repos/jitsi/jitsi-meet/stargazers","contributors_url":"https://api.github.com/repos/jitsi/jitsi-meet/contributors","subscribers_url":"https://api.github.com/repos/jitsi/jitsi-meet/subscribers","subscription_url":"https://api.github.com/repos/jitsi/jitsi-meet/subscription","commits_url":"https://api.github.com/repos/jitsi/jitsi-meet/commits{/sha}","git_commits_url":"https://api.github.com/repos/jitsi/jitsi-meet/git/commits{/sha}","comments_url":"https://api.github.com/repos/jitsi/jitsi-meet/comments{/number}","issue_comment_url":"https://api.github.com/repos/jitsi/jitsi-meet/issues/comments{/number}","contents_url":"https://api.github.com/repos/jitsi/jitsi-meet/contents/{+path}","compare_url":"https://api.github.com/repos/jitsi/jitsi-meet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jitsi/jitsi-meet/merges","archive_url":"https://api.github.com/repos/jitsi/jitsi-meet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jitsi/jitsi-meet/downloads","issues_url":"https://api.github.com/repos/jitsi/jitsi-meet/issues{/number}","pulls_url":"https://api.github.com/repos/jitsi/jitsi-meet/pulls{/number}","milestones_url":"https://api.github.com/repos/jitsi/jitsi-meet/milestones{/number}","notifications_url":"https://api.github.com/repos/jitsi/jitsi-meet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jitsi/jitsi-meet/labels{/name}","releases_url":"https://api.github.com/repos/jitsi/jitsi-meet/releases{/id}","deployments_url":"https://api.github.com/repos/jitsi/jitsi-meet/deployments","created_at":"2013-12-16T12:51:09Z","updated_at":"2018-02-27T19:25:33Z","pushed_at":"2018-02-27T15:08:10Z","git_url":"git://github.com/jitsi/jitsi-meet.git","ssh_url":"git@github.com:jitsi/jitsi-meet.git","clone_url":"https://github.com/jitsi/jitsi-meet.git","svn_url":"https://github.com/jitsi/jitsi-meet","homepage":"https://jitsi.org/meet","size":24319,"stargazers_count":2158,"watchers_count":2158,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":748,"mirror_url":null,"archived":false,"open_issues_count":413,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":748,"open_issues":413,"watchers":2158,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jitsi/jitsi-meet/pulls/2488"},"html":{"href":"https://github.com/jitsi/jitsi-meet/pull/2488"},"issue":{"href":"https://api.github.com/repos/jitsi/jitsi-meet/issues/2488"},"comments":{"href":"https://api.github.com/repos/jitsi/jitsi-meet/issues/2488/comments"},"review_comments":{"href":"https://api.github.com/repos/jitsi/jitsi-meet/pulls/2488/comments"},"review_comment":{"href":"https://api.github.com/repos/jitsi/jitsi-meet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jitsi/jitsi-meet/pulls/2488/commits"},"statuses":{"href":"https://api.github.com/repos/jitsi/jitsi-meet/statuses/02feea86d2b495ba098f877df9f7e476ed838539"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"virtuacoplenny"}}