From 5ed5c02ad47d823c4b47c1faf6f52846157bf341 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Wed, 7 Apr 2021 15:41:57 +1000 Subject: [PATCH] Debug --- Session/Conversations/ConversationVC+Interaction.swift | 7 +++++-- SessionMessagingKit/Contacts/Contact.swift | 5 ++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Session/Conversations/ConversationVC+Interaction.swift b/Session/Conversations/ConversationVC+Interaction.swift index 568616115..a90e1e690 100644 --- a/Session/Conversations/ConversationVC+Interaction.swift +++ b/Session/Conversations/ConversationVC+Interaction.swift @@ -382,10 +382,13 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc case .mediaMessage: guard let index = viewItems.firstIndex(where: { $0 === viewItem }), let cell = messagesTableView.cellForRow(at: IndexPath(row: index, section: 0)) as? VisibleMessageCell else { return } - if let thread = viewItem.interaction.thread as? TSContactThread, + if let thread = self.thread as? TSContactThread, Storage.shared.getContact(with: thread.contactIdentifier())?.isTrusted != true { // Ask the user whether they want to download this attachment - + let modal = DownloadAttachmentModal(viewItem: viewItem) + modal.modalPresentationStyle = .overFullScreen + modal.modalTransitionStyle = .crossDissolve + present(modal, animated: true, completion: nil) } else { guard let albumView = cell.albumView else { return } let locationInCell = gestureRecognizer.location(in: cell) diff --git a/SessionMessagingKit/Contacts/Contact.swift b/SessionMessagingKit/Contacts/Contact.swift index 8c01e39b6..7e897060e 100644 --- a/SessionMessagingKit/Contacts/Contact.swift +++ b/SessionMessagingKit/Contacts/Contact.swift @@ -56,10 +56,9 @@ public class Contact : NSObject, NSCoding { // NSObject/NSCoding conformance is // MARK: Coding public required init?(coder: NSCoder) { - guard let sessionID = coder.decodeObject(forKey: "sessionID") as! String?, - let isTrusted = coder.decodeObject(forKey: "isTrusted") as! Bool? else { return nil } + guard let sessionID = coder.decodeObject(forKey: "sessionID") as! String? else { return nil } self.sessionID = sessionID - self.isTrusted = isTrusted + self.isTrusted = coder.decodeBool(forKey: "isTrusted") if let name = coder.decodeObject(forKey: "displayName") as! String? { self.name = name } if let nickname = coder.decodeObject(forKey: "nickname") as! String? { self.nickname = nickname } if let profilePictureURL = coder.decodeObject(forKey: "profilePictureURL") as! String? { self.profilePictureURL = profilePictureURL }