Commit 9739141f authored by Adrien Béraud's avatar Adrien Béraud

datatransfer: fix autoaccept

Change-Id: Ifb8b5566989e28efe4ba0ea5257018306830bf7a
parent 14782a80
......@@ -744,7 +744,7 @@ public class NotificationServiceImpl implements NotificationService {
return;
}
InteractionStatus event = info.getStatus();
if (event == null) {
if (event == null || event == InteractionStatus.FILE_AVAILABLE) {
return;
}
android.net.Uri path = ConversationPath.toUri(conversation);
......
......@@ -590,7 +590,8 @@ public class ConversationFacade {
private void handleDataTransferEvent(DataTransfer transfer) {
Conversation conversation = mAccountService.getAccount(transfer.getAccount()).onDataTransferEvent(transfer);
if (transfer.getStatus() == Interaction.InteractionStatus.TRANSFER_CREATED && !transfer.isOutgoing()) {
Interaction.InteractionStatus status = transfer.getStatus();
if ((status == Interaction.InteractionStatus.TRANSFER_CREATED || status == Interaction.InteractionStatus.FILE_AVAILABLE) && !transfer.isOutgoing()) {
if (transfer.canAutoAccept(mPreferencesService.getMaxFileAutoAccept(transfer.getAccount()))) {
mAccountService.acceptFileTransfer(conversation, transfer.getFileId(), transfer);
return;
......
......@@ -66,9 +66,9 @@ public class Interaction {
String mExtraFlag = new JsonObject().toString();
// Swarm
private String mConversationId;
private String mMessageId;
private List<String> mParentIds;
private String mConversationId = null;
private String mMessageId = null;
private List<String> mParentIds = null;
/* Needed by ORMLite */
public Interaction() {
......
......@@ -1553,6 +1553,7 @@ public class AccountService {
}
interaction.setContact(contact);
interaction.setSwarmInfo(conversation.getUri().getRawRingId(), id, parents);
interaction.setConversation(conversation);
if (conversation.addSwarmElement(interaction)) {
if (conversation.isVisible())
mHistoryService.setMessageRead(account.getAccountID(), conversation.getUri(), interaction.getMessageId());
......@@ -1670,6 +1671,8 @@ public class AccountService {
boolean isIncoming = !interaction.getContact().isUser();
if (isIncoming) {
incomingSwarmMessageSubject.onNext(interaction);
if (interaction instanceof DataTransfer)
dataTransferSubject.onNext((DataTransfer)interaction);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment