diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ee930c..dc1e361 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes +## 9.2.1 +### Bug Fixes +- Fixed issue where app would crash when receiving chat messages while backgrounded + ## 9.2.0 ### New This version of the SDK adds support for wait offline. This gives the patient the option to close the app, remain in the wait queue, and be notified when their provider is ready for them. To accomplish this, we've added a number of things: diff --git a/DexcareSDK.podspec b/DexcareSDK.podspec index 3bd00bf..ede268b 100644 --- a/DexcareSDK.podspec +++ b/DexcareSDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'DexcareSDK' - s.version = '9.2.0' + s.version = '9.2.1' s.platform = :ios, '13.0' s.swift_version = '5.0' s.summary = 'DexcareSDK library for express care services' diff --git a/Sources/DexcareiOSSDK/Info.plist b/Sources/DexcareiOSSDK/Info.plist index d95ee6e..d5416de 100644 --- a/Sources/DexcareiOSSDK/Info.plist +++ b/Sources/DexcareiOSSDK/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 9.2.0 + 9.2.1 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSCameraUsageDescription diff --git a/Sources/DexcareiOSSDK/VirtualVisit/ChatViewController.swift b/Sources/DexcareiOSSDK/VirtualVisit/ChatViewController.swift index 8b08a29..e6992d6 100644 --- a/Sources/DexcareiOSSDK/VirtualVisit/ChatViewController.swift +++ b/Sources/DexcareiOSSDK/VirtualVisit/ChatViewController.swift @@ -27,6 +27,8 @@ class ChatViewController: MessagesViewController, ChatView { // Add a small (but not too big) delay on when to refresh the collection view or typing state // We cancel any previous request if the next one comes in before the delay // We do need it to be quick enough so we get some immediate feedback when typing in a new message + // This delay has been added to throttle the cascade of messages that are received when a user resumes a visits + // Since only the last message is needed in that scenario lazy var workItemDelay = 0.1 var typingIndicatorWorkItem: DispatchWorkItem? var refreshWorkItem: DispatchWorkItem? @@ -248,11 +250,16 @@ extension ChatViewController: MessagesDataSource { /// We added extra logs to track the issue and help us reproduce it. /// /// Internal Issue: ENG-11367 + /// + /// Update July 22, 2024 + /// The above issue is caused when the user has minimized the app and is receiving messages. + /// The issue can also be resolved by removing workItemDelay mechanism or revamping the chat throttling mechanism. + /// Simply returning a empty chat message appears to have no ill effects (the empty chat mesasges do not appear). if let message = messages[safe: indexPath.section] { return message } - serverLogger?.postMessage(message: "ChatViewController::messageForItem(at \(indexPath.section)) does not exist. Total number of sections = \(messages.count).") - return messages[indexPath.section] + serverLogger?.postMessage(message: "ChatViewController::messageForItem(at \(indexPath.section)) is out of range") + return ChatMessage.empty } func numberOfSections(in messagesCollectionView: MessagesCollectionView) -> Int { @@ -354,6 +361,8 @@ extension ChatViewController: MessagesDisplayDelegate { } struct ChatMessage: MessageType { + static var empty: Self = ChatMessage(sender: ChatSender(id: "", displayName: ""), messageId: "", sentDate: Date(), kind: .text("")) + var sender: SenderType var messageId: String var sentDate: Date