Skip to content

Commit 669991a

Browse files
committed
Add video cell and ensure and is set for all cell types. Needs testing.
1 parent ef44cfd commit 669991a

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

MessengerKit/Messenger View/MSGMessengerViewController + DataSource.swift

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ extension MSGMessengerViewController: UICollectionViewDataSource, UICollectionVi
3434
let identifier = message.user.isSender ? "outgoingText" : "incomingText"
3535
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath) as! MSGMessageCell
3636

37-
// TODO: set the delegate here
3837
cell.delegate = self
39-
4038
cell.message = message
4139
cell.style = style
4240
cell.isLastInSection = isLast
@@ -56,8 +54,9 @@ extension MSGMessengerViewController: UICollectionViewDataSource, UICollectionVi
5654
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath) as! MSGMessageCell
5755

5856
cell.delegate = self
59-
6057
cell.message = message
58+
cell.style = style
59+
cell.isLastInSection = isLast
6160

6261
return cell
6362

@@ -68,22 +67,33 @@ extension MSGMessengerViewController: UICollectionViewDataSource, UICollectionVi
6867
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath) as! MSGMessageCell
6968

7069
cell.delegate = self
71-
7270
cell.message = message
71+
cell.style = style
72+
cell.isLastInSection = isLast
7373

7474
return cell
7575

7676

7777
case .video:
78-
fatalError("video cell not defined")
79-
break
78+
79+
let identifier = message.user.isSender ? "outgoingVideo" : "incomingVideo"
80+
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath) as! MSGMessageCell
81+
82+
cell.delegate = self
83+
cell.message = message
84+
cell.style = style
85+
cell.isLastInSection = isLast
86+
87+
return cell
8088

8189
case .custom:
8290
let identifier = message.user.isSender ? "outgoingCustom" : "incomingCustom"
8391
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath) as! MSGMessageCell
8492

8593
cell.delegate = self
8694
cell.message = message
95+
cell.style = style
96+
cell.isLastInSection = isLast
8797

8898
return cell
8999
}

0 commit comments

Comments
 (0)