Repository navigation
4.2.0
v4.2.0
New
-
Added optional offline support, disabled by default. Enable it using
AppSettings.AppSettingsBuilder().setOfflineConfig(OfflineConfig.Builder().setEnabled(true).build()). The SDK maintains an on-device cache of conversations, messages, users, groups, and media for the logged-in user, serves cached results first, queues outgoing messages, and synchronizes data when connectivity is restored. -
Introduced
OfflineConfig.Builderto configure cache size and lifetime, pending-message limits, queue overflow policies, automatic message delivery after reconnection, media caching, and encryption. AddedCometChat.isOfflineEnabled()to check whether offline support is currently active, including when its state changes during a session. -
Added listener-based overloads to
sendTextMessage,sendMediaMessage,sendCustomMessage, andsendInteractiveMessage, supportingonMessagePending,onMessageSent, andonErrorcallbacks. When offline support is enabled, these methods queue messages sent without an active connection and deliver them when connectivity returns, including after an application restart. -
Added
getPendingMessages(onSuccess:onError:),retryMessage(_:),retryAllFailedMessages(), anddiscardLocalMessage(_:)to manage queued messages. IntroducedOutboxListener, registered throughCometChat.addOutboxListener(_:_:), to monitor outbox updates. -
Added cached-result and server-result listener overloads to
MessagesRequest,ConversationRequest,UsersRequest,GroupsRequest,GroupMembersRequest,BannedGroupMembersRequest,BlockedUserRequest,ThreadsRequest,ReactionsRequest, andNotificationFeedRequest. These methods deliver locally cached results first, followed by updated server results. Added the same functionality togetConversation(conversationWith:conversationType:listener:)andgetMessageDetails(_:listener:)throughConversationDetailsListenerandMessageDetailsListener. -
Introduced
getSyncState(),getLastSyncTimestamp(), andforceSyncNow(onSuccess:onError:)to monitor and control synchronization. AddedSyncListenerandCometChatMessageDelegate.onMessagesSynced(_:)to receive synchronization updates. -
Added
downloadMedia(url:messageServerId:onProgress:onSuccess:onError:)andgetCachedMediaPath(_:)to download and access locally cached media. IntroducedAttachment.localPathandMediaDownloadListenerto support local media access and download monitoring. -
Added
getExistingUploadFileRequest(receiverId:receiverType:parentMessageId:)to restore an upload batch associated with a chat after an application restart. EnhancedUploadFileRequest.getItems()to retrieve every file in the batch with its upload state, and added support for retrying restored files throughretryAttachment(fileId:)using the SDK's locally stored copy. -
Added optional encryption at rest through
setEncryption(true), using a bundled SQLCipher implementation that avoids conflicts with the application's existing SQLite, SQLCipher, GRDB, or FMDB dependencies. Encryption keys are stored in the Keychain, andgetOfflineEncryptionStatus()reports the active encryption status. -
Added
clearOfflineCache()andgetCacheSize()for offline cache management. IntroducedOfflineCacheResetListenerto report when the cache is rebuilt and indicate how many unsent messages were lost. -
Added read-only
BaseMessage.localMessageIdandBaseMessage.sourceproperties to identify locally stored messages and their origin. -
Updated offline message delivery behavior when connectivity is unavailable. With offline support enabled, listener-based message sends invoke
onMessagePending, followed byonErrorwithERROR_INTERNET_UNAVAILABLE, while keeping the message queued. Do not resend the message when this error occurs. The SDK invokesonMessageSentwhen connectivity returns, whileonOutboxMessageFailed(_:_:)reports messages that ultimately fail. -
Introduced manual retry handling for failed messages. Failed messages are not retried automatically. Use
retryMessage(_:)to retry an individual message orretryAllFailedMessages()to retry all failed messages. -
Introduced at-least-once delivery for queued messages. Duplicate messages may appear in a conversation if the server accepts a request but its response does not reach the SDK.
-
Updated offline data retention behavior so that logging out or switching to a different user deletes that user's offline cache and unsent messages.
-
Updated
getCacheSize()to read cache information from disk. Call this method off the main thread to avoid blocking the application's main thread. -
Excluded the offline cache database and cached media, including unsent upload data, from iCloud and device backups.
Enhancements
- Increased the maximum supported page size for
ReactionsRequestto 1000 reactions. Values exceeding 1000 are automatically capped at 1000. Previously, limits greater than 20 returnedERROR_LIMIT_EXCEEDED.
Fixes
-
Fixed an issue where the WebSocket connection could remain disconnected after multiple connection drops. Previously, after the first successful reconnection, subsequent drops were retried only once, potentially requiring an application restart to restore connectivity.
-
Fixed a heartbeat issue that could disconnect a newly established WebSocket connection. When a connection dropped and recovered within approximately three seconds of a heartbeat, the previous heartbeat check could incorrectly close the new connection. This fix also applies to manual
ping()calls whenautoEstablishSocketConnectionis disabled. -
Fixed pagination for pinned and saved message lists. Pages after the first now continue from the correct position in the server's previous page, preventing duplicate or missing messages when loading additional results.
-
Fixed an issue where a
MessagesRequestcontaining bothpinnedandsavedfilters could return no results because both filters were sent to the server. The request now returns the saved message list when both filters are specified.
Privacy
- Updated the SDK privacy manifest to declare its use of file timestamp, system boot time, and disk space APIs. No application changes are required; Xcode automatically includes these declarations in the application's privacy report.