Completed message selection

pull/689/head
Vincent 5 years ago
parent 0c4f57e57d
commit fc235d6057

@ -997,6 +997,10 @@
"delete": { "delete": {
"message": "Delete" "message": "Delete"
}, },
"forwardMessage": {
"message": "Forward",
"description": "Text of Forward Message button"
},
"deletePublicWarning": { "deletePublicWarning": {
"message": "message":
"Are you sure? Clicking 'delete' will permanently remove this message for everyone in this channel." "Are you sure? Clicking 'delete' will permanently remove this message for everyone in this channel."

@ -590,6 +590,7 @@
onCopyPublicKey: () => this.copyPublicKey(), onCopyPublicKey: () => this.copyPublicKey(),
onDeleteContact: () => this.deleteContact(), onDeleteContact: () => this.deleteContact(),
onDeleteMessages: () => this.deleteMessages(), onDeleteMessages: () => this.deleteMessages(),
onCloseOverlay: () => this.resetMessageSelection(),
}; };
this.updateAsyncPropsCache(); this.updateAsyncPropsCache();

@ -152,11 +152,6 @@
'show-message-detail', 'show-message-detail',
this.showMessageDetail this.showMessageDetail
); );
this.listenTo(
this.model,
'message-selection-changed',
this.onMessageSelectionChanged
);
this.listenTo(this.model.messageCollection, 'navigate-to', url => { this.listenTo(this.model.messageCollection, 'navigate-to', url => {
window.location = url; window.location = url;
}); });
@ -241,6 +236,8 @@
onSetDisappearingMessages: seconds => onSetDisappearingMessages: seconds =>
this.setDisappearingMessages(seconds), this.setDisappearingMessages(seconds),
onDeleteMessages: () => this.destroyMessages(), onDeleteMessages: () => this.destroyMessages(),
onDeleteSelectedMessages: () => this.deleteSelectedMessages(),
onCloseOverlay: () => this.model.resetMessageSelection(),
onDeleteContact: () => this.model.deleteContact(), onDeleteContact: () => this.model.deleteContact(),
onResetSession: () => this.endSession(), onResetSession: () => this.endSession(),
@ -1814,18 +1811,6 @@
} }
}, },
onMessageSelectionChanged() {
const selectionSize = this.model.selectedMessages.size;
if (selectionSize > 0) {
$('.compose').hide();
} else {
$('.compose').show();
}
this.bulkEditView.update(selectionSize);
},
resetMessageSelection() { resetMessageSelection() {
this.model.resetMessageSelection(); this.model.resetMessageSelection();
}, },

@ -62,6 +62,9 @@ interface Props {
onDeleteContact: () => void; onDeleteContact: () => void;
onResetSession: () => void; onResetSession: () => void;
onCloseOverlay: () => void;
onDeleteSelectedMessages: () => void;
onArchive: () => void; onArchive: () => void;
onMoveToInbox: () => void; onMoveToInbox: () => void;
@ -246,7 +249,6 @@ export class ConversationHeader extends React.Component<Props> {
<SessionIconButton <SessionIconButton
iconType={SessionIconType.Ellipses} iconType={SessionIconType.Ellipses}
iconSize={SessionIconSize.Large} iconSize={SessionIconSize.Large}
onClick={this.showMenuBound}
/> />
</ContextMenuTrigger> </ContextMenuTrigger>
); );
@ -302,7 +304,7 @@ export class ConversationHeader extends React.Component<Props> {
} }
public renderSelectionOverlay() { public renderSelectionOverlay() {
const { onDeleteMessages } = this.props; const { onDeleteSelectedMessages, onCloseOverlay, i18n } = this.props;
return ( return (
<div className="message-selection-overlay"> <div className="message-selection-overlay">
@ -310,6 +312,7 @@ export class ConversationHeader extends React.Component<Props> {
<SessionIconButton <SessionIconButton
iconType={SessionIconType.Exit} iconType={SessionIconType.Exit}
iconSize={SessionIconSize.Medium} iconSize={SessionIconSize.Medium}
onClick={onCloseOverlay}
/> />
</div> </div>
@ -317,15 +320,14 @@ export class ConversationHeader extends React.Component<Props> {
<SessionButton <SessionButton
buttonType={SessionButtonType.Default} buttonType={SessionButtonType.Default}
buttonColor={SessionButtonColor.Primary} buttonColor={SessionButtonColor.Primary}
text={'Forward'} text={i18n('forwardMessage')}
onClick={onDeleteMessages}
/> />
<SessionButton <SessionButton
buttonType={SessionButtonType.Default} buttonType={SessionButtonType.Default}
buttonColor={SessionButtonColor.Danger} buttonColor={SessionButtonColor.Danger}
text={'Delete'} text={i18n('delete')}
onClick={onDeleteMessages} onClick={onDeleteSelectedMessages}
/> />
</div> </div>
</div> </div>

@ -9,7 +9,6 @@ export interface Props {
iconColor: string; iconColor: string;
iconPadded: boolean; iconPadded: boolean;
iconRotation: number; iconRotation: number;
onClick: any;
} }
export class SessionIcon extends React.PureComponent<Props> { export class SessionIcon extends React.PureComponent<Props> {
@ -18,7 +17,6 @@ export class SessionIcon extends React.PureComponent<Props> {
iconColor: '', iconColor: '',
iconRotation: 0, iconRotation: 0,
iconPadded: false, iconPadded: false,
onClick: () => null,
}; };
constructor(props: any) { constructor(props: any) {

@ -3,8 +3,18 @@ import classNames from 'classnames';
import { Props, SessionIcon } from '../icon'; import { Props, SessionIcon } from '../icon';
export class SessionIconButton extends React.PureComponent<Props> { interface SProps extends Props {
public static defaultProps = SessionIcon.defaultProps; onClick: any;
}
export class SessionIconButton extends React.PureComponent<SProps> {
public static readonly extendedDefaults = {
onClick: () => null,
};
public static readonlydefaultProps = {
...SessionIcon.defaultProps,
...SessionIconButton.extendedDefaults,
};
constructor(props: any) { constructor(props: any) {
super(props); super(props);
@ -18,7 +28,6 @@ export class SessionIconButton extends React.PureComponent<Props> {
iconColor, iconColor,
iconRotation, iconRotation,
iconPadded, iconPadded,
onClick,
} = this.props; } = this.props;
return ( return (
@ -38,7 +47,6 @@ export class SessionIconButton extends React.PureComponent<Props> {
iconSize={iconSize} iconSize={iconSize}
iconColor={iconColor} iconColor={iconColor}
iconRotation={iconRotation} iconRotation={iconRotation}
onClick={onClick}
/> />
</div> </div>
); );

Loading…
Cancel
Save