diff --git a/js/background.js b/js/background.js index 617aabb8d..bba651097 100644 --- a/js/background.js +++ b/js/background.js @@ -469,10 +469,6 @@ await window.Signal.Data.removeMessage(message.id, { Message: Whisper.Message, }); - const conversation = message.getConversation(); - if (conversation) { - await conversation.updateLastMessage(); - } }) ); window.log.info('Cleanup: complete'); diff --git a/js/models/conversations.d.ts b/js/models/conversations.d.ts index d3d5f2d89..bb66433e7 100644 --- a/js/models/conversations.d.ts +++ b/js/models/conversations.d.ts @@ -93,7 +93,9 @@ export interface ConversationModel block: any; copyPublicKey: any; getAvatar: any; - notifyTyping: any; + notifyTyping: ( + { isTyping, sender } = { isTyping: boolean, sender: string } + ) => any; setSecondaryStatus: any; queueJob: any; onUpdateGroupName: any; diff --git a/js/models/conversations.js b/js/models/conversations.js index 5a8c148f8..e474ef671 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -1801,9 +1801,7 @@ }) ); }, - notifyTyping(options = {}) { - const { isTyping, sender, senderDevice } = options; - + notifyTyping({ isTyping, sender }) { // We don't do anything with typing messages from our other devices if (sender === this.ourNumber) { return; @@ -1826,10 +1824,8 @@ } } - const identifier = `${sender}.${senderDevice}`; - this.contactTypingTimers = this.contactTypingTimers || {}; - const record = this.contactTypingTimers[identifier]; + const record = this.contactTypingTimers[sender]; if (record) { clearTimeout(record.timer); @@ -1840,16 +1836,13 @@ // 'change' causes a re-render of this conversation's list item in the left pane if (isTyping) { - this.contactTypingTimers[identifier] = this.contactTypingTimers[ - identifier - ] || { + this.contactTypingTimers[sender] = this.contactTypingTimers[sender] || { timestamp: Date.now(), sender, - senderDevice, }; - this.contactTypingTimers[identifier].timer = setTimeout( - this.clearContactTypingTimer.bind(this, identifier), + this.contactTypingTimers[sender].timer = setTimeout( + this.clearContactTypingTimer.bind(this, sender), 15 * 1000 ); if (!record) { @@ -1858,7 +1851,7 @@ this.commit(); } } else { - delete this.contactTypingTimers[identifier]; + delete this.contactTypingTimers[sender]; if (record) { // User was previously typing, and is no longer. State change! this.trigger('typing-update'); @@ -1867,13 +1860,13 @@ } }, - clearContactTypingTimer(identifier) { + clearContactTypingTimer(sender) { this.contactTypingTimers = this.contactTypingTimers || {}; - const record = this.contactTypingTimers[identifier]; + const record = this.contactTypingTimers[sender]; if (record) { clearTimeout(record.timer); - delete this.contactTypingTimers[identifier]; + delete this.contactTypingTimers[sender]; // User was previously typing, but timed out or we received message. State change! this.trigger('typing-update'); diff --git a/js/signal_protocol_store.js b/js/signal_protocol_store.js index 41e5785f4..9e06e1782 100644 --- a/js/signal_protocol_store.js +++ b/js/signal_protocol_store.js @@ -3,7 +3,6 @@ dcodeIO, Backbone, _, - libsignal, textsecure, stringObject, BlockedNumberController diff --git a/libloki/test/index.html b/libloki/test/index.html index 40d57ba36..f91e323a6 100644 --- a/libloki/test/index.html +++ b/libloki/test/index.html @@ -15,7 +15,6 @@ - diff --git a/libtextsecure/test/index.html b/libtextsecure/test/index.html index 724d0a79e..216b6c465 100644 --- a/libtextsecure/test/index.html +++ b/libtextsecure/test/index.html @@ -14,7 +14,6 @@ - diff --git a/ts/receiver/contentMessage.ts b/ts/receiver/contentMessage.ts index bad11db98..8c91f3027 100644 --- a/ts/receiver/contentMessage.ts +++ b/ts/receiver/contentMessage.ts @@ -511,7 +511,7 @@ async function handleTypingMessage( const typingMessage = iTypingMessage as SignalService.TypingMessage; - const { timestamp, groupId, action } = typingMessage; + const { timestamp, action } = typingMessage; const { source } = envelope; await removeFromCache(envelope); @@ -548,11 +548,9 @@ async function handleTypingMessage( const started = action === SignalService.TypingMessage.Action.STARTED; if (conversation) { - const senderDevice = 1; conversation.notifyTyping({ isTyping: started, sender: source, - senderDevice, }); } } diff --git a/ts/receiver/queuedJob.ts b/ts/receiver/queuedJob.ts index 2997ccdcd..55fb66661 100644 --- a/ts/receiver/queuedJob.ts +++ b/ts/receiver/queuedJob.ts @@ -458,6 +458,12 @@ async function handleRegularMessage( if (source !== ourNumber && primarySource) { message.set({ source: primarySource.key }); } + + // we just received a message from that user so we reset the typing indicator for this convo + conversation.notifyTyping({ + isTyping: false, + sender: primarySource.key, + }); } async function handleExpirationTimerUpdate(