Expose liveLocationSharing methods from sdk

This commit is contained in:
ganfra 2026-02-18 14:59:49 +01:00
parent f8d0de2391
commit f25b2a8045
5 changed files with 124 additions and 0 deletions

View file

@ -17,6 +17,7 @@ import io.element.android.libraries.matrix.api.encryption.identity.IdentityState
import io.element.android.libraries.matrix.api.room.history.RoomHistoryVisibility
import io.element.android.libraries.matrix.api.room.join.JoinRule
import io.element.android.libraries.matrix.api.room.knock.KnockRequest
import io.element.android.libraries.matrix.api.room.location.LiveLocationShare
import io.element.android.libraries.matrix.api.room.powerlevels.RoomPowerLevelsValues
import io.element.android.libraries.matrix.api.room.powerlevels.UserRoleChange
import io.element.android.libraries.matrix.api.roomdirectory.RoomVisibility
@ -182,4 +183,30 @@ interface JoinedRoom : BaseRoom {
* Subscribe to a [Flow] of [SendQueueUpdate] related to this room.
*/
fun subscribeToSendQueueUpdates(): Flow<SendQueueUpdate>
/**
* Subscribe to live location shares in this room.
* @return Flow of list of active live location shares.
*/
fun subscribeToLiveLocationShares(): Flow<List<LiveLocationShare>>
/**
* Start sharing live location in this room.
* @param durationMillis How long to share location (in milliseconds).
* @return Result indicating success or failure.
*/
suspend fun startLiveLocationShare(durationMillis: Long): Result<Unit>
/**
* Stop sharing live location in this room.
* @return Result indicating success or failure.
*/
suspend fun stopLiveLocationShare(): Result<Unit>
/**
* Send a live location update while a live location share is active.
* @param geoUri The geo URI (e.g., "geo:51.5074,-0.1278").
* @return Result indicating success or failure.
*/
suspend fun sendLiveLocation(geoUri: String): Result<Unit>
}

View file

@ -0,0 +1,24 @@
/*
* Copyright (c) 2025 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
* Please see LICENSE files in the repository root for full details.
*/
package io.element.android.libraries.matrix.api.room.location
import io.element.android.libraries.matrix.api.core.UserId
/**
* Represents a live location share from a user in a room.
*/
data class LiveLocationShare(
/** The user who is sharing their location. */
val userId: UserId,
/** The last known geo URI (e.g., "geo:51.5074,-0.1278"). */
val lastGeoUri: String,
/** The timestamp of the last location update. */
val lastTimestamp: Long,
/** Whether the live location share is still active. */
val isLive: Boolean,
)