Update nav tab badges, fix several call tabs issues
This commit is contained in:
parent
ed6ffb695a
commit
9c7dc22a23
43 changed files with 1095 additions and 936 deletions
|
@ -29,3 +29,10 @@ export const getCallHistorySelector = createSelector(
|
|||
};
|
||||
}
|
||||
);
|
||||
|
||||
export const getCallHistoryUnreadCount = createSelector(
|
||||
getCallHistory,
|
||||
callHistory => {
|
||||
return callHistory.unreadCount;
|
||||
}
|
||||
);
|
||||
|
|
|
@ -66,6 +66,10 @@ import type { HasStories } from '../../types/Stories';
|
|||
import { getHasStoriesSelector } from './stories2';
|
||||
import { canEditMessage } from '../../util/canEditMessage';
|
||||
import { isOutgoing } from '../../messages/helpers';
|
||||
import {
|
||||
countAllConversationsUnreadStats,
|
||||
type UnreadStats,
|
||||
} from '../../util/countUnreadStats';
|
||||
|
||||
export type ConversationWithStoriesType = ConversationType & {
|
||||
hasStories?: HasStories;
|
||||
|
@ -532,37 +536,12 @@ export const getAllGroupsWithInviteAccess = createSelector(
|
|||
})
|
||||
);
|
||||
|
||||
export type UnreadStats = Readonly<{
|
||||
unreadCount: number;
|
||||
unreadMentionsCount: number;
|
||||
markedUnread: boolean;
|
||||
}>;
|
||||
|
||||
export const getAllConversationsUnreadStats = createSelector(
|
||||
getLeftPaneLists,
|
||||
(leftPaneLists: LeftPaneLists): UnreadStats => {
|
||||
let unreadCount = 0;
|
||||
let unreadMentionsCount = 0;
|
||||
let markedUnread = false;
|
||||
|
||||
function count(conversations: ReadonlyArray<ConversationType>) {
|
||||
conversations.forEach(conversation => {
|
||||
if (conversation.unreadCount != null) {
|
||||
unreadCount += conversation.unreadCount;
|
||||
}
|
||||
if (conversation.unreadMentionsCount != null) {
|
||||
unreadMentionsCount += conversation.unreadMentionsCount;
|
||||
}
|
||||
if (conversation.markedUnread) {
|
||||
markedUnread = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
count(leftPaneLists.pinnedConversations);
|
||||
count(leftPaneLists.conversations);
|
||||
|
||||
return { unreadCount, unreadMentionsCount, markedUnread };
|
||||
getAllConversations,
|
||||
(conversations): UnreadStats => {
|
||||
return countAllConversationsUnreadStats(conversations, {
|
||||
includeMuted: false,
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
import { createSelector } from 'reselect';
|
||||
import type { StateType } from '../reducer';
|
||||
import type { NavStateType } from '../ducks/nav';
|
||||
import { getAllConversationsUnreadStats } from './conversations';
|
||||
import { getStoriesNotificationCount } from './stories';
|
||||
import type { UnreadStats } from '../../util/countUnreadStats';
|
||||
|
||||
function getNav(state: StateType): NavStateType {
|
||||
return state.nav;
|
||||
|
@ -12,3 +15,17 @@ function getNav(state: StateType): NavStateType {
|
|||
export const getSelectedNavTab = createSelector(getNav, nav => {
|
||||
return nav.selectedNavTab;
|
||||
});
|
||||
|
||||
export const getAppUnreadStats = createSelector(
|
||||
getAllConversationsUnreadStats,
|
||||
getStoriesNotificationCount,
|
||||
(conversationsUnreadStats, storiesNotificationCount): UnreadStats => {
|
||||
return {
|
||||
// Note: Conversation unread stats includes the call history unread count.
|
||||
unreadCount:
|
||||
conversationsUnreadStats.unreadCount + storiesNotificationCount,
|
||||
unreadMentionsCount: conversationsUnreadStats.unreadMentionsCount,
|
||||
markedUnread: conversationsUnreadStats.markedUnread,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
|
@ -42,3 +42,8 @@ export const isOSUnsupported = createSelector(
|
|||
getUpdatesState,
|
||||
({ dialogType }) => dialogType === DialogType.UnsupportedOS
|
||||
);
|
||||
|
||||
export const getHasPendingUpdate = createSelector(
|
||||
getUpdatesState,
|
||||
({ didSnooze }) => didSnooze === true
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue