2015-01-02 15:43:28 -08:00
|
|
|
package org.thoughtcrime.securesms.mms;
|
|
|
|
|
2015-06-04 14:19:10 -07:00
|
|
|
import android.content.Context;
|
|
|
|
|
|
|
|
import org.thoughtcrime.securesms.util.Util;
|
2020-02-11 11:00:00 +11:00
|
|
|
import org.whispersystems.signalservice.loki.api.LokiFileServerAPI;
|
2015-06-04 14:19:10 -07:00
|
|
|
|
2015-01-02 15:43:28 -08:00
|
|
|
public class PushMediaConstraints extends MediaConstraints {
|
2017-05-08 15:32:59 -07:00
|
|
|
|
2015-06-04 14:19:10 -07:00
|
|
|
private static final int MAX_IMAGE_DIMEN_LOWMEM = 768;
|
2016-12-14 10:21:14 -08:00
|
|
|
private static final int MAX_IMAGE_DIMEN = 4096;
|
2015-01-02 15:43:28 -08:00
|
|
|
|
|
|
|
@Override
|
2015-06-04 14:19:10 -07:00
|
|
|
public int getImageMaxWidth(Context context) {
|
|
|
|
return Util.isLowMemory(context) ? MAX_IMAGE_DIMEN_LOWMEM : MAX_IMAGE_DIMEN;
|
2015-01-02 15:43:28 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-06-04 14:19:10 -07:00
|
|
|
public int getImageMaxHeight(Context context) {
|
|
|
|
return getImageMaxWidth(context);
|
2015-01-02 15:43:28 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-05-08 15:32:59 -07:00
|
|
|
public int getImageMaxSize(Context context) {
|
2020-02-11 11:00:00 +11:00
|
|
|
return LokiFileServerAPI.Companion.getMaxFileSize();
|
2015-01-02 15:43:28 -08:00
|
|
|
}
|
|
|
|
|
2015-07-15 13:42:59 -07:00
|
|
|
@Override
|
2017-05-08 15:32:59 -07:00
|
|
|
public int getGifMaxSize(Context context) {
|
2020-02-11 11:00:00 +11:00
|
|
|
return LokiFileServerAPI.Companion.getMaxFileSize();
|
2015-07-15 13:42:59 -07:00
|
|
|
}
|
|
|
|
|
2015-01-02 15:43:28 -08:00
|
|
|
@Override
|
2017-05-08 15:32:59 -07:00
|
|
|
public int getVideoMaxSize(Context context) {
|
2020-02-11 11:00:00 +11:00
|
|
|
return LokiFileServerAPI.Companion.getMaxFileSize();
|
2015-01-02 15:43:28 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-05-08 15:32:59 -07:00
|
|
|
public int getAudioMaxSize(Context context) {
|
2020-02-11 11:00:00 +11:00
|
|
|
return LokiFileServerAPI.Companion.getMaxFileSize();
|
2015-01-02 15:43:28 -08:00
|
|
|
}
|
2017-04-24 15:52:48 -07:00
|
|
|
|
|
|
|
@Override
|
2017-05-08 15:32:59 -07:00
|
|
|
public int getDocumentMaxSize(Context context) {
|
2020-02-11 11:00:00 +11:00
|
|
|
return LokiFileServerAPI.Companion.getMaxFileSize();
|
2017-04-24 15:52:48 -07:00
|
|
|
}
|
2015-01-02 15:43:28 -08:00
|
|
|
}
|