Added online indicator.

Disable selection in contacts.
pull/165/head
Mikunj 7 years ago
parent 0decbaee88
commit 9b382de6da

@ -77,6 +77,7 @@
unlockTimestamp: null, // Timestamp used for expiring friend requests. unlockTimestamp: null, // Timestamp used for expiring friend requests.
sessionResetStatus: SessionResetEnum.none, sessionResetStatus: SessionResetEnum.none,
swarmNodes: new Set([]), 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() { async cleanup() {
await window.Signal.Types.Conversation.deleteExternalFiles( await window.Signal.Types.Conversation.deleteExternalFiles(
this.attributes, this.attributes,
@ -386,6 +394,7 @@
status: this.lastMessageStatus, status: this.lastMessageStatus,
text: this.lastMessage, text: this.lastMessage,
}, },
isOnline: this.get('isOnline'),
onClick: () => this.trigger('select', this), onClick: () => this.trigger('select', this),
}; };

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

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

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

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

Loading…
Cancel
Save