Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
Merge branch 'feature/support-change-uid'
Browse files Browse the repository at this point in the history
  • Loading branch information
medisean committed Apr 6, 2017
2 parents 45d5a0b + de6a663 commit ae1ebeb
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 11 deletions.
9 changes: 7 additions & 2 deletions MessageKit/BaseMessageModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@ public protocol MessageModelProtocol: MessageItemProtocol {

public protocol DecoratedMessageModelProtocol: MessageModelProtocol {

var messageModel: MessageModelProtocol { get }
var messageModel: MessageModelProtocol { get set }
}

public extension DecoratedMessageModelProtocol {

var uid: String {
return self.messageModel.uid
get {
return self.messageModel.uid
}
set {
self.messageModel.uid = newValue
}
}

var senderId: String {
Expand Down
11 changes: 9 additions & 2 deletions MessageKit/CustomMessageModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ public protocol CustomMessageModelProtocol: DecoratedMessageModelProtocol {

open class CustomMessageModel: CustomMessageModelProtocol {

open let messageModel: MessageModelProtocol
open var messageModel: MessageModelProtocol
open var customView: UIView
open var uid: String { return messageModel.uid }
open var uid: String {
get {
return messageModel.uid
}
set {
messageModel.uid = newValue
}
}

public init(messageModel: MessageModelProtocol, customView: UIView) {
self.messageModel = messageModel
Expand Down
11 changes: 9 additions & 2 deletions MessageKit/FileMessageModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@ public protocol FileMessageModelProtocol: DecoratedMessageModelProtocol {

open class FileMessageModel: FileMessageModelProtocol {

open let messageModel: MessageModelProtocol
open var messageModel: MessageModelProtocol
open var fileName: String
open var fileSize: String
open var fileFolderColor: UIColor
open var uid: String { return messageModel.uid }
open var uid: String {
get {
return messageModel.uid
}
set {
messageModel.uid = newValue
}
}

public init(messageModel: MessageModelProtocol, fileName: String, fileSize: String, fileFolderColor: UIColor) {
self.messageModel = messageModel
Expand Down
2 changes: 1 addition & 1 deletion MessageKit/MessageItemProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ public protocol MessageItemProtocol: class, UniqueIdentificable {
}

public protocol UniqueIdentificable {
var uid: String { get }
var uid: String { get set }
}
11 changes: 9 additions & 2 deletions MessageKit/PhotoMessageModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ public typealias PhotoClosure = (_ imageview: UIImageView) -> ()

open class PhotoMessageModel: PhotoMessageModelProtocol {

open let messageModel: MessageModelProtocol
open var messageModel: MessageModelProtocol
open let imageSize: CGSize
open let imageClosure: PhotoClosure
open var uid: String { return messageModel.uid }
open var uid: String {
get {
return messageModel.uid
}
set {
messageModel.uid = newValue
}
}

public init(messageModel: MessageModelProtocol, imageSize: CGSize, imageClosure: @escaping PhotoClosure) {
self.messageModel = messageModel
Expand Down
11 changes: 9 additions & 2 deletions MessageKit/TextMessageModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ public protocol TextMessageModelProtocol: DecoratedMessageModelProtocol {

open class TextMessageModel: TextMessageModelProtocol {

open let messageModel: MessageModelProtocol
open var messageModel: MessageModelProtocol
open let text: String
open var uid: String { return self.messageModel.uid }
open var uid: String {
get {
return messageModel.uid
}
set {
messageModel.uid = newValue
}
}

public init(messageModel: MessageModelProtocol, text: String) {
self.messageModel = messageModel
Expand Down

0 comments on commit ae1ebeb

Please sign in to comment.