do not turn send button green unless history is caught up. fixes #1232

This commit is contained in:
Daniel Gultsch 2017-05-19 13:39:44 +02:00
parent 7cd4ed78b2
commit 5a5eb5bdd3
2 changed files with 20 additions and 3 deletions

View File

@ -102,6 +102,22 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
}
}
public boolean isCatchingUp(Conversation conversation) {
final Account account = conversation.getAccount();
if (account.getXmppConnection().isWaitingForSmCatchup()) {
return true;
} else {
synchronized (this.queries) {
for(Query query : this.queries) {
if (query.getAccount() == account && query.isCatchup() && ((conversation.getMode() == Conversation.MODE_SINGLE && query.getWith() == null) || query.getConversation() == conversation)) {
return true;
}
}
}
return false;
}
}
public Query query(final Conversation conversation, long end, boolean allowCatchup) {
return this.query(conversation,conversation.getLastMessageTransmitted(),end, allowCatchup);
}

View File

@ -1275,9 +1275,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
action = SendButtonAction.TEXT;
}
}
if (activity.useSendButtonToIndicateStatus() && c != null
&& c.getAccount().getStatus() == Account.State.ONLINE) {
if (c.getMode() == Conversation.MODE_SINGLE) {
if (activity.useSendButtonToIndicateStatus() && c.getAccount().getStatus() == Account.State.ONLINE) {
if (activity.xmppConnectionService != null && activity.xmppConnectionService.getMessageArchiveService().isCatchingUp(c)) {
status = Presence.Status.OFFLINE;
} else if (c.getMode() == Conversation.MODE_SINGLE) {
status = c.getContact().getShownStatus();
} else {
status = c.getMucOptions().online() ? Presence.Status.ONLINE : Presence.Status.OFFLINE;