Added relays count (#3773)

Signed-off-by: Benjamin Faershtein <119711889+RCGV1@users.noreply.github.com>
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
Benjamin Faershtein 2025-11-24 16:30:44 -08:00 committed by GitHub
parent 0d00c838b0
commit 022652efe5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 18 additions and 3 deletions

View file

@ -1326,6 +1326,9 @@ class MeshService : Service() {
p.data.status = m
p.routingError = routingError
p.data.relayNode = relayNode
if (isAck) {
p.data.relays += 1
}
packetRepository.get().update(p)
}
serviceBroadcasts.broadcastMessageStatus(requestId, m)

View file

@ -64,6 +64,7 @@ import kotlin.time.Duration.Companion.seconds
private const val RSSI_DELAY = 10
private const val RSSI_TIMEOUT = 5
@Suppress("LongMethod", "LoopWithTooManyJumpStatements")
@Composable
fun CurrentlyConnectedInfo(
node: Node,

View file

@ -54,6 +54,7 @@ data class PacketEntity(
replyId = data.replyId,
viaMqtt = node.viaMqtt,
relayNode = data.relayNode,
relays = data.relays,
)
}
}

View file

@ -87,6 +87,7 @@ data class Message(
val originalMessage: Message? = null,
val viaMqtt: Boolean = false,
val relayNode: Int? = null,
val relays: Int = 0,
) {
fun getStatusStringRes(): Pair<StringResource, StringResource> {
val title = if (routingError > 0) Res.string.error else Res.string.message_delivery_status

View file

@ -62,6 +62,7 @@ data class DataPacket(
var rssi: Int = 0,
var replyId: Int? = null, // If this is a reply to a previous message, this is the ID of that message
var relayNode: Int? = null,
var relays: Int = 0,
) : Parcelable {
/** If there was an error with this message, this string describes what was wrong. */

View file

@ -954,6 +954,10 @@
<string name="privacy_url" translatable="false">" https://meshtastic.org/docs/legal/privacy/"</string>
<string name="unset">Unset - 0</string>
<string name="relayed_by">Relayed by: %1$s</string>
<plurals name="relays">
<item quantity="one">Heard %1$d Relay</item>
<item quantity="other">Heard %1$d Relays</item>
</plurals>
<string name="preserve_favorites">Preserve Favorites?</string>
<string name="usb_devices">USB Devices</string>

View file

@ -30,18 +30,21 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import org.jetbrains.compose.resources.StringResource
import org.jetbrains.compose.resources.pluralStringResource
import org.jetbrains.compose.resources.stringResource
import org.meshtastic.core.strings.Res
import org.meshtastic.core.strings.close
import org.meshtastic.core.strings.relayed_by
import org.meshtastic.core.strings.relays
import org.meshtastic.core.strings.resend
@Suppress("UnusedParameter")
@Composable
fun DeliveryInfo(
title: StringResource,
resendOption: Boolean,
text: StringResource? = null,
relayNodeName: String? = null,
relays: Int = 0,
onConfirm: (() -> Unit) = {},
onDismiss: () -> Unit = {},
) = AlertDialog(
@ -75,9 +78,9 @@ fun DeliveryInfo(
style = MaterialTheme.typography.bodyMedium,
)
}
relayNodeName?.let {
if (relays != 0) {
Text(
text = stringResource(Res.string.relayed_by, it),
text = pluralStringResource(Res.plurals.relays, relays, relays),
modifier = Modifier.padding(top = 8.dp),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.bodyMedium,

View file

@ -397,6 +397,7 @@ internal fun MessageStatusDialog(
resendOption = resendOption,
text = text,
relayNodeName = relayNodeName,
relays = message.relays,
onConfirm = onResend,
onDismiss = onDismiss,
)