Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Display for self-sent messages #1350

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/src/main/java/com/geeksville/mesh/model/Message.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.geeksville.mesh.model

import com.geeksville.mesh.MeshProtos
import com.geeksville.mesh.MeshProtos.Routing
import com.geeksville.mesh.MeshUser
import com.geeksville.mesh.MessageStatus
import com.geeksville.mesh.R

Expand Down Expand Up @@ -29,7 +29,7 @@ val Routing.Error.stringRes: Int
data class Message(
val uuid: Long,
val receivedTime: Long,
val user: MeshUser,
val user: MeshProtos.User,
val text: String,
val time: Long,
val read: Boolean,
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/geeksville/mesh/model/NodeDB.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class NodeDB @Inject constructor(
fun getUser(userId: String): MeshProtos.User =
nodeDBbyNum.value.values.find { it.user.id == userId }?.user
?: MeshProtos.User.newBuilder()
.setId(userId)
.setLongName("Meshtastic ${userId.takeLast(n = 4)}")
.setShortName(userId.takeLast(n = 4))
.setHwModel(MeshProtos.HardwareModel.UNSET)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/geeksville/mesh/model/UIState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ class UIViewModel @Inject constructor(
Message(
uuid = it.uuid,
receivedTime = it.received_time,
user = MeshUser(getUser(it.data.from)), // FIXME convert to proto User
user = getUser(it.data.from),
text = it.data.text.orEmpty(),
time = it.data.time,
read = it.read,
Expand Down