Update story notifications to match spec.

This commit is contained in:
Alex Hart
2022-07-01 13:34:14 -03:00
committed by Greyson Parrelli
parent bd5907ea04
commit 2270dfaf21
2 changed files with 8 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ import org.thoughtcrime.securesms.database.model.MessageRecord
import org.thoughtcrime.securesms.database.model.ReactionRecord
import org.thoughtcrime.securesms.notifications.profiles.NotificationProfile
import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.util.isStoryReaction
/**
* Queries the message databases to determine messages that should be in notifications.
@@ -125,7 +126,7 @@ object NotificationStateProvider {
) {
private val isGroupStoryReply: Boolean = thread.groupStoryId != null
private val isUnreadIncoming: Boolean = isUnreadMessage && !messageRecord.isOutgoing && !isGroupStoryReply
private val isNotifiableGroupStoryMessage: Boolean = isUnreadMessage && !messageRecord.isOutgoing && isGroupStoryReply && (isParentStorySentBySelf || hasSelfRepliedToStory)
private val isNotifiableGroupStoryMessage: Boolean = isUnreadMessage && !messageRecord.isOutgoing && isGroupStoryReply && (isParentStorySentBySelf || (hasSelfRepliedToStory && !messageRecord.isStoryReaction()))
fun includeMessage(notificationProfile: NotificationProfile?): MessageInclusion {
return if (isUnreadIncoming || stickyThread || isNotifiableGroupStoryMessage) {

View File

@@ -37,7 +37,12 @@ public class PagingMappingAdapter<Key> extends MappingAdapter {
if (pagingController != null) {
pagingController.onDataNeededAroundIndex(position);
}
return super.getItem(position);
if (position > 0 && position < super.getCurrentList().size()) {
return super.getItem(position);
} else {
return null;
}
}
@Override