Revert "Do not remove onboarding story when disabling stories."

This reverts commit 8c76cead58.
fork-5.53.8
Alex Hart 2022-10-13 09:17:34 -03:00
rodzic a04c2c30b9
commit 2bbce6ad47
4 zmienionych plików z 4 dodań i 29 usunięć

Wyświetl plik

@ -198,7 +198,6 @@ public abstract class MessageDatabase extends Database implements MmsSmsColumns,
public abstract boolean isStory(long messageId); public abstract boolean isStory(long messageId);
public abstract @NonNull Reader getOutgoingStoriesTo(@NonNull RecipientId recipientId); public abstract @NonNull Reader getOutgoingStoriesTo(@NonNull RecipientId recipientId);
public abstract @NonNull Reader getAllOutgoingStories(boolean reverse, int limit); public abstract @NonNull Reader getAllOutgoingStories(boolean reverse, int limit);
public abstract @NonNull Reader getAllIncomingStoriesExceptOnboarding();
public abstract @NonNull Reader getAllOutgoingStoriesAt(long sentTimestamp); public abstract @NonNull Reader getAllOutgoingStoriesAt(long sentTimestamp);
public abstract @NonNull List<StoryResult> getOrderedStoryRecipientsAndIds(boolean isOutgoingOnly); public abstract @NonNull List<StoryResult> getOrderedStoryRecipientsAndIds(boolean isOutgoingOnly);
public abstract @NonNull Reader getAllStoriesFor(@NonNull RecipientId recipientId, int limit); public abstract @NonNull Reader getAllStoriesFor(@NonNull RecipientId recipientId, int limit);

Wyświetl plik

@ -635,17 +635,6 @@ public class MmsDatabase extends MessageDatabase {
return new Reader(rawQuery(where, null, reverse, limit)); 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 @Override
public @NonNull MessageDatabase.Reader getAllOutgoingStoriesAt(long sentTimestamp) { public @NonNull MessageDatabase.Reader getAllOutgoingStoriesAt(long sentTimestamp) {
String where = IS_STORY_CLAUSE + " AND " + DATE_SENT + " = ? AND (" + getOutgoingTypeClause() + ")"; String where = IS_STORY_CLAUSE + " AND " + DATE_SENT + " = ? AND (" + getOutgoingTypeClause() + ")";

Wyświetl plik

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

Wyświetl plik

@ -28,18 +28,10 @@ class StoriesPrivacySettingsRepository {
Stories.onStorySettingsChanged(Recipient.self().id) Stories.onStorySettingsChanged(Recipient.self().id)
ApplicationDependencies.resetAllNetworkConnections() ApplicationDependencies.resetAllNetworkConnections()
if (!isEnabled) { SignalDatabase.mms.getAllOutgoingStories(false, -1).use { reader ->
SignalDatabase.mms.getAllOutgoingStories(false, -1).use { reader -> reader.map { record -> record.id }
reader.map { record -> record.id } }.forEach { messageId ->
}.forEach { messageId -> MessageSender.sendRemoteDelete(messageId, true)
MessageSender.sendRemoteDelete(messageId, true)
}
SignalDatabase.mms.allIncomingStoriesExceptOnboarding.use { reader ->
reader.map { record -> record.id }
}.forEach { messageId ->
SignalDatabase.mms.deleteMessage(messageId)
}
} }
}.subscribeOn(Schedulers.io()) }.subscribeOn(Schedulers.io())
} }