Skip to content

Commit e1e9995

Browse files
HansonHanson
authored andcommitted
fix: 修改显示头像,添加图片泡泡边框,修改泡泡箭头与颜色
1 parent a9f383b commit e1e9995

21 files changed

+202
-243
lines changed

BatChat/Scenes/Session/BCSessionViewController.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import UIKit
99
import Chatto
1010

11-
class BCSessionViewController: DemoChatViewController {
11+
class BCSessionViewController: BCChatViewController {
1212
override func viewDidLoad() {
1313
super.viewDidLoad()
1414

@@ -41,7 +41,7 @@ class BCSessionViewController: DemoChatViewController {
4141

4242
}
4343

44-
class DemoChatViewController: BaseChatViewController {
44+
class BCChatViewController: BaseChatViewController {
4545
var shouldUseAlternativePresenter: Bool = false
4646

4747
var inputTextView: ChatInputBar?
@@ -64,6 +64,7 @@ class DemoChatViewController: BaseChatViewController {
6464
self.title = "Chat"
6565
self.messagesSelector.delegate = self
6666
self.chatItemsDecorator = BaseChatItemsDecorator(messagesSelector: self.messagesSelector)
67+
view.backgroundColor = .backColor
6768
// self.replyActionHandler = DemoReplyActionHandler(presentingViewController: self)
6869
}
6970

@@ -192,7 +193,7 @@ class DemoChatViewController: BaseChatViewController {
192193
// }
193194
}
194195

195-
extension DemoChatViewController: MessagesSelectorDelegate {
196+
extension BCChatViewController: MessagesSelectorDelegate {
196197
func messagesSelector(_ messagesSelector: MessagesSelectorProtocol, didSelectMessage: MessageModelProtocol) {
197198
self.enqueueModelUpdate(updateType: .normal)
198199
}

BatChat/Scenes/Session/Base/BaseMessageCollectionViewCellAvatarStyle.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,15 @@ import UIKit
1010
class BaseMessageCollectionViewCellAvatarStyle: BaseMessageCollectionViewCellDefaultStyle {
1111

1212
init() {
13-
super.init(
14-
replyIndicatorStyle: .init(
15-
image: UIImage(named: "reply-indicator")!,
16-
size: .init(width: 38, height: 38),
17-
maxOffsetToReplyIndicator: 48
18-
)
19-
)
13+
super.init( dateTextStyle: .init(font: UIFont.systemFont(ofSize: 12), color: .red), replyIndicatorStyle: .none)
2014
}
2115

2216
override func avatarSize(viewModel: MessageViewModelProtocol) -> CGSize {
2317
// Display avatar for both incoming and outgoing messages for demo purpose
2418
return CGSize(width: 35, height: 35)
2519
}
20+
21+
override func avatarVerticalAlignment(viewModel: MessageViewModelProtocol) -> VerticalAlignment {
22+
return .top
23+
}
2624
}

BatChat/Scenes/Session/Chat Items/BaseMessage/BaseChatItemsDecorator.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ final class BaseChatItemsDecorator: ChatItemsDecoratorProtocol {
2929
let prev: ChatItemProtocol? = (index > 0) ? chatItems[index - 1] : nil
3030

3131
let bottomMargin = self.separationAfterItem(chatItem, next: next)
32-
var showsTail = false
32+
let showsTail = true
3333
var additionalItems = [DecoratedChatItem]()
3434
var addTimeSeparator = false
3535
var isSelected = false
3636
var isShowingSelectionIndicator = false
3737

3838
if let currentMessage = chatItem as? MessageModelProtocol {
39-
if let nextMessage = next as? MessageModelProtocol {
40-
showsTail = currentMessage.senderId != nextMessage.senderId
41-
} else {
42-
showsTail = true
43-
}
39+
// if let nextMessage = next as? MessageModelProtocol {
40+
// showsTail = currentMessage.senderId != nextMessage.senderId
41+
// } else {
42+
// showsTail = true
43+
// }
4444

4545
if let previousMessage = prev as? MessageModelProtocol {
4646
addTimeSeparator = !calendar.isDate(currentMessage.date, inSameDayAs: previousMessage.date)
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,23 @@
11
{
22
"images" : [
33
{
4-
"resizing" : {
5-
"mode" : "9-part",
6-
"center" : {
7-
"mode" : "stretch",
8-
"width" : 1,
9-
"height" : 1
10-
},
11-
"cap-insets" : {
12-
"bottom" : 16,
13-
"top" : 16,
14-
"right" : 16,
15-
"left" : 20
16-
}
17-
},
4+
"filename" : "btn_dialogue_left_white.png",
185
"idiom" : "universal",
19-
"filename" : "bubble-incoming-border-tail@1x.png",
206
"scale" : "1x"
217
},
228
{
23-
"resizing" : {
24-
"mode" : "9-part",
25-
"center" : {
26-
"mode" : "stretch",
27-
"width" : 1,
28-
"height" : 1
29-
},
30-
"cap-insets" : {
31-
"bottom" : 33,
32-
"top" : 32,
33-
"right" : 33,
34-
"left" : 40
35-
}
36-
},
9+
"filename" : "btn_dialogue_left_white@2x.png",
3710
"idiom" : "universal",
38-
"filename" : "bubble-incoming-border-tail@2x.png",
3911
"scale" : "2x"
4012
},
4113
{
42-
"resizing" : {
43-
"mode" : "9-part",
44-
"center" : {
45-
"mode" : "stretch",
46-
"width" : 1,
47-
"height" : 1
48-
},
49-
"cap-insets" : {
50-
"bottom" : 49,
51-
"top" : 49,
52-
"right" : 50,
53-
"left" : 60
54-
}
55-
},
14+
"filename" : "btn_dialogue_left_white@3x.png",
5615
"idiom" : "universal",
57-
"filename" : "bubble-incoming-border-tail@3x.png",
5816
"scale" : "3x"
5917
}
6018
],
6119
"info" : {
62-
"version" : 1,
63-
"author" : "xcode"
20+
"author" : "xcode",
21+
"version" : 1
6422
}
65-
}
23+
}

0 commit comments

Comments
 (0)