WidgetService

interface WidgetService

This is the entry point to manage widgets. You can grab an instance of this service through an active session.

Functions

Link copied to clipboard
abstract suspend fun createRoomWidget(    roomId: String,     widgetId: String,     content: Content): Widget

Creates and send a new widget in a room. It makes sure you have the rights to handle this.

Link copied to clipboard
abstract suspend fun destroyRoomWidget(roomId: String, widgetId: String)

Deactivate a widget in a room. It makes sure you have the rights to handle this.

Link copied to clipboard
abstract fun getRoomWidgets(    roomId: String,     widgetId: QueryStateEventValue,     widgetTypes: Set<String>? = null,     excludedTypes: Set<String>? = null): List<Widget>

Returns the current room widgets defined through state events. Some widgets can be deactivated, so be sure to check for isActive if needed.

Link copied to clipboard
abstract fun getRoomWidgetsLive(    roomId: String,     widgetId: QueryStateEventValue,     widgetTypes: Set<String>? = null,     excludedTypes: Set<String>? = null): LiveData<List<Widget>>

Returns the live room widgets so you can listen to them. Some widgets can be deactivated, so be sure to check for isActive.

Link copied to clipboard
abstract fun getUserWidgets(widgetTypes: Set<String>? = null, excludedTypes: Set<String>? = null): List<Widget>

Returns the current user widgets. Some widgets can be deactivated, so be sure to check for isActive.

Link copied to clipboard
abstract fun getUserWidgetsLive(widgetTypes: Set<String>? = null, excludedTypes: Set<String>? = null): LiveData<List<Widget>>

Returns the live user widgets so you can listen to them. Some widgets can be deactivated, so be sure to check for isActive.

Link copied to clipboard
abstract fun getWidgetComputedUrl(widget: Widget, isLightTheme: Boolean): String?

Return the computed URL of a widget.

Link copied to clipboard
abstract fun getWidgetPostAPIMediator(): WidgetPostAPIMediator

Returns a new instance of WidgetPostAPIMediator. Be careful to call clearWebView method and setHandler to null to avoid memory leaks. This is to be used for "admin" widgets so you can interact through JS.

Link copied to clipboard
abstract fun getWidgetURLFormatter(): WidgetURLFormatter

Returns an instance of WidgetURLFormatter.

Link copied to clipboard
abstract fun hasPermissionsToHandleWidgets(roomId: String): Boolean

Returns true if you can add/remove widgets. It goes through