Long press node in map jumps to node in node list (#955)

* Fix scrolling to node and blinking

* Show node in list, instead of opening DM
This commit is contained in:
Davis 2024-04-06 05:36:01 -06:00 committed by GitHub
parent 80e9bbbe56
commit e887336da3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 87 additions and 49 deletions

View file

@ -105,21 +105,12 @@ class MapFragment : ScreenFragment("Map Fragment"), Logging {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setContent {
AppCompatTheme {
MapView(model, ::openDirectMessage)
MapView(model)
}
}
}
}
private fun openDirectMessage(node: NodeInfo) {
val user = node.user ?: return
model.setContactKey("${node.channel}${user.id}")
parentFragmentManager.beginTransaction()
.replace(R.id.mainActivityLayout, MessagesFragment())
.addToBackStack(null)
.commit()
}
}
@Composable
@ -135,7 +126,6 @@ private fun MapView.UpdateMarkers(
@Composable
fun MapView(
model: UIViewModel = viewModel(),
openDirectMessage: (NodeInfo) -> Unit = { },
) {
// UI Elements
@ -236,7 +226,8 @@ fun MapView(
icon = markerIcon
setOnLongClickListener {
openDirectMessage(node)
performHapticFeedback()
model.focusUserNode(node)
true
}
}