call update file params from thread

now that file params has more work to do we should make sure we always call it from a sperate thread
This commit is contained in:
Daniel Gultsch 2016-07-13 00:20:38 +02:00
parent be4aa2afc9
commit ff1b23b4d9
1 changed files with 16 additions and 16 deletions

View File

@ -435,7 +435,10 @@ public class XmppConnectionService extends Service {
} }
message.setCounterpart(conversation.getNextCounterpart()); message.setCounterpart(conversation.getNextCounterpart());
message.setType(Message.TYPE_FILE); message.setType(Message.TYPE_FILE);
String path = getFileBackend().getOriginalPath(uri); final String path = getFileBackend().getOriginalPath(uri);
mFileAddingExecutor.execute(new Runnable() {
@Override
public void run() {
if (path != null) { if (path != null) {
message.setRelativeFilePath(path); message.setRelativeFilePath(path);
getFileBackend().updateFileParams(message); getFileBackend().updateFileParams(message);
@ -445,9 +448,6 @@ public class XmppConnectionService extends Service {
callback.success(message); callback.success(message);
} }
} else { } else {
mFileAddingExecutor.execute(new Runnable() {
@Override
public void run() {
try { try {
getFileBackend().copyFileToPrivateStorage(message, uri); getFileBackend().copyFileToPrivateStorage(message, uri);
getFileBackend().updateFileParams(message); getFileBackend().updateFileParams(message);
@ -465,8 +465,8 @@ public class XmppConnectionService extends Service {
callback.error(e.getResId(), message); callback.error(e.getResId(), message);
} }
} }
});
} }
});
} }
public void attachImageToConversation(final Conversation conversation, final Uri uri, final UiCallback<Message> callback) { public void attachImageToConversation(final Conversation conversation, final Uri uri, final UiCallback<Message> callback) {