Adds some logging to detect story playback order
This commit is contained in:
parent
85c8ff76dc
commit
dcf0c5284d
2 changed files with 36 additions and 1 deletions
|
@ -10,6 +10,7 @@ import type { PropsType as SmartStoryViewerPropsType } from '../state/smart/Stor
|
||||||
import { StoriesPane } from './StoriesPane';
|
import { StoriesPane } from './StoriesPane';
|
||||||
import { Theme, themeClassName } from '../util/theme';
|
import { Theme, themeClassName } from '../util/theme';
|
||||||
import { getWidthFromPreferredWidth } from '../util/leftPaneWidth';
|
import { getWidthFromPreferredWidth } from '../util/leftPaneWidth';
|
||||||
|
import * as log from '../logging/log';
|
||||||
|
|
||||||
export type PropsType = {
|
export type PropsType = {
|
||||||
hiddenStories: Array<ConversationStoryType>;
|
hiddenStories: Array<ConversationStoryType>;
|
||||||
|
@ -48,6 +49,8 @@ export const Stories = ({
|
||||||
conversationStory.stories.some(story => story.isUnread)
|
conversationStory.stories.some(story => story.isUnread)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
log.info('stories.onNextUserStories', { nextUnreadIndex });
|
||||||
|
|
||||||
if (nextUnreadIndex >= 0) {
|
if (nextUnreadIndex >= 0) {
|
||||||
const nextStory = stories[nextUnreadIndex];
|
const nextStory = stories[nextUnreadIndex];
|
||||||
setConversationIdToView(nextStory.conversationId);
|
setConversationIdToView(nextStory.conversationId);
|
||||||
|
@ -59,6 +62,11 @@ export const Stories = ({
|
||||||
x => x.conversationId === conversationIdToView
|
x => x.conversationId === conversationIdToView
|
||||||
);
|
);
|
||||||
|
|
||||||
|
log.info('stories.onNextUserStories', {
|
||||||
|
storyIndex,
|
||||||
|
length: stories.length,
|
||||||
|
});
|
||||||
|
|
||||||
// If we've reached the end, close the viewer
|
// If we've reached the end, close the viewer
|
||||||
if (storyIndex >= stories.length - 1 || storyIndex === -1) {
|
if (storyIndex >= stories.length - 1 || storyIndex === -1) {
|
||||||
setConversationIdToView(undefined);
|
setConversationIdToView(undefined);
|
||||||
|
@ -72,6 +80,12 @@ export const Stories = ({
|
||||||
const storyIndex = stories.findIndex(
|
const storyIndex = stories.findIndex(
|
||||||
x => x.conversationId === conversationIdToView
|
x => x.conversationId === conversationIdToView
|
||||||
);
|
);
|
||||||
|
|
||||||
|
log.info('stories.onPrevUserStories', {
|
||||||
|
storyIndex,
|
||||||
|
length: stories.length,
|
||||||
|
});
|
||||||
|
|
||||||
if (storyIndex <= 0) {
|
if (storyIndex <= 0) {
|
||||||
// Restart playback on the story if it's the oldest
|
// Restart playback on the story if it's the oldest
|
||||||
setConversationIdToView(conversationIdToView);
|
setConversationIdToView(conversationIdToView);
|
||||||
|
@ -95,7 +109,16 @@ export const Stories = ({
|
||||||
<StoriesPane
|
<StoriesPane
|
||||||
hiddenStories={hiddenStories}
|
hiddenStories={hiddenStories}
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
onStoryClicked={setConversationIdToView}
|
onStoryClicked={clickedIdToView => {
|
||||||
|
const storyIndex = stories.findIndex(
|
||||||
|
x => x.conversationId === clickedIdToView
|
||||||
|
);
|
||||||
|
log.info('stories.onStoryClicked', {
|
||||||
|
storyIndex,
|
||||||
|
length: stories.length,
|
||||||
|
});
|
||||||
|
setConversationIdToView(clickedIdToView);
|
||||||
|
}}
|
||||||
openConversationInternal={openConversationInternal}
|
openConversationInternal={openConversationInternal}
|
||||||
queueStoryDownload={queueStoryDownload}
|
queueStoryDownload={queueStoryDownload}
|
||||||
stories={stories}
|
stories={stories}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import { getStoryDuration } from '../util/getStoryDuration';
|
||||||
import { graphemeAwareSlice } from '../util/graphemeAwareSlice';
|
import { graphemeAwareSlice } from '../util/graphemeAwareSlice';
|
||||||
import { isDownloaded, isDownloading } from '../types/Attachment';
|
import { isDownloaded, isDownloading } from '../types/Attachment';
|
||||||
import { useEscapeHandling } from '../hooks/useEscapeHandling';
|
import { useEscapeHandling } from '../hooks/useEscapeHandling';
|
||||||
|
import * as log from '../logging/log';
|
||||||
|
|
||||||
export type PropsType = {
|
export type PropsType = {
|
||||||
conversationId: string;
|
conversationId: string;
|
||||||
|
@ -183,6 +184,10 @@ export const StoryViewer = ({
|
||||||
const unreadStoryIndex = storiesRef.current.findIndex(
|
const unreadStoryIndex = storiesRef.current.findIndex(
|
||||||
story => story.isUnread
|
story => story.isUnread
|
||||||
);
|
);
|
||||||
|
log.info('stories.findUnreadStory', {
|
||||||
|
unreadStoryIndex,
|
||||||
|
stories: storiesRef.current.length,
|
||||||
|
});
|
||||||
setCurrentStoryIndex(unreadStoryIndex < 0 ? 0 : unreadStoryIndex);
|
setCurrentStoryIndex(unreadStoryIndex < 0 ? 0 : unreadStoryIndex);
|
||||||
}, [conversationId]);
|
}, [conversationId]);
|
||||||
|
|
||||||
|
@ -221,6 +226,12 @@ export const StoryViewer = ({
|
||||||
if (shouldCancel) {
|
if (shouldCancel) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
log.info('stories.setStoryDuration', {
|
||||||
|
contentType: attachment.textAttachment
|
||||||
|
? 'text'
|
||||||
|
: attachment.contentType,
|
||||||
|
duration,
|
||||||
|
});
|
||||||
setStoryDuration(duration);
|
setStoryDuration(duration);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -286,6 +297,7 @@ export const StoryViewer = ({
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
markStoryRead(messageId);
|
markStoryRead(messageId);
|
||||||
|
log.info('stories.markStoryRead', { messageId });
|
||||||
}, [markStoryRead, messageId]);
|
}, [markStoryRead, messageId]);
|
||||||
|
|
||||||
// Queue all undownloaded stories once we're viewing someone's stories
|
// Queue all undownloaded stories once we're viewing someone's stories
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue