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(); const isAttachmentPending = this.isAttachmentPending();
// Don't show lightbox for GIFs
if (isGIF(attachments)) { if (isGIF(attachments)) {
window.log.info("<Message> handleOpen: lightbox doesn't open for GIFs");
return; return;
} }
if (isTapToView) { if (isTapToView) {
if (isAttachmentPending) { if (isAttachmentPending) {
window.log.info(
'<Message> handleOpen: tap-to-view attachment is pending; not showing the lightbox'
);
return; return;
} }

View file

@ -889,9 +889,15 @@ Whisper.ConversationView = Whisper.View.extend({
this.showSafetyNumber(contactId); this.showSafetyNumber(contactId);
}; };
const showExpiredIncomingTapToViewToast = () => { const showExpiredIncomingTapToViewToast = () => {
window.log.info(
'Showing expired tap-to-view toast for an incoming message'
);
this.showToast(Whisper.TapToViewExpiredIncomingToast); this.showToast(Whisper.TapToViewExpiredIncomingToast);
}; };
const showExpiredOutgoingTapToViewToast = () => { const showExpiredOutgoingTapToViewToast = () => {
window.log.info(
'Showing expired tap-to-view toast for an outgoing message'
);
this.showToast(Whisper.TapToViewExpiredOutgoingToast); this.showToast(Whisper.TapToViewExpiredOutgoingToast);
}; };
const showForwardMessageModal = this.showForwardMessageModal.bind(this); const showForwardMessageModal = this.showForwardMessageModal.bind(this);
@ -2798,6 +2804,8 @@ Whisper.ConversationView = Whisper.View.extend({
}, },
async displayTapToViewMessage(messageId: string) { async displayTapToViewMessage(messageId: string) {
window.log.info('displayTapToViewMessage: attempting to display message');
const message = window.MessageController.getById(messageId); const message = window.MessageController.getById(messageId);
if (!message) { if (!message) {
throw new Error(`displayTapToViewMessage: Message ${messageId} missing!`); throw new Error(`displayTapToViewMessage: Message ${messageId} missing!`);
@ -2832,7 +2840,10 @@ Whisper.ConversationView = Whisper.View.extend({
await message.markViewOnceMessageViewed(); await message.markViewOnceMessageViewed();
const closeLightbox = async () => { const closeLightbox = async () => {
window.log.info('displayTapToViewMessage: attempting to close lightbox');
if (!this.lightboxView) { if (!this.lightboxView) {
window.log.info('displayTapToViewMessage: lightbox was already closed');
return; return;
} }
@ -2870,6 +2881,8 @@ Whisper.ConversationView = Whisper.View.extend({
}); });
window.Signal.Backbone.Views.Lightbox.show(this.lightboxView.el); window.Signal.Backbone.Views.Lightbox.show(this.lightboxView.el);
window.log.info('displayTapToViewMessage: showed lightbox');
}, },
deleteMessage(messageId: string) { deleteMessage(messageId: string) {