Compare commits

..

1 Commits

Author SHA1 Message Date
akwizgran
aabb0bfb4a Allow WebP images to be used as attachments and avatars. 2021-05-21 12:43:19 +01:00
7 changed files with 13 additions and 22 deletions

View File

@@ -42,7 +42,7 @@ configurations {
dependencies {
implementation project(path: ':bramble-core', configuration: 'default')
tor 'org.briarproject:tor-android:0.3.5.14'
tor 'org.briarproject:tor-android:0.3.5.13@zip'
tor 'org.briarproject:obfs4proxy-android:0.0.12-dev-40245c4a@zip'
annotationProcessor 'com.google.dagger:dagger-compiler:2.24'

View File

@@ -119,7 +119,12 @@ public class AndroidUtils {
* Returns an array of supported content types for image attachments.
*/
public static String[] getSupportedImageContentTypes() {
return new String[] {"image/jpeg", "image/png", "image/gif"};
return new String[] {
"image/jpeg",
"image/png",
"image/gif",
"image/webp"
};
}
@Nullable

View File

@@ -76,7 +76,7 @@ dependencyVerification {
'org.bouncycastle:bcpkix-jdk15on:1.56:bcpkix-jdk15on-1.56.jar:7043dee4e9e7175e93e0b36f45b1ec1ecb893c5f755667e8b916eb8dd201c6ca',
'org.bouncycastle:bcprov-jdk15on:1.56:bcprov-jdk15on-1.56.jar:963e1ee14f808ffb99897d848ddcdb28fa91ddda867eb18d303e82728f878349',
'org.briarproject:obfs4proxy-android:0.0.12-dev-40245c4a:obfs4proxy-android-0.0.12-dev-40245c4a.zip:8ab05a8f8391be2cb5ab2b665c281a06d9e3a756bd0f95a40a36ca927866ea82',
'org.briarproject:tor-android:0.3.5.14:tor-android-0.3.5.14.jar:92bdb9890de8f14e9e90d1e3aff49a7a4b9262f19904410ae0a3baf94ed6be33',
'org.briarproject:tor-android:0.3.5.13:tor-android-0.3.5.13.zip:e0978db136731dae07774b722970cdae1e462fb5adc82845dd80a7e2d87f356c',
'org.checkerframework:checker-compat-qual:2.5.3:checker-compat-qual-2.5.3.jar:d76b9afea61c7c082908023f0cbc1427fab9abd2df915c8b8a3e7a509bccbc6d',
'org.checkerframework:checker-qual:2.5.2:checker-qual-2.5.2.jar:64b02691c8b9d4e7700f8ee2e742dce7ea2c6e81e662b7522c9ee3bf568c040a',
'org.checkerframework:checker-qual:2.8.1:checker-qual-2.8.1.jar:9103499008bcecd4e948da29b17864abb64304e15706444ae209d17ebe0575df',

View File

@@ -16,7 +16,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
implementation 'net.java.dev.jna:jna:4.5.2'
implementation 'net.java.dev.jna:jna-platform:4.5.2'
tor 'org.briarproject:tor:0.3.5.14'
tor 'org.briarproject:tor:0.3.5.13-1@zip'
tor 'org.briarproject:obfs4proxy:0.0.12-dev-40245c4a@zip'
annotationProcessor 'com.google.dagger:dagger-compiler:2.24'

View File

@@ -24,7 +24,7 @@ dependencyVerification {
'org.apache.ant:ant:1.9.4:ant-1.9.4.jar:649ae0730251de07b8913f49286d46bba7b92d47c5f332610aa426c4f02161d8',
'org.beanshell:bsh:1.3.0:bsh-1.3.0.jar:9b04edc75d19db54f1b4e8b5355e9364384c6cf71eb0a1b9724c159d779879f8',
'org.briarproject:obfs4proxy:0.0.12-dev-40245c4a:obfs4proxy-0.0.12-dev-40245c4a.zip:172029e7058b3a83ac93ac4991a44bf76e16ce8d46f558f5836d57da3cb3a766',
'org.briarproject:tor:0.3.5.14:tor-0.3.5.14.jar:a969ab3f4bde4a7fc5945c53935cf3bca50de44451a34ebeca8add93e2a9af60',
'org.briarproject:tor:0.3.5.13-1:tor-0.3.5.13-1.zip:ef35c16bf8dc1f4c75ed71d9f55e4514f383d124ec96b859aca647c990927c99',
'org.checkerframework:checker-compat-qual:2.5.3:checker-compat-qual-2.5.3.jar:d76b9afea61c7c082908023f0cbc1427fab9abd2df915c8b8a3e7a509bccbc6d',
'org.checkerframework:checker-qual:2.5.2:checker-qual-2.5.2.jar:64b02691c8b9d4e7700f8ee2e742dce7ea2c6e81e662b7522c9ee3bf568c040a',
'org.codehaus.mojo:animal-sniffer-annotations:1.17:animal-sniffer-annotations-1.17.jar:92654f493ecfec52082e76354f0ebf87648dc3d5cec2e3c3cdb947c016747a53',

View File

@@ -21,7 +21,6 @@ import org.briarproject.briar.android.view.ImagePreview.ImagePreviewListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.logging.Logger;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
@@ -38,8 +37,6 @@ import static android.widget.Toast.LENGTH_LONG;
import static androidx.core.content.ContextCompat.getColor;
import static androidx.customview.view.AbsSavedState.EMPTY_STATE;
import static androidx.lifecycle.Lifecycle.State.DESTROYED;
import static java.util.logging.Level.INFO;
import static java.util.logging.Logger.getLogger;
import static org.briarproject.briar.android.util.UiUtils.resolveColorAttribute;
import static org.briarproject.briar.android.view.TextSendController.SendState.SENT;
import static org.briarproject.briar.api.messaging.MessagingConstants.MAX_ATTACHMENTS_PER_MESSAGE;
@@ -49,9 +46,6 @@ import static org.briarproject.briar.api.messaging.MessagingConstants.MAX_ATTACH
public class TextAttachmentController extends TextSendController
implements ImagePreviewListener {
private static final Logger LOG =
getLogger(TextAttachmentController.class.getName());
private final ImagePreview imagePreview;
private final AttachmentListener attachmentListener;
private final CompositeSendButton sendButton;
@@ -73,7 +67,6 @@ public class TextAttachmentController extends TextSendController
sendButton.setOnImageClickListener(view -> onImageButtonClicked());
}
@UiThread
@Override
protected void updateViewState() {
super.updateViewState();
@@ -167,13 +160,10 @@ public class TextAttachmentController extends TextSendController
* at most once per call to
* {@link Activity#startActivityForResult(Intent, int)}.
*/
@UiThread
@SuppressWarnings("JavadocReference")
public void onImageReceived(@Nullable Intent resultData) {
if (LOG.isLoggable(INFO)) LOG.info("onImageReceived: " + resultData);
if (resultData == null) return;
if (loadingUris) throw new AssertionError("still loading URIs");
if (!imageUris.isEmpty()) throw new AssertionError("uris " + imageUris);
if (loadingUris || !imageUris.isEmpty()) throw new AssertionError();
List<Uri> newUris = new ArrayList<>();
if (resultData.getData() != null) {
newUris.add(resultData.getData());
@@ -187,7 +177,6 @@ public class TextAttachmentController extends TextSendController
}
}
@UiThread
private void onNewUris(boolean restart, List<Uri> newUris) {
if (newUris.isEmpty()) return;
if (loadingUris) throw new AssertionError();
@@ -208,9 +197,8 @@ public class TextAttachmentController extends TextSendController
@Override
public void onChanged(@Nullable AttachmentResult attachmentResult) {
if (attachmentResult == null) {
// The fresh LiveData was deliberately set to null
// when the AttachmentCreator reset its state.
// This means that we can simply stop observing it.
// The fresh LiveData was deliberately set to null.
// This means that we can stop observing it.
result.removeObserver(this);
} else {
boolean noError = onNewAttachmentItemResults(
@@ -282,7 +270,6 @@ public class TextAttachmentController extends TextSendController
onCancel();
}
@UiThread
@Override
public void onCancel() {
textInput.clearText();

View File

@@ -4,7 +4,6 @@ allprojects {
repositories {
jcenter()
mavenLocal()
mavenCentral()
google()
maven { url "https://jitpack.io" }
}