소스 검색

fix: cellForItemAt updated with incorrect msg

nayooti 5 년 전
부모
커밋
098201ceb7
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      deltachat-ios/Controller/GalleryViewController.swift

+ 5 - 2
deltachat-ios/Controller/GalleryViewController.swift

@@ -98,7 +98,9 @@ class GalleryViewController: UIViewController {
         var sections: [GallerySection] = []
         TimeBucket.allCases.forEach { bucket in
             if let msgIds = buckets[bucket] {
-                sections.append(GallerySection(timeBucket: bucket, msgIds: msgIds))
+                sections.append(
+                    GallerySection(timeBucket: bucket, msgIds: msgIds)
+                )
             }
         }
         return sections
@@ -122,7 +124,8 @@ extension GalleryViewController: UICollectionViewDataSource, UICollectionViewDel
             for: indexPath) as? GalleryCell else {
             return UICollectionViewCell()
         }
-        let msg = DcMsg(id: mediaMessageIds[indexPath.row])
+        let msgId = gridSections[indexPath.section].msgIds[indexPath.row]
+        let msg = DcMsg(id: msgId)
         mediaCell.update(msg: msg)
         return mediaCell
     }