mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 09:25:19 +00:00
copy text and fix notifications for DM
This commit is contained in:
@@ -49,15 +49,13 @@ class MeshDelegateHandler(
|
|||||||
|
|
||||||
// Show notification with enhanced information - now includes senderPeerID
|
// Show notification with enhanced information - now includes senderPeerID
|
||||||
message.senderPeerID?.let { senderPeerID ->
|
message.senderPeerID?.let { senderPeerID ->
|
||||||
if (state.getSelectedPrivateChatPeerValue() != senderPeerID) {
|
// Use nickname if available, fall back to sender or senderPeerID
|
||||||
// Use nickname if available, fall back to sender or senderPeerID
|
val senderNickname = message.sender.takeIf { it != senderPeerID } ?: senderPeerID
|
||||||
val senderNickname = message.sender.takeIf { it != senderPeerID } ?: senderPeerID
|
notificationManager.showPrivateMessageNotification(
|
||||||
notificationManager.showPrivateMessageNotification(
|
senderPeerID = senderPeerID,
|
||||||
senderPeerID = senderPeerID,
|
senderNickname = senderNickname,
|
||||||
senderNickname = senderNickname,
|
messageContent = message.content
|
||||||
messageContent = message.content
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (message.channel != null) {
|
} else if (message.channel != null) {
|
||||||
// Channel message
|
// Channel message
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.*
|
|||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
|
import androidx.compose.foundation.text.selection.SelectionContainer
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
@@ -41,17 +42,19 @@ fun MessagesList(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyColumn(
|
SelectionContainer {
|
||||||
state = listState,
|
LazyColumn(
|
||||||
modifier = modifier.padding(horizontal = 12.dp, vertical = 8.dp),
|
state = listState,
|
||||||
verticalArrangement = Arrangement.spacedBy(2.dp)
|
modifier = modifier.padding(horizontal = 12.dp, vertical = 8.dp),
|
||||||
) {
|
verticalArrangement = Arrangement.spacedBy(2.dp)
|
||||||
items(messages) { message ->
|
) {
|
||||||
MessageItem(
|
items(messages) { message ->
|
||||||
message = message,
|
MessageItem(
|
||||||
currentUserNickname = currentUserNickname,
|
message = message,
|
||||||
meshService = meshService
|
currentUserNickname = currentUserNickname,
|
||||||
)
|
meshService = meshService
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class NotificationManager(private val context: Context) {
|
|||||||
*/
|
*/
|
||||||
fun showPrivateMessageNotification(senderPeerID: String, senderNickname: String, messageContent: String) {
|
fun showPrivateMessageNotification(senderPeerID: String, senderNickname: String, messageContent: String) {
|
||||||
// Only show notifications if app is in background OR user is not viewing this specific chat
|
// Only show notifications if app is in background OR user is not viewing this specific chat
|
||||||
val shouldNotify = isAppInBackground || currentPrivateChatPeer != senderPeerID
|
val shouldNotify = isAppInBackground || (!isAppInBackground && currentPrivateChatPeer != senderPeerID)
|
||||||
|
|
||||||
if (!shouldNotify) {
|
if (!shouldNotify) {
|
||||||
Log.d(TAG, "Skipping notification - app in foreground and viewing chat with $senderNickname")
|
Log.d(TAG, "Skipping notification - app in foreground and viewing chat with $senderNickname")
|
||||||
|
|||||||
Reference in New Issue
Block a user