register open conversation with notification service

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/ui/ConversationActivity.java | 1 
src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | 3 +
2 files changed, 4 insertions(+)

Detailed changes

src/main/java/eu/siacs/conversations/ui/ConversationActivity.java 🔗

@@ -98,6 +98,7 @@ public class ConversationActivity extends XmppActivity implements OnConversation
 			notifyFragmentOfBackendConnected(id);
 		}
 		invalidateActionBarTitle();
+		xmppConnectionService.getNotificationService().setIsInForeground(true);
 		Intent intent = pendingViewIntent.pop();
 		if (intent != null) {
 			if (processViewIntent(intent)) {

src/main/java/eu/siacs/conversations/ui/ConversationFragment.java 🔗

@@ -1580,6 +1580,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
 				this.activity.xmppConnectionService.updateConversation(this.conversation);
 			}
 			updateChatState(this.conversation, msg);
+			this.activity.xmppConnectionService.getNotificationService().setOpenConversation(null);
 		}
 	}
 
@@ -1658,6 +1659,8 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
 		}
 		if (activity != null) {
 			activity.onConversationRead(this.conversation);
+			//TODO if we only do this when this fragment is running on main it won't *bing* in tablet layout which might be unnecessary since we can *see* it
+			activity.xmppConnectionService.getNotificationService().setOpenConversation(this.conversation);
 		}
 	}