Exclude showing pin icon and menu item for contacts list.

pull/1745/head
Warrick Corfe-Tan 4 years ago
parent 6dd7f34e4d
commit 60b3032833

@ -23,7 +23,11 @@ import { DefaultTheme, withTheme } from 'styled-components';
import { PubKey } from '../session/types';
import { ConversationType, openConversationExternal } from '../state/ducks/conversations';
import { SessionIcon, SessionIconSize, SessionIconType } from './session/icon';
import { SessionButtonColor } from './session/SessionButton';
export enum ConversationListItemType {
Conversation = 'conversation',
Contact = 'contact',
}
export interface ConversationListItemProps extends ConversationType {
index?: number; // used to force a refresh when one conversation is removed on top of the list
@ -33,6 +37,7 @@ export interface ConversationListItemProps extends ConversationType {
type PropsHousekeeping = {
style?: Object;
theme: DefaultTheme;
conversationListItemType: ConversationListItemType;
};
type Props = ConversationListItemProps & PropsHousekeeping;
@ -65,7 +70,7 @@ class ConversationListItem extends React.PureComponent<Props> {
}
public renderHeader() {
const { unreadCount, mentionedUs, activeAt, isPinned } = this.props;
const { unreadCount, mentionedUs, activeAt, isPinned, conversationListItemType } = this.props;
let atSymbol = null;
let unreadCountDiv = null;
@ -74,6 +79,15 @@ class ConversationListItem extends React.PureComponent<Props> {
unreadCountDiv = <p className="module-conversation-list-item__unread-count">{unreadCount}</p>;
}
const pinIcon = (conversationListItemType === ConversationListItemType.Conversation && isPinned) ?
<SessionIcon
iconType={SessionIconType.Pin}
iconColor={this.props.theme.colors.textColorSubtle}
iconSize={SessionIconSize.Tiny} />
:
null;
return (
<div className="module-conversation-list-item__header">
<div
@ -85,13 +99,8 @@ class ConversationListItem extends React.PureComponent<Props> {
{this.renderUser()}
</div>
{isPinned ?
<SessionIcon
iconType={SessionIconType.Pin}
iconColor={this.props.theme.colors.textColorSubtle}
iconSize={SessionIconSize.Tiny} />
: null
}
{pinIcon}
{unreadCountDiv}
{atSymbol}
{

@ -1,6 +1,6 @@
import React from 'react';
import { ConversationListItemWithDetails } from '../ConversationListItem';
import { ConversationListItemType, ConversationListItemWithDetails } from '../ConversationListItem';
import { RowRendererParamsType } from '../LeftPane';
import { AutoSizer, List } from 'react-virtualized';
import { ConversationType as ReduxConversationType } from '../../state/ducks/conversations';
@ -39,6 +39,7 @@ export class LeftPaneContactSection extends React.Component<Props> {
return (
<ConversationListItemWithDetails
conversationListItemType={ConversationListItemType.Contact}
key={item.id}
style={style}
{...item}

@ -5,6 +5,7 @@ import { AutoSizer, List } from 'react-virtualized';
import { MainViewController } from '../MainViewController';
import {
ConversationListItemProps,
ConversationListItemType,
ConversationListItemWithDetails,
} from '../ConversationListItem';
import { ConversationType as ReduxConversationType } from '../../state/ducks/conversations';
@ -97,6 +98,7 @@ export class LeftPaneMessageSection extends React.Component<Props, State> {
return (
<ConversationListItemWithDetails
key={key}
conversationListItemType={ConversationListItemType.Conversation}
style={style}
{...conversation}
onClick={openConversationExternal}

@ -1,6 +1,7 @@
import React, { useState } from 'react';
import { animation, Menu } from 'react-contexify';
import { ConversationTypeEnum } from '../../../models/conversation';
import { ConversationListItemType } from '../../ConversationListItem';
import {
getBlockMenuItem,
@ -19,6 +20,7 @@ export type PropsContextConversationItem = {
id: string;
triggerId: string;
type: ConversationTypeEnum;
conversationListItemType: ConversationListItemType;
isMe: boolean;
isPublic?: boolean;
isBlocked?: boolean;
@ -39,15 +41,18 @@ export const ConversationListItemContextMenu = (props: PropsContextConversationI
type,
left,
isKickedFromGroup,
theme,
conversationListItemType,
} = props;
const isGroup = type === 'group';
const isConversation = conversationListItemType === ConversationListItemType.Conversation;
const pinMenuItem = isConversation ? <MenuItemPinConversation conversationId={conversationId} /> : null;
return (
<>
<Menu id={triggerId} animation={animation.fade}>
<MenuItemPinConversation conversationId={conversationId} />
{pinMenuItem}
{getBlockMenuItem(isMe, type === ConversationTypeEnum.PRIVATE, isBlocked, conversationId)}
{getCopyMenuItem(isPublic, isGroup, conversationId)}
{getMarkAllReadMenuItem(conversationId)}

@ -25,8 +25,6 @@ import {
showUpdateGroupNameByConvoId,
unblockConvoById,
} from '../../../interactions/conversationInteractions';
import { purgeStoredState } from 'redux-persist';
import { persistConfig, _purgedStoredState } from '../../../state/createStore';
function showTimerOptions(
isPublic: boolean,
@ -142,10 +140,6 @@ export const MenuItemPinConversation = (props: PinConversationMenuItemProps): JS
...conversation,
isPinned: !isPinned
}))
if (isPinned) {
// purgeStoredState(persistConfig);
}
}
return <Item onClick={togglePinConversation}>{(isPinned ? 'Unpin' : 'Pin') + ' Conversation'}</Item>

@ -9,6 +9,7 @@ import { actions as userActions } from '../state/ducks/user';
import { mn_decode, mn_encode } from '../session/crypto/mnemonic';
import { ConversationTypeEnum } from '../models/conversation';
import _ from 'underscore';
import { persistStore } from 'redux-persist';
/**
* Might throw
@ -134,6 +135,10 @@ async function bouncyDeleteAccount(reason?: string) {
await window.Signal.Data.removeOtherData();
// 'unlink' => toast will be shown on app restart
window.localStorage.setItem('restart-reason', reason || '');
if (window.inboxStore) {
// warrick: this part might be redundant due to localStorage getting cleared.
persistStore(window.inboxStore).purge();
}
};
try {
window?.log?.info('DeleteAccount => Sending a last SyncConfiguration');

Loading…
Cancel
Save