Skip to content

Commit

Permalink
Add more logging for view-once message interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanHahn-Signal committed Aug 12, 2021
1 parent 3b5820b commit 9fd191a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ts/components/conversation/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2084,13 +2084,16 @@ export class Message extends React.PureComponent<Props, State> {

const isAttachmentPending = this.isAttachmentPending();

// Don't show lightbox for GIFs
if (isGIF(attachments)) {
window.log.info("<Message> handleOpen: lightbox doesn't open for GIFs");
return;
}

if (isTapToView) {
if (isAttachmentPending) {
window.log.info(
'<Message> handleOpen: tap-to-view attachment is pending; not showing the lightbox'
);
return;
}

Expand Down
13 changes: 13 additions & 0 deletions ts/views/conversation_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -889,9 +889,15 @@ Whisper.ConversationView = Whisper.View.extend({
this.showSafetyNumber(contactId);
};
const showExpiredIncomingTapToViewToast = () => {
window.log.info(
'Showing expired tap-to-view toast for an incoming message'
);
this.showToast(Whisper.TapToViewExpiredIncomingToast);
};
const showExpiredOutgoingTapToViewToast = () => {
window.log.info(
'Showing expired tap-to-view toast for an outgoing message'
);
this.showToast(Whisper.TapToViewExpiredOutgoingToast);
};
const showForwardMessageModal = this.showForwardMessageModal.bind(this);
Expand Down Expand Up @@ -2798,6 +2804,8 @@ Whisper.ConversationView = Whisper.View.extend({
},

async displayTapToViewMessage(messageId: string) {
window.log.info('displayTapToViewMessage: attempting to display message');

const message = window.MessageController.getById(messageId);
if (!message) {
throw new Error(`displayTapToViewMessage: Message ${messageId} missing!`);
Expand Down Expand Up @@ -2832,7 +2840,10 @@ Whisper.ConversationView = Whisper.View.extend({
await message.markViewOnceMessageViewed();

const closeLightbox = async () => {
window.log.info('displayTapToViewMessage: attempting to close lightbox');

if (!this.lightboxView) {
window.log.info('displayTapToViewMessage: lightbox was already closed');
return;
}

Expand Down Expand Up @@ -2870,6 +2881,8 @@ Whisper.ConversationView = Whisper.View.extend({
});

window.Signal.Backbone.Views.Lightbox.show(this.lightboxView.el);

window.log.info('displayTapToViewMessage: showed lightbox');
},

deleteMessage(messageId: string) {
Expand Down

0 comments on commit 9fd191a

Please sign in to comment.