Added online indicator.

Disable selection in contacts.
This commit is contained in:
Mikunj 2019-01-17 15:10:07 +11:00
parent 0decbaee88
commit 9b382de6da
5 changed files with 45 additions and 5 deletions

View File

@ -77,6 +77,7 @@
unlockTimestamp: null, // Timestamp used for expiring friend requests.
sessionResetStatus: SessionResetEnum.none,
swarmNodes: new Set([]),
isOnline: false,
};
},
@ -252,6 +253,13 @@
);
},
async setIsOnline(online) {
this.set({ isOnline: online });
await window.Signal.Data.updateConversation(this.id, this.attributes, {
Conversation: Whisper.Conversation,
});
},
async cleanup() {
await window.Signal.Types.Conversation.deleteExternalFiles(
this.attributes,
@ -386,6 +394,7 @@
status: this.lastMessageStatus,
text: this.lastMessage,
},
isOnline: this.get('isOnline'),
onClick: () => this.trigger('select', this),
};

View File

@ -60,6 +60,7 @@
const props = this.model.getPropsForListItem();
delete props.lastMessage;
delete props.lastUpdated;
delete props.isSelected;
return props;
},

View File

@ -1767,6 +1767,10 @@
.module-avatar {
background-color: $color-dark-85;
}
.module-contact-name {
margin-right: 0px;
}
}
.module-conversation-list-item--has-unread {
@ -1822,12 +1826,10 @@
.module-conversation-list-item__content {
flex-grow: 1;
margin-left: 12px;
// parent - 48px (for avatar) - 16px (our right margin)
max-width: calc(100% - 64px);
display: flex;
flex-direction: column;
align-items: stretch;
overflow: hidden;
}
.module-conversation-list-item__header {

View File

@ -13,6 +13,7 @@ interface Props {
phoneNumber?: string;
profileName?: string;
size: number;
borderColor?: string;
}
interface State {
@ -41,7 +42,14 @@ export class Avatar extends React.Component<Props, State> {
}
public renderImage() {
const { avatarPath, i18n, name, phoneNumber, profileName } = this.props;
const {
avatarPath,
i18n,
name,
phoneNumber,
profileName,
borderColor,
} = this.props;
const { imageBroken } = this.state;
const hasImage = avatarPath && !imageBroken;
@ -53,8 +61,16 @@ export class Avatar extends React.Component<Props, State> {
!name && profileName ? ` ~${profileName}` : ''
}`;
const borderStyle = borderColor
? {
borderColor: borderColor,
borderStyle: 'solid',
}
: undefined;
return (
<img
style={borderStyle}
onError={this.handleImageErrorBound}
alt={i18n('contactAvatarAlt', [title])}
src={avatarPath}
@ -63,11 +79,18 @@ export class Avatar extends React.Component<Props, State> {
}
public renderNoImage() {
const { conversationType, name, size } = this.props;
const { conversationType, name, size, borderColor } = this.props;
const initials = getInitials(name);
const isGroup = conversationType === 'group';
const borderStyle = borderColor
? {
borderColor: borderColor,
borderStyle: 'solid',
}
: undefined;
if (!isGroup && initials) {
return (
<div
@ -75,6 +98,7 @@ export class Avatar extends React.Component<Props, State> {
'module-avatar__label',
`module-avatar__label--${size}`
)}
style={borderStyle}
>
{initials}
</div>
@ -88,6 +112,7 @@ export class Avatar extends React.Component<Props, State> {
`module-avatar__icon--${conversationType}`,
`module-avatar__icon--${size}`
)}
style={borderStyle}
/>
);
}

View File

@ -28,6 +28,7 @@ interface Props {
};
showFriendRequestIndicator?: boolean;
isBlocked: boolean;
isOnline: boolean;
i18n: Localizer;
onClick?: () => void;
@ -43,6 +44,7 @@ export class ConversationListItem extends React.Component<Props> {
name,
phoneNumber,
profileName,
isOnline,
} = this.props;
return (
@ -56,6 +58,7 @@ export class ConversationListItem extends React.Component<Props> {
phoneNumber={phoneNumber}
profileName={profileName}
size={48}
borderColor={isOnline ? '#1c8260' : '#3d3e44'}
/>
{this.renderUnread()}
</div>