hook up sending pipeline & clean

This commit is contained in:
Ryan ZHAO
2021-03-02 12:24:09 +11:00
parent 242eb90d21
commit d9eaedd6ae
79 changed files with 457 additions and 749 deletions

View File

@@ -9,6 +9,7 @@ import androidx.annotation.Nullable;
import com.google.android.gms.common.util.IOUtils;
import org.session.libsession.messaging.sending_receiving.attachments.AttachmentTransferProgress;
import org.session.libsession.utilities.MediaTypes;
import org.thoughtcrime.securesms.ApplicationContext;
import org.thoughtcrime.securesms.database.AttachmentDatabase;
@@ -192,7 +193,7 @@ public class LinkPreviewRepository implements InjectableType {
return Optional.of(new UriAttachment(uri,
uri,
contentType,
AttachmentDatabase.TRANSFER_PROGRESS_STARTED,
AttachmentTransferProgress.TRANSFER_PROGRESS_STARTED,
bytes.length,
bitmap.getWidth(),
bitmap.getHeight(),

View File

@@ -43,13 +43,13 @@ public class LinkPreviewViewModel extends ViewModel {
return linkPreviewState.getValue() != null && linkPreviewState.getValue().getLinkPreview().isPresent();
}
public @NonNull List<LinkPreview> getActiveLinkPreviews() {
public Optional<LinkPreview> getActiveLinkPreview() {
final LinkPreviewState state = linkPreviewState.getValue();
if (state == null || !state.getLinkPreview().isPresent()) {
return Collections.emptyList();
return Optional.absent();
} else {
return Collections.singletonList(state.getLinkPreview().get());
return state.getLinkPreview();
}
}