Remove unneeded code

This commit is contained in:
Niels Andriesse 2020-03-05 09:27:39 +11:00
parent 218d6488af
commit 4dd882ea52

View File

@ -2452,38 +2452,30 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
LokiThreadFriendRequestStatus friendRequestStatus = DatabaseFactory.getLokiThreadDatabase(context).getFriendRequestStatus(threadId); LokiThreadFriendRequestStatus friendRequestStatus = DatabaseFactory.getLokiThreadDatabase(context).getFriendRequestStatus(threadId);
outgoingMessage.isFriendRequest = !isGroupConversation() && friendRequestStatus != LokiThreadFriendRequestStatus.FRIENDS; // Needed for stageOutgoingMessage(...) outgoingMessage.isFriendRequest = !isGroupConversation() && friendRequestStatus != LokiThreadFriendRequestStatus.FRIENDS; // Needed for stageOutgoingMessage(...)
Permissions.with(this) if (clearComposeBox) {
.request(Manifest.permission.SEND_SMS, Manifest.permission.READ_SMS) inputPanel.clearQuote();
.ifNecessary(!isSecureText || forceSms) attachmentManager.clear(glideRequests, false);
.withPermanentDenialDialog(getString(R.string.ConversationActivity_signal_needs_sms_permission_in_order_to_send_an_sms)) silentlySetComposeText("");
.onAllGranted(() -> { }
if (clearComposeBox) {
inputPanel.clearQuote();
attachmentManager.clear(glideRequests, false);
silentlySetComposeText("");
}
final long id = fragment.stageOutgoingMessage(outgoingMessage); final long id = fragment.stageOutgoingMessage(outgoingMessage);
new AsyncTask<Void, Void, Long>() { new AsyncTask<Void, Void, Long>() {
@Override @Override
protected Long doInBackground(Void... param) { protected Long doInBackground(Void... param) {
if (initiating) { if (initiating) {
DatabaseFactory.getRecipientDatabase(context).setProfileSharing(recipient, true); DatabaseFactory.getRecipientDatabase(context).setProfileSharing(recipient, true);
} }
return MessageSender.send(context, outgoingMessage, threadId, forceSms, () -> fragment.releaseOutgoingMessage(id)); return MessageSender.send(context, outgoingMessage, threadId, forceSms, () -> fragment.releaseOutgoingMessage(id));
} }
@Override @Override
protected void onPostExecute(Long result) { protected void onPostExecute(Long result) {
sendComplete(result); sendComplete(result);
future.set(null); future.set(null);
} }
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
})
.onAnyDenied(() -> future.set(null))
.execute();
return future; return future;
} }
@ -2512,32 +2504,24 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
LokiThreadFriendRequestStatus friendRequestStatus = DatabaseFactory.getLokiThreadDatabase(context).getFriendRequestStatus(threadId); LokiThreadFriendRequestStatus friendRequestStatus = DatabaseFactory.getLokiThreadDatabase(context).getFriendRequestStatus(threadId);
message.isFriendRequest = !isGroupConversation() && friendRequestStatus != LokiThreadFriendRequestStatus.FRIENDS; // Needed for stageOutgoingMessage(...) message.isFriendRequest = !isGroupConversation() && friendRequestStatus != LokiThreadFriendRequestStatus.FRIENDS; // Needed for stageOutgoingMessage(...)
Permissions.with(this) silentlySetComposeText("");
.request(Manifest.permission.SEND_SMS) final long id = fragment.stageOutgoingMessage(message);
.ifNecessary(forceSms || !isSecureText)
.withPermanentDenialDialog(getString(R.string.ConversationActivity_signal_needs_sms_permission_in_order_to_send_an_sms))
.onAllGranted(() -> {
silentlySetComposeText("");
final long id = fragment.stageOutgoingMessage(message);
new AsyncTask<OutgoingTextMessage, Void, Long>() { new AsyncTask<OutgoingTextMessage, Void, Long>() {
@Override @Override
protected Long doInBackground(OutgoingTextMessage... messages) { protected Long doInBackground(OutgoingTextMessage... messages) {
if (initiatingConversation) { if (initiatingConversation) {
DatabaseFactory.getRecipientDatabase(context).setProfileSharing(recipient, true); DatabaseFactory.getRecipientDatabase(context).setProfileSharing(recipient, true);
} }
return MessageSender.send(context, messages[0], threadId, forceSms, () -> fragment.releaseOutgoingMessage(id)); return MessageSender.send(context, messages[0], threadId, forceSms, () -> fragment.releaseOutgoingMessage(id));
} }
@Override @Override
protected void onPostExecute(Long result) { protected void onPostExecute(Long result) {
sendComplete(result); sendComplete(result);
} }
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, message); }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, message);
})
.execute();
} }
private void showDefaultSmsPrompt() { private void showDefaultSmsPrompt() {