mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: improve packetResponse performance
This commit is contained in:
parent
15fe0b7cc1
commit
b0f990e42a
2 changed files with 7 additions and 6 deletions
|
|
@ -153,10 +153,11 @@ class UIViewModel @Inject constructor(
|
|||
_ourNodeInfo.value = it
|
||||
}.launchIn(viewModelScope)
|
||||
|
||||
combine(meshLog, requestId) { packet, requestId ->
|
||||
if (requestId != null) _packetResponse.value =
|
||||
packet.firstOrNull { it.meshPacket?.decoded?.requestId == requestId }
|
||||
}.launchIn(viewModelScope)
|
||||
viewModelScope.launch {
|
||||
combine(meshLogRepository.getAllLogs(9), requestId) { list, id ->
|
||||
list.takeIf { id != null }?.firstOrNull { it.meshPacket?.decoded?.requestId == id }
|
||||
}.collect { response -> _packetResponse.value = response }
|
||||
}
|
||||
|
||||
debug("ViewModel created")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue