Do not remove onboarding story when disabling stories.

This commit is contained in:
Alex Hart
2022-10-12 13:35:38 -03:00
committed by Greyson Parrelli
parent da3623d7e6
commit 8c76cead58
5 changed files with 35 additions and 5 deletions

View File

@@ -198,6 +198,7 @@ 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, int limit);
public abstract @NonNull Reader getAllIncomingStoriesExceptOnboarding();
public abstract @NonNull Reader getAllOutgoingStoriesAt(long sentTimestamp);
public abstract @NonNull List<StoryResult> getOrderedStoryRecipientsAndIds(boolean isOutgoingOnly);
public abstract @NonNull Reader getAllStoriesFor(@NonNull RecipientId recipientId, int limit);

View File

@@ -635,6 +635,17 @@ public class MmsDatabase extends MessageDatabase {
return new Reader(rawQuery(where, null, reverse, limit));
}
@Override
public @NonNull MessageDatabase.Reader getAllIncomingStoriesExceptOnboarding() {
RecipientId onboardingRecipientId = SignalStore.releaseChannelValues().getReleaseChannelRecipientId();
String where = IS_STORY_CLAUSE + " AND NOT (" + getOutgoingTypeClause() + ")";
if (onboardingRecipientId != null) {
where += " AND " + RECIPIENT_ID + " != " + onboardingRecipientId.serialize();
}
return new Reader(rawQuery(where, null, false, -1L));
}
@Override
public @NonNull MessageDatabase.Reader getAllOutgoingStoriesAt(long sentTimestamp) {
String where = IS_STORY_CLAUSE + " AND " + DATE_SENT + " = ? AND (" + getOutgoingTypeClause() + ")";

View File

@@ -1448,6 +1448,11 @@ public class SmsDatabase extends MessageDatabase {
throw new UnsupportedOperationException();
}
@Override
public @NonNull MessageDatabase.Reader getAllIncomingStoriesExceptOnboarding() {
throw new UnsupportedOperationException();
}
@Override
public @NonNull MessageDatabase.Reader getAllOutgoingStoriesAt(long sentTimestamp) {
throw new UnsupportedOperationException();