Only display outgoing messages when entering viewer through my stories.

This commit is contained in:
Alex Hart
2022-07-25 15:33:34 -03:00
committed by Cody Henthorne
parent d40be0abf8
commit cb7b2d90d5
15 changed files with 52 additions and 38 deletions

View File

@@ -191,7 +191,7 @@ 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<StoryResult> getOrderedStoryRecipientsAndIds();
public abstract @NonNull List<StoryResult> getOrderedStoryRecipientsAndIds(boolean isOutgoingOnly);
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);

View File

@@ -613,7 +613,7 @@ public class MmsDatabase extends MessageDatabase {
whereArgs = SqlUtil.buildArgs(recipientId);
} else {
where += " AND " + THREAD_ID_WHERE;
whereArgs = SqlUtil.buildArgs(1, 0, threadId);
whereArgs = SqlUtil.buildArgs(threadId);
}
return new Reader(rawQuery(where, whereArgs));
@@ -798,7 +798,8 @@ public class MmsDatabase extends MessageDatabase {
}
@Override
public @NonNull List<StoryResult> getOrderedStoryRecipientsAndIds() {
public @NonNull List<StoryResult> getOrderedStoryRecipientsAndIds(boolean isOutgoingOnly) {
String where = "WHERE is_story > 0 AND remote_deleted = 0" + (isOutgoingOnly ? " AND is_outgoing != 0" : "") + "\n";
SQLiteDatabase db = getReadableDatabase();
String query = "SELECT\n"
+ " mms.date AS sent_timestamp,\n"
@@ -812,7 +813,7 @@ public class MmsDatabase extends MessageDatabase {
+ "FROM mms\n"
+ "JOIN thread\n"
+ "ON mms.thread_id = thread._id\n"
+ "WHERE is_story > 0 AND remote_deleted = 0\n"
+ where
+ "ORDER BY\n"
+ "is_unread DESC,\n"
+ "CASE\n"

View File

@@ -1413,7 +1413,7 @@ public class SmsDatabase extends MessageDatabase {
}
@Override
public @NonNull List<StoryResult> getOrderedStoryRecipientsAndIds() {
public @NonNull List<StoryResult> getOrderedStoryRecipientsAndIds(boolean isOutgoingOnly) {
throw new UnsupportedOperationException();
}