Rename fun for clarity

This commit is contained in:
Benoit Marty 2022-01-29 07:40:41 +01:00
parent b14e557c36
commit 83ed80e6d8
4 changed files with 5 additions and 5 deletions

View File

@ -63,5 +63,5 @@ data class MessageLocationContent(
@Json(name = "org.matrix.msc1767.text") val text: String? = null
) : MessageContent {
fun getUri() = locationInfo?.geoUri ?: geoUri
fun getBestGeoUri() = locationInfo?.geoUri ?: geoUri
}

View File

@ -614,7 +614,7 @@ class RoomDetailFragment @Inject constructor(
private fun handleShowLocationPreview(locationContent: MessageLocationContent, senderId: String) {
// TODO Create a helper
val geoUri = locationContent.getUri()
val geoUri = locationContent.getBestGeoUri()
val locationData = LocationData.create(geoUri)
navigator
.openLocationSharing(
@ -1948,7 +1948,7 @@ class RoomDetailFragment @Inject constructor(
when (action.messageContent) {
is MessageTextContent -> shareText(requireContext(), action.messageContent.body)
is MessageLocationContent -> {
LocationData.create(action.messageContent.getUri())?.let {
LocationData.create(action.messageContent.getBestGeoUri())?.let {
openLocation(requireActivity(), it.latitude, it.longitude)
}
}

View File

@ -79,7 +79,7 @@ class MessageActionsEpoxyController @Inject constructor(
val bindingOptions = spanUtils.getBindingOptions(body)
val locationUrl = state.timelineEvent()?.root?.getClearContent()
?.toModel<MessageLocationContent>(catchError = true)
?.let { LocationData.create(it.getUri()) }
?.let { LocationData.create(it.getBestGeoUri()) }
?.let { urlMapProvider.buildStaticMapUrl(it, INITIAL_MAP_ZOOM_IN_TIMELINE, 1200, 800) }
bottomSheetMessagePreviewItem {

View File

@ -200,7 +200,7 @@ class MessageItemFactory @Inject constructor(
informationData: MessageInformationData,
highlight: Boolean,
attributes: AbsMessageItem.Attributes): MessageLocationItem? {
val geoUri = locationContent.getUri()
val geoUri = locationContent.getBestGeoUri()
val locationData = LocationData.create(geoUri)
val width = resources.displayMetrics.widthPixels - dimensionConverter.dpToPx(60)