don't mark previous conversation as read when processing pending intent. fixes #2079

This commit is contained in:
Daniel Gultsch 2016-11-08 12:42:13 +01:00
parent bca8f11c9c
commit 1ef8d0a746
1 changed files with 7 additions and 1 deletions

View File

@ -120,6 +120,7 @@ public class ConversationActivity extends XmppActivity
private boolean mActivityPaused = false; private boolean mActivityPaused = false;
private AtomicBoolean mRedirected = new AtomicBoolean(false); private AtomicBoolean mRedirected = new AtomicBoolean(false);
private Pair<Integer, Intent> mPostponedActivityResult; private Pair<Integer, Intent> mPostponedActivityResult;
private boolean mUnprocessedNewIntent = false;
public Conversation getSelectedConversation() { public Conversation getSelectedConversation() {
return this.mSelectedConversation; return this.mSelectedConversation;
@ -375,7 +376,7 @@ public class ConversationActivity extends XmppActivity
} }
public void sendReadMarkerIfNecessary(final Conversation conversation) { public void sendReadMarkerIfNecessary(final Conversation conversation) {
if (!mActivityPaused && conversation != null) { if (!mActivityPaused && !mUnprocessedNewIntent && conversation != null) {
xmppConnectionService.sendReadMarker(conversation); xmppConnectionService.sendReadMarker(conversation);
} }
} }
@ -1087,6 +1088,7 @@ public class ConversationActivity extends XmppActivity
protected void onNewIntent(final Intent intent) { protected void onNewIntent(final Intent intent) {
if (intent != null && ACTION_VIEW_CONVERSATION.equals(intent.getAction())) { if (intent != null && ACTION_VIEW_CONVERSATION.equals(intent.getAction())) {
mOpenConversation = null; mOpenConversation = null;
mUnprocessedNewIntent = true;
if (xmppConnectionServiceBound) { if (xmppConnectionServiceBound) {
handleViewConversationIntent(intent); handleViewConversationIntent(intent);
intent.setAction(Intent.ACTION_MAIN); intent.setAction(Intent.ACTION_MAIN);
@ -1125,6 +1127,7 @@ public class ConversationActivity extends XmppActivity
} }
this.mActivityPaused = false; this.mActivityPaused = false;
if (!isConversationsOverviewVisable() || !isConversationsOverviewHideable()) { if (!isConversationsOverviewVisable() || !isConversationsOverviewHideable()) {
sendReadMarkerIfNecessary(getSelectedConversation()); sendReadMarkerIfNecessary(getSelectedConversation());
} }
@ -1289,6 +1292,7 @@ public class ConversationActivity extends XmppActivity
this.mConversationFragment.appendText(text); this.mConversationFragment.appendText(text);
} }
hideConversationsOverview(); hideConversationsOverview();
mUnprocessedNewIntent = false;
openConversation(); openConversation();
if (mContentView instanceof SlidingPaneLayout) { if (mContentView instanceof SlidingPaneLayout) {
updateActionBarTitle(true); //fixes bug where slp isn't properly closed yet updateActionBarTitle(true); //fixes bug where slp isn't properly closed yet
@ -1299,6 +1303,8 @@ public class ConversationActivity extends XmppActivity
startDownloadable(message); startDownloadable(message);
} }
} }
} else {
mUnprocessedNewIntent = false;
} }
} }