Fixes rendering of about bio
This commit is contained in:
parent
3ee69c211d
commit
1b38db2d79
10 changed files with 82 additions and 12 deletions
|
@ -2100,7 +2100,10 @@ $timer-icons: '55', '50', '45', '40', '35', '30', '25', '20', '15', '10', '05',
|
||||||
.module-about {
|
.module-about {
|
||||||
&__container {
|
&__container {
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
max-width: 248px;
|
max-width: 248px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__text {
|
&__text {
|
||||||
|
@ -2113,6 +2116,13 @@ $timer-icons: '55', '50', '45', '40', '35', '30', '25', '20', '15', '10', '05',
|
||||||
}
|
}
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
|
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
display: -webkit-box;
|
||||||
|
overflow: hidden;
|
||||||
|
text-align: left;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
img.emoji {
|
img.emoji {
|
||||||
height: 1em;
|
height: 1em;
|
||||||
margin-right: 3px;
|
margin-right: 3px;
|
||||||
|
@ -2740,6 +2750,11 @@ $timer-icons: '55', '50', '45', '40', '35', '30', '25', '20', '15', '10', '05',
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-contact-list-item__left {
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.module-contact-list-item__text__name {
|
.module-contact-list-item__text__name {
|
||||||
|
@ -2780,7 +2795,6 @@ $timer-icons: '55', '50', '45', '40', '35', '30', '25', '20', '15', '10', '05',
|
||||||
}
|
}
|
||||||
|
|
||||||
.module-contact-list-item__admin {
|
.module-contact-list-item__admin {
|
||||||
flex-grow: 1;
|
|
||||||
text-align: right;
|
text-align: right;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
|
@ -2897,6 +2911,10 @@ $timer-icons: '55', '50', '45', '40', '35', '30', '25', '20', '15', '10', '05',
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.module-conversation-header__title-clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.module-conversation-header__note-to-self {
|
.module-conversation-header__note-to-self {
|
||||||
@include dark-theme {
|
@include dark-theme {
|
||||||
color: $color-gray-02;
|
color: $color-gray-02;
|
||||||
|
|
14
ts/Crypto.ts
14
ts/Crypto.ts
|
@ -773,3 +773,17 @@ export function splitUuids(arrayBuffer: ArrayBuffer): Array<string | null> {
|
||||||
}
|
}
|
||||||
return uuids;
|
return uuids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function trimForDisplay(arrayBuffer: ArrayBuffer): ArrayBuffer {
|
||||||
|
const padded = new Uint8Array(arrayBuffer);
|
||||||
|
|
||||||
|
let paddingEnd = 0;
|
||||||
|
for (paddingEnd; paddingEnd < padded.length; paddingEnd += 1) {
|
||||||
|
if (padded[paddingEnd] === 0x00) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return window.dcodeIO.ByteBuffer.wrap(padded)
|
||||||
|
.slice(0, paddingEnd)
|
||||||
|
.toArrayBuffer();
|
||||||
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ storiesOf('Components/ContactListItem', module)
|
||||||
name="Someone 🔥 Somewhere"
|
name="Someone 🔥 Somewhere"
|
||||||
phoneNumber="(202) 555-0011"
|
phoneNumber="(202) 555-0011"
|
||||||
profileName="🔥Flames🔥"
|
profileName="🔥Flames🔥"
|
||||||
about="👍 Free to chat"
|
about="👍 This is my really long status message that I have in order to test line breaking"
|
||||||
avatarPath={gifUrl}
|
avatarPath={gifUrl}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -47,6 +47,7 @@ const commonProps = {
|
||||||
|
|
||||||
onShowSafetyNumber: action('onShowSafetyNumber'),
|
onShowSafetyNumber: action('onShowSafetyNumber'),
|
||||||
onShowAllMedia: action('onShowAllMedia'),
|
onShowAllMedia: action('onShowAllMedia'),
|
||||||
|
onShowContactModal: action('onShowContactModal'),
|
||||||
onShowGroupMembers: action('onShowGroupMembers'),
|
onShowGroupMembers: action('onShowGroupMembers'),
|
||||||
onGoBack: action('onGoBack'),
|
onGoBack: action('onGoBack'),
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ export type PropsDataType = {
|
||||||
export type PropsActionsType = {
|
export type PropsActionsType = {
|
||||||
onSetMuteNotifications: (seconds: number) => void;
|
onSetMuteNotifications: (seconds: number) => void;
|
||||||
onSetDisappearingMessages: (seconds: number) => void;
|
onSetDisappearingMessages: (seconds: number) => void;
|
||||||
|
onShowContactModal: (contactId: string) => void;
|
||||||
onDeleteMessages: () => void;
|
onDeleteMessages: () => void;
|
||||||
onResetSession: () => void;
|
onResetSession: () => void;
|
||||||
onSearchInConversation: () => void;
|
onSearchInConversation: () => void;
|
||||||
|
@ -468,6 +469,42 @@ export class ConversationHeader extends React.Component<PropsType> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private renderHeader(): JSX.Element {
|
||||||
|
const { id, isMe, onShowContactModal, type } = this.props;
|
||||||
|
|
||||||
|
if (type === 'group' || isMe) {
|
||||||
|
return (
|
||||||
|
<div className="module-conversation-header__title-flex">
|
||||||
|
{this.renderAvatar()}
|
||||||
|
{this.renderTitle()}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const onContactClick = () => onShowContactModal(id);
|
||||||
|
const onKeyDown = (e: React.KeyboardEvent): void => {
|
||||||
|
if (e.key === 'Enter' || e.key === ' ') {
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
onShowContactModal(id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="module-conversation-header__title-flex module-conversation-header__title-clickable"
|
||||||
|
onClick={onContactClick}
|
||||||
|
onKeyDown={onKeyDown}
|
||||||
|
role="button"
|
||||||
|
tabIndex={0}
|
||||||
|
>
|
||||||
|
{this.renderAvatar()}
|
||||||
|
{this.renderTitle()}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
const { id } = this.props;
|
const { id } = this.props;
|
||||||
const triggerId = `conversation-${id}`;
|
const triggerId = `conversation-${id}`;
|
||||||
|
@ -476,10 +513,7 @@ export class ConversationHeader extends React.Component<PropsType> {
|
||||||
<div className="module-conversation-header">
|
<div className="module-conversation-header">
|
||||||
{this.renderBackButton()}
|
{this.renderBackButton()}
|
||||||
<div className="module-conversation-header__title-container">
|
<div className="module-conversation-header__title-container">
|
||||||
<div className="module-conversation-header__title-flex">
|
{this.renderHeader()}
|
||||||
{this.renderAvatar()}
|
|
||||||
{this.renderTitle()}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{this.renderExpirationLength()}
|
{this.renderExpirationLength()}
|
||||||
{this.renderOutgoingCallButtons()}
|
{this.renderOutgoingCallButtons()}
|
||||||
|
|
|
@ -191,7 +191,7 @@ export const ConversationHero = ({
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</h1>
|
</h1>
|
||||||
{about && (
|
{about && !isMe && (
|
||||||
<div className="module-about__container">
|
<div className="module-about__container">
|
||||||
<About text={about} />
|
<About text={about} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -29,6 +29,7 @@ import {
|
||||||
fromEncodedBinaryToArrayBuffer,
|
fromEncodedBinaryToArrayBuffer,
|
||||||
getRandomBytes,
|
getRandomBytes,
|
||||||
stringFromBytes,
|
stringFromBytes,
|
||||||
|
trimForDisplay,
|
||||||
verifyAccessKey,
|
verifyAccessKey,
|
||||||
} from '../Crypto';
|
} from '../Crypto';
|
||||||
import { GroupChangeClass } from '../textsecure.d';
|
import { GroupChangeClass } from '../textsecure.d';
|
||||||
|
@ -3768,26 +3769,26 @@ export class ConversationModel extends window.Backbone.Model<
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile.about) {
|
if (profile.about) {
|
||||||
const key = this.get('profileKey');
|
const key = c.get('profileKey');
|
||||||
if (key) {
|
if (key) {
|
||||||
const keyBuffer = base64ToArrayBuffer(key);
|
const keyBuffer = base64ToArrayBuffer(key);
|
||||||
const decrypted = await window.textsecure.crypto.decryptProfile(
|
const decrypted = await window.textsecure.crypto.decryptProfile(
|
||||||
base64ToArrayBuffer(profile.about),
|
base64ToArrayBuffer(profile.about),
|
||||||
keyBuffer
|
keyBuffer
|
||||||
);
|
);
|
||||||
this.set('about', stringFromBytes(decrypted));
|
c.set('about', stringFromBytes(trimForDisplay(decrypted)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile.aboutEmoji) {
|
if (profile.aboutEmoji) {
|
||||||
const key = this.get('profileKey');
|
const key = c.get('profileKey');
|
||||||
if (key) {
|
if (key) {
|
||||||
const keyBuffer = base64ToArrayBuffer(key);
|
const keyBuffer = base64ToArrayBuffer(key);
|
||||||
const decrypted = await window.textsecure.crypto.decryptProfile(
|
const decrypted = await window.textsecure.crypto.decryptProfile(
|
||||||
base64ToArrayBuffer(profile.aboutEmoji),
|
base64ToArrayBuffer(profile.aboutEmoji),
|
||||||
keyBuffer
|
keyBuffer
|
||||||
);
|
);
|
||||||
this.set('aboutEmoji', stringFromBytes(decrypted));
|
c.set('aboutEmoji', stringFromBytes(trimForDisplay(decrypted)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ export type OwnProps = {
|
||||||
onSetMuteNotifications: (seconds: number) => void;
|
onSetMuteNotifications: (seconds: number) => void;
|
||||||
onSetPin: (value: boolean) => void;
|
onSetPin: (value: boolean) => void;
|
||||||
onShowAllMedia: () => void;
|
onShowAllMedia: () => void;
|
||||||
|
onShowContactModal: (contactId: string) => void;
|
||||||
onShowGroupMembers: () => void;
|
onShowGroupMembers: () => void;
|
||||||
|
|
||||||
onArchive: () => void;
|
onArchive: () => void;
|
||||||
|
|
|
@ -14770,7 +14770,7 @@
|
||||||
"rule": "React-createRef",
|
"rule": "React-createRef",
|
||||||
"path": "ts/components/conversation/ConversationHeader.tsx",
|
"path": "ts/components/conversation/ConversationHeader.tsx",
|
||||||
"line": " this.menuTriggerRef = React.createRef();",
|
"line": " this.menuTriggerRef = React.createRef();",
|
||||||
"lineNumber": 101,
|
"lineNumber": 102,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2020-05-20T20:10:43.540Z",
|
"updated": "2020-05-20T20:10:43.540Z",
|
||||||
"reasonDetail": "Used to reference popup menu"
|
"reasonDetail": "Used to reference popup menu"
|
||||||
|
|
|
@ -458,6 +458,7 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
{
|
{
|
||||||
id: this.model.id,
|
id: this.model.id,
|
||||||
|
|
||||||
|
onShowContactModal: this.showContactModal.bind(this),
|
||||||
onSetDisappearingMessages: (seconds: number) =>
|
onSetDisappearingMessages: (seconds: number) =>
|
||||||
this.setDisappearingMessages(seconds),
|
this.setDisappearingMessages(seconds),
|
||||||
onDeleteMessages: () => this.destroyMessages(),
|
onDeleteMessages: () => this.destroyMessages(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue