From 11bf0a06a8e9f0b06d10b60ed6bd64c5d8e414ef Mon Sep 17 00:00:00 2001 From: charles Date: Wed, 23 Nov 2022 11:20:30 +1100 Subject: [PATCH] Update expiration type proto --- .../messaging/jobs/DisappearingMessagesJob.kt | 2 +- .../ReceivedMessageHandler.kt | 2 ++ libsignal/protobuf/SignalService.proto | 4 +-- .../libsignal/protos/SignalServiceProtos.java | 32 +++++++++---------- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/libsession/src/main/java/org/session/libsession/messaging/jobs/DisappearingMessagesJob.kt b/libsession/src/main/java/org/session/libsession/messaging/jobs/DisappearingMessagesJob.kt index 50f9c9e22b..21106feddc 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/jobs/DisappearingMessagesJob.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/jobs/DisappearingMessagesJob.kt @@ -8,7 +8,7 @@ import org.session.libsession.messaging.utilities.Data import org.session.libsession.snode.SnodeAPI import org.session.libsession.utilities.Address -class DisappearingMessagesJob(val messageIds: LongArray, val startedAtMs: Long): Job { +class DisappearingMessagesJob(val messageIds: LongArray = longArrayOf(), val startedAtMs: Long = 0): Job { override var delegate: JobDelegate? = null override var id: String? = null diff --git a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt index 5249772f08..b55a30029d 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt @@ -4,6 +4,7 @@ import android.text.TextUtils import org.session.libsession.avatars.AvatarHelper import org.session.libsession.messaging.MessagingModuleConfiguration import org.session.libsession.messaging.jobs.BackgroundGroupAddJob +import org.session.libsession.messaging.jobs.DisappearingMessagesJob import org.session.libsession.messaging.jobs.JobQueue import org.session.libsession.messaging.messages.ExpirationConfiguration import org.session.libsession.messaging.messages.Message @@ -78,6 +79,7 @@ fun MessageReceiver.handle(message: Message, proto: SignalServiceProtos.Content, is CallMessage -> handleCallMessage(message) is SyncedExpiriesMessage -> handleSyncedExpiriesMessage(message) } + JobQueue.shared.add(DisappearingMessagesJob()) } fun updateExpirationConfigurationIfNeeded(message: Message, proto: SignalServiceProtos.Content, openGroupID: String?) { diff --git a/libsignal/protobuf/SignalService.proto b/libsignal/protobuf/SignalService.proto index 841a871db2..ff044e60a0 100644 --- a/libsignal/protobuf/SignalService.proto +++ b/libsignal/protobuf/SignalService.proto @@ -44,8 +44,8 @@ message UnsendRequest { message Content { enum ExpirationType { - DELETE_AFTER_SEND = 1; - DELETE_AFTER_READ = 2; + DELETE_AFTER_READ = 1; + DELETE_AFTER_SEND = 2; } optional DataMessage dataMessage = 1; diff --git a/libsignal/src/main/java/org/session/libsignal/protos/SignalServiceProtos.java b/libsignal/src/main/java/org/session/libsignal/protos/SignalServiceProtos.java index e293dc9d6e..b118a5af4d 100644 --- a/libsignal/src/main/java/org/session/libsignal/protos/SignalServiceProtos.java +++ b/libsignal/src/main/java/org/session/libsignal/protos/SignalServiceProtos.java @@ -2747,31 +2747,31 @@ public final class SignalServiceProtos { public enum ExpirationType implements com.google.protobuf.ProtocolMessageEnum { /** - * DELETE_AFTER_SEND = 1; + * DELETE_AFTER_READ = 1; */ - DELETE_AFTER_SEND(0, 1), + DELETE_AFTER_READ(0, 1), /** - * DELETE_AFTER_READ = 2; + * DELETE_AFTER_SEND = 2; */ - DELETE_AFTER_READ(1, 2), + DELETE_AFTER_SEND(1, 2), ; /** - * DELETE_AFTER_SEND = 1; + * DELETE_AFTER_READ = 1; */ - public static final int DELETE_AFTER_SEND_VALUE = 1; + public static final int DELETE_AFTER_READ_VALUE = 1; /** - * DELETE_AFTER_READ = 2; + * DELETE_AFTER_SEND = 2; */ - public static final int DELETE_AFTER_READ_VALUE = 2; + public static final int DELETE_AFTER_SEND_VALUE = 2; public final int getNumber() { return value; } public static ExpirationType valueOf(int value) { switch (value) { - case 1: return DELETE_AFTER_SEND; - case 2: return DELETE_AFTER_READ; + case 1: return DELETE_AFTER_READ; + case 2: return DELETE_AFTER_SEND; default: return null; } } @@ -3079,7 +3079,7 @@ public final class SignalServiceProtos { dataExtractionNotification_ = org.session.libsignal.protos.SignalServiceProtos.DataExtractionNotification.getDefaultInstance(); unsendRequest_ = org.session.libsignal.protos.SignalServiceProtos.UnsendRequest.getDefaultInstance(); messageRequestResponse_ = org.session.libsignal.protos.SignalServiceProtos.MessageRequestResponse.getDefaultInstance(); - expirationType_ = org.session.libsignal.protos.SignalServiceProtos.Content.ExpirationType.DELETE_AFTER_SEND; + expirationType_ = org.session.libsignal.protos.SignalServiceProtos.Content.ExpirationType.DELETE_AFTER_READ; expirationTimer_ = 0; lastDisappearingMessageChangeTimestamp_ = 0L; syncedExpiries_ = org.session.libsignal.protos.SignalServiceProtos.SyncedExpiries.getDefaultInstance(); @@ -3416,7 +3416,7 @@ public final class SignalServiceProtos { messageRequestResponseBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000080); - expirationType_ = org.session.libsignal.protos.SignalServiceProtos.Content.ExpirationType.DELETE_AFTER_SEND; + expirationType_ = org.session.libsignal.protos.SignalServiceProtos.Content.ExpirationType.DELETE_AFTER_READ; bitField0_ = (bitField0_ & ~0x00000100); expirationTimer_ = 0; bitField0_ = (bitField0_ & ~0x00000200); @@ -4610,7 +4610,7 @@ public final class SignalServiceProtos { } // optional .signalservice.Content.ExpirationType expirationType = 11; - private org.session.libsignal.protos.SignalServiceProtos.Content.ExpirationType expirationType_ = org.session.libsignal.protos.SignalServiceProtos.Content.ExpirationType.DELETE_AFTER_SEND; + private org.session.libsignal.protos.SignalServiceProtos.Content.ExpirationType expirationType_ = org.session.libsignal.protos.SignalServiceProtos.Content.ExpirationType.DELETE_AFTER_READ; /** * optional .signalservice.Content.ExpirationType expirationType = 11; */ @@ -4640,7 +4640,7 @@ public final class SignalServiceProtos { */ public Builder clearExpirationType() { bitField0_ = (bitField0_ & ~0x00000100); - expirationType_ = org.session.libsignal.protos.SignalServiceProtos.Content.ExpirationType.DELETE_AFTER_SEND; + expirationType_ = org.session.libsignal.protos.SignalServiceProtos.Content.ExpirationType.DELETE_AFTER_READ; onChanged(); return this; } @@ -28645,8 +28645,8 @@ public final class SignalServiceProtos { "\022.\n&lastDisappearingMessageChangeTimesta" + "mp\030\r \001(\004\0225\n\016syncedExpiries\030\016 \001(\0132\035.signa" + "lservice.SyncedExpiries\">\n\016ExpirationTyp" + - "e\022\025\n\021DELETE_AFTER_SEND\020\001\022\025\n\021DELETE_AFTER" + - "_READ\020\002\"\265\002\n\016SyncedExpiries\022V\n\024conversati", + "e\022\025\n\021DELETE_AFTER_READ\020\001\022\025\n\021DELETE_AFTER" + + "_SEND\020\002\"\265\002\n\016SyncedExpiries\022V\n\024conversati", "onExpiries\030\001 \003(\01328.signalservice.SyncedE" + "xpiries.SyncedConversationExpiries\032\312\001\n\032S" + "yncedConversationExpiries\022\022\n\nsyncTarget\030" +