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

This commit is contained in:
cyberta
2020-07-06 12:52:43 +02:00
parent 69b587cbfb
commit af2798dd7c
@@ -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();
}