mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 03:11:10 +01:00
Update note to self sending flow.
This commit is contained in:
@@ -123,7 +123,6 @@ public final class JobManagerFactories {
|
|||||||
put(AttachmentCopyJob.KEY, new AttachmentCopyJob.Factory());
|
put(AttachmentCopyJob.KEY, new AttachmentCopyJob.Factory());
|
||||||
put(AttachmentDownloadJob.KEY, new AttachmentDownloadJob.Factory());
|
put(AttachmentDownloadJob.KEY, new AttachmentDownloadJob.Factory());
|
||||||
put(AttachmentHashBackfillJob.KEY, new AttachmentHashBackfillJob.Factory());
|
put(AttachmentHashBackfillJob.KEY, new AttachmentHashBackfillJob.Factory());
|
||||||
put(MarkNoteToSelfAttachmentUploadedJob.KEY, new MarkNoteToSelfAttachmentUploadedJob.Factory());
|
|
||||||
put(AttachmentUploadJob.KEY, new AttachmentUploadJob.Factory());
|
put(AttachmentUploadJob.KEY, new AttachmentUploadJob.Factory());
|
||||||
put(AutomaticSessionResetJob.KEY, new AutomaticSessionResetJob.Factory());
|
put(AutomaticSessionResetJob.KEY, new AutomaticSessionResetJob.Factory());
|
||||||
put(AvatarGroupsV1DownloadJob.KEY, new AvatarGroupsV1DownloadJob.Factory());
|
put(AvatarGroupsV1DownloadJob.KEY, new AvatarGroupsV1DownloadJob.Factory());
|
||||||
@@ -379,6 +378,7 @@ public final class JobManagerFactories {
|
|||||||
put("DonationReceiptRedemptionJob", new FailingJob.Factory());
|
put("DonationReceiptRedemptionJob", new FailingJob.Factory());
|
||||||
put("SendGiftJob", new FailingJob.Factory());
|
put("SendGiftJob", new FailingJob.Factory());
|
||||||
put("InactiveGroupCheckMigrationJob", new PassingMigrationJob.Factory());
|
put("InactiveGroupCheckMigrationJob", new PassingMigrationJob.Factory());
|
||||||
|
put("AttachmentMarkUploadedJob", new FailingJob.Factory());
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,97 +0,0 @@
|
|||||||
package org.thoughtcrime.securesms.jobs;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import org.signal.core.util.logging.Log;
|
|
||||||
import org.thoughtcrime.securesms.attachments.AttachmentId;
|
|
||||||
import org.thoughtcrime.securesms.attachments.DatabaseAttachment;
|
|
||||||
import org.thoughtcrime.securesms.database.AttachmentTable;
|
|
||||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
|
||||||
import org.thoughtcrime.securesms.jobmanager.JsonJobData;
|
|
||||||
import org.thoughtcrime.securesms.jobmanager.Job;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Marks a note to self attachment (that didn't need to be uploaded, because there's no linked devices) as being uploaded for UX purposes.
|
|
||||||
* Also generates a key/iv/digest that otherwise wouldn't exist due to the lack of upload.
|
|
||||||
*/
|
|
||||||
public final class MarkNoteToSelfAttachmentUploadedJob extends BaseJob {
|
|
||||||
|
|
||||||
public static final String KEY = "AttachmentMarkUploadedJob";
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private static final String TAG = Log.tag(MarkNoteToSelfAttachmentUploadedJob.class);
|
|
||||||
|
|
||||||
private static final String KEY_ATTACHMENT_ID = "row_id";
|
|
||||||
private static final String KEY_MESSAGE_ID = "message_id";
|
|
||||||
|
|
||||||
private final AttachmentId attachmentId;
|
|
||||||
private final long messageId;
|
|
||||||
|
|
||||||
public MarkNoteToSelfAttachmentUploadedJob(long messageId, @NonNull AttachmentId attachmentId) {
|
|
||||||
this(new Parameters.Builder()
|
|
||||||
.setLifespan(TimeUnit.DAYS.toMillis(1))
|
|
||||||
.setMaxAttempts(Parameters.UNLIMITED)
|
|
||||||
.build(),
|
|
||||||
messageId,
|
|
||||||
attachmentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private MarkNoteToSelfAttachmentUploadedJob(@NonNull Parameters parameters, long messageId, @NonNull AttachmentId attachmentId) {
|
|
||||||
super(parameters);
|
|
||||||
this.attachmentId = attachmentId;
|
|
||||||
this.messageId = messageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @Nullable byte[] serialize() {
|
|
||||||
return new JsonJobData.Builder().putLong(KEY_ATTACHMENT_ID, attachmentId.id)
|
|
||||||
.putLong(KEY_MESSAGE_ID, messageId)
|
|
||||||
.serialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NonNull String getFactoryKey() {
|
|
||||||
return KEY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRun() throws Exception {
|
|
||||||
DatabaseAttachment databaseAttachment = SignalDatabase.attachments().getAttachment(attachmentId);
|
|
||||||
|
|
||||||
if (databaseAttachment == null) {
|
|
||||||
throw new InvalidAttachmentException("Cannot find the specified attachment.");
|
|
||||||
}
|
|
||||||
|
|
||||||
SignalDatabase.attachments().markAttachmentUploaded(messageId, databaseAttachment);
|
|
||||||
SignalDatabase.attachments().createKeyIvDigestIfNecessary(databaseAttachment);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean onShouldRetry(@NonNull Exception exception) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class InvalidAttachmentException extends Exception {
|
|
||||||
InvalidAttachmentException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class Factory implements Job.Factory<MarkNoteToSelfAttachmentUploadedJob> {
|
|
||||||
@Override
|
|
||||||
public @NonNull MarkNoteToSelfAttachmentUploadedJob create(@NonNull Parameters parameters, @Nullable byte[] serializedData) {
|
|
||||||
JsonJobData data = JsonJobData.deserialize(serializedData);
|
|
||||||
|
|
||||||
return new MarkNoteToSelfAttachmentUploadedJob(parameters,
|
|
||||||
data.getLong(KEY_MESSAGE_ID),
|
|
||||||
new AttachmentId(data.getLong(KEY_ATTACHMENT_ID)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -118,22 +118,7 @@ class MediaSelectionRepository(context: Context) {
|
|||||||
StoryType.NONE
|
StoryType.NONE
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MessageSender.isLocalSelfSend(context, singleRecipient, SendType.SIGNAL)) {
|
if (scheduledTime != -1L && storyType == StoryType.NONE) {
|
||||||
Log.i(TAG, "Local self-send. Skipping pre-upload.")
|
|
||||||
emitter.onSuccess(
|
|
||||||
MediaSendActivityResult(
|
|
||||||
recipientId = singleRecipient!!.id,
|
|
||||||
nonUploadedMedia = updatedMedia,
|
|
||||||
body = trimmedBody,
|
|
||||||
messageSendType = sendType,
|
|
||||||
isViewOnce = isViewOnce,
|
|
||||||
mentions = trimmedMentions,
|
|
||||||
bodyRanges = trimmedBodyRanges,
|
|
||||||
storyType = StoryType.NONE,
|
|
||||||
scheduledTime = scheduledTime
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else if (scheduledTime != -1L && storyType == StoryType.NONE) {
|
|
||||||
Log.i(TAG, "Scheduled message. Skipping pre-upload.")
|
Log.i(TAG, "Scheduled message. Skipping pre-upload.")
|
||||||
if (contacts.isEmpty()) {
|
if (contacts.isEmpty()) {
|
||||||
emitter.onSuccess(
|
emitter.onSuccess(
|
||||||
@@ -261,10 +246,6 @@ class MediaSelectionRepository(context: Context) {
|
|||||||
uploadRepository.deleteAbandonedAttachments()
|
uploadRepository.deleteAbandonedAttachments()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isLocalSelfSend(recipient: Recipient?): Boolean {
|
|
||||||
return MessageSender.isLocalSelfSend(context, recipient, SendType.SIGNAL)
|
|
||||||
}
|
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
private fun buildModelsToTransform(
|
private fun buildModelsToTransform(
|
||||||
selectedMedia: List<Media>,
|
selectedMedia: List<Media>,
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class MediaSelectionViewModel(
|
|||||||
store.update {
|
store.update {
|
||||||
it.copy(
|
it.copy(
|
||||||
isMeteredConnection = metered,
|
isMeteredConnection = metered,
|
||||||
isPreUploadEnabled = shouldPreUpload(metered, it.recipient)
|
isPreUploadEnabled = shouldPreUpload(metered)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ class MediaSelectionViewModel(
|
|||||||
store.update(Recipient.live(recipientSearchKey.recipientId).liveData) { r, s ->
|
store.update(Recipient.live(recipientSearchKey.recipientId).liveData) { r, s ->
|
||||||
s.copy(
|
s.copy(
|
||||||
recipient = r,
|
recipient = r,
|
||||||
isPreUploadEnabled = shouldPreUpload(s.isMeteredConnection, r)
|
isPreUploadEnabled = shouldPreUpload(s.isMeteredConnection)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -449,8 +449,8 @@ class MediaSelectionViewModel(
|
|||||||
repository.uploadRepository.cancelUpload(media)
|
repository.uploadRepository.cancelUpload(media)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun shouldPreUpload(metered: Boolean, recipient: Recipient?): Boolean {
|
private fun shouldPreUpload(metered: Boolean): Boolean {
|
||||||
return !metered && !repository.isLocalSelfSend(recipient)
|
return !metered
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onSaveState(outState: Bundle) {
|
fun onSaveState(outState: Bundle) {
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ import org.thoughtcrime.securesms.jobmanager.Job;
|
|||||||
import org.thoughtcrime.securesms.jobmanager.JobManager;
|
import org.thoughtcrime.securesms.jobmanager.JobManager;
|
||||||
import org.thoughtcrime.securesms.jobs.AttachmentCompressionJob;
|
import org.thoughtcrime.securesms.jobs.AttachmentCompressionJob;
|
||||||
import org.thoughtcrime.securesms.jobs.AttachmentCopyJob;
|
import org.thoughtcrime.securesms.jobs.AttachmentCopyJob;
|
||||||
import org.thoughtcrime.securesms.jobs.MarkNoteToSelfAttachmentUploadedJob;
|
|
||||||
import org.thoughtcrime.securesms.jobs.AttachmentUploadJob;
|
import org.thoughtcrime.securesms.jobs.AttachmentUploadJob;
|
||||||
import org.thoughtcrime.securesms.jobs.IndividualSendJob;
|
import org.thoughtcrime.securesms.jobs.IndividualSendJob;
|
||||||
import org.thoughtcrime.securesms.jobs.ProfileKeySendJob;
|
import org.thoughtcrime.securesms.jobs.ProfileKeySendJob;
|
||||||
@@ -59,17 +58,14 @@ import org.thoughtcrime.securesms.jobs.PushGroupSendJob;
|
|||||||
import org.thoughtcrime.securesms.jobs.ReactionSendJob;
|
import org.thoughtcrime.securesms.jobs.ReactionSendJob;
|
||||||
import org.thoughtcrime.securesms.jobs.RemoteDeleteSendJob;
|
import org.thoughtcrime.securesms.jobs.RemoteDeleteSendJob;
|
||||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||||
import org.thoughtcrime.securesms.linkpreview.LinkPreview;
|
|
||||||
import org.thoughtcrime.securesms.mediasend.Media;
|
import org.thoughtcrime.securesms.mediasend.Media;
|
||||||
import org.thoughtcrime.securesms.mms.MmsException;
|
import org.thoughtcrime.securesms.mms.MmsException;
|
||||||
import org.thoughtcrime.securesms.mms.OutgoingMessage;
|
import org.thoughtcrime.securesms.mms.OutgoingMessage;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientUtil;
|
import org.thoughtcrime.securesms.recipients.RecipientUtil;
|
||||||
import org.thoughtcrime.securesms.service.ExpiringMessageManager;
|
|
||||||
import org.thoughtcrime.securesms.util.ParcelUtil;
|
import org.thoughtcrime.securesms.util.ParcelUtil;
|
||||||
import org.thoughtcrime.securesms.util.SignalLocalMetrics;
|
import org.thoughtcrime.securesms.util.SignalLocalMetrics;
|
||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
|
||||||
import org.whispersystems.signalservice.api.push.DistributionId;
|
import org.whispersystems.signalservice.api.push.DistributionId;
|
||||||
import org.whispersystems.signalservice.api.util.Preconditions;
|
import org.whispersystems.signalservice.api.util.Preconditions;
|
||||||
|
|
||||||
@@ -78,10 +74,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -203,8 +197,8 @@ public class MessageSender {
|
|||||||
recipient,
|
recipient,
|
||||||
SendType.SIGNAL,
|
SendType.SIGNAL,
|
||||||
messageId,
|
messageId,
|
||||||
jobDependencyIds,
|
jobDependencyIds
|
||||||
false);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMessageSent();
|
onMessageSent();
|
||||||
@@ -240,7 +234,7 @@ public class MessageSender {
|
|||||||
SignalLocalMetrics.IndividualMessageSend.onInsertedIntoDatabase(messageId, metricId);
|
SignalLocalMetrics.IndividualMessageSend.onInsertedIntoDatabase(messageId, metricId);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessageInternal(context, recipient, sendType, messageId, Collections.emptyList(), message.getScheduledDate() > 0);
|
sendMessageInternal(context, recipient, sendType, messageId, Collections.emptyList());
|
||||||
onMessageSent();
|
onMessageSent();
|
||||||
threadTable.update(allocatedThreadId, true, true);
|
threadTable.update(allocatedThreadId, true, true);
|
||||||
|
|
||||||
@@ -282,7 +276,7 @@ public class MessageSender {
|
|||||||
|
|
||||||
attachmentDatabase.updateMessageId(attachmentIds, messageId, message.getStoryType().isStory());
|
attachmentDatabase.updateMessageId(attachmentIds, messageId, message.getStoryType().isStory());
|
||||||
|
|
||||||
sendMessageInternal(context, recipient, SendType.SIGNAL, messageId, jobIds, false);
|
sendMessageInternal(context, recipient, SendType.SIGNAL, messageId, jobIds);
|
||||||
onMessageSent();
|
onMessageSent();
|
||||||
threadTable.update(allocatedThreadId, true, true);
|
threadTable.update(allocatedThreadId, true, true);
|
||||||
|
|
||||||
@@ -398,9 +392,7 @@ public class MessageSender {
|
|||||||
long messageId = messageIds.get(i);
|
long messageId = messageIds.get(i);
|
||||||
Recipient recipient = messages.get(i).getThreadRecipient();
|
Recipient recipient = messages.get(i).getThreadRecipient();
|
||||||
|
|
||||||
if (isLocalSelfSend(context, recipient, SendType.SIGNAL)) {
|
if (recipient.isPushGroup()) {
|
||||||
sendLocalMediaSelf(messageId);
|
|
||||||
} else if (recipient.isPushGroup()) {
|
|
||||||
jobManager.add(new PushGroupSendJob(messageId, recipient.getId(), Collections.emptySet(), true, false), messageDependsOnIds, recipient.getId().toQueueKey());
|
jobManager.add(new PushGroupSendJob(messageId, recipient.getId(), Collections.emptySet(), true, false), messageDependsOnIds, recipient.getId().toQueueKey());
|
||||||
} else if (recipient.isDistributionList()) {
|
} else if (recipient.isDistributionList()) {
|
||||||
jobManager.add(new PushDistributionListSendJob(messageId, recipient.getId(), true, Collections.emptySet()), messageDependsOnIds, recipient.getId().toQueueKey());
|
jobManager.add(new PushDistributionListSendJob(messageId, recipient.getId(), true, Collections.emptySet()), messageDependsOnIds, recipient.getId().toQueueKey());
|
||||||
@@ -415,9 +407,6 @@ public class MessageSender {
|
|||||||
* be enqueued (like in the case of a local self-send).
|
* be enqueued (like in the case of a local self-send).
|
||||||
*/
|
*/
|
||||||
public static @Nullable PreUploadResult preUploadPushAttachment(@NonNull Context context, @NonNull Attachment attachment, @Nullable Recipient recipient, @NonNull Media media) {
|
public static @Nullable PreUploadResult preUploadPushAttachment(@NonNull Context context, @NonNull Attachment attachment, @Nullable Recipient recipient, @NonNull Media media) {
|
||||||
if (isLocalSelfSend(context, recipient, SendType.SIGNAL)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Log.i(TAG, "Pre-uploading attachment for " + (recipient != null ? recipient.getId() : "null"));
|
Log.i(TAG, "Pre-uploading attachment for " + (recipient != null ? recipient.getId() : "null"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -508,7 +497,7 @@ public class MessageSender {
|
|||||||
sendType = SendType.SIGNAL;
|
sendType = SendType.SIGNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessageInternal(context, recipient, sendType, messageId, Collections.emptyList(), false);
|
sendMessageInternal(context, recipient, sendType, messageId, Collections.emptyList());
|
||||||
|
|
||||||
onMessageSent();
|
onMessageSent();
|
||||||
}
|
}
|
||||||
@@ -532,12 +521,9 @@ public class MessageSender {
|
|||||||
Recipient recipient,
|
Recipient recipient,
|
||||||
SendType sendType,
|
SendType sendType,
|
||||||
long messageId,
|
long messageId,
|
||||||
@NonNull Collection<String> uploadJobIds,
|
@NonNull Collection<String> uploadJobIds)
|
||||||
boolean isScheduledSend)
|
|
||||||
{
|
{
|
||||||
if (isLocalSelfSend(context, recipient, sendType) && !isScheduledSend && !SignalStore.backup().backsUpMedia()) {
|
if (recipient.isPushGroup()) {
|
||||||
sendLocalMediaSelf(messageId);
|
|
||||||
} else if (recipient.isPushGroup()) {
|
|
||||||
sendGroupPush(context, recipient, messageId, Collections.emptySet(), uploadJobIds);
|
sendGroupPush(context, recipient, messageId, Collections.emptySet(), uploadJobIds);
|
||||||
} else if (recipient.isDistributionList()) {
|
} else if (recipient.isDistributionList()) {
|
||||||
sendDistributionList(context, recipient, messageId, Collections.emptySet(), uploadJobIds);
|
sendDistributionList(context, recipient, messageId, Collections.emptySet(), uploadJobIds);
|
||||||
@@ -609,64 +595,6 @@ public class MessageSender {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLocalSelfSend(@NonNull Context context, @Nullable Recipient recipient, SendType sendType) {
|
|
||||||
return recipient != null &&
|
|
||||||
recipient.isSelf() &&
|
|
||||||
sendType == SendType.SIGNAL &&
|
|
||||||
SignalStore.account().isRegistered() &&
|
|
||||||
!SignalStore.account().hasLinkedDevices();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void sendLocalMediaSelf(long messageId) {
|
|
||||||
try {
|
|
||||||
ExpiringMessageManager expirationManager = AppDependencies.getExpiringMessageManager();
|
|
||||||
MessageTable mmsDatabase = SignalDatabase.messages();
|
|
||||||
OutgoingMessage message = mmsDatabase.getOutgoingMessage(messageId);
|
|
||||||
SyncMessageId syncId = new SyncMessageId(Recipient.self().getId(), message.getSentTimeMillis());
|
|
||||||
List<Attachment> attachments = new LinkedList<>();
|
|
||||||
|
|
||||||
|
|
||||||
attachments.addAll(message.getAttachments());
|
|
||||||
|
|
||||||
attachments.addAll(Stream.of(message.getLinkPreviews())
|
|
||||||
.map(LinkPreview::getThumbnail)
|
|
||||||
.filter(Optional::isPresent)
|
|
||||||
.map(Optional::get)
|
|
||||||
.toList());
|
|
||||||
|
|
||||||
attachments.addAll(Stream.of(message.getSharedContacts())
|
|
||||||
.map(Contact::getAvatar).withoutNulls()
|
|
||||||
.map(Contact.Avatar::getAttachment).withoutNulls()
|
|
||||||
.toList());
|
|
||||||
|
|
||||||
List<AttachmentCompressionJob> compressionJobs = Stream.of(attachments)
|
|
||||||
.map(a -> AttachmentCompressionJob.fromAttachment((DatabaseAttachment) a, false, -1))
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
List<MarkNoteToSelfAttachmentUploadedJob> fakeUploadJobs = Stream.of(attachments)
|
|
||||||
.map(a -> new MarkNoteToSelfAttachmentUploadedJob(messageId, ((DatabaseAttachment) a).attachmentId))
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
AppDependencies.getJobManager().startChain(compressionJobs)
|
|
||||||
.then(fakeUploadJobs)
|
|
||||||
.enqueue();
|
|
||||||
|
|
||||||
mmsDatabase.markAsSent(messageId, true);
|
|
||||||
mmsDatabase.markUnidentified(messageId, true);
|
|
||||||
|
|
||||||
mmsDatabase.incrementDeliveryReceiptCount(message.getSentTimeMillis(), Recipient.self().getId(), System.currentTimeMillis());
|
|
||||||
mmsDatabase.incrementReadReceiptCount(message.getSentTimeMillis(), Recipient.self().getId(), System.currentTimeMillis());
|
|
||||||
mmsDatabase.incrementViewedReceiptCount(message.getSentTimeMillis(), Recipient.self().getId(), System.currentTimeMillis());
|
|
||||||
|
|
||||||
if (message.getExpiresIn() > 0 && !message.isExpirationUpdate()) {
|
|
||||||
mmsDatabase.markExpireStarted(messageId);
|
|
||||||
expirationManager.scheduleDeletion(messageId, true, message.getExpiresIn());
|
|
||||||
}
|
|
||||||
} catch (NoSuchMessageException | MmsException e) {
|
|
||||||
Log.w(TAG, "Failed to update self-sent message.", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class PreUploadResult implements Parcelable {
|
public static class PreUploadResult implements Parcelable {
|
||||||
private final Media media;
|
private final Media media;
|
||||||
private final AttachmentId attachmentId;
|
private final AttachmentId attachmentId;
|
||||||
|
|||||||
Reference in New Issue
Block a user