Skip to content

Commit 3275e4d

Browse files
Rename position to positionInUserGroup
This is in preparation of adding positionInMessagesSection.
1 parent 7f88722 commit 3275e4d

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

Sources/ExyteChat/ChatView/WrappingMessages.swift

+14-8
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,21 @@ extension ChatView {
100100
let nextMessageIsSameUser = nextMessage?.user.id == message.user.id
101101
let prevMessageIsSameUser = prevMessage?.user.id == message.user.id
102102

103-
let position: PositionInUserGroup
103+
let positionInUserGroup: PositionInUserGroup
104104
if nextMessageExists, nextMessageIsSameUser, prevMessageIsSameUser {
105-
position = .middle
105+
positionInUserGroup = .middle
106106
} else if !nextMessageExists || !nextMessageIsSameUser, !prevMessageIsSameUser {
107-
position = .single
107+
positionInUserGroup = .single
108108
} else if nextMessageExists, nextMessageIsSameUser {
109-
position = .first
109+
positionInUserGroup = .first
110110
} else {
111-
position = .last
111+
positionInUserGroup = .last
112112
}
113113

114114
if replyMode == .quote {
115-
return MessageRow(message: $0.element, positionInUserGroup: position, commentsPosition: nil)
115+
return MessageRow(
116+
message: $0.element, positionInUserGroup: positionInUserGroup,
117+
commentsPosition: nil)
116118
}
117119

118120
let nextMessageIsAReply = nextMessage?.replyMessage != nil
@@ -156,9 +158,13 @@ extension ChatView {
156158
positionInChat = .middle
157159
}
158160

159-
let commentsPosition = CommentsPosition(inCommentsGroup: positionInComments, inSection: positionInSection, inChat: positionInChat)
161+
let commentsPosition = CommentsPosition(
162+
inCommentsGroup: positionInComments, inSection: positionInSection,
163+
inChat: positionInChat)
160164

161-
return MessageRow(message: $0.element, positionInUserGroup: position, commentsPosition: commentsPosition)
165+
return MessageRow(
166+
message: $0.element, positionInUserGroup: positionInUserGroup,
167+
commentsPosition: commentsPosition)
162168
}
163169
.reversed()
164170
}

0 commit comments

Comments
 (0)