Autoplay the hidden stories section
This commit is contained in:
parent
7edb9edfe1
commit
94ef800e33
4 changed files with 26 additions and 5 deletions
|
@ -326,6 +326,7 @@ export const StoryViewer = ({
|
|||
|
||||
const canFreelyNavigateStories =
|
||||
storyViewMode === StoryViewModeType.All ||
|
||||
storyViewMode === StoryViewModeType.Hidden ||
|
||||
storyViewMode === StoryViewModeType.Unread;
|
||||
|
||||
const canNavigateLeft =
|
||||
|
|
|
@ -814,6 +814,21 @@ const viewUserStories: ViewUserStoriesActionCreatorType = ({
|
|||
|
||||
const story = storiesByConversationId[currentIndex];
|
||||
|
||||
const hiddenConversationIds = new Set(
|
||||
getHideStoryConversationIds(getState())
|
||||
);
|
||||
|
||||
let inferredStoryViewMode: StoryViewModeType;
|
||||
if (storyViewMode) {
|
||||
inferredStoryViewMode = storyViewMode;
|
||||
} else if (hiddenConversationIds.has(conversationId)) {
|
||||
inferredStoryViewMode = StoryViewModeType.Hidden;
|
||||
} else if (hasUnread) {
|
||||
inferredStoryViewMode = StoryViewModeType.Unread;
|
||||
} else {
|
||||
inferredStoryViewMode = StoryViewModeType.All;
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: VIEW_STORY,
|
||||
payload: {
|
||||
|
@ -821,9 +836,7 @@ const viewUserStories: ViewUserStoriesActionCreatorType = ({
|
|||
messageId: story.messageId,
|
||||
numStories,
|
||||
shouldShowDetailsModal,
|
||||
storyViewMode:
|
||||
storyViewMode ||
|
||||
(hasUnread ? StoryViewModeType.Unread : StoryViewModeType.All),
|
||||
storyViewMode: inferredStoryViewMode,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
@ -1008,7 +1021,11 @@ const viewStory: ViewStoryActionCreatorType = (
|
|||
}
|
||||
}
|
||||
|
||||
const conversationStories = getStories(state).stories;
|
||||
const storiesSelectorState = getStories(state);
|
||||
const conversationStories =
|
||||
storyViewMode === StoryViewModeType.Hidden
|
||||
? storiesSelectorState.hiddenStories
|
||||
: storiesSelectorState.stories;
|
||||
const conversationStoryIndex = conversationStories.findIndex(
|
||||
item => item.conversationId === story.conversationId
|
||||
);
|
||||
|
|
|
@ -405,7 +405,9 @@ export const getStories = createSelector(
|
|||
});
|
||||
|
||||
return {
|
||||
hiddenStories: Array.from(hiddenStoriesById.values()),
|
||||
hiddenStories: Array.from(hiddenStoriesById.values()).sort(
|
||||
sortByRecencyAndUnread
|
||||
),
|
||||
myStories: Array.from(myStoriesById.values()).sort(sortMyStories),
|
||||
stories: Array.from(storiesById.values()).sort(sortByRecencyAndUnread),
|
||||
};
|
||||
|
|
|
@ -116,6 +116,7 @@ export enum StoryViewDirectionType {
|
|||
// User = All of a user's stories
|
||||
export enum StoryViewModeType {
|
||||
All = 'All',
|
||||
Hidden = 'Hidden',
|
||||
Single = 'Single',
|
||||
Unread = 'Unread',
|
||||
User = 'User',
|
||||
|
|
Loading…
Reference in a new issue