mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 17:45:20 +00:00
Camera take picture (#484)
* camera capture * icon change * image preview great * remove string
This commit is contained in:
@@ -275,6 +275,9 @@ class MediaSendingManager(
|
||||
if (transferId != null) {
|
||||
val cancelled = meshService.cancelFileTransfer(transferId)
|
||||
if (cancelled) {
|
||||
// Try to remove cached local file for this message (if any)
|
||||
runCatching { findMessagePathById(messageId)?.let { java.io.File(it).delete() } }
|
||||
|
||||
// Remove the message from chat upon explicit cancel
|
||||
messageManager.removeMessageById(messageId)
|
||||
synchronized(transferMessageMap) {
|
||||
@@ -285,6 +288,20 @@ class MediaSendingManager(
|
||||
}
|
||||
}
|
||||
|
||||
private fun findMessagePathById(messageId: String): String? {
|
||||
// Search main timeline
|
||||
state.getMessagesValue().firstOrNull { it.id == messageId }?.content?.let { return it }
|
||||
// Search private chats
|
||||
state.getPrivateChatsValue().values.forEach { list ->
|
||||
list.firstOrNull { it.id == messageId }?.content?.let { return it }
|
||||
}
|
||||
// Search channel messages
|
||||
state.getChannelMessagesValue().values.forEach { list ->
|
||||
list.firstOrNull { it.id == messageId }?.content?.let { return it }
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* Update progress for a transfer
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user