소스 검색

prepare gif and video support

nayooti 5 년 전
부모
커밋
7f6ce249fe
3개의 변경된 파일16개의 추가작업 그리고 6개의 파일을 삭제
  1. 3 3
      deltachat-ios/Controller/GalleryViewController.swift
  2. 13 2
      deltachat-ios/View/Cell/GalleryCell.swift
  3. 0 1
      deltachat-ios/View/GalleryTimeLabel.swift

+ 3 - 3
deltachat-ios/Controller/GalleryViewController.swift

@@ -96,15 +96,15 @@ extension GalleryViewController: UICollectionViewDataSource, UICollectionViewDel
     }
 
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
-        guard let mediaCell = collectionView.dequeueReusableCell(
+        guard let galleryCell = collectionView.dequeueReusableCell(
             withReuseIdentifier: GalleryCell.reuseIdentifier,
             for: indexPath) as? GalleryCell else {
             return UICollectionViewCell()
         }
         let msgId = mediaMessageIds[indexPath.row]
         let msg = DcMsg(id: msgId)
-        mediaCell.update(msg: msg)
-        return mediaCell
+        galleryCell.update(msg: msg)
+        return galleryCell
     }
 
     func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {

+ 13 - 2
deltachat-ios/View/Cell/GalleryCell.swift

@@ -1,6 +1,7 @@
 import UIKit
 import DcCore
 
+
 class GalleryCell: UICollectionViewCell {
     static let reuseIdentifier = "gallery_cell"
 
@@ -30,10 +31,20 @@ class GalleryCell: UICollectionViewCell {
     }
 
     func update(msg: DcMsg) {
-        guard let image = msg.image else {
+        guard let viewtype = msg.viewtype else {
             return
         }
-        imageView.image = image
+
+        switch viewtype {
+        case .image:
+            imageView.image = msg.image
+        case .video:
+            break
+        case .gif:
+            break
+        default:
+            break
+        }
     }
 
     override var isSelected: Bool {

+ 0 - 1
deltachat-ios/View/GalleryTimeLabel.swift

@@ -34,7 +34,6 @@ class GalleryTimeLabel: UIView {
         let localizedDescription = date.galleryLocalizedDescription
         if label.text != localizedDescription {
             label.text = localizedDescription
-            setNeedsLayout() // TOODO: test if this is actually needed
         }
     }