mirror of
https://github.com/MessageKit/MessageKit.git
synced 2026-02-06 19:03:19 +00:00
25 lines
770 B
Swift
25 lines
770 B
Swift
//
|
|
// MessagesDisplayDataSource.swift
|
|
// MessageKit
|
|
//
|
|
// Created by Steven on 7/26/17.
|
|
// Copyright © 2017 Hexed Bits. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
// I don't want this to inherit from MessagesDataSource really but I need access to isFromCurrentSender(message:) for now
|
|
public protocol MessagesDisplayDataSource: class, MessagesDataSource {
|
|
|
|
func avatarForMessage(_ message: MessageType, at indexPath: IndexPath, in collectionView: UICollectionView) -> Avatar
|
|
|
|
}
|
|
|
|
public extension MessagesDisplayDataSource {
|
|
|
|
func messageColorFor(_ message: MessageType, at indexPath: IndexPath, in collectionView: UICollectionView) -> UIColor {
|
|
return isFromCurrentSender(message: message) ? .outgoingGreen : .incomingGray
|
|
}
|
|
|
|
}
|