Skip to content

Commit

Permalink
feat: 🎸 delayed message(s) are visually announced
Browse files Browse the repository at this point in the history
relevant for client-side handling of delayed messages; show three
bubbles typing indicator on bot side to signal that a delayed message
will appear
  • Loading branch information
MarcoEidinger committed Jul 30, 2021
1 parent da9a309 commit 5015477
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/SAPCAI/Foundation/ViewModel/MessagingViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,13 @@ public final class MessagingViewModel: ObservableObject, Identifiable {
_ = newMessages.enumerated().reduce(MessagingViewModel.defaultDelay)
{ accumulate, current in
if accumulate > 0 {
self.isRequestPending = true
DispatchQueue.main.asyncAfter(deadline: .now() + accumulate) {
self.model.append(current.element)
self.acknowledgedMessages.append(current.element)
if self.model.count == self.receivedMessages.count {
self.isRequestPending = false
}
}
} else {
self.model.append(current.element)
Expand Down

0 comments on commit 5015477

Please sign in to comment.