mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: extract NodeMenu from UsersFragment
This commit is contained in:
parent
db500c5200
commit
f75879603e
3 changed files with 99 additions and 57 deletions
|
|
@ -265,6 +265,7 @@ class UIViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
fun requestTraceroute(destNum: Int) {
|
||||
info("Requesting traceroute for '$destNum'")
|
||||
try {
|
||||
val packetId = meshService?.packetId ?: return
|
||||
meshService?.requestTraceroute(packetId, destNum)
|
||||
|
|
@ -274,16 +275,18 @@ class UIViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
fun removeNode(nodeNum: Int) = viewModelScope.launch(Dispatchers.IO) {
|
||||
info("Removing node '$nodeNum'")
|
||||
try {
|
||||
val packetId = meshService?.packetId ?: return@launch
|
||||
meshService?.removeByNodenum(packetId, nodeNum)
|
||||
nodeDB.deleteNode(nodeNum)
|
||||
} catch (ex: RemoteException) {
|
||||
errormsg("Request traceroute error: ${ex.message}")
|
||||
errormsg("Remove node error: ${ex.message}")
|
||||
}
|
||||
}
|
||||
|
||||
fun requestPosition(destNum: Int, position: Position = Position(0.0, 0.0, 0)) {
|
||||
info("Requesting position for '$destNum'")
|
||||
try {
|
||||
meshService?.requestPosition(destNum, position)
|
||||
} catch (ex: RemoteException) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue