mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Fix content type handling
This commit is contained in:
parent
b43f22945c
commit
cf4fa84043
|
@ -25,7 +25,12 @@ final class MediaPlaceholderView : UIView {
|
||||||
|
|
||||||
private func setUpViewHierarchy() {
|
private func setUpViewHierarchy() {
|
||||||
let (iconName, attachmentDescription): (String, String) = {
|
let (iconName, attachmentDescription): (String, String) = {
|
||||||
guard let contentType = viewItem.attachmentPointer?.contentType else { return ("actionsheet_document_black", "file") } // Should never occur
|
guard let message = viewItem.interaction as? TSIncomingMessage else { return ("actionsheet_document_black", "file") } // Should never occur
|
||||||
|
var attachments: [TSAttachment] = []
|
||||||
|
Storage.read { transaction in
|
||||||
|
attachments = message.attachments(with: transaction)
|
||||||
|
}
|
||||||
|
guard let contentType = attachments.first?.contentType else { return ("actionsheet_document_black", "file") } // Should never occur
|
||||||
if MIMETypeUtil.isAudio(contentType) { return ("Microphone", "audio") }
|
if MIMETypeUtil.isAudio(contentType) { return ("Microphone", "audio") }
|
||||||
if MIMETypeUtil.isImage(contentType) || MIMETypeUtil.isVideo(contentType) { return ("actionsheet_camera_roll_black", "media") }
|
if MIMETypeUtil.isImage(contentType) || MIMETypeUtil.isVideo(contentType) { return ("actionsheet_camera_roll_black", "media") }
|
||||||
return ("actionsheet_document_black", "file")
|
return ("actionsheet_document_black", "file")
|
||||||
|
|
Loading…
Reference in a new issue