android/ui: support searching for node by IP address (#423)

fixes tailscale/corp#20846

Adds searching by IP to android, matching the existing
iOS behavior.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
jonathan/npe_crash_1
Jonathan Nobels 6 months ago committed by GitHub
parent 864cc35bd4
commit 634d51c20b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -3,6 +3,7 @@
package com.tailscale.ipn.ui.util package com.tailscale.ipn.ui.util
import androidx.compose.ui.util.fastAny
import com.tailscale.ipn.mdm.MDMSettings import com.tailscale.ipn.mdm.MDMSettings
import com.tailscale.ipn.ui.model.Netmap import com.tailscale.ipn.ui.model.Netmap
import com.tailscale.ipn.ui.model.Tailcfg import com.tailscale.ipn.ui.model.Tailcfg
@ -111,7 +112,10 @@ class PeerCategorizer {
} }
val matchingPeers = val matchingPeers =
peers.filter { it.displayName.contains(searchTerm, ignoreCase = true) } peers.filter {
it.displayName.contains(searchTerm, ignoreCase = true) ||
(it.Addresses ?: emptyList()).fastAny { addr -> addr.contains(searchTerm) }
}
if (matchingPeers.isNotEmpty()) { if (matchingPeers.isNotEmpty()) {
PeerSet(user, matchingPeers) PeerSet(user, matchingPeers)
} else { } else {

Loading…
Cancel
Save