diff --git a/sdk/android/v5/additional-message-filtering.mdx b/sdk/android/v5/additional-message-filtering.mdx index 6dccfc3ce..5c4f93a94 100644 --- a/sdk/android/v5/additional-message-filtering.mdx +++ b/sdk/android/v5/additional-message-filtering.mdx @@ -1401,6 +1401,8 @@ With offline support enabled, `fetchPrevious`/`fetchNext` answer from the on-dev | `setMentionedUIDs(List)` | Cached | | `setPinned(boolean)` | Cached | | `setSaved(boolean)` | Cached | +| `setMessageId(long)` | Cached. The server page is always shown, but it is saved to the cache only when it connects to (borders or overlaps) the cached history; this also applies to filtered and thread lists | +| `setTimestamp(long)` | Cached. The server page is always shown, but it is saved to the cache only when it connects to (borders or overlaps) the cached history; this also applies to filtered and thread lists | `setPinned` and `setSaved` are served from separate pinned and saved stores, not the message cache, so the other filters in this table do not apply to a pinned or saved read. diff --git a/sdk/android/v5/block-users.mdx b/sdk/android/v5/block-users.mdx index ddc466dca..5594f3403 100644 --- a/sdk/android/v5/block-users.mdx +++ b/sdk/android/v5/block-users.mdx @@ -266,7 +266,7 @@ override fun onError(e: CometChatException) { ## Offline Behaviour -With offline support enabled, `BlockedUsersRequest.fetchNext()` on a `UserFetchListener` first delivers `onCachedUsers` from the SDK's own blocked-users list, which it refreshes on login and on reconnect and updates when you call `blockUsers()` or `unblockUsers()`. Then `onServerUsers` delivers the live page to reconcile by `uid`; the server page is not saved to the device. The cached page is empty when no users are blocked or when `setSearchKeyword` is set. Offline, the read ends with `onError` with code `ERROR_INTERNET_UNAVAILABLE` after the cached page. See [Show Cached Data](/sdk/android/v5/offline-cached-data). +With offline support enabled, `BlockedUsersRequest.fetchNext()` on a `UserFetchListener` first delivers `onCachedUsers` from the SDK's own blocked-users list, which it refreshes on login and on reconnect and updates when you call `blockUsers()` or `unblockUsers()`. Then `onServerUsers` delivers the live page to reconcile by `uid`; the server page is not saved to the device. The cached page is empty when no users are blocked or when `setSearchKeyword` is set. Offline, the read ends with `onError` with code `ERROR_INTERNET_UNAVAILABLE` after the cached page. A second `fetchNext()` made while the first is still loading returns an empty page at once, online or offline, without a cached page and without moving to the next page. See [Show Cached Data](/sdk/android/v5/offline-cached-data). | Builder method | Offline | |---|---| diff --git a/sdk/android/v5/delete-group.mdx b/sdk/android/v5/delete-group.mdx index ce071dad4..2d8d7d8dc 100644 --- a/sdk/android/v5/delete-group.mdx +++ b/sdk/android/v5/delete-group.mdx @@ -10,7 +10,7 @@ description: "Only a group admin can remove it, and this page shows the single p To delete a group you need to use the `deleteGroup()` method. The user must be an **Admin** of the group they are trying to delete. -Deleting a group needs a connection — with offline support enabled, `deleteGroup()` is **not** queued for later. After it succeeds, the group's conversation and cached messages are removed from the on-device cache when the group-deleted event arrives or at the next reconnect sync; any messages still queued to it are then reported as failed with reason `DISCARDED`. See [Send While Offline](/sdk/android/v5/offline-send). +Deleting a group needs a connection — with offline support enabled, `deleteGroup()` is **not** queued for later. After it succeeds, the SDK removes the group's conversation, messages, media, queued messages, pins and saved messages from the on-device cache; any messages still queued to it are reported as failed with reason `DISCARDED`. See [Send While Offline](/sdk/android/v5/offline-send). diff --git a/sdk/android/v5/offline-cached-data.mdx b/sdk/android/v5/offline-cached-data.mdx index 6803ad77b..d7b93d523 100644 --- a/sdk/android/v5/offline-cached-data.mdx +++ b/sdk/android/v5/offline-cached-data.mdx @@ -49,7 +49,7 @@ After a successful server response, the SDK delivers the server's copy for the * Two rules follow from this: -- **Offline, the read ends with an error.** After the cached page, a read that gets no answer because the device is offline settles with `onError`, code `ERROR_INTERNET_UNAVAILABLE`. A real server error reaches `onError` unchanged. The call always settles, as long as you wait for each fetch to return before starting the next one on the same request object. +- **Offline, the read ends with an error.** After the cached page, a read that gets no answer because the device is offline settles with `onError`, code `ERROR_INTERNET_UNAVAILABLE`. A real server error reaches `onError` unchanged. The call always settles, as long as you wait for each fetch to return before starting the next one on the same request object. On a `ConversationsRequest` or `BlockedUsersRequest`, a second `fetchNext()` made while the first is still loading returns an empty page at once, online or offline, without a cached page and without moving to the next page. - **The server phase never fires offline.** It fires only on a genuine server response. Never treat a cached page as "end of history"; an empty cached page only means the end of the *cached* window. diff --git a/sdk/android/v5/offline-enable.mdx b/sdk/android/v5/offline-enable.mdx index dc9f6d6ac..f8605e89f 100644 --- a/sdk/android/v5/offline-enable.mdx +++ b/sdk/android/v5/offline-enable.mdx @@ -39,12 +39,12 @@ Offline support requires CometChat Android SDK **5.1.0** or later (minSdk 21). A ```groovy -implementation "com.cometchat:chat-sdk-android:5.1.0" +implementation "com.cometchat:chat-sdk-android:5.1.2" ``` ```kotlin -implementation("com.cometchat:chat-sdk-android:5.1.0") +implementation("com.cometchat:chat-sdk-android:5.1.2") ``` diff --git a/sdk/android/v5/offline-media-caching.mdx b/sdk/android/v5/offline-media-caching.mdx index 60ac4f78f..5061930b7 100644 --- a/sdk/android/v5/offline-media-caching.mdx +++ b/sdk/android/v5/offline-media-caching.mdx @@ -242,6 +242,6 @@ Remove the listener with `CometChat.removeMediaDownloadListener("MEDIA_LISTENER" ## Media cache size limit -Cached media bytes are bounded by `maxMediaCacheSize` (default **500 MB**; `0` means unlimited). When the cache exceeds the limit, the least recently accessed media is deleted first until it is back under budget. Media for un-sent (queued) messages is never evicted, though it still counts toward the budget; copies held for an in-progress upload are excluded from the budget. Because protected media is never evicted, the cache can briefly exceed `maxMediaCacheSize`. Bulk list loads and syncs do not refresh an item's recency. +Cached media bytes are bounded by `maxMediaCacheSize` (default **500 MB**; `0` means unlimited). When the cache exceeds the limit, the least recently accessed media is deleted first until it is back under budget. Media for un-sent (queued) messages and copies held for an in-progress upload are never evicted and do not count toward the budget. Because this protected media is never evicted, the media on disk can briefly exceed `maxMediaCacheSize`. Bulk list loads and syncs do not refresh an item's recency. Media is stored as files in durable, backup-excluded storage; the location is not configurable. Eviction runs silently in the background — there is no cache-limit callback. To reason about size, use `CometChat.getCacheSize()` and the configured limits. See the [configuration reference](/sdk/android/v5/offline-reference) for the full set of options. diff --git a/sdk/android/v5/offline-reference.mdx b/sdk/android/v5/offline-reference.mdx index c448c799d..7e4dbb270 100644 --- a/sdk/android/v5/offline-reference.mdx +++ b/sdk/android/v5/offline-reference.mdx @@ -162,7 +162,7 @@ Compare `CometChatException.getCode()` against these codes. All are constants in | `ERROR_OFFLINE_DISABLED` | An offline-only operation was called while offline support is not active. | | `ERROR_OFFLINE_MESSAGE_DISCARDED` | A queued message was removed before it could send. | | `ERROR_OFFLINE_MESSAGE_IN_FLIGHT` | `retryMessage` / `discardLocalMessage` targeted a message that is still being sent. | -| `ERROR_OFFLINE_MESSAGE_NOT_FOUND` | `retryMessage` / `discardLocalMessage` found no unsent message with the given local id. | +| `ERROR_OFFLINE_MESSAGE_NOT_FOUND` | `retryMessage` / `discardLocalMessage` found no unsent message with the given local id, or the id was `null`. | | `ERROR_OFFLINE_MESSAGE_PERSIST_FAILED` | The local cache was briefly unavailable, so `getPendingMessages`, `retryMessage`, `retryAllFailedMessages` or `discardLocalMessage` changed nothing. Try again. | | `ERROR_PENDING_QUEUE_LIMIT` | A send was refused because the outbox is full or the media is too large; the reason is `QUEUE_FULL` or `BYTE_OVERFLOW`. | | `ERROR_OFFLINE_MEDIA_COPY_FAILED` | A media send could not be queued because its file could not be copied; the reason is `PERMANENT`. | diff --git a/sdk/android/v5/offline-send.mdx b/sdk/android/v5/offline-send.mdx index 4aa87594d..09c1e8e9f 100644 --- a/sdk/android/v5/offline-send.mdx +++ b/sdk/android/v5/offline-send.mdx @@ -192,7 +192,7 @@ Every message exposes its offline state. `getLocalMessageId()` returns the SDK-g | `PERMANENT` | The server rejected the message, or the error was not recognized. A manual retry will not help. | | `QUEUE_FULL` | A new send was refused because the queue is full (count cap). | | `QUEUE_OVERFLOW` | An older queued message was evicted to admit a newer one (`DROP_OLDEST` only). | -| `BYTE_OVERFLOW` | A media send was refused because caching its bytes would exceed `maxMediaCacheSize`, the budget for the whole media cache (received and queued media). | +| `BYTE_OVERFLOW` | A media send was refused because its bytes would not fit within `maxMediaCacheSize`, the budget for cached media, even after evicting the least recently used cached media. Media of queued messages does not count toward this budget. | | `DISCARDED` | A queued message was removed before it could send: by `clearOfflineCache`, by leaving or deleting its conversation, or by logout. Reported with code `ERROR_OFFLINE_MESSAGE_DISCARDED`. (`discardLocalMessage` reports `onSuccess` instead.) | ## Inspect the Queue @@ -331,7 +331,7 @@ CometChat.discardLocalMessage(localMessageId, object : CometChat.CallbackListene | Error code | Reason | |---|---| | `ERROR_OFFLINE_MESSAGE_IN_FLIGHT` | The message is already sending (`SENDING`). | -| `ERROR_OFFLINE_MESSAGE_NOT_FOUND` | No unsent message has that id (unknown, or already sent). | +| `ERROR_OFFLINE_MESSAGE_NOT_FOUND` | No unsent message has that id (`null`, unknown, or already sent). | | `ERROR_OFFLINE_DISABLED` | Offline support is not running. | | `ERROR_OFFLINE_MESSAGE_PERSIST_FAILED` | The local cache was briefly unavailable. Try again. | @@ -350,7 +350,7 @@ The outbox holds at most `maxPendingMessages` messages still trying to send (`PE | `REJECT_NEWEST` (**default**) | The new send is refused and reported with reason `QUEUE_FULL`. Nothing already queued is lost. | | `DROP_OLDEST` | The oldest `PENDING` message is evicted to admit the new one, and reported with `onError` (code `ERROR_PENDING_QUEUE_LIMIT`, reason `QUEUE_OVERFLOW`). If there is no `PENDING` message to evict, the new send is refused with `QUEUE_FULL`. | -A media send whose bytes would push the media cache over `maxMediaCacheSize` is refused with reason `BYTE_OVERFLOW`; nothing is evicted to make room. +When a media send's bytes would push the media cache over `maxMediaCacheSize`, the SDK first evicts the least recently used cached media to make room; the send is refused with reason `BYTE_OVERFLOW` only if the file still cannot fit, and then nothing is evicted. Media of queued messages does not count toward the budget and is never evicted. A **refused** send (`QUEUE_FULL` / `BYTE_OVERFLOW`) is never queued, so it fires **no** `onMessagePending`; it reports `onError` with the code `ERROR_PENDING_QUEUE_LIMIT`, and the global `OfflineMessageListener` receives `onOutboxMessageFailed(message, reason)` carrying the exact reason. diff --git a/sdk/android/v5/overview.mdx b/sdk/android/v5/overview.mdx index 53aa39bc9..c558cd130 100644 --- a/sdk/android/v5/overview.mdx +++ b/sdk/android/v5/overview.mdx @@ -67,7 +67,7 @@ Then, add CometChat to the **app level**`build.gradle` file in the `dependencies ```groovy dependencies { - implementation "com.cometchat:chat-sdk-android:5.1.0" + implementation "com.cometchat:chat-sdk-android:5.1.2" } ``` diff --git a/sdk/android/v5/pin-conversation.mdx b/sdk/android/v5/pin-conversation.mdx index cba93bfff..270996325 100644 --- a/sdk/android/v5/pin-conversation.mdx +++ b/sdk/android/v5/pin-conversation.mdx @@ -256,7 +256,11 @@ Every fetched `Conversation` carries its pin state. Register a `ConversationListener` to be notified when a conversation is pinned or unpinned, so your list can reorder without a refetch. -Your own pin or unpin fires `onConversationPinned` / `onConversationUnpinned` on the device that performed it, just before the `pinConversation()` / `unpinConversation()` success callback, so update your UI in one of the two, not both. These callbacks also fire on the user's **other** devices when a pin frame arrives there. +These callbacks fire only for pins and unpins made elsewhere, such as from the user's other devices. They do not fire on the device that performed the action: update the UI for this device's own pin or unpin in the `onSuccess` callback of `pinConversation()` / `unpinConversation()`. + + +This behaviour applies from SDK 5.1.2. In 5.1.0 and 5.1.1 these callbacks also fired on the acting device. If you use the Android UI Kit, upgrade it to 6.3.0 together with SDK 5.1.2. + diff --git a/sdk/android/v5/pin-message.mdx b/sdk/android/v5/pin-message.mdx index 921a05f75..31876dc52 100644 --- a/sdk/android/v5/pin-message.mdx +++ b/sdk/android/v5/pin-message.mdx @@ -311,7 +311,11 @@ Editing a message preserves its pin. A message stores only its most recent pinne Register a `MessageListener` and override the pin callbacks. Each event delivers the full updated `BaseMessage`, so you can directly replace the message in your list. -Your own pin or unpin fires `onMessagePinned` / `onMessageUnpinned` on the device that performed it, just before the `pinMessage()` / `unpinMessage()` success callback, so update your UI in one of the two, not both. These callbacks also fire on **other** participants' devices when a pin frame arrives there. +These callbacks fire only for pins and unpins by other users or from the user's other devices. They do not fire on the device that performed the action: update the UI for this device's own pin or unpin in the `onSuccess` callback of `pinMessage()` / `unpinMessage()`. + + +This behaviour applies from SDK 5.1.2. In 5.1.0 and 5.1.1 these callbacks also fired on the acting device. If you use the Android UI Kit, upgrade it to 6.3.0 together with SDK 5.1.2. + diff --git a/sdk/android/v5/real-time-listeners.mdx b/sdk/android/v5/real-time-listeners.mdx index c903cf570..b18de000c 100644 --- a/sdk/android/v5/real-time-listeners.mdx +++ b/sdk/android/v5/real-time-listeners.mdx @@ -183,10 +183,10 @@ With offline support enabled, `MessageListener` also receives `onMessagesSynced` | `onMessagesRead(MessageReceipt messageReceipt)` | This event is triggered when a set of messages are marked as read for any particular conversation. | | `onMessageEdited(BaseMessage message)` | This method is triggered when a particular message has been edited in a user/group conversation. | | `onMessageDeleted(BaseMessage message)` | This event is triggered when a particular message is deleted in a user/group conversation. | -| `onMessagePinned(BaseMessage message)` | This event is triggered when a message is pinned in a user/group conversation. | -| `onMessageUnpinned(BaseMessage message)` | This event is triggered when a message is unpinned in a user/group conversation. | -| `onMessageSaved(BaseMessage message)` | This event is triggered when the logged-in user saves a message (private — never delivered to other participants). | -| `onMessageUnsaved(BaseMessage message)` | This event is triggered when the logged-in user unsaves a message (private — never delivered to other participants). | +| `onMessagePinned(BaseMessage message)` | This event is triggered when a message is pinned in a user/group conversation (not fired on the device that performed the action). | +| `onMessageUnpinned(BaseMessage message)` | This event is triggered when a message is unpinned in a user/group conversation (not fired on the device that performed the action). | +| `onMessageSaved(BaseMessage message)` | This event is triggered when the logged-in user saves a message (private — never delivered to other participants; not fired on the device that performed the action). | +| `onMessageUnsaved(BaseMessage message)` | This event is triggered when the logged-in user unsaves a message (private — never delivered to other participants; not fired on the device that performed the action). | | `onInteractiveMessageReceived(InteractiveMessage message)` | This event is triggered when an Interactive Message is received. | | `onInteractionGoalCompleted(InteractionReceipt receipt)` | This event is triggered when an interaction Goal is achieved. | | `onTransientMessageReceived(TransientMessage transientMessage)` | This event is triggered when a Transient Message is received. | @@ -372,8 +372,8 @@ The `ConversationListener` class provides you with live events related to conver | Method | Information | | ------------------------------------------------- | ---------------------------------------------------------------------------- | -| `onConversationPinned(Conversation conversation)` | This event is triggered when a conversation is pinned for the logged-in user. | -| `onConversationUnpinned(Conversation conversation)` | This event is triggered when a conversation is unpinned for the logged-in user. | +| `onConversationPinned(Conversation conversation)` | This event is triggered when a conversation is pinned for the logged-in user (not fired on the device that performed the action). | +| `onConversationUnpinned(Conversation conversation)` | This event is triggered when a conversation is unpinned for the logged-in user (not fired on the device that performed the action). | To add the `ConversationListener`, you need to use the `addConversationListener()` method provided by the `CometChat` class. diff --git a/sdk/android/v5/retrieve-conversations.mdx b/sdk/android/v5/retrieve-conversations.mdx index f7e99e1f1..eae812bdb 100644 --- a/sdk/android/v5/retrieve-conversations.mdx +++ b/sdk/android/v5/retrieve-conversations.mdx @@ -405,7 +405,7 @@ The `Conversation` object consists of the following fields: | -------------------- | -------------------------------------------------------------------- | | `conversationId` | ID of the conversation | | `conversationType` | Type of conversation (user/group) | -| `lastMessage` | Last message the conversation | +| `lastMessage` | Last message the conversation. With [offline support](/sdk/android/v5/offline-send) enabled, a last message that has not been sent yet carries its send status in `getStatus()` (`MessageStatus.PENDING` or `MessageStatus.FAILED`) | | `conversationWith` | `User` or `Group` object containing the details of the user or group | | `unreadMessageCount` | Unread message count for the conversation | @@ -570,7 +570,7 @@ While converting a `Message` object to a `Conversation` object, the `unreadMessa ## Offline Behaviour -With [offline support](/sdk/android/v5/offline-cached-data) enabled, `fetchNext()` delivers a cached page first (`onCachedConversations`, even when empty) and then the server list (`onServerConversations`); offline, the read ends with `onError` with code `ERROR_INTERNET_UNAVAILABLE` after the cached page. The cached page is answered only when every builder filter on the request is locally computable — a single server-only filter blanks the cached page while the server phase still answers in full. +With [offline support](/sdk/android/v5/offline-cached-data) enabled, `fetchNext()` delivers a cached page first (`onCachedConversations`, even when empty) and then the server list (`onServerConversations`); offline, the read ends with `onError` with code `ERROR_INTERNET_UNAVAILABLE` after the cached page. The cached page is answered only when every builder filter on the request is locally computable — a single server-only filter blanks the cached page while the server phase still answers in full. A second `fetchNext()` made while the first is still loading returns an empty page at once, online or offline, without a cached page and without moving to the next page. | Builder method | Offline | |---|---| diff --git a/sdk/android/v5/save-message.mdx b/sdk/android/v5/save-message.mdx index 7cc9b5c0a..894f162bd 100644 --- a/sdk/android/v5/save-message.mdx +++ b/sdk/android/v5/save-message.mdx @@ -243,7 +243,11 @@ if (message.isSaved) { Because saving is private, save events are never delivered to other participants. Register a `MessageListener` and override the save callbacks; each event delivers the full updated `BaseMessage`. -Your own save or unsave fires `onMessageSaved` / `onMessageUnsaved` on the device that performed it, just before the `saveMessage()` / `unsaveMessage()` success callback, so update your UI in one of the two, not both. These callbacks also fire on the user's **other** devices when a save frame arrives there. +These callbacks fire only for saves and unsaves from the user's other devices. They do not fire on the device that performed the action: update the UI for this device's own save or unsave in the `onSuccess` callback of `saveMessage()` / `unsaveMessage()`. + + +This behaviour applies from SDK 5.1.2. In 5.1.0 and 5.1.1 these callbacks also fired on the acting device. If you use the Android UI Kit, upgrade it to 6.3.0 together with SDK 5.1.2. + diff --git a/sdk/android/v5/setup.mdx b/sdk/android/v5/setup.mdx index 91e4636e9..9efd25be5 100644 --- a/sdk/android/v5/setup.mdx +++ b/sdk/android/v5/setup.mdx @@ -47,7 +47,7 @@ Then, add CometChat to the **app level** `build.gradle` file in the `dependencie ```groovy dependencies { - implementation "com.cometchat:chat-sdk-android:5.1.0" + implementation "com.cometchat:chat-sdk-android:5.1.2" } ``` diff --git a/sdk/android/v5/upgrading-from-v4.mdx b/sdk/android/v5/upgrading-from-v4.mdx index a7e805f0d..66f643aff 100644 --- a/sdk/android/v5/upgrading-from-v4.mdx +++ b/sdk/android/v5/upgrading-from-v4.mdx @@ -12,7 +12,7 @@ Update your `build.gradle` dependency: ```groovy dependencies { - implementation "com.cometchat:chat-sdk-android:5.1.0" + implementation "com.cometchat:chat-sdk-android:5.1.2" } ```