Onboarding story
This commit is contained in:
parent
94f318ea08
commit
19a42ed719
42 changed files with 725 additions and 143 deletions
|
@ -61,6 +61,7 @@ import type { AccountSelectorType } from './accounts';
|
|||
import { getAccountSelector } from './accounts';
|
||||
import * as log from '../../logging/log';
|
||||
import { TimelineMessageLoadingState } from '../../util/timelineUtil';
|
||||
import { isSignalConversation } from '../../util/isSignalConversation';
|
||||
import { reduce } from '../../util/iterables';
|
||||
|
||||
let placeholderContact: ConversationType;
|
||||
|
@ -296,6 +297,10 @@ export const _getLeftPaneLists = (
|
|||
};
|
||||
}
|
||||
|
||||
if (isSignalConversation(conversation)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// We always show pinned conversations
|
||||
if (conversation.isPinned) {
|
||||
pinnedConversations.push(conversation);
|
||||
|
@ -450,7 +455,8 @@ function hasDisplayInfo(conversation: ConversationType): boolean {
|
|||
|
||||
function canComposeConversation(conversation: ConversationType): boolean {
|
||||
return Boolean(
|
||||
!conversation.isBlocked &&
|
||||
!isSignalConversation(conversation) &&
|
||||
!conversation.isBlocked &&
|
||||
!isConversationUnregistered(conversation) &&
|
||||
hasDisplayInfo(conversation) &&
|
||||
isTrusted(conversation)
|
||||
|
@ -462,6 +468,7 @@ export const getAllComposableConversations = createSelector(
|
|||
(conversationLookup: ConversationLookupType): Array<ConversationType> =>
|
||||
Object.values(conversationLookup).filter(
|
||||
conversation =>
|
||||
!isSignalConversation(conversation) &&
|
||||
!conversation.isBlocked &&
|
||||
!conversation.isGroupV1AndDisabled &&
|
||||
!isConversationUnregistered(conversation) &&
|
||||
|
|
|
@ -97,6 +97,7 @@ import { DAY, HOUR, SECOND } from '../../util/durations';
|
|||
import { getStoryReplyText } from '../../util/getStoryReplyText';
|
||||
import { isIncoming, isOutgoing, isStory } from '../../messages/helpers';
|
||||
import { calculateExpirationTimestamp } from '../../util/expirationTimer';
|
||||
import { isSignalConversation } from '../../util/isSignalConversation';
|
||||
|
||||
export { isIncoming, isOutgoing, isStory };
|
||||
|
||||
|
@ -1648,6 +1649,10 @@ function canReplyOrReact(
|
|||
return false;
|
||||
}
|
||||
|
||||
if (isSignalConversation(conversation)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isOutgoing(message)) {
|
||||
return (
|
||||
isMessageJustForMe(sendStateByConversationId, ourConversationId) ||
|
||||
|
|
|
@ -38,6 +38,7 @@ import { getStoriesEnabled } from './items';
|
|||
import { calculateExpirationTimestamp } from '../../util/expirationTimer';
|
||||
import { getMessageIdForLogging } from '../../util/idForLogging';
|
||||
import * as log from '../../logging/log';
|
||||
import { SIGNAL_ACI } from '../../types/Conversation';
|
||||
|
||||
export const getStoriesState = (state: StateType): StoriesStateType =>
|
||||
state.stories;
|
||||
|
@ -67,6 +68,20 @@ function sortByRecencyAndUnread(
|
|||
storyA: ConversationStoryType,
|
||||
storyB: ConversationStoryType
|
||||
): number {
|
||||
if (
|
||||
storyA.storyView.sender.uuid === SIGNAL_ACI &&
|
||||
storyA.storyView.isUnread
|
||||
) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (
|
||||
storyB.storyView.sender.uuid === SIGNAL_ACI &&
|
||||
storyB.storyView.isUnread
|
||||
) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (storyA.storyView.isUnread && storyB.storyView.isUnread) {
|
||||
return storyA.storyView.timestamp > storyB.storyView.timestamp ? -1 : 1;
|
||||
}
|
||||
|
@ -160,6 +175,7 @@ export function getStoryView(
|
|||
'profileName',
|
||||
'sharedGroupNames',
|
||||
'title',
|
||||
'uuid',
|
||||
]);
|
||||
|
||||
const {
|
||||
|
@ -330,9 +346,13 @@ export const getStories = createSelector(
|
|||
return;
|
||||
}
|
||||
|
||||
// if for some reason this story is already experied (bug)
|
||||
// log it and skip it
|
||||
if ((calculateExpirationTimestamp(story) ?? 0) < Date.now()) {
|
||||
// if for some reason this story is already expired (bug)
|
||||
// log it and skip it. Unless it's the onboarding story, that story
|
||||
// doesn't have an expiration until it is viewed.
|
||||
if (
|
||||
!story.sourceUuid === SIGNAL_ACI &&
|
||||
(calculateExpirationTimestamp(story) ?? 0) < Date.now()
|
||||
) {
|
||||
const messageIdForLogging = getMessageIdForLogging({
|
||||
...pick(story, 'type', 'sourceUuid', 'sourceDevice'),
|
||||
sent_at: story.timestamp,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue