Add more logging for view-once message interactions

This commit is contained in:
Evan Hahn 2021-08-12 11:20:22 -05:00 committed by GitHub
parent 3b5820b96a
commit 9fd191ae00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -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;
}

View File

@ -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);
@ -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!`);
@ -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;
}
@ -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) {