Remove SignalServiceMessageReceiver

This commit is contained in:
Niels Andriesse 2021-05-18 09:54:16 +10:00
parent c1548a4e51
commit 47ff53d559
7 changed files with 3 additions and 90 deletions

View File

@ -2,14 +2,12 @@ package org.thoughtcrime.securesms.dependencies;
import android.content.Context;
import org.session.libsignal.service.api.SignalServiceMessageReceiver;
import org.thoughtcrime.securesms.jobs.AvatarDownloadJob;
import org.thoughtcrime.securesms.jobs.RetrieveProfileAvatarJob;
import org.thoughtcrime.securesms.linkpreview.LinkPreviewRepository;
import org.thoughtcrime.securesms.preferences.AppProtectionPreferenceFragment;
import dagger.Module;
import dagger.Provides;
@Module(complete = false, injects = {AvatarDownloadJob.class,
RetrieveProfileAvatarJob.class,
@ -20,18 +18,7 @@ public class SignalCommunicationModule {
private final Context context;
private SignalServiceMessageReceiver messageReceiver;
public SignalCommunicationModule(Context context) {
this.context = context;
}
@Provides
synchronized SignalServiceMessageReceiver provideSignalMessageReceiver() {
if (this.messageReceiver == null) {
this.messageReceiver = new SignalServiceMessageReceiver();
}
return this.messageReceiver;
this.context = context;
}
}

View File

@ -19,7 +19,6 @@ import org.thoughtcrime.securesms.util.BitmapUtil;
import org.session.libsignal.utilities.Hex;
import org.session.libsignal.exceptions.InvalidMessageException;
import org.session.libsignal.utilities.guava.Optional;
import org.session.libsignal.service.api.SignalServiceMessageReceiver;
import org.session.libsignal.messages.SignalServiceAttachmentPointer;
import org.session.libsignal.exceptions.NonSuccessfulResponseCodeException;
@ -40,8 +39,6 @@ public class AvatarDownloadJob extends BaseJob implements InjectableType {
private static final String KEY_GROUP_ID = "group_id";
@Inject SignalServiceMessageReceiver receiver;
private String groupId;
public AvatarDownloadJob(@NonNull String groupId) {

View File

@ -12,7 +12,6 @@ import org.session.libsession.messaging.threads.recipients.Recipient;
import org.session.libsession.utilities.DownloadUtilities;
import org.session.libsession.utilities.TextSecurePreferences;
import org.session.libsession.utilities.Util;
import org.session.libsignal.service.api.SignalServiceMessageReceiver;
import org.session.libsignal.streams.ProfileCipherInputStream;
import org.session.libsignal.exceptions.PushNetworkException;
import org.session.libsignal.utilities.Log;
@ -43,7 +42,6 @@ public class RetrieveProfileAvatarJob extends BaseJob implements InjectableType
private static final String KEY_PROFILE_AVATAR = "profile_avatar";
private static final String KEY_ADDRESS = "address";
@Inject SignalServiceMessageReceiver receiver;
private String profileAvatar;
private Recipient recipient;

View File

@ -20,7 +20,6 @@ import org.thoughtcrime.securesms.net.ContentProxySafetyInterceptor;
import org.thoughtcrime.securesms.net.RequestController;
import org.thoughtcrime.securesms.providers.BlobProvider;
import org.session.libsignal.utilities.guava.Optional;
import org.session.libsignal.service.api.SignalServiceMessageReceiver;
import org.thoughtcrime.securesms.linkpreview.LinkPreviewUtil.OpenGraph;
import org.session.libsession.messaging.sending_receiving.attachments.Attachment;
@ -48,8 +47,6 @@ public class LinkPreviewRepository implements InjectableType {
private final OkHttpClient client;
@Inject SignalServiceMessageReceiver messageReceiver;
public LinkPreviewRepository(@NonNull Context context) {
this.client = new OkHttpClient.Builder()
.addNetworkInterceptor(new ContentProxySafetyInterceptor())

View File

@ -10,7 +10,7 @@ import org.session.libsignal.utilities.guava.Optional
/**
* Represents a received SignalServiceAttachment "handle." This
* is a pointer to the actual attachment content, which needs to be
* retrieved using [SignalServiceMessageReceiver.retrieveAttachment]
* retrieved using SignalServiceMessageReceiver.retrieveAttachment
*
* @author Moxie Marlinspike
*/

View File

@ -7,12 +7,11 @@
package org.session.libsignal.messages;
import org.session.libsignal.utilities.guava.Optional;
import org.session.libsignal.service.api.SignalServiceMessageReceiver;
/**
* Represents a received SignalServiceAttachment "handle." This
* is a pointer to the actual attachment content, which needs to be
* retrieved using {@link SignalServiceMessageReceiver#retrieveAttachment(SignalServiceAttachmentPointer, java.io.File, int)}
* retrieved using SignalServiceMessageReceiver.retrieveAttachment(SignalServiceAttachmentPointer, java.io.File, int)
*
* @author Moxie Marlinspike
*/

View File

@ -1,65 +0,0 @@
/*
* Copyright (C) 2014-2016 Open Whisper Systems
*
* Licensed according to the LICENSE file in this repository.
*/
package org.session.libsignal.service.api;
import org.session.libsignal.exceptions.InvalidMessageException;
import org.session.libsignal.messages.SignalServiceAttachment.ProgressListener;
import org.session.libsignal.messages.SignalServiceAttachmentPointer;
import org.session.libsignal.messages.SignalServiceDataMessage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
/**
* The primary interface for receiving Signal Service messages.
*
* @author Moxie Marlinspike
*/
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public class SignalServiceMessageReceiver {
/**
* Retrieves a SignalServiceAttachment.
*
* @param pointer The {@link SignalServiceAttachmentPointer}
* received in a {@link SignalServiceDataMessage}.
* @param destination The download destination for this attachment.
*
* @return An InputStream that streams the plaintext attachment contents.
* @throws IOException
* @throws InvalidMessageException
*/
public InputStream retrieveAttachment(SignalServiceAttachmentPointer pointer, File destination, int maxSizeBytes)
throws IOException, InvalidMessageException
{
return retrieveAttachment(pointer, destination, maxSizeBytes, null);
}
public InputStream retrieveProfileAvatar(String path, File destination, byte[] profileKey, int maxSizeBytes)
throws IOException
{
throw new IOException();
}
/**
* Retrieves a SignalServiceAttachment.
*
* @param pointer The {@link SignalServiceAttachmentPointer}
* received in a {@link SignalServiceDataMessage}.
* @param destination The download destination for this attachment.
* @param listener An optional listener (may be null) to receive callbacks on download progress.
*
* @return An InputStream that streams the plaintext attachment contents.
* @throws IOException
* @throws InvalidMessageException
*/
public InputStream retrieveAttachment(SignalServiceAttachmentPointer pointer, File destination, int maxSizeBytes, ProgressListener listener)
throws IOException, InvalidMessageException
{
throw new IOException();
}
}