mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-29 18:39:27 +01:00
Update beacon info state event by setting live as false.
This commit is contained in:
parent
047a45d77f
commit
4ee7332973
@ -66,6 +66,12 @@ interface StateService {
|
||||
*/
|
||||
suspend fun deleteAvatar()
|
||||
|
||||
/**
|
||||
* Stops sharing live location in the room
|
||||
* @param beaconInfoStateEvent Initial beacon info state event
|
||||
*/
|
||||
suspend fun stopLiveLocation(beaconInfoStateEvent: Event)
|
||||
|
||||
/**
|
||||
* Send a state event to the room
|
||||
* @param eventType The type of event to send.
|
||||
|
@ -25,12 +25,15 @@ import org.matrix.android.sdk.api.query.QueryStringValue
|
||||
import org.matrix.android.sdk.api.session.events.model.Event
|
||||
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||
import org.matrix.android.sdk.api.session.events.model.toContent
|
||||
import org.matrix.android.sdk.api.session.events.model.toModel
|
||||
import org.matrix.android.sdk.api.session.room.model.GuestAccess
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomCanonicalAliasContent
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomHistoryVisibility
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomJoinRules
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomJoinRulesAllowEntry
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomJoinRulesContent
|
||||
import org.matrix.android.sdk.api.session.room.model.livelocation.BeaconInfo
|
||||
import org.matrix.android.sdk.api.session.room.model.livelocation.LiveLocationBeaconContent
|
||||
import org.matrix.android.sdk.api.session.room.state.StateService
|
||||
import org.matrix.android.sdk.api.util.JsonDict
|
||||
import org.matrix.android.sdk.api.util.MimeTypes
|
||||
@ -186,4 +189,25 @@ internal class DefaultStateService @AssistedInject constructor(@Assisted private
|
||||
}
|
||||
updateJoinRule(RoomJoinRules.RESTRICTED, null, allowEntries)
|
||||
}
|
||||
|
||||
override suspend fun stopLiveLocation(beaconInfoStateEvent: Event) {
|
||||
beaconInfoStateEvent.getClearContent()?.toModel<LiveLocationBeaconContent>()?.let { content ->
|
||||
val beaconContent = LiveLocationBeaconContent(
|
||||
unstableBeaconInfo = BeaconInfo(
|
||||
description = content.getBestBeaconInfo()?.description,
|
||||
timeout = content.getBestBeaconInfo()?.timeout,
|
||||
isLive = false,
|
||||
),
|
||||
unstableTimestampAsMilliseconds = System.currentTimeMillis()
|
||||
).toContent()
|
||||
|
||||
beaconInfoStateEvent.stateKey?.let {
|
||||
sendStateEvent(
|
||||
eventType = EventType.STATE_ROOM_BEACON_INFO.first(),
|
||||
body = beaconContent,
|
||||
stateKey = it
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user