Allow hidden story viewing.

This commit is contained in:
Alex Hart
2022-04-06 14:37:25 -03:00
committed by GitHub
parent dc6fd8be7f
commit 7fb5ceeda4
12 changed files with 60 additions and 33 deletions

View File

@@ -190,7 +190,7 @@ public abstract class MessageDatabase extends Database implements MmsSmsColumns
public abstract @NonNull Reader getAllStoriesFor(@NonNull RecipientId recipientId);
public abstract @NonNull MessageId getStoryId(@NonNull RecipientId authorId, long sentTimestamp) throws NoSuchMessageException;
public abstract int getNumberOfStoryReplies(long parentStoryId);
public abstract long getUnreadStoryThreadCount();
public abstract @NonNull List<RecipientId> getUnreadStoryThreadRecipientIds();
public abstract boolean containsStories(long threadId);
public abstract boolean hasSelfReplyInStory(long parentStoryId);
public abstract @NonNull Cursor getStoryReplies(long parentStoryId);

View File

@@ -650,7 +650,7 @@ public class MmsDatabase extends MessageDatabase {
}
@Override
public long getUnreadStoryThreadCount() {
public @NonNull List<RecipientId> getUnreadStoryThreadRecipientIds() {
SQLiteDatabase db = getReadableDatabase();
String query = "SELECT DISTINCT " + ThreadDatabase.RECIPIENT_ID + "\n"
+ "FROM " + TABLE_NAME + "\n"
@@ -660,11 +660,16 @@ public class MmsDatabase extends MessageDatabase {
try (Cursor cursor = db.rawQuery(query, null)) {
if (cursor != null) {
return cursor.getCount();
List<RecipientId> recipientIds = new ArrayList<>(cursor.getCount());
while (cursor.moveToNext()) {
recipientIds.add(RecipientId.from(cursor.getLong(0)));
}
return recipientIds;
}
}
return 0;
return Collections.emptyList();
}
@Override

View File

@@ -1427,7 +1427,7 @@ public class SmsDatabase extends MessageDatabase {
}
@Override
public long getUnreadStoryThreadCount() {
public @NonNull List<RecipientId> getUnreadStoryThreadRecipientIds() {
throw new UnsupportedOperationException();
}