Browse Source

show sender and date of voice messages (instead of cryptic filename and bytes)

B. Petersen 2 years ago
parent
commit
2929c9d77d

+ 1 - 1
deltachat-ios/Controller/FilesViewController.swift

@@ -146,7 +146,7 @@ extension FilesViewController: UITableViewDelegate, UITableViewDataSource {
             return UITableViewCell()
         }
         let msg = dcContext.getMessage(id: fileMessageIds[indexPath.row])
-        cell.update(msg: msg)
+        cell.update(msg: msg, dcContext: dcContext)
         return cell
     }
 

+ 12 - 2
deltachat-ios/View/Cell/DocumentGalleryFileCell.swift

@@ -75,8 +75,10 @@ class DocumentGalleryFileCell: UITableViewCell {
     }
 
     // MARK: - update
-    func update(msg: DcMsg) {
-        if msg.type == DC_MSG_WEBXDC {
+    func update(msg: DcMsg, dcContext: DcContext) {
+        if msg.type == DC_MSG_VOICE {
+            updateVoiceMsg(msg: msg, dcContext: dcContext)
+        } else if msg.type == DC_MSG_WEBXDC {
             updateWebxdcMsg(msg: msg)
         } else {
             updateFileMsg(msg: msg)
@@ -91,6 +93,14 @@ class DocumentGalleryFileCell: UITableViewCell {
         subtitle.text = msg.getPrettyFileSize()
     }
 
+    private func updateVoiceMsg(msg: DcMsg, dcContext: DcContext) {
+        if let fileUrl = msg.fileURL {
+            generateThumbnailFor(url: fileUrl, placeholder: UIImage(named: "ic_attach_file_36pt")?.maskWithColor(color: DcColors.grayTextColor))
+        }
+        title.text = msg.getSenderName(dcContext.getContact(id: msg.fromContactId))
+        subtitle.text = msg.formattedSentDate()
+    }
+
     private func updateWebxdcMsg(msg: DcMsg) {
         let dict = msg.getWebxdcInfoDict()
         if let iconfilePath = dict["icon"] as? String {