From af2798dd7cc6c865c393d2265ee9b964df3ff6b2 Mon Sep 17 00:00:00 2001 From: cyberta Date: Mon, 6 Jul 2020 12:52:43 +0200 Subject: [PATCH] keep activity stack intact, of forwarding message was successful, close the current ConversationActivity and go back to the initial chat the message was forwarded from --- src/org/thoughtcrime/securesms/ConversationActivity.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index e2a53565e..8248bb360 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -194,6 +194,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity private boolean isSecurityInitialized = false; private boolean isShareDraftInitialized = false; + private boolean successfulForwardingAttempt = false; + private final DynamicTheme dynamicTheme = new DynamicTheme(); private final DynamicLanguage dynamicLanguage = new DynamicLanguage(); @@ -560,7 +562,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity private void handleReturnToConversationList() { - if (isRelayingMessageContent(this)) { + if (isRelayingMessageContent(this) || successfulForwardingAttempt) { if (isSharing(this)) { // we're allowing only 1 try to share, going back to the conversation list will // close the conversation list in activtyForResult() as well, so that the user @@ -669,7 +671,10 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity } new AlertDialog.Builder(this) .setMessage(getString(R.string.ask_forward, name)) - .setPositiveButton(R.string.ok, (dialogInterface, i) -> SendRelayedMessageUtil.immediatelyRelay(this, chatId)) + .setPositiveButton(R.string.ok, (dialogInterface, i) -> { + SendRelayedMessageUtil.immediatelyRelay(this, chatId); + successfulForwardingAttempt = true; + }) .setNegativeButton(R.string.cancel, (dialogInterface, i) -> finish()) .show(); }