Skip to content

Commit 5454bbb

Browse files
jhaaaasaulmc
andauthored
Docs: Add user consent section (#130)
* docs: add user consent section * Update README.md Co-authored-by: Saul Carlin <saul.carlin@gmail.com> --------- Co-authored-by: Saul Carlin <saul.carlin@gmail.com>
1 parent 1bcf817 commit 5454bbb

File tree

1 file changed

+34
-22
lines changed

1 file changed

+34
-22
lines changed

README.md

+34-22
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,38 @@ val decodedConversation = containerAgain.decode(client)
252252
decodedConversation.send(text = "hi")
253253
```
254254

255-
### Handle different types of content
255+
### Cache conversations
256+
257+
As a performance optimization, you may want to persist the list of conversations in your application outside of the SDK to speed up the first call to `client.conversations.list()`.
258+
259+
The exported conversation list contains encryption keys for any V2 conversations included in the list. As such, you should treat it with the same care that you treat private keys.
260+
261+
You can get a JSON serializable list of conversations by calling:
262+
263+
```kotlin
264+
val client = Client().create(wallet)
265+
val conversations = client.conversations.export()
266+
saveConversationsSomewhere(JSON.stringify(conversations))
267+
// To load the conversations in a new SDK instance you can run:
268+
269+
val client = Client.create(wallet)
270+
val conversations = JSON.parse(loadConversationsFromSomewhere())
271+
val client.importConversation(conversations)
272+
```
273+
274+
## Request and respect user consent
275+
276+
![Feature status](https://img.shields.io/badge/Feature_status-Alpha-orange)
277+
278+
The user consent feature enables your app to request and respect user consent preferences. With this feature, another blockchain account address registered on the XMTP network can have one of three consent preference values:
279+
280+
- Unknown
281+
- Allowed
282+
- Denied
283+
284+
To learn more, see [Request and respect user consent](https://xmtp.org/docs/build/user-consent).
285+
286+
## Handle different types of content
256287

257288
All the send functions support `SendOptions` as an optional parameter. The `contentType` option allows specifying different types of content than the default simple string, which is identified with content type identifier `ContentTypeText`.
258289

@@ -274,11 +305,11 @@ As shown in the example above, you must provide a `contentFallback` value. Use i
274305
> **Caution**
275306
> If you don't provide a `contentFallback` value, clients that don't support the content type will display an empty message. This results in a poor user experience and breaks interoperability.
276307
277-
#### Handle custom content types
308+
### Handle custom content types
278309

279310
Beyond this, custom codecs and content types may be proposed as interoperable standards through XRCs. To learn more about the custom content type proposal process, see [XIP-5](https://github.com/xmtp/XIPs/blob/main/XIPs/xip-5-message-content-types.md).
280311

281-
### Compression
312+
## Compression
282313

283314
Message content can be optionally compressed using the compression option. The value of the option is the name of the compression algorithm to use. Currently supported are gzip and deflate. Compression is applied to the bytes produced by the content codec.
284315

@@ -288,25 +319,6 @@ Content will be decompressed transparently on the receiving end. Note that Clien
288319
conversation.send(text = '#'.repeat(1000), options = ClientOptions.Api(compression = EncodedContentCompression.GZIP))
289320
```
290321

291-
### Cache conversations
292-
293-
As a performance optimization, you may want to persist the list of conversations in your application outside of the SDK to speed up the first call to `client.conversations.list()`.
294-
295-
The exported conversation list contains encryption keys for any V2 conversations included in the list. As such, you should treat it with the same care that you treat private keys.
296-
297-
You can get a JSON serializable list of conversations by calling:
298-
299-
```kotlin
300-
val client = Client().create(wallet)
301-
val conversations = client.conversations.export()
302-
saveConversationsSomewhere(JSON.stringify(conversations))
303-
// To load the conversations in a new SDK instance you can run:
304-
305-
val client = Client.create(wallet)
306-
val conversations = JSON.parse(loadConversationsFromSomewhere())
307-
val client.importConversation(conversations)
308-
```
309-
310322
## 🏗 Breaking revisions
311323

312324
Because `xmtp-android` is in active development, you should expect breaking revisions that might require you to adopt the latest SDK release to enable your app to continue working as expected.

0 commit comments

Comments
 (0)