pull/365/head
nielsandriesse 4 years ago
parent a360fa7721
commit 5ed5c02ad4

@ -382,10 +382,13 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
case .mediaMessage: case .mediaMessage:
guard let index = viewItems.firstIndex(where: { $0 === viewItem }), guard let index = viewItems.firstIndex(where: { $0 === viewItem }),
let cell = messagesTableView.cellForRow(at: IndexPath(row: index, section: 0)) as? VisibleMessageCell else { return } 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 { Storage.shared.getContact(with: thread.contactIdentifier())?.isTrusted != true {
// Ask the user whether they want to download this attachment // 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 { } else {
guard let albumView = cell.albumView else { return } guard let albumView = cell.albumView else { return }
let locationInCell = gestureRecognizer.location(in: cell) let locationInCell = gestureRecognizer.location(in: cell)

@ -56,10 +56,9 @@ public class Contact : NSObject, NSCoding { // NSObject/NSCoding conformance is
// MARK: Coding // MARK: Coding
public required init?(coder: NSCoder) { public required init?(coder: NSCoder) {
guard let sessionID = coder.decodeObject(forKey: "sessionID") as! String?, guard let sessionID = coder.decodeObject(forKey: "sessionID") as! String? else { return nil }
let isTrusted = coder.decodeObject(forKey: "isTrusted") as! Bool? else { return nil }
self.sessionID = sessionID 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 name = coder.decodeObject(forKey: "displayName") as! String? { self.name = name }
if let nickname = coder.decodeObject(forKey: "nickname") as! String? { self.nickname = nickname } if let nickname = coder.decodeObject(forKey: "nickname") as! String? { self.nickname = nickname }
if let profilePictureURL = coder.decodeObject(forKey: "profilePictureURL") as! String? { self.profilePictureURL = profilePictureURL } if let profilePictureURL = coder.decodeObject(forKey: "profilePictureURL") as! String? { self.profilePictureURL = profilePictureURL }

Loading…
Cancel
Save