move chat state reset from background switch to foreground switch to account for chat states sent in the mean time

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 6 
1 file changed, 3 insertions(+), 3 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/services/XmppConnectionService.java 🔗

@@ -1636,6 +1636,9 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
 	}
 
 	private void switchToForeground() {
+		for (Conversation conversation : getConversations()) {
+			conversation.setIncomingChatState(ChatState.ACTIVE);
+		}
 		for (Account account : getAccounts()) {
 			if (account.getStatus() == Account.State.ONLINE) {
 				XmppConnection connection = account.getXmppConnection();
@@ -1656,9 +1659,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
 				}
 			}
 		}
-		for (Conversation conversation : getConversations()) {
-			conversation.setIncomingChatState(ChatState.ACTIVE);
-		}
 		this.mNotificationService.setIsInForeground(false);
 		Log.d(Config.LOGTAG, "app switched into background");
 	}