Merge pull request #88 from loki-project/files

Implement File Size Limit
This commit is contained in:
gmbnt 2020-02-11 11:03:25 +11:00 committed by GitHub
commit 4af78eb3bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,13 +3,12 @@ package org.thoughtcrime.securesms.mms;
import android.content.Context;
import org.thoughtcrime.securesms.util.Util;
import org.whispersystems.signalservice.loki.api.LokiFileServerAPI;
public class PushMediaConstraints extends MediaConstraints {
private static final int MAX_IMAGE_DIMEN_LOWMEM = 768;
private static final int MAX_IMAGE_DIMEN = 4096;
private static final int KB = 1024;
private static final int MB = 1024 * KB;
@Override
public int getImageMaxWidth(Context context) {
@ -23,26 +22,26 @@ public class PushMediaConstraints extends MediaConstraints {
@Override
public int getImageMaxSize(Context context) {
return 6 * MB;
return LokiFileServerAPI.Companion.getMaxFileSize();
}
@Override
public int getGifMaxSize(Context context) {
return 25 * MB;
return LokiFileServerAPI.Companion.getMaxFileSize();
}
@Override
public int getVideoMaxSize(Context context) {
return 100 * MB;
return LokiFileServerAPI.Companion.getMaxFileSize();
}
@Override
public int getAudioMaxSize(Context context) {
return 100 * MB;
return LokiFileServerAPI.Companion.getMaxFileSize();
}
@Override
public int getDocumentMaxSize(Context context) {
return 100 * MB;
return LokiFileServerAPI.Companion.getMaxFileSize();
}
}