mirror of
https://github.com/moparisthebest/Conversations
synced 2024-12-25 00:48:52 -05:00
block send action while encrypting pgp message
This commit is contained in:
parent
469cf72e56
commit
afa34ce15a
@ -1688,6 +1688,9 @@ public class ConversationActivity extends XmppActivity
|
||||
).show();
|
||||
}
|
||||
});
|
||||
if (mConversationFragment != null) {
|
||||
mConversationFragment.doneSendingPgpMessage();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
import eu.siacs.conversations.R;
|
||||
@ -1071,6 +1072,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||
}
|
||||
|
||||
protected void messageSent() {
|
||||
mSendingPgpMessage.set(false);
|
||||
mEditMessage.setText("");
|
||||
updateChatMsgHint();
|
||||
new Handler().post(new Runnable() {
|
||||
@ -1086,6 +1088,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||
mEditMessage.requestFocus();
|
||||
}
|
||||
|
||||
public void doneSendingPgpMessage() {
|
||||
mSendingPgpMessage.set(false);
|
||||
}
|
||||
|
||||
enum SendButtonAction {TEXT, TAKE_PHOTO, SEND_LOCATION, RECORD_VOICE, CANCEL, CHOOSE_PICTURE}
|
||||
|
||||
private int getSendButtonImageResource(SendButtonAction action, Presence.Status status) {
|
||||
@ -1299,6 +1305,8 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||
messageSent();
|
||||
}
|
||||
|
||||
private AtomicBoolean mSendingPgpMessage = new AtomicBoolean(false);
|
||||
|
||||
protected void sendPgpMessage(final Message message) {
|
||||
final ConversationActivity activity = (ConversationActivity) getActivity();
|
||||
final XmppConnectionService xmppService = activity.xmppConnectionService;
|
||||
@ -1311,6 +1319,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||
activity.announcePgp(conversation.getAccount(), conversation, activity.onOpenPGPKeyPublished);
|
||||
return;
|
||||
}
|
||||
if (!mSendingPgpMessage.compareAndSet(false,true)) {
|
||||
Log.d(Config.LOGTAG,"sending pgp message already in progress");
|
||||
}
|
||||
if (conversation.getMode() == Conversation.MODE_SINGLE) {
|
||||
if (contact.getPgpKeyId() != 0) {
|
||||
xmppService.getPgpEngine().hasKey(contact,
|
||||
@ -1340,6 +1351,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||
).show();
|
||||
}
|
||||
});
|
||||
mSendingPgpMessage.set(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user