notify on mam catchup messages
This commit is contained in:
parent
2262921ff4
commit
55c1129a65
|
@ -397,15 +397,21 @@ public class MessageParser extends AbstractParser implements
|
||||||
}
|
}
|
||||||
|
|
||||||
conversation.add(message);
|
conversation.add(message);
|
||||||
if (query != null) {
|
|
||||||
query.incrementMessageCount();
|
if (query == null || query.getWith() == null) { //either no mam or catchup
|
||||||
} else {
|
|
||||||
if (status == Message.STATUS_SEND || status == Message.STATUS_SEND_RECEIVED) {
|
if (status == Message.STATUS_SEND || status == Message.STATUS_SEND_RECEIVED) {
|
||||||
mXmppConnectionService.markRead(conversation);
|
mXmppConnectionService.markRead(conversation);
|
||||||
account.activateGracePeriod();
|
if (query == null) {
|
||||||
|
account.activateGracePeriod();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
message.markUnread();
|
message.markUnread();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (query != null) {
|
||||||
|
query.incrementMessageCount();
|
||||||
|
} else {
|
||||||
mXmppConnectionService.updateConversationUi();
|
mXmppConnectionService.updateConversationUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +451,11 @@ public class MessageParser extends AbstractParser implements
|
||||||
if (message.trusted() && message.treatAsDownloadable() != Message.Decision.NEVER && manager.getAutoAcceptFileSize() > 0) {
|
if (message.trusted() && message.treatAsDownloadable() != Message.Decision.NEVER && manager.getAutoAcceptFileSize() > 0) {
|
||||||
manager.createNewDownloadConnection(message);
|
manager.createNewDownloadConnection(message);
|
||||||
} else if (!message.isRead()) {
|
} else if (!message.isRead()) {
|
||||||
mXmppConnectionService.getNotificationService().push(message);
|
if (query == null) {
|
||||||
|
mXmppConnectionService.getNotificationService().push(message);
|
||||||
|
} else if (query.getWith() == null) { // mam catchup
|
||||||
|
mXmppConnectionService.getNotificationService().pushFromBacklog(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else { //no body
|
} else { //no body
|
||||||
if (isTypeGroupChat) {
|
if (isTypeGroupChat) {
|
||||||
|
|
|
@ -218,6 +218,9 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
|
||||||
if (complete || relevant == null || abort) {
|
if (complete || relevant == null || abort) {
|
||||||
this.finalizeQuery(query);
|
this.finalizeQuery(query);
|
||||||
Log.d(Config.LOGTAG,query.getAccount().getJid().toBareJid().toString()+": finished mam after "+query.getTotalCount()+" messages");
|
Log.d(Config.LOGTAG,query.getAccount().getJid().toBareJid().toString()+": finished mam after "+query.getTotalCount()+" messages");
|
||||||
|
if (query.getWith() == null && query.getTotalCount() > 0) {
|
||||||
|
mXmppConnectionService.getNotificationService().finishBacklog(true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
final Query nextQuery;
|
final Query nextQuery;
|
||||||
if (query.getPagingOrder() == PagingOrder.NORMAL) {
|
if (query.getPagingOrder() == PagingOrder.NORMAL) {
|
||||||
|
|
|
@ -119,10 +119,10 @@ public class NotificationService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void finishBacklog() {
|
public void finishBacklog(boolean notify) {
|
||||||
synchronized (notifications) {
|
synchronized (notifications) {
|
||||||
mXmppConnectionService.updateUnreadCountBadge();
|
mXmppConnectionService.updateUnreadCountBadge();
|
||||||
updateNotification(false);
|
updateNotification(notify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1107,7 +1107,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
mNotificationService.finishBacklog();
|
mNotificationService.finishBacklog(false);
|
||||||
mRestoredFromDatabase = true;
|
mRestoredFromDatabase = true;
|
||||||
Log.d(Config.LOGTAG, "restored all messages");
|
Log.d(Config.LOGTAG, "restored all messages");
|
||||||
updateConversationUi();
|
updateConversationUi();
|
||||||
|
|
Loading…
Reference in a new issue