Skip to content

Commit

Permalink
Merge pull request #33 from zjc19891106/main
Browse files Browse the repository at this point in the history
fix red
  • Loading branch information
zjc19891106 authored Dec 13, 2024
2 parents 00e22bd + 3c7553b commit 1de0d07
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 9 deletions.
31 changes: 31 additions & 0 deletions Example/EaseChatUIKit/CustomMessageListController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,37 @@ import EaseChatUIKit

class CustomMessageListController: MessageListController {

override func processFollowInputAttachmentAction() {
if Appearance.chat.messageAttachmentMenuStyle == .followInput {
if let fileItem = Appearance.chat.inputExtendActions.first(where: { $0.tag == "File" }) {
fileItem.action = { [weak self] item,object in
self?.handleAttachmentAction(item: item)
}
}
if let photoItem = Appearance.chat.inputExtendActions.first(where: { $0.tag == "Photo" }) {
photoItem.action = { [weak self] item,object in
self?.handleAttachmentAction(item: item)
}
}
if let cameraItem = Appearance.chat.inputExtendActions.first(where: { $0.tag == "Camera" }) {
cameraItem.action = { [weak self] item,object in
self?.handleAttachmentAction(item: item)
}
}
if let contactItem = Appearance.chat.inputExtendActions.first(where: { $0.tag == "Contact" }) {
contactItem.action = { [weak self] item,object in
self?.handleAttachmentAction(item: item)
}
}
if let redPackageItem = Appearance.chat.inputExtendActions.first(where: { $0.tag == "Red" }) {
redPackageItem.action = { [weak self] item,object in
self?.handleAttachmentAction(item: item)
}
}

}
}

override func handleAttachmentAction(item: any ActionSheetItemProtocol) {
switch item.tag {
case "File": self.selectFile()
Expand Down
2 changes: 1 addition & 1 deletion Example/EaseChatUIKit/LoginViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extension LoginViewController {
profile.id = userName.lowercased()
profile.nickname = "Tester 001"
profile.avatarURL = "https://accktvpic.oss-cn-beijing.aliyuncs.com/pic/sample_avatar/sample_avatar_1.png"
ChatUIKitClient.shared.login(user: profile, token: passWord) { error in
ChatUIKitClient.shared.login(user: profile, token: "YWMtrBLRHrjtEe-IODH5J7D-t1zzvlQ7sUrSpVuQGlyIzFQLSg3AGHsR7bfQlcHY0wi4AwMAAAGTvYg04AAAjKBtZLdDVioXxzdjKdcRBpgxcIah52G6mqXF9GvrZUhB8g") { error in
if error == nil {
UIApplication.shared.chat.keyWindow?.rootViewController = MainViewController()
} else {
Expand Down
14 changes: 8 additions & 6 deletions Example/EaseChatUIKit/RedPackageCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@ class RedPackageCell: CustomMessageCell {

override func refresh(entity: MessageEntity) {
super.refresh(entity: entity)

DispatchQueue.main.asyncAfter(wallDeadline: .now()+0.25) {
if Appearance.chat.bubbleStyle == .withArrow {
self.bubbleWithArrow.arrow.image = UIImage(named: self.towards == .left ? "arrow_left": "arrow_right", in: .chatBundle, with: nil)?.withTintColor(.systemRed, renderingMode: .automatic)
} else {
self.bubbleMultiCorners.backgroundColor = .systemRed
}
}
}

override func updateAxis(entity: MessageEntity) {
super.updateAxis(entity: entity)
if Appearance.chat.bubbleStyle == .withArrow {
self.bubbleWithArrow.arrow.image = UIImage(named: self.towards == .left ? "arrow_left": "arrow_right", in: .chatBundle, with: nil)?.withTintColor(self.towards == .left ? .systemRed:.systemRed)
} else {
self.bubbleMultiCorners.backgroundColor = .systemRed
}

}
}

Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ extension MessageListView: UITableViewDelegate,UITableViewDataSource {
let identifier = String(describing: Class.self)
cell = tableView.dequeueReusableCell(with: Class, reuseIdentifier: identifier)
if cell == nil {
cell = ComponentsRegister.shared.ChatCustomMessageCell.init(towards: towards, reuseIdentifier: identifier)
cell = Class.init(towards: towards, reuseIdentifier: identifier)
}
break
}
Expand All @@ -623,7 +623,7 @@ extension MessageListView: UITableViewDelegate,UITableViewDataSource {
let identifier = String(describing: Class.self)
cell = tableView.dequeueReusableCell(with: Class, reuseIdentifier: identifier)
if cell == nil {
cell = ComponentsRegister.shared.ChatCustomMessageCell.init(towards: towards, reuseIdentifier: identifier)
cell = Class.init(towards: towards, reuseIdentifier: identifier)
}
break
}
Expand Down

0 comments on commit 1de0d07

Please sign in to comment.