mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat: add remote node configuration (#626)
This commit is contained in:
parent
ec3a046fb6
commit
85e62eaab4
12 changed files with 523 additions and 267 deletions
|
|
@ -17,6 +17,7 @@ import androidx.lifecycle.asLiveData
|
|||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.geeksville.mesh.NodeInfo
|
||||
import com.geeksville.mesh.Portnums
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.android.Logging
|
||||
import com.geeksville.mesh.databinding.AdapterNodeLayoutBinding
|
||||
|
|
@ -56,6 +57,7 @@ class UsersFragment : ScreenFragment("Users"), Logging {
|
|||
private var nodes = arrayOf<NodeInfo>()
|
||||
|
||||
private fun popup(view: View, position: Int) {
|
||||
if (!model.isConnected()) return
|
||||
val node = nodes[position]
|
||||
val user = node.user
|
||||
val showAdmin = position == 0 || model.adminChannelIndex > 0
|
||||
|
|
@ -93,6 +95,13 @@ class UsersFragment : ScreenFragment("Users"), Logging {
|
|||
model.requestTraceroute(node.num)
|
||||
}
|
||||
}
|
||||
R.id.remote_admin -> {
|
||||
debug("calling remote admin --> destNum: ${node.num}")
|
||||
parentFragmentManager.beginTransaction()
|
||||
.replace(R.id.mainActivityLayout, DeviceSettingsFragment(node))
|
||||
.addToBackStack(null)
|
||||
.commit()
|
||||
}
|
||||
R.id.reboot -> {
|
||||
MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle("${getString(R.string.reboot)}\n${user?.longName}?")
|
||||
|
|
@ -333,6 +342,7 @@ class UsersFragment : ScreenFragment("Users"), Logging {
|
|||
|
||||
model.packetResponse.asLiveData().observe(viewLifecycleOwner) { meshLog ->
|
||||
meshLog?.meshPacket?.let { meshPacket ->
|
||||
if (meshPacket.decoded.portnum != Portnums.PortNum.TRACEROUTE_APP) return@let
|
||||
val routeList = meshLog.routeDiscovery?.routeList
|
||||
fun nodeName(num: Int) = model.nodeDB.nodesByNum?.get(num)?.user?.longName
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue