mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Implement several caching improvements for the Story Viewer.
This commit is contained in:
@@ -189,10 +189,10 @@ public abstract class MessageDatabase extends Database implements MmsSmsColumns
|
||||
|
||||
public abstract boolean isStory(long messageId);
|
||||
public abstract @NonNull Reader getOutgoingStoriesTo(@NonNull RecipientId recipientId);
|
||||
public abstract @NonNull Reader getAllOutgoingStories(boolean reverse);
|
||||
public abstract @NonNull Reader getAllOutgoingStories(boolean reverse, int limit);
|
||||
public abstract @NonNull Reader getAllOutgoingStoriesAt(long sentTimestamp);
|
||||
public abstract @NonNull List<StoryResult> getOrderedStoryRecipientsAndIds();
|
||||
public abstract @NonNull Reader getAllStoriesFor(@NonNull RecipientId recipientId);
|
||||
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);
|
||||
public abstract @NonNull List<RecipientId> getUnreadStoryThreadRecipientIds();
|
||||
|
||||
@@ -620,10 +620,10 @@ public class MmsDatabase extends MessageDatabase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull MessageDatabase.Reader getAllOutgoingStories(boolean reverse) {
|
||||
public @NonNull MessageDatabase.Reader getAllOutgoingStories(boolean reverse, int limit) {
|
||||
String where = IS_STORY_CLAUSE + " AND (" + getOutgoingTypeClause() + ")";
|
||||
|
||||
return new Reader(rawQuery(where, null, reverse, -1L));
|
||||
return new Reader(rawQuery(where, null, reverse, limit));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -636,11 +636,11 @@ public class MmsDatabase extends MessageDatabase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull MessageDatabase.Reader getAllStoriesFor(@NonNull RecipientId recipientId) {
|
||||
public @NonNull MessageDatabase.Reader getAllStoriesFor(@NonNull RecipientId recipientId, int limit) {
|
||||
long threadId = SignalDatabase.threads().getThreadIdIfExistsFor(recipientId);
|
||||
String where = IS_STORY_CLAUSE + " AND " + THREAD_ID_WHERE;
|
||||
String[] whereArgs = SqlUtil.buildArgs(threadId);
|
||||
Cursor cursor = rawQuery(where, whereArgs, false, -1L);
|
||||
Cursor cursor = rawQuery(where, whereArgs, false, limit);
|
||||
|
||||
return new Reader(cursor);
|
||||
}
|
||||
|
||||
@@ -1403,7 +1403,7 @@ public class SmsDatabase extends MessageDatabase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull MessageDatabase.Reader getAllOutgoingStories(boolean reverse) {
|
||||
public @NonNull MessageDatabase.Reader getAllOutgoingStories(boolean reverse, int limit) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@@ -1418,7 +1418,7 @@ public class SmsDatabase extends MessageDatabase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull MessageDatabase.Reader getAllStoriesFor(@NonNull RecipientId recipientId) {
|
||||
public @NonNull MessageDatabase.Reader getAllStoriesFor(@NonNull RecipientId recipientId, int limit) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user