add lastPostIndex props to Thread and Permalink, and add markers for those screens (#2780)

This commit is contained in:
Saturnino Abril
2019-05-09 22:39:58 +08:00
committed by Miguel Alatzar
parent 1a81daaa37
commit c450c530a7
7 changed files with 16 additions and 4 deletions

View File

@@ -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',
]);

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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}

View File

@@ -17,6 +17,7 @@ exports[`thread should match snapshot, has root post 1`] = `
<Connect(PostList)
currentUserId="member_user_id"
indicateNewMessages={false}
lastPostIndex={-1}
location="thread"
navigator={
Object {
@@ -114,6 +115,7 @@ exports[`thread should match snapshot, render footer 1`] = `
<Connect(PostList)
currentUserId="member_user_id"
indicateNewMessages={false}
lastPostIndex={-1}
location="thread"
navigator={
Object {
@@ -158,6 +160,7 @@ exports[`thread should match snapshot, render footer 2`] = `
<Connect(PostList)
currentUserId="member_user_id"
indicateNewMessages={false}
lastPostIndex={-1}
lastViewedAt={0}
location="thread"
navigator={

View File

@@ -5,7 +5,9 @@ import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {Platform} from 'react-native';
import {intlShape} from 'react-intl';
import {General, RequestStatus} from 'mattermost-redux/constants';
import {getLastPostIndex} from 'mattermost-redux/utils/post_list';
import {THREAD} from 'app/constants/screen';
@@ -147,6 +149,7 @@ export default class Thread extends PureComponent {
renderFooter={this.renderFooter()}
indicateNewMessages={false}
postIds={postIds}
lastPostIndex={Platform.OS === 'android' ? getLastPostIndex(postIds) : -1}
currentUserId={myMember && myMember.user_id}
lastViewedAt={this.state.lastViewedAt}
navigator={navigator}

View File

@@ -39,7 +39,8 @@ const presetTID = {
'channel:close_drawer': 9,
'channel:open_drawer': 10,
'posts:loading': 11,
'posts:list_update': 12,
'post_list:thread': 12,
'post_list:permalink': 13,
};
export function setTraceRecord({