1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Add methods to influence set_presence on /sync API calls (#3578)

* Add methods to influence set_presence on /sync API calls

* Tweak comment

* Improve coverage
This commit is contained in:
Michael Telatynski
2023-07-11 14:31:12 +01:00
committed by GitHub
parent 1fdc0af5b7
commit f2471b6dbd
4 changed files with 43 additions and 2 deletions

View File

@@ -21,7 +21,7 @@ limitations under the License.
import { Optional } from "matrix-events-sdk";
import type { IDeviceKeys, IMegolmSessionData, IOneTimeKey } from "./@types/crypto";
import { ISyncStateData, SyncApi, SyncApiOptions, SyncState } from "./sync";
import { ISyncStateData, SetPresence, SyncApi, SyncApiOptions, SyncState } from "./sync";
import {
EventStatus,
IContent,
@@ -5531,6 +5531,16 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
return getHttpUriForMxc(this.baseUrl, mxcUrl, width, height, resizeMethod, allowDirectLinks);
}
/**
* Specify the set_presence value to be used for subsequent calls to the Sync API.
* This has an advantage over calls to the PUT /presence API in that it
* doesn't clobber status_msg set by other devices.
* @param presence - the presence to specify to set_presence of sync calls
*/
public async setSyncPresence(presence?: SetPresence): Promise<void> {
this.syncApi?.setPresence(presence);
}
/**
* @param opts - Options to apply
* @returns Promise which resolves