Add expiration time to group update requests.

This commit is contained in:
Greyson Parrelli 2018-06-22 11:29:16 -07:00
parent b5d4cac90a
commit b39a7ac939

View File

@ -11,6 +11,7 @@ import org.thoughtcrime.securesms.database.GroupDatabase.GroupRecord;
import org.thoughtcrime.securesms.dependencies.InjectableType; import org.thoughtcrime.securesms.dependencies.InjectableType;
import org.thoughtcrime.securesms.jobmanager.JobParameters; import org.thoughtcrime.securesms.jobmanager.JobParameters;
import org.thoughtcrime.securesms.jobmanager.requirements.NetworkRequirement; import org.thoughtcrime.securesms.jobmanager.requirements.NetworkRequirement;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.GroupUtil; import org.thoughtcrime.securesms.util.GroupUtil;
import org.whispersystems.libsignal.util.guava.Optional; import org.whispersystems.libsignal.util.guava.Optional;
import org.whispersystems.signalservice.api.SignalServiceMessageSender; import org.whispersystems.signalservice.api.SignalServiceMessageSender;
@ -88,9 +89,13 @@ public class PushGroupUpdateJob extends ContextJob implements InjectableType {
.withName(record.get().getTitle()) .withName(record.get().getTitle())
.build(); .build();
Address groupAddress = Address.fromSerialized(GroupUtil.getEncodedId(groupId, false));
Recipient groupRecipient = Recipient.from(context, groupAddress, false);
SignalServiceDataMessage message = SignalServiceDataMessage.newBuilder() SignalServiceDataMessage message = SignalServiceDataMessage.newBuilder()
.asGroupMessage(groupContext) .asGroupMessage(groupContext)
.withTimestamp(System.currentTimeMillis()) .withTimestamp(System.currentTimeMillis())
.withExpiration(groupRecipient.getExpireMessages())
.build(); .build();
messageSender.sendMessage(new SignalServiceAddress(source), message); messageSender.sendMessage(new SignalServiceAddress(source), message);