mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat: Adds Request user info (#1279)
* Request user info * safe calls * Fix: Ensure NodeInfo is sent when requesting user info The `requestUserInfo` function now correctly sends `NodeInfo` when requesting user info by using the ` toNodeInfo()` method on `ourNodeInfo`. This ensures the recipient receives the necessary information. * fix: remove unused parameters, use service's node db for our node entity --------- Co-authored-by: musznik <bymucha@gmail.com>
This commit is contained in:
parent
83c3b484ad
commit
f944a236ac
6 changed files with 37 additions and 5 deletions
|
|
@ -58,10 +58,10 @@ import java.util.concurrent.TimeUnit
|
|||
import javax.inject.Inject
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/// Given a human name, strip out the first letter of the first three words and return that as the initials for
|
||||
/// that user. If the original name is only one word, strip vowels from the original name and if the result is
|
||||
/// 3 or more characters, use the first three characters. If not, just take the first 3 characters of the
|
||||
/// original name.
|
||||
// / Given a human name, strip out the first letter of the first three words and return that as the initials for
|
||||
// / that user. If the original name is only one word, strip vowels from the original name and if the result is
|
||||
// / 3 or more characters, use the first three characters. If not, just take the first 3 characters of the
|
||||
// / original name.
|
||||
fun getInitials(nameIn: String): String {
|
||||
val nchars = 4
|
||||
val minchars = 2
|
||||
|
|
@ -411,6 +411,15 @@ class UIViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
fun requestUserInfo(destNum: Int) {
|
||||
info("Requesting UserInfo for '$destNum'")
|
||||
try {
|
||||
meshService?.requestUserInfo( destNum )
|
||||
} catch (ex: RemoteException) {
|
||||
errormsg("Request NodeInfo error: ${ex.message}")
|
||||
}
|
||||
}
|
||||
|
||||
fun requestPosition(destNum: Int, position: Position = Position(0.0, 0.0, 0)) {
|
||||
info("Requesting position for '$destNum'")
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue