From 06d6e6e64a10766b32cd73251d4719271df77bef Mon Sep 17 00:00:00 2001 From: zoff99 Date: Sun, 18 Feb 2024 13:00:35 +0100 Subject: [PATCH] more tooltip information for group messages --- src/main/kotlin/Main.kt | 24 +++++++++++++++---- .../zoffcc/applications/trifa/MainActivity.kt | 12 ++++++++++ .../com/zoffcc/applications/trifa2/ChatApp.kt | 3 +++ .../applications/trifa2/GroupChatMessage.kt | 5 +++- .../applications/trifa2/GroupMessageData.kt | 9 +++++++ 5 files changed, 48 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index 67ad6e62..aed3661c 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -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)) } } @@ -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 -> diff --git a/src/main/kotlin/com/zoffcc/applications/trifa/MainActivity.kt b/src/main/kotlin/com/zoffcc/applications/trifa/MainActivity.kt index 9a9d9f76..0a5e2ec5 100644 --- a/src/main/kotlin/com/zoffcc/applications/trifa/MainActivity.kt +++ b/src/main/kotlin/com/zoffcc/applications/trifa/MainActivity.kt @@ -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!!, @@ -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, @@ -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, @@ -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, diff --git a/src/main/kotlin/com/zoffcc/applications/trifa2/ChatApp.kt b/src/main/kotlin/com/zoffcc/applications/trifa2/ChatApp.kt index fb4f51aa..b582ad0e 100644 --- a/src/main/kotlin/com/zoffcc/applications/trifa2/ChatApp.kt +++ b/src/main/kotlin/com/zoffcc/applications/trifa2/ChatApp.kt @@ -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, diff --git a/src/main/kotlin/com/zoffcc/applications/trifa2/GroupChatMessage.kt b/src/main/kotlin/com/zoffcc/applications/trifa2/GroupChatMessage.kt index f6879487..07122b8b 100644 --- a/src/main/kotlin/com/zoffcc/applications/trifa2/GroupChatMessage.kt +++ b/src/main/kotlin/com/zoffcc/applications/trifa2/GroupChatMessage.kt @@ -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), diff --git a/src/main/kotlin/com/zoffcc/applications/trifa2/GroupMessageData.kt b/src/main/kotlin/com/zoffcc/applications/trifa2/GroupMessageData.kt index 7348e474..7c08108a 100644 --- a/src/main/kotlin/com/zoffcc/applications/trifa2/GroupMessageData.kt +++ b/src/main/kotlin/com/zoffcc/applications/trifa2/GroupMessageData.kt @@ -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, @@ -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?, @@ -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,