Retain picker cache ownership on native PM rejection
This commit is contained in:
1 parent
fe9441d63b
commit
dd8041b30f
2 files changed
+6
-3
No files matched your search
@@ -186,7 +186,7 @@ object NativeLib {
|
||||
fun dmSend(convId: String, text: String) { nativeDmSend(convId, text) }
|
||||
fun dmRequestConversations() { nativeDmRequestConversations() }
|
||||
fun dmRequestMessages(convId: String) { nativeDmRequestMessages(convId) }
|
||||
fun dmSendFile(convId: String, path: String, name: String) { nativeDmSendFile(convId, path, name) }
|
||||
fun dmSendFile(convId: String, path: String, name: String): Boolean = nativeDmSendFile(convId, path, name)
|
||||
|
||||
private external fun nativeInit(dbPath: String, controlPort: Int, config: Any, logCb: Any): Boolean
|
||||
private external fun nativeStart(configText: String): Boolean
|
||||
@@ -299,5 +299,5 @@ object NativeLib {
|
||||
private external fun nativeDmSend(convId: String, text: String)
|
||||
private external fun nativeDmRequestConversations()
|
||||
private external fun nativeDmRequestMessages(convId: String)
|
||||
private external fun nativeDmSendFile(convId: String, path: String, name: String)
|
||||
private external fun nativeDmSendFile(convId: String, path: String, name: String): Boolean
|
||||
}
|
||||
@@ -1025,7 +1025,10 @@ class ChatViewModel : ViewModel() {
|
||||
|
||||
fun sendAttachment(filePath: String, target: ConversationTarget, name: String = File(filePath).name) {
|
||||
val r = repo ?: throw IllegalStateException("Сервис чата остановлен")
|
||||
if (target is ConversationTarget.Pm) { NativeLib.dmSendFile(target.id, filePath, name); return }
|
||||
if (target is ConversationTarget.Pm) {
|
||||
if (!NativeLib.dmSendFile(target.id, filePath, name)) throw IllegalStateException("Не удалось отправить вложение")
|
||||
return
|
||||
}
|
||||
val chId = target.id
|
||||
val ext = filePath.substringAfterLast('.', "").lowercase()
|
||||
if (ext in IMAGE_EXTENSIONS) {
|
||||
|
||||
Reference in new issue
Block a user