Keep track of when audio attachments are voice notes

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2017-05-11 22:46:35 -07:00
parent e96bf2bdc7
commit b78c05e70b
26 changed files with 76 additions and 44 deletions

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.Log;
import org.thoughtcrime.securesms.attachments.Attachment;
@@ -93,7 +94,9 @@ public class MediaNetworkRequirement implements Requirement, ContextDependent {
boolean isAllowed;
if (isNonDocumentType(contentType)) {
if (attachment.isVoiceNote() || (MediaUtil.isAudio(attachment) && TextUtils.isEmpty(attachment.getFileName()))) {
isAllowed = isConnectedWifi() || isConnectedMobile();
} else if (isNonDocumentType(contentType)) {
isAllowed = allowedTypes.contains(MediaUtil.getDiscreteMimeType(contentType));
} else {
isAllowed = allowedTypes.contains("documents");