Fix attachment deduplication issue with Stories.

This commit is contained in:
Alex Hart
2022-06-28 16:37:36 -03:00
committed by Cody Henthorne
parent ed25be2e23
commit ba6e1b5dd5
7 changed files with 64 additions and 57 deletions

View File

@@ -16,9 +16,11 @@
*/
package org.thoughtcrime.securesms.mms;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
public class MediaStream {
public class MediaStream implements Closeable {
private final InputStream stream;
private final String mimeType;
private final int width;
@@ -46,4 +48,9 @@ public class MediaStream {
public int getHeight() {
return height;
}
@Override
public void close() throws IOException {
stream.close();
}
}

View File

@@ -81,4 +81,22 @@ public class OutgoingSecureMediaMessage extends OutgoingMediaMessage {
getMentions(),
getGiftBadge());
}
public @NonNull OutgoingSecureMediaMessage stripAttachments() {
return new OutgoingSecureMediaMessage(getRecipient(),
getBody(),
Collections.emptyList(),
getSentTimeMillis(),
getDistributionType(),
getExpiresIn(),
isViewOnce(),
getStoryType(),
getParentStoryId(),
isStoryReaction(),
getOutgoingQuote(),
Collections.emptyList(),
Collections.emptyList(),
getMentions(),
getGiftBadge());
}
}