Skip to content

Commit

Permalink
Show Quick Replies for visitor when the QR is the latest in history
Browse files Browse the repository at this point in the history
This PR allows Quick Reply buttons to be displayed from history if quick
reply button is the last message. This works for regular and authenticated
vistor. The same implementation will be added to Secure Conversations in
a subsequent PR because of a blocking issue.

MOB-2580
  • Loading branch information
rasmustautsglia committed Aug 28, 2023
1 parent 6fc9e98 commit 56c0e33
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions GliaWidgets/Sources/ViewModel/Chat/ChatViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@ extension ChatViewModel {
fromHistory: self.environment.loadChatMessagesFromHistory()
)
}
if let item = items.last, case .gvaQuickReply(_, let button, _, _) = item.kind {
let props = button.options.map { self.quickReplyOption($0) }
self.action?(.quickReplyPropsUpdated(.shown(props)))
}

self.historySection.set(items)
self.action?(.refreshSection(self.historySection.index))
self.action?(.scrollToBottom(animated: false))
Expand Down

0 comments on commit 56c0e33

Please sign in to comment.