mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Refactor LiveLocationShare to include structured LastLocation
This commit is contained in:
+3
-2
@@ -138,7 +138,8 @@ class ShowLocationPresenter(
|
||||
val membersStateFlow = joinedRoom.membersStateFlow.mapState { it.joinedRoomMembers() }
|
||||
combine(liveLocationSharesFlow, membersStateFlow) { liveShares, members ->
|
||||
liveShares.mapNotNull { share ->
|
||||
val location = Location.fromGeoUri(share.lastGeoUri) ?: return@mapNotNull null
|
||||
val lastLocation = share.lastLocation ?: return@mapNotNull null
|
||||
val location = Location.fromGeoUri(lastLocation.geoUri) ?: return@mapNotNull null
|
||||
val member = members.find { it.userId == share.userId }
|
||||
val displayName = member?.getBestName() ?: share.userId.value
|
||||
val avatarUrl = member?.avatarUrl
|
||||
@@ -154,7 +155,7 @@ class ShowLocationPresenter(
|
||||
formattedTimestamp = "Sharing live location",
|
||||
location = location,
|
||||
isLive = true,
|
||||
assetType = AssetType.SENDER,
|
||||
assetType = lastLocation.assetType,
|
||||
)
|
||||
}.toPersistentList()
|
||||
}.collect { value = it }
|
||||
|
||||
Reference in New Issue
Block a user