From 4dd882ea52b1a100e30f7fe2fc320cb055f35dd8 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Thu, 5 Mar 2020 09:27:39 +1100 Subject: [PATCH] Remove unneeded code --- .../conversation/ConversationActivity.java | 86 ++++++++----------- 1 file changed, 35 insertions(+), 51 deletions(-) diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java index 628e8c85ba..8cb1f03570 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java @@ -2452,38 +2452,30 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity LokiThreadFriendRequestStatus friendRequestStatus = DatabaseFactory.getLokiThreadDatabase(context).getFriendRequestStatus(threadId); outgoingMessage.isFriendRequest = !isGroupConversation() && friendRequestStatus != LokiThreadFriendRequestStatus.FRIENDS; // Needed for stageOutgoingMessage(...) - Permissions.with(this) - .request(Manifest.permission.SEND_SMS, Manifest.permission.READ_SMS) - .ifNecessary(!isSecureText || forceSms) - .withPermanentDenialDialog(getString(R.string.ConversationActivity_signal_needs_sms_permission_in_order_to_send_an_sms)) - .onAllGranted(() -> { - if (clearComposeBox) { - inputPanel.clearQuote(); - attachmentManager.clear(glideRequests, false); - silentlySetComposeText(""); - } + if (clearComposeBox) { + inputPanel.clearQuote(); + attachmentManager.clear(glideRequests, false); + silentlySetComposeText(""); + } - final long id = fragment.stageOutgoingMessage(outgoingMessage); + final long id = fragment.stageOutgoingMessage(outgoingMessage); - new AsyncTask() { - @Override - protected Long doInBackground(Void... param) { - if (initiating) { - DatabaseFactory.getRecipientDatabase(context).setProfileSharing(recipient, true); - } + new AsyncTask() { + @Override + protected Long doInBackground(Void... param) { + if (initiating) { + 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 - protected void onPostExecute(Long result) { - sendComplete(result); - future.set(null); - } - }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - }) - .onAnyDenied(() -> future.set(null)) - .execute(); + @Override + protected void onPostExecute(Long result) { + sendComplete(result); + future.set(null); + } + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); return future; } @@ -2512,32 +2504,24 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity LokiThreadFriendRequestStatus friendRequestStatus = DatabaseFactory.getLokiThreadDatabase(context).getFriendRequestStatus(threadId); message.isFriendRequest = !isGroupConversation() && friendRequestStatus != LokiThreadFriendRequestStatus.FRIENDS; // Needed for stageOutgoingMessage(...) - Permissions.with(this) - .request(Manifest.permission.SEND_SMS) - .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); + silentlySetComposeText(""); + final long id = fragment.stageOutgoingMessage(message); - new AsyncTask() { - @Override - protected Long doInBackground(OutgoingTextMessage... messages) { - if (initiatingConversation) { - DatabaseFactory.getRecipientDatabase(context).setProfileSharing(recipient, true); - } + new AsyncTask() { + @Override + protected Long doInBackground(OutgoingTextMessage... messages) { + if (initiatingConversation) { + 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 - protected void onPostExecute(Long result) { - sendComplete(result); - } - }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, message); - - }) - .execute(); + @Override + protected void onPostExecute(Long result) { + sendComplete(result); + } + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, message); } private void showDefaultSmsPrompt() {