diff --git a/docs/build/group-chat.md b/docs/build/group-chat.md index 9e424dc3..6b51470f 100644 --- a/docs/build/group-chat.md +++ b/docs/build/group-chat.md @@ -706,11 +706,13 @@ stream.stop() ## Sync group chats -Calling `sync()` for a group or groups gets any updates since the last sync and adds them to the local database. Be sure to periodically synchronize each group chat to ensure your app has the latest group chat details, including the most recent messages, member list, and group chat details, for example. +Calling `sync()` for a group or groups gets any updates since the last sync and adds them to the local database. + +Sync group chats anytime a user accesses a conversation view. This sync is especially important if a user backgrounds (switches away from) your app, then reopens the app and accesses a conversation view. When the user reopens the app, it may be using an old epoch (snapshot) of data. This is even more likely to be true if there were many group membership changes during the time the app was backgrounded. A group chat sync bumps the app to the latest epoch, helping to ensure that your user always sees the current group chat, including the most recent messages, member list, and group chat details, for example. Updates are also retrieved and added to the local database when streaming and when the user takes an action. -When your user sends a message, you don’t need to sync with the network for them to see their own message. The message gets written to their local database, and it shows up immediately for them. The same applies when your user creates a group. +When your user sends a message, you don’t need to sync with the network for them to see their own message. The message gets written to their local database, and it shows up immediately for them. The same applies when your user creates a group. See [⚠️ Important: Manage actions that make a local database inaccessible](#️-important-manage-actions-that-make-a-local-database-inaccessible). diff --git a/docs/build/message-history.md b/docs/build/message-history.md index 0a1837ca..5a273838 100644 --- a/docs/build/message-history.md +++ b/docs/build/message-history.md @@ -84,10 +84,6 @@ const client = await Client.create('0x1234...', { ## Request message history sync -Code your app to request a message history sync anytime a user accesses a conversation view. - -This sync is especially important if a user backgrounds (switches away from) your app, then reopens the app and accesses a conversation view. When the user reopens the app, it may be using an old epoch (snapshot) of data. This is even more likely to be true if there were many group membership changes during the time the app was backgrounded. A message history sync bumps the app to the latest epoch, helping to ensure that your user always sees the current group chat. - When a new client is created, it will look for other clients registered with the same inbox ID. If there are none, there is no message history to be synced. If there are clients registered with the same inbox ID, it will request a message history sync with the clients. For example, let’s say that inbox ID 1/client B requests a message history sync with inbox ID 1/client A. diff --git a/docs/build/messages/read-receipt.mdx b/docs/build/messages/read-receipt.mdx index 7e1c1601..ff89aa05 100644 --- a/docs/build/messages/read-receipt.mdx +++ b/docs/build/messages/read-receipt.mdx @@ -52,31 +52,6 @@ const xmtp = await Client.create(signer, { env: "dev" }); xmtp.registerCodec(new ReadReceiptCodec()); ``` - - - -The React SDK supports all current standards-track content types, but only text messages are enabled out of the box. Adding support for other standards-track content types requires a bit of configuration. - -```jsx -import { - XMTPProvider, - readReceiptContentTypeConfig, -} from "@xmtp/react-sdk"; - -const contentTypeConfigs = [ - readReceiptContentTypeConfig, - // other content type configs... -]; - -createRoot(document.getElementById("root") as HTMLElement).render( - - - - - , -); -``` - @@ -132,20 +107,6 @@ The content of a read receipt message must be an empty object. await conversation.messages.send({}, ContentTypeReadReceipt); ``` - - - -The content of a read receipt message must be an empty object. - -```jsx -import { useSendMessage } from "@xmtp/react-sdk"; -import { ContentTypeReadReceipt } from "@xmtp/content-type-read-receipt"; - -const { sendMessage } = useSendMessage(); - -sendMessage(conversation, {}, ContentTypeReadReceipt); -``` - @@ -214,41 +175,6 @@ if (message.contentType.sameAs(ContentTypeReadReceipt)) { } ``` - - - -```jsx -import { ContentTypeId } from "@xmtp/react-sdk"; -import { ContentTypeReadReceipt } from "@xmtp/content-type-read-receipt"; - -const contentType = ContentTypeId.fromString(message.contentType); - -if (ContentTypeReadReceipt.sameAs(contentType)) { - // The message is a read receipt - const timestamp = message.sentAt; -} -``` - -**getReadReceipt** - -Use to retrieve the read receipt from a cached conversation. It takes a `CachedConversation` object as a parameter and returns the read receipt date, or `undefined`, if the conversation has no read receipt. - -```jsx -import { getReadReceipt } from "@xmtp/react-sdk"; - -const readReceiptDate = getReadReceipt(conversation); -``` - -**hasReadReceipt** - -Use to check if a cached conversation has a read receipt. It takes a `CachedConversation` object as a parameter and returns `true` if the conversation has a read receipt and `false` if otherwise. - -```jsx -import { hasReadReceipt } from "@xmtp/react-sdk"; - -const hasReceipt = hasReadReceipt(conversation); -``` -