Skip to content

Commit

Permalink
more tooltip information for group messages
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Feb 18, 2024
1 parent 6295adc commit e1c9852
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 5 deletions.
24 changes: 20 additions & 4 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1282,9 +1282,17 @@ fun load_groupmessages_for_friend(selectedGroupId: String?)
when (it.TRIFA_MESSAGE_TYPE)
{
TRIFAGlobals.TRIFA_MSG_TYPE.TRIFA_MSG_TYPE_TEXT.value ->
uigroupmessages.add(UIGroupMessage(was_synced = it.was_synced, msg_id_hash = it.msg_id_hash, message_id_tox = it.message_id_tox, msgDatabaseId = it.id, user = friend_user, timeMs = it.sent_timestamp, text = it.text, toxpk = it.tox_group_peer_pubkey.uppercase(), groupId = it.group_identifier.lowercase(), trifaMsgType = it.TRIFA_MESSAGE_TYPE, filename_fullpath = it.filename_fullpath))
uigroupmessages.add(UIGroupMessage(was_synced = it.was_synced,
sentTimeMs = it.sent_timestamp,
rcvdTimeMs = it.rcvd_timestamp,
syncdTimeMs = it.rcvd_timestamp,
msg_id_hash = it.msg_id_hash, message_id_tox = it.message_id_tox, msgDatabaseId = it.id, user = friend_user, timeMs = it.sent_timestamp, text = it.text, toxpk = it.tox_group_peer_pubkey.uppercase(), groupId = it.group_identifier.lowercase(), trifaMsgType = it.TRIFA_MESSAGE_TYPE, filename_fullpath = it.filename_fullpath))
TRIFAGlobals.TRIFA_MSG_TYPE.TRIFA_MSG_FILE.value ->
uigroupmessages.add(UIGroupMessage(was_synced = it.was_synced, msg_id_hash = it.msg_id_hash, message_id_tox = it.message_id_tox, msgDatabaseId = it.id, user = friend_user, timeMs = it.sent_timestamp, text = it.text, toxpk = it.tox_group_peer_pubkey.uppercase(), groupId = it.group_identifier.lowercase(), trifaMsgType = it.TRIFA_MESSAGE_TYPE, filename_fullpath = it.filename_fullpath))
uigroupmessages.add(UIGroupMessage(was_synced = it.was_synced,
sentTimeMs = it.sent_timestamp,
rcvdTimeMs = it.rcvd_timestamp,
syncdTimeMs = it.rcvd_timestamp,
msg_id_hash = it.msg_id_hash, message_id_tox = it.message_id_tox, msgDatabaseId = it.id, user = friend_user, timeMs = it.sent_timestamp, text = it.text, toxpk = it.tox_group_peer_pubkey.uppercase(), groupId = it.group_identifier.lowercase(), trifaMsgType = it.TRIFA_MESSAGE_TYPE, filename_fullpath = it.filename_fullpath))

}
}
Expand All @@ -1293,9 +1301,17 @@ fun load_groupmessages_for_friend(selectedGroupId: String?)
when (it.TRIFA_MESSAGE_TYPE)
{
TRIFAGlobals.TRIFA_MSG_TYPE.TRIFA_MSG_TYPE_TEXT.value ->
uigroupmessages.add(UIGroupMessage(was_synced = it.was_synced, msg_id_hash = it.msg_id_hash, message_id_tox = it.message_id_tox, msgDatabaseId = it.id, user = myUser, timeMs = it.sent_timestamp, text = it.text, toxpk = it.tox_group_peer_pubkey.uppercase(), groupId = it.group_identifier.lowercase(), trifaMsgType = it.TRIFA_MESSAGE_TYPE, filename_fullpath = it.filename_fullpath))
uigroupmessages.add(UIGroupMessage(was_synced = it.was_synced,
sentTimeMs = it.sent_timestamp,
rcvdTimeMs = it.rcvd_timestamp,
syncdTimeMs = it.rcvd_timestamp,
msg_id_hash = it.msg_id_hash, message_id_tox = it.message_id_tox, msgDatabaseId = it.id, user = myUser, timeMs = it.sent_timestamp, text = it.text, toxpk = it.tox_group_peer_pubkey.uppercase(), groupId = it.group_identifier.lowercase(), trifaMsgType = it.TRIFA_MESSAGE_TYPE, filename_fullpath = it.filename_fullpath))
TRIFAGlobals.TRIFA_MSG_TYPE.TRIFA_MSG_FILE.value ->
uigroupmessages.add(UIGroupMessage(was_synced = it.was_synced, msg_id_hash = it.msg_id_hash, message_id_tox = it.message_id_tox, msgDatabaseId = it.id, user = myUser, timeMs = it.sent_timestamp, text = it.text, toxpk = it.tox_group_peer_pubkey.uppercase(), groupId = it.group_identifier.lowercase(), trifaMsgType = it.TRIFA_MESSAGE_TYPE, filename_fullpath = it.filename_fullpath))
uigroupmessages.add(UIGroupMessage(was_synced = it.was_synced,
sentTimeMs = it.sent_timestamp,
rcvdTimeMs = it.rcvd_timestamp,
syncdTimeMs = it.rcvd_timestamp,
msg_id_hash = it.msg_id_hash, message_id_tox = it.message_id_tox, msgDatabaseId = it.id, user = myUser, timeMs = it.sent_timestamp, text = it.text, toxpk = it.tox_group_peer_pubkey.uppercase(), groupId = it.group_identifier.lowercase(), trifaMsgType = it.TRIFA_MESSAGE_TYPE, filename_fullpath = it.filename_fullpath))
}
}
else ->
Expand Down
12 changes: 12 additions & 0 deletions src/main/kotlin/com/zoffcc/applications/trifa/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2633,6 +2633,9 @@ class MainActivity
groupmessagestore.send(GroupMessageAction.ReceiveGroupMessage(
UIGroupMessage(
was_synced = false,
sentTimeMs = message_timestamp_ms,
rcvdTimeMs = message_timestamp_ms,
syncdTimeMs = message_timestamp_ms,
msg_id_hash = "",
message_id_tox = message_id_hex, msgDatabaseId = msg_dbid,
user = peer_user, timeMs = message_timestamp_ms, text = message_orig!!,
Expand Down Expand Up @@ -3206,6 +3209,9 @@ class MainActivity
groupmessagestore.send(GroupMessageAction.ReceiveGroupMessage(
UIGroupMessage(
was_synced = true,
sentTimeMs = m.sent_timestamp,
rcvdTimeMs = m.rcvd_timestamp,
syncdTimeMs = m.rcvd_timestamp,
msg_id_hash = m.msg_id_hash,
message_id_tox = m.message_id_tox, msgDatabaseId = msg_dbid,
user = peer_user, timeMs = m.sent_timestamp, text = m.text,
Expand Down Expand Up @@ -3236,6 +3242,9 @@ class MainActivity
groupmessagestore.send(GroupMessageAction.ReceiveGroupMessage(
UIGroupMessage(
was_synced = was_synced,
sentTimeMs = msg_timestamp,
rcvdTimeMs = msg_timestamp,
syncdTimeMs = msg_timestamp,
msg_id_hash = msg_id_hash,
message_id_tox = "", msgDatabaseId = file_meta_data.rowid,
user = peer_user, timeMs = msg_timestamp,
Expand Down Expand Up @@ -3350,6 +3359,9 @@ class MainActivity
GroupMessageAction.SendGroupMessage(
UIGroupMessage(
was_synced = m.was_synced,
sentTimeMs = m.sent_timestamp,
rcvdTimeMs = m.rcvd_timestamp,
syncdTimeMs = m.sent_timestamp,
msg_id_hash = m.msg_id_hash,
message_id_tox = m.message_id_tox, msgDatabaseId = row_id,
user = myUser, timeMs = m.sent_timestamp, text = m.text,
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/com/zoffcc/applications/trifa2/ChatApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,9 @@ fun GroupApp(focusRequester: FocusRequester, displayTextField: Boolean = true, s
groupmessagestore.send(GroupMessageAction.SendGroupMessage(
UIGroupMessage(
was_synced = false,
sentTimeMs = timestamp,
rcvdTimeMs = timestamp,
syncdTimeMs = timestamp,
msg_id_hash = "",
message_id_tox = message_id_hex, msgDatabaseId = db_msgid,
user = myUser, timeMs = timestamp, text = text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ inline fun GroupChatMessage(isMyMessage: Boolean, groupmessage: UIGroupMessage,
)
Spacer(modifier = Modifier.width(10.dp))
}
Tooltip("Message sent at: " + timeToString(groupmessage.timeMs)) {
Tooltip("Message sent at: " + timeToString(groupmessage.timeMs) + "\n" +
"Message ID: " + groupmessage.message_id_tox + "\n" +
"Sender Peer Pubkey: " + groupmessage.toxpk + "\n" +
"was synced: " + groupmessage.was_synced.toString()) {
Text(
modifier = Modifier.padding(all = 0.dp),
text = timeToString(groupmessage.timeMs),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import kotlin.random.Random
data class UIGroupMessage private constructor(
val user: User,
val timeMs: Long,
val sentTimeMs: Long,
val rcvdTimeMs: Long,
val syncdTimeMs: Long,
val text: String,
val id: Long,
val msgDatabaseId: Long,
Expand All @@ -17,6 +20,9 @@ data class UIGroupMessage private constructor(
constructor(
user: User,
timeMs: Long,
sentTimeMs: Long,
rcvdTimeMs: Long,
syncdTimeMs: Long,
text: String,
msgDatabaseId: Long,
msg_id_hash: String?,
Expand All @@ -29,6 +35,9 @@ data class UIGroupMessage private constructor(
) : this(
user = user,
timeMs = timeMs,
sentTimeMs = sentTimeMs,
rcvdTimeMs = rcvdTimeMs,
syncdTimeMs = syncdTimeMs,
text = text,
id = msgDatabaseId,
msgDatabaseId = msgDatabaseId,
Expand Down

0 comments on commit e1c9852

Please sign in to comment.