mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Add support for stories "seen" state.
This commit is contained in:
committed by
Cody Henthorne
parent
995a4ad6ec
commit
94bd3101c9
@@ -203,7 +203,11 @@ public abstract class MessageDatabase extends Database implements MmsSmsColumns,
|
||||
public abstract @NonNull Reader getOutgoingStoriesTo(@NonNull RecipientId recipientId);
|
||||
public abstract @NonNull Reader getAllOutgoingStories(boolean reverse, int limit);
|
||||
public abstract @NonNull Reader getAllOutgoingStoriesAt(long sentTimestamp);
|
||||
public abstract @NonNull List<MarkedMessageInfo> markAllIncomingStoriesRead();
|
||||
public abstract @NonNull List<StoryResult> getOrderedStoryRecipientsAndIds(boolean isOutgoingOnly);
|
||||
|
||||
public abstract void markOnboardingStoryRead();
|
||||
|
||||
public abstract @NonNull Reader getAllStoriesFor(@NonNull RecipientId recipientId, int limit);
|
||||
public abstract @NonNull MessageId getStoryId(@NonNull RecipientId authorId, long sentTimestamp) throws NoSuchMessageException;
|
||||
public abstract int getNumberOfStoryReplies(long parentStoryId);
|
||||
|
||||
@@ -655,6 +655,31 @@ public class MmsDatabase extends MessageDatabase {
|
||||
return new Reader(cursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull List<MarkedMessageInfo> markAllIncomingStoriesRead() {
|
||||
String where = IS_STORY_CLAUSE + " AND NOT (" + getOutgoingTypeClause() + ") AND " + READ + " = 0";
|
||||
|
||||
List<MarkedMessageInfo> markedMessageInfos = setMessagesRead(where, null);
|
||||
notifyConversationListListeners();
|
||||
|
||||
return markedMessageInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markOnboardingStoryRead() {
|
||||
RecipientId recipientId = SignalStore.releaseChannelValues().getReleaseChannelRecipientId();
|
||||
if (recipientId == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String where = IS_STORY_CLAUSE + " AND NOT (" + getOutgoingTypeClause() + ") AND " + READ + " = 0 AND " + RECIPIENT_ID + " = ?";
|
||||
|
||||
List<MarkedMessageInfo> markedMessageInfos = setMessagesRead(where, SqlUtil.buildArgs(recipientId));
|
||||
if (!markedMessageInfos.isEmpty()) {
|
||||
notifyConversationListListeners();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull MessageDatabase.Reader getAllStoriesFor(@NonNull RecipientId recipientId, int limit) {
|
||||
long threadId = SignalDatabase.threads().getThreadIdIfExistsFor(recipientId);
|
||||
@@ -801,7 +826,7 @@ public class MmsDatabase extends MessageDatabase {
|
||||
+ "FROM " + TABLE_NAME + "\n"
|
||||
+ "JOIN " + ThreadDatabase.TABLE_NAME + "\n"
|
||||
+ "ON " + TABLE_NAME + "." + THREAD_ID + " = " + ThreadDatabase.TABLE_NAME + "." + ThreadDatabase.ID + "\n"
|
||||
+ "WHERE " + IS_STORY_CLAUSE + " AND (" + getOutgoingTypeClause() + ") = 0 AND " + VIEWED_RECEIPT_COUNT + " = 0";
|
||||
+ "WHERE " + IS_STORY_CLAUSE + " AND (" + getOutgoingTypeClause() + ") = 0 AND " + VIEWED_RECEIPT_COUNT + " = 0 AND " + TABLE_NAME + "." + READ + " = 0";
|
||||
|
||||
try (Cursor cursor = db.rawQuery(query, null)) {
|
||||
if (cursor != null) {
|
||||
|
||||
@@ -1488,11 +1488,21 @@ public class SmsDatabase extends MessageDatabase {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull List<MarkedMessageInfo> markAllIncomingStoriesRead() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull List<StoryResult> getOrderedStoryRecipientsAndIds(boolean isOutgoingOnly) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markOnboardingStoryRead() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull MessageDatabase.Reader getAllStoriesFor(@NonNull RecipientId recipientId, int limit) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
Reference in New Issue
Block a user