mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Expose global account data get and set on MatrixClient
MatrixClient had no way to read or write global account data although the underlying client supports it. Add getAccountData and setAccountData to the interface and implement them in RustMatrixClient using the same withContext/runCatchingExceptions idiom as the neighbouring methods. The content is the raw JSON string the SDK returns and accepts: event types are open ended, so a typed wrapper belongs to whichever caller needs one. Scope is limited to global account data; the room level variant and the change notification APIs can follow when a feature needs them.
This commit is contained in:
+10
@@ -210,6 +210,16 @@ interface MatrixClient {
|
||||
*/
|
||||
suspend fun addRecentEmoji(emoji: String): Result<Unit>
|
||||
|
||||
/**
|
||||
* Returns the raw JSON content of the global account data event of type [eventType], or null if it is not set.
|
||||
*/
|
||||
suspend fun getAccountData(eventType: String): Result<String?>
|
||||
|
||||
/**
|
||||
* Sets the global account data event of type [eventType] to the raw JSON [content].
|
||||
*/
|
||||
suspend fun setAccountData(eventType: String, content: String): Result<Unit>
|
||||
|
||||
/**
|
||||
* Marks the room with the provided [roomId] as read, sending a fully read receipt for [eventId].
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user