mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Merge branch 'main' into wch423/aac-encoder
This commit is contained in:
@@ -1172,6 +1172,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
playbackViewModel.stopNonMessageAudioPlayback();
|
||||
|
||||
DcContext dcContext = DcHelper.getContext(context);
|
||||
final int currentChatId = dcChat.getId();
|
||||
Util.runOnAnyBackgroundThread(() -> {
|
||||
DcMsg msg = null;
|
||||
int recompress = 0;
|
||||
@@ -1181,9 +1182,9 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
if (action == ACTION_SEND_OUT) {
|
||||
dcContext.sendEditRequest(msgId, body);
|
||||
} else {
|
||||
dcContext.setDraft(chatId, null);
|
||||
dcContext.setDraft(currentChatId, null);
|
||||
}
|
||||
future.set(chatId);
|
||||
future.set(currentChatId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1194,7 +1195,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
try {
|
||||
if (slideDeck.getWebxdctDraftId() != 0) {
|
||||
msg = dcContext.getDraft(chatId);
|
||||
msg = dcContext.getDraft(currentChatId);
|
||||
} else {
|
||||
List<Attachment> attachments = slideDeck.asAttachments();
|
||||
for (Attachment attachment : attachments) {
|
||||
@@ -1239,7 +1240,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
// for WEBXDC, drafts are just sent out as is.
|
||||
// for preparations and other cases, cleanup draft soon.
|
||||
if (msg == null || msg.getType() != DcMsg.DC_MSG_WEBXDC) {
|
||||
dcContext.setDraft(dcChat.getId(), null);
|
||||
dcContext.setDraft(currentChatId, null);
|
||||
}
|
||||
|
||||
if(msg!=null) {
|
||||
@@ -1255,7 +1256,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
false
|
||||
);
|
||||
});
|
||||
doSend = VideoRecoder.prepareVideo(ConversationActivity.this, dcChat.getId(), msg);
|
||||
doSend = VideoRecoder.prepareVideo(ConversationActivity.this, currentChatId, msg);
|
||||
Util.runOnMain(() -> {
|
||||
try {
|
||||
if (progressDialog != null) progressDialog.dismiss();
|
||||
@@ -1266,48 +1267,36 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
}
|
||||
|
||||
if (doSend) {
|
||||
if (dcContext.sendMsg(dcChat.getId(), msg) == 0) {
|
||||
if (dcContext.sendMsg(currentChatId, msg) == 0) {
|
||||
String lastError = dcContext.getLastError();
|
||||
if (!"".equals(lastError)) {
|
||||
Util.runOnMain(() -> Toast.makeText(ConversationActivity.this, lastError, Toast.LENGTH_LONG).show());
|
||||
}
|
||||
future.set(chatId);
|
||||
future.set(currentChatId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Util.runOnMain(() -> sendComplete(dcChat.getId()));
|
||||
if (currentChatId == this.chatId) {
|
||||
Util.runOnMain(() -> sendComplete());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dcContext.setDraft(dcChat.getId(), msg);
|
||||
dcContext.setDraft(currentChatId, msg);
|
||||
}
|
||||
future.set(chatId);
|
||||
future.set(currentChatId);
|
||||
});
|
||||
|
||||
return future;
|
||||
}
|
||||
|
||||
|
||||
protected void sendComplete(int chatId) {
|
||||
boolean refreshFragment = (chatId != this.chatId);
|
||||
this.chatId = chatId;
|
||||
|
||||
protected void sendComplete() {
|
||||
if (fragment == null || !fragment.isVisible() || isFinishing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
fragment.setLastSeen(-1);
|
||||
|
||||
if (refreshFragment) {
|
||||
fragment.reload(recipient, chatId);
|
||||
try {
|
||||
int accId = rpc.getSelectedAccountId();
|
||||
DcHelper.getNotificationCenter(this).updateVisibleChat(accId, chatId);
|
||||
} catch (RpcException e) {
|
||||
Log.e(TAG, "rpc.getSelectedAccountId() failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
fragment.scrollToBottom();
|
||||
attachmentManager.cleanup();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user