diff --git a/js/models/conversations.js b/js/models/conversations.js index e83e6194c..ea5be6d0d 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -35,7 +35,6 @@ const { Conversation, Contact, - Errors, Message, PhoneNumber, } = window.Signal.Types; @@ -2215,7 +2214,6 @@ } }, - hasMember(number) { return _.contains(this.get('members'), number); }, diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index b51f48d68..a083261c7 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -365,7 +365,6 @@ this.unload('windows closed'); }); - this.$('.send-message').focus(this.focusBottomBar.bind(this)); this.$('.send-message').blur(this.unfocusBottomBar.bind(this)); diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index 769622bd3..862fb984e 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -129,8 +129,6 @@ border-radius: 16px; overflow: hidden; - - background-color: $color-white; } .module-message__attachment-container--with-content-below { diff --git a/stylesheets/_session.scss b/stylesheets/_session.scss index f86e1e3df..6d71c21c0 100644 --- a/stylesheets/_session.scss +++ b/stylesheets/_session.scss @@ -1337,11 +1337,9 @@ input { .session-scroll-button { animation: fadein $session-fadein-duration; - position: sticky; - text-align: -webkit-right; - bottom: 15px; - right: 25px; + position: fixed; z-index: 2; + right: 60px; .session-icon-button { display: flex; diff --git a/stylesheets/themes.scss b/stylesheets/themes.scss index 94e7ba731..8fa3951fc 100644 --- a/stylesheets/themes.scss +++ b/stylesheets/themes.scss @@ -9,7 +9,9 @@ $accentDarkTheme: #00f782; $borderLightTheme: #f1f1f1; // search for references on ts TODO: make this exposed on ts $borderDarkTheme: rgba($white, 0.06); -$borderAvatarColor: unquote('#00000059'); // search for references on ts TODO: make this exposed on ts +$borderAvatarColor: unquote( + '#00000059' +); // search for references on ts TODO: make this exposed on ts $themes: ( light: ( diff --git a/ts/components/session/conversation/SessionCompositionBox.tsx b/ts/components/session/conversation/SessionCompositionBox.tsx index 523fc242d..db3fd2d5c 100644 --- a/ts/components/session/conversation/SessionCompositionBox.tsx +++ b/ts/components/session/conversation/SessionCompositionBox.tsx @@ -497,7 +497,11 @@ export class SessionCompositionBox extends React.Component { 'attachments' ); - const linkPreviews = stagedLinkPreview && [_.pick(stagedLinkPreview, 'url', 'image', 'title')] || []; + const linkPreviews = + (stagedLinkPreview && [ + _.pick(stagedLinkPreview, 'url', 'image', 'title'), + ]) || + []; try { const attachments = await this.getFiles(); @@ -510,7 +514,6 @@ export class SessionCompositionBox extends React.Component { {} ); - // Message sending sucess this.props.onMessageSuccess(); @@ -526,7 +529,6 @@ export class SessionCompositionBox extends React.Component { stagedLinkPreview: undefined, ignoredLink: undefined, }); - } } catch (e) { // Message sending failed diff --git a/ts/components/session/conversation/SessionConversation.tsx b/ts/components/session/conversation/SessionConversation.tsx index fac307139..75ac52e4b 100644 --- a/ts/components/session/conversation/SessionConversation.tsx +++ b/ts/components/session/conversation/SessionConversation.tsx @@ -395,9 +395,10 @@ export class SessionConversation extends React.Component { messages.push({ ...messageModels[i], firstMessageOfSeries }); previousSender = messageModels[i].authorPhoneNumber; } - - const previousTopMessage = this.state.messages[0]?.id; - const newTopMessage = messages[0]?.id; + const oldLen = this.state.messages.length; + const newLen = messages.length; + const previousTopMessage = this.state.messages[oldLen - 1]?.id; + const newTopMessage = messages[newLen - 1]?.id; this.setState({ messages, messageFetchTimestamp: timestamp }); @@ -843,43 +844,43 @@ export class SessionConversation extends React.Component { // ~~~~~~~~~~~ KEYBOARD NAVIGATION ~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private onKeyDown(event: any) { - // const messageContainer = this.messageContainerRef.current; - // if (!messageContainer) { - // return; - // } - // const selectionMode = !!this.state.selectedMessages.length; - // const recordingMode = this.state.showRecordingView; - // const pageHeight = messageContainer.clientHeight; - // const arrowScrollPx = 50; - // const pageScrollPx = pageHeight * 0.8; - // if (event.key === 'Escape') { - // // EXIT MEDIA VIEW - // if (recordingMode) { - // // EXIT RECORDING VIEW - // } - // // EXIT WHAT ELSE? - // } - // switch (event.key) { - // case 'Escape': - // if (selectionMode) { - // this.resetSelection(); - // } - // break; - // // Scrolling - // case 'ArrowUp': - // messageContainer.scrollBy(0, -arrowScrollPx); - // break; - // case 'ArrowDown': - // messageContainer.scrollBy(0, arrowScrollPx); - // break; - // case 'PageUp': - // messageContainer.scrollBy(0, -pageScrollPx); - // break; - // case 'PageDown': - // messageContainer.scrollBy(0, pageScrollPx); - // break; - // default: - // } + const messageContainer = this.messageContainerRef.current; + if (!messageContainer) { + return; + } + const selectionMode = !!this.state.selectedMessages.length; + const recordingMode = this.state.showRecordingView; + const pageHeight = messageContainer.clientHeight; + const arrowScrollPx = 50; + const pageScrollPx = pageHeight * 0.8; + if (event.key === 'Escape') { + // EXIT MEDIA VIEW + if (recordingMode) { + // EXIT RECORDING VIEW + } + // EXIT WHAT ELSE? + } + switch (event.key) { + case 'Escape': + if (selectionMode) { + this.resetSelection(); + } + break; + // Scrolling + case 'ArrowUp': + messageContainer.scrollBy(0, -arrowScrollPx); + break; + case 'ArrowDown': + messageContainer.scrollBy(0, arrowScrollPx); + break; + case 'PageUp': + messageContainer.scrollBy(0, -pageScrollPx); + break; + case 'PageDown': + messageContainer.scrollBy(0, pageScrollPx); + break; + default: + } } private clearAttachments() { diff --git a/ts/components/session/conversation/SessionConversationMessagesList.tsx b/ts/components/session/conversation/SessionConversationMessagesList.tsx index a711274e3..79c160433 100644 --- a/ts/components/session/conversation/SessionConversationMessagesList.tsx +++ b/ts/components/session/conversation/SessionConversationMessagesList.tsx @@ -208,7 +208,7 @@ export class SessionConversationMessagesList extends React.Component< } if (isScrolledToBottom) { - unread = messages[messages.length - 1]; + unread = messages[0]; } else { unread = this.findNewestVisibleUnread(); } @@ -385,48 +385,4 @@ export class SessionConversationMessagesList extends React.Component< public resetSelection() { this.props.resetSelection(); } - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // ~~~~~~~~~~~ KEYBOARD NAVIGATION ~~~~~~~~~~~~ - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - private onKeyDown(event: any) { - //FIXME Audric - // const messageContainer = this.messageContainerRef.current; - // if (!messageContainer) { - // return; - // } - // const selectionMode = !!this.props.selectedMessages.length; - // const recordingMode = this.props.showRecordingView; - // const pageHeight = messageContainer.clientHeight; - // const arrowScrollPx = 50; - // const pageScrollPx = pageHeight * 0.8; - // if (event.key === 'Escape') { - // // EXIT MEDIA VIEW - // if (recordingMode) { - // // EXIT RECORDING VIEW - // } - // // EXIT WHAT ELSE? - // } - // switch (event.key) { - // case 'Escape': - // if (selectionMode) { - // this.resetSelection(); - // } - // break; - // // Scrolling - // case 'ArrowUp': - // messageContainer.scrollBy(0, -arrowScrollPx); - // break; - // case 'ArrowDown': - // messageContainer.scrollBy(0, arrowScrollPx); - // break; - // case 'PageUp': - // messageContainer.scrollBy(0, -pageScrollPx); - // break; - // case 'PageDown': - // messageContainer.scrollBy(0, pageScrollPx); - // break; - // default: - // } - } }