pull/715/head
Audric Ackermann 6 years ago
parent ab0ff9c3ad
commit 213db6c1ed

@ -17,11 +17,7 @@
'use strict'; 'use strict';
window.Whisper = window.Whisper || {}; window.Whisper = window.Whisper || {};
const { Message } = window.Signal.Types; const { getAbsoluteAttachmentPath } = window.Signal.Migrations;
const {
upgradeMessageSchema,
getAbsoluteAttachmentPath,
} = window.Signal.Migrations;
const MAX_MESSAGE_BODY_LENGTH = 64 * 1024; const MAX_MESSAGE_BODY_LENGTH = 64 * 1024;
@ -337,7 +333,7 @@
}); });
this.showGroupSettings = () => { this.showGroupSettings = () => {
if(!this.groupSettings) { if (!this.groupSettings) {
this.groupSettings = new Whisper.ReactWrapperView({ this.groupSettings = new Whisper.ReactWrapperView({
className: 'group-settings', className: 'group-settings',
Component: window.Signal.Components.SessionChannelSettings, Component: window.Signal.Components.SessionChannelSettings,
@ -346,11 +342,11 @@
this.$('.conversation-content-right').append(this.groupSettings.el); this.$('.conversation-content-right').append(this.groupSettings.el);
} }
this.$('.conversation-content-right').show(); this.$('.conversation-content-right').show();
} };
this.hideGroupSettings = () => { this.hideGroupSettings = () => {
this.$('.conversation-content-right').hide(); this.$('.conversation-content-right').hide();
} };
this.memberView.render(); this.memberView.render();
@ -963,7 +959,6 @@
el[0].scrollIntoView(); el[0].scrollIntoView();
}, },
scrollToBottom() { scrollToBottom() {
// If we're above the last seen indicator, we should scroll there instead // If we're above the last seen indicator, we should scroll there instead
// Note: if we don't end up at the bottom of the conversation, button won't go away! // Note: if we don't end up at the bottom of the conversation, button won't go away!

@ -233,7 +233,7 @@ function createWindow() {
preload: path.join(__dirname, 'preload.js'), preload: path.join(__dirname, 'preload.js'),
nativeWindowOpen: true, nativeWindowOpen: true,
}, },
icon: path.join(__dirname, 'images', 'session','icon_64.png'), icon: path.join(__dirname, 'images', 'session', 'icon_64.png'),
}, },
_.pick(windowConfig, [ _.pick(windowConfig, [
'maximized', 'maximized',

@ -38,7 +38,6 @@
text-align: center; text-align: center;
} }
&-item { &-item {
display: flex; display: flex;
align-items: center; align-items: center;
@ -56,7 +55,6 @@
&:hover { &:hover {
@include session-dark-background-hover; @include session-dark-background-hover;
} }
} }
// no double border (top and bottom) between two elements // no double border (top and bottom) between two elements
@ -100,7 +98,7 @@
opacity: 1; opacity: 1;
&:after { &:after {
content: ""; /* This is necessary for the pseudo element to work. */ content: ''; /* This is necessary for the pseudo element to work. */
display: block; display: block;
margin: 0 auto; margin: 0 auto;
width: 70%; width: 70%;
@ -124,7 +122,6 @@
} }
} }
.conversation-content { .conversation-content {
display: flex; display: flex;
height: inherit; height: inherit;

@ -16,7 +16,6 @@ interface Props {
export class AttachmentSection extends React.Component<Props> { export class AttachmentSection extends React.Component<Props> {
public render() { public render() {
return ( return (
<div className="module-attachment-section"> <div className="module-attachment-section">
<div className="module-attachment-section__items"> <div className="module-attachment-section__items">

@ -18,7 +18,6 @@ interface State {
selectedTab: 'media' | 'documents'; selectedTab: 'media' | 'documents';
} }
interface TabSelectEvent { interface TabSelectEvent {
type: 'media' | 'documents'; type: 'media' | 'documents';
} }

@ -40,7 +40,7 @@ const Section = ({
}) => { }) => {
const handleClick = onSelect const handleClick = onSelect
? () => { ? () => {
if(type !== SectionType.Profile) { if (type !== SectionType.Profile) {
onSelect(type); onSelect(type);
} }
} }
@ -58,7 +58,7 @@ const Section = ({
onAvatarClick={handleClick} onAvatarClick={handleClick}
/> />
); );
} }
let iconType: SessionIconType; let iconType: SessionIconType;
switch (type) { switch (type) {

@ -82,7 +82,7 @@ export class LeftPaneContactSection extends React.Component<Props, State> {
public renderHeader(): JSX.Element | undefined { public renderHeader(): JSX.Element | undefined {
const { receivedFriendRequestCount } = this.props; const { receivedFriendRequestCount } = this.props;
// The feature "organize your friends as custom list" is not included in the first release // The feature "organize your friends as custom list" is not included in the first release
const labels = [window.i18n('contactsHeader')/*, window.i18n('lists')*/]; const labels = [window.i18n('contactsHeader') /*, window.i18n('lists')*/];
return LeftPane.RENDER_HEADER( return LeftPane.RENDER_HEADER(
labels, labels,

@ -1,11 +1,14 @@
import React from 'react'; import React from 'react';
import { SessionIconButton, SessionIconSize, SessionIconType } from './icon'; import { SessionIconButton, SessionIconSize, SessionIconType } from './icon';
import { Avatar } from '../Avatar'; import { Avatar } from '../Avatar';
import { SessionButton, SessionButtonColor, SessionButtonType } from './SessionButton'; import {
SessionButton,
SessionButtonColor,
SessionButtonType,
} from './SessionButton';
import { MediaGallery } from '../conversation/media-gallery/MediaGallery'; import { MediaGallery } from '../conversation/media-gallery/MediaGallery';
import _ from 'lodash'; import _ from 'lodash';
interface Props { interface Props {
id: string; id: string;
name: string; name: string;
@ -19,7 +22,6 @@ interface Props {
} }
export class SessionChannelSettings extends React.Component<Props, any> { export class SessionChannelSettings extends React.Component<Props, any> {
public constructor(props: Props) { public constructor(props: Props) {
super(props); super(props);
@ -31,13 +33,15 @@ export class SessionChannelSettings extends React.Component<Props, any> {
} }
public componentWillMount() { public componentWillMount() {
this.getMediaGalleryProps().then(({ documents, media, onItemClick }) => { this.getMediaGalleryProps()
.then(({ documents, media, onItemClick }) => {
this.setState({ this.setState({
documents, documents,
media, media,
onItemClick, onItemClick,
}); });
}).ignore(); })
.ignore();
} }
public async getMediaGalleryProps() { public async getMediaGalleryProps() {
@ -70,7 +74,9 @@ export class SessionChannelSettings extends React.Component<Props, any> {
if (schemaVersion < message.VERSION_NEEDED_FOR_DISPLAY) { if (schemaVersion < message.VERSION_NEEDED_FOR_DISPLAY) {
// Yep, we really do want to wait for each of these // Yep, we really do want to wait for each of these
// eslint-disable-next-line no-await-in-loop // eslint-disable-next-line no-await-in-loop
rawMedia[i] = await window.Signal.Migrations.upgradeMessageSchema(message); rawMedia[i] = await window.Signal.Migrations.upgradeMessageSchema(
message
);
// eslint-disable-next-line no-await-in-loop // eslint-disable-next-line no-await-in-loop
await window.Signal.Data.saveMessage(rawMedia[i], { await window.Signal.Data.saveMessage(rawMedia[i], {
Message: window.Whisper.Message, Message: window.Whisper.Message,
@ -86,30 +92,37 @@ export class SessionChannelSettings extends React.Component<Props, any> {
return (attachments || []) return (attachments || [])
.filter( .filter(
(attachment: { thumbnail: any; pending: any; error: any }) => (attachment: { thumbnail: any; pending: any; error: any }) =>
attachment.thumbnail && attachment.thumbnail && !attachment.pending && !attachment.error
!attachment.pending &&
!attachment.error
) )
.map((attachment: { path?: any; contentType?: any; thumbnail?: any }, index: any) => { .map(
(
attachment: { path?: any; contentType?: any; thumbnail?: any },
index: any
) => {
const { thumbnail } = attachment; const { thumbnail } = attachment;
return { return {
objectURL: window.Signal.Migrations.getAbsoluteAttachmentPath(attachment.path), objectURL: window.Signal.Migrations.getAbsoluteAttachmentPath(
attachment.path
),
thumbnailObjectUrl: thumbnail thumbnailObjectUrl: thumbnail
? window.Signal.Migrations.getAbsoluteAttachmentPath(thumbnail.path) ? window.Signal.Migrations.getAbsoluteAttachmentPath(
thumbnail.path
)
: null, : null,
contentType: attachment.contentType, contentType: attachment.contentType,
index, index,
attachment, attachment,
message, message,
}; };
}
}); );
}) })
); );
// Unlike visual media, only one non-image attachment is supported // Unlike visual media, only one non-image attachment is supported
const documents = rawDocuments.map((message: { attachments: Array<any> }) => { const documents = rawDocuments.map(
(message: { attachments: Array<any> }) => {
const attachments = message.attachments || []; const attachments = message.attachments || [];
const attachment = attachments[0]; const attachment = attachments[0];
@ -119,7 +132,8 @@ export class SessionChannelSettings extends React.Component<Props, any> {
attachment, attachment,
message, message,
}; };
}); }
);
const saveAttachment = async ({ attachment, message }: any = {}) => { const saveAttachment = async ({ attachment, message }: any = {}) => {
const timestamp = message.received_at; const timestamp = message.received_at;
@ -131,7 +145,7 @@ export class SessionChannelSettings extends React.Component<Props, any> {
}); });
}; };
const onItemClick = async ({ message, attachment, type } : any) => { const onItemClick = async ({ message, attachment, type }: any) => {
switch (type) { switch (type) {
case 'documents': case 'documents':
case 'media': { case 'media': {
@ -169,7 +183,6 @@ export class SessionChannelSettings extends React.Component<Props, any> {
}; };
} }
public render() { public render() {
const { memberCount, name, onLeaveGroup } = this.props; const { memberCount, name, onLeaveGroup } = this.props;
const { documents, media, onItemClick } = this.state; const { documents, media, onItemClick } = this.state;
@ -178,25 +191,59 @@ export class SessionChannelSettings extends React.Component<Props, any> {
<div className="group-settings"> <div className="group-settings">
{this.renderHeader()} {this.renderHeader()}
<h2>{name}</h2> <h2>{name}</h2>
{memberCount && <div className="text-subtle">{window.i18n('members', memberCount)}</div>} {memberCount && (
<input className="description" placeholder={window.i18n('description')} /> <div className="text-subtle">
{window.i18n('members', memberCount)}
<div className="group-settings-item" >{window.i18n('notifications')}</div> </div>
<div className="group-settings-item" >{window.i18n('disappearingMessages')}</div> )}
<MediaGallery documents={documents} media={media} onItemClick={onItemClick} /> <input
<SessionButton text={window.i18n('leaveGroup')} buttonColor={SessionButtonColor.Danger} buttonType={SessionButtonType.SquareOutline} onClick={onLeaveGroup}/> className="description"
</div>); placeholder={window.i18n('description')}
/>
<div className="group-settings-item">
{window.i18n('notifications')}
</div>
<div className="group-settings-item">
{window.i18n('disappearingMessages')}
</div>
<MediaGallery
documents={documents}
media={media}
onItemClick={onItemClick}
/>
<SessionButton
text={window.i18n('leaveGroup')}
buttonColor={SessionButtonColor.Danger}
buttonType={SessionButtonType.SquareOutline}
onClick={onLeaveGroup}
/>
</div>
);
} }
private renderHeader() { private renderHeader() {
const { id, onGoBack, onInviteFriends, avatarPath } = this.props; const { id, onGoBack, onInviteFriends, avatarPath } = this.props;
return ( return (
<div className="group-settings-header"> <div className="group-settings-header">
<SessionIconButton iconType={SessionIconType.Chevron} iconSize={SessionIconSize.Medium} iconRotation={90} onClick={onGoBack} /> <SessionIconButton
<Avatar avatarPath={avatarPath} phoneNumber={id} conversationType="group" size={80} /> iconType={SessionIconType.Chevron}
<SessionIconButton iconType={SessionIconType.AddUser} iconSize={SessionIconSize.Medium} onClick={onInviteFriends} /> iconSize={SessionIconSize.Medium}
iconRotation={90}
onClick={onGoBack}
/>
<Avatar
avatarPath={avatarPath}
phoneNumber={id}
conversationType="group"
size={80}
/>
<SessionIconButton
iconType={SessionIconType.AddUser}
iconSize={SessionIconSize.Medium}
onClick={onInviteFriends}
/>
</div> </div>
); );
} }

Loading…
Cancel
Save