Add NotInCallConstraint, restrict auto-download of media and documents when on an active voice or video call.

This commit is contained in:
Alex Hart
2021-01-12 16:01:31 -04:00
committed by Greyson Parrelli
parent ef95479157
commit 8724d904b7
5 changed files with 89 additions and 3 deletions

View File

@@ -16,6 +16,7 @@ import org.thoughtcrime.securesms.attachments.DatabaseAttachment;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.NoSuchMessageException;
import org.thoughtcrime.securesms.database.model.MessageRecord;
import org.thoughtcrime.securesms.jobmanager.impl.NotInCallConstraint;
import org.thoughtcrime.securesms.recipients.Recipient;
import java.util.Collections;
@@ -46,9 +47,9 @@ public class AttachmentUtil {
{
return true;
} else if (isNonDocumentType(contentType)) {
return allowedTypes.contains(MediaUtil.getDiscreteMimeType(contentType));
return NotInCallConstraint.isNotInConnectedCall() && allowedTypes.contains(MediaUtil.getDiscreteMimeType(contentType));
} else {
return allowedTypes.contains("documents");
return NotInCallConstraint.isNotInConnectedCall() && allowedTypes.contains("documents");
}
}