From c450c530a74cb5d577bd2c7a661652806c440b2e Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Thu, 9 May 2019 22:39:58 +0800 Subject: [PATCH] add lastPostIndex props to Thread and Permalink, and add markers for those screens (#2780) --- app/components/post_body/post_body.js | 3 ++- app/components/post_list/post_list.js | 3 +-- app/screens/channel/channel_post_list/channel_post_list.js | 2 ++ app/screens/permalink/permalink.js | 3 +++ app/screens/thread/__snapshots__/thread.test.js.snap | 3 +++ app/screens/thread/thread.js | 3 +++ app/telemetry/telemetry_utils.js | 3 ++- 7 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/components/post_body/post_body.js b/app/components/post_body/post_body.js index 1116aad16..c0285b85b 100644 --- a/app/components/post_body/post_body.js +++ b/app/components/post_body/post_body.js @@ -102,7 +102,8 @@ export default class PostBody extends PureComponent { telemetry.end([ 'channel:switch_initial', 'channel:switch_loaded', - 'posts:list_update', + 'post_list:permalink', + 'post_list:thread', 'team:switch', 'start:overall', ]); diff --git a/app/components/post_list/post_list.js b/app/components/post_list/post_list.js index 49f13e07d..90a75b758 100644 --- a/app/components/post_list/post_list.js +++ b/app/components/post_list/post_list.js @@ -105,8 +105,6 @@ export default class PostList extends PureComponent { this.handleDeepLink(this.props.deepLinkURL); this.props.actions.setDeepLinkURL(''); } - - telemetry.start(['posts:list_update']); } componentWillUnmount() { @@ -147,6 +145,7 @@ export default class PostList extends PureComponent { }; handlePermalinkPress = (postId, teamName) => { + telemetry.start(['post_list:permalink']); const {actions, onPermalinkPress} = this.props; if (onPermalinkPress) { diff --git a/app/screens/channel/channel_post_list/channel_post_list.js b/app/screens/channel/channel_post_list/channel_post_list.js index d0cd21aea..1530d1807 100644 --- a/app/screens/channel/channel_post_list/channel_post_list.js +++ b/app/screens/channel/channel_post_list/channel_post_list.js @@ -17,6 +17,7 @@ import PostListRetry from 'app/components/post_list_retry'; import RetryBarIndicator from 'app/components/retry_bar_indicator'; import {ViewTypes} from 'app/constants'; import tracker from 'app/utils/time_tracker'; +import telemetry from 'app/telemetry'; let ChannelIntro = null; let LoadMorePosts = null; @@ -87,6 +88,7 @@ export default class ChannelPostList extends PureComponent { }; goToThread = (post) => { + telemetry.start(['post_list:thread']); const {actions, channelId, navigator, theme} = this.props; const rootId = (post.root_id || post.id); diff --git a/app/screens/permalink/permalink.js b/app/screens/permalink/permalink.js index e5c7cf6c2..81f3f2763 100644 --- a/app/screens/permalink/permalink.js +++ b/app/screens/permalink/permalink.js @@ -4,6 +4,7 @@ import React, {PureComponent} from 'react'; import PropTypes from 'prop-types'; import { + Platform, Text, TouchableOpacity, View, @@ -15,6 +16,7 @@ import AwesomeIcon from 'react-native-vector-icons/FontAwesome'; import {General} from 'mattermost-redux/constants'; import EventEmitter from 'mattermost-redux/utils/event_emitter'; +import {getLastPostIndex} from 'mattermost-redux/utils/post_list'; import FormattedText from 'app/components/formatted_text'; import Loading from 'app/components/loading'; @@ -393,6 +395,7 @@ export default class Permalink extends PureComponent { onPermalinkPress={this.handlePermalinkPress} onPostPress={this.goToThread} postIds={postIdsState} + lastPostIndex={Platform.OS === 'android' ? getLastPostIndex(postIdsState) : -1} currentUserId={currentUserId} lastViewedAt={0} navigator={navigator} diff --git a/app/screens/thread/__snapshots__/thread.test.js.snap b/app/screens/thread/__snapshots__/thread.test.js.snap index 523a50ced..d4cb7cf1d 100644 --- a/app/screens/thread/__snapshots__/thread.test.js.snap +++ b/app/screens/thread/__snapshots__/thread.test.js.snap @@ -17,6 +17,7 @@ exports[`thread should match snapshot, has root post 1`] = `