change : Hide UserLocaitonPuck when currentlySharing from this device (and follow the marker instead of the puck)

This commit is contained in:
ganfra
2026-06-03 21:54:29 +02:00
parent 930aa4f1db
commit f800bb5586
2 changed files with 36 additions and 2 deletions
@@ -200,7 +200,15 @@ import kotlinx.coroutines.launch
}
}
}
val userLocationState = userLocationStateFactory.create(hasLocationPermission = permissionsState.isAnyGranted)
val isCurrentlySharing by liveLocationShareManager.isCurrentlySharing(roomId = joinedRoom.roomId).collectAsState()
val hideUserLocationPuck = mode is ShowLocationMode.Live && isCurrentlySharing
val userLocationState = if (hideUserLocationPuck) {
// When sharing with this device, use the user LocationShareItem as source of data instead of the device.
val ownLocationShare by remember { derivedStateOf { updatedLocationShares.find { it.isOwnUser }?.location?.asMapLibreLocation() } }
UserLocationState(ownLocationShare)
} else {
userLocationStateFactory.create(hasLocationPermission = permissionsState.isAnyGranted)
}
return ShowLocationState(
customMapStyleUrl = customMapStyleUrl,
dialogState = dialogState,
@@ -210,7 +218,7 @@ import kotlinx.coroutines.launch
userLocationState = userLocationState,
isLive = mode is ShowLocationMode.Live,
appName = appName,
hideUserLocationPuck = false,
hideUserLocationPuck = hideUserLocationPuck,
eventSink = ::handleEvent,
)
}