Sync expirationStartTimestamp on outgoing messages
Linked devices need to know when to start the clock.
This commit is contained in:
@@ -38996,7 +38996,7 @@ MessageSender.prototype = {
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
sendSyncMessage: function(encodedDataMessage, timestamp, destination) {
|
||||
sendSyncMessage: function(encodedDataMessage, timestamp, destination, expirationStartTimestamp) {
|
||||
var myNumber = textsecure.storage.user.getNumber();
|
||||
var myDevice = textsecure.storage.user.getDeviceId();
|
||||
if (myDevice == 1) {
|
||||
@@ -39010,6 +39010,9 @@ MessageSender.prototype = {
|
||||
if (destination) {
|
||||
sentMessage.destination = destination;
|
||||
}
|
||||
if (expirationStartTimestamp) {
|
||||
sentMessage.expirationStartTimestamp = expirationStartTimestamp;
|
||||
}
|
||||
var syncMessage = new textsecure.protobuf.SyncMessage();
|
||||
syncMessage.sent = sentMessage;
|
||||
var contentMessage = new textsecure.protobuf.Content();
|
||||
|
@@ -155,13 +155,15 @@
|
||||
send: function(promise) {
|
||||
this.trigger('pending');
|
||||
return promise.then(function(result) {
|
||||
var now = Date.now();
|
||||
this.trigger('done');
|
||||
if (result.dataMessage) {
|
||||
this.set({dataMessage: result.dataMessage});
|
||||
}
|
||||
this.save({sent: true});
|
||||
this.save({sent: true, expirationStartTimestamp: now});
|
||||
this.sendSyncMessage();
|
||||
}.bind(this)).catch(function(result) {
|
||||
var now = Date.now();
|
||||
this.trigger('done');
|
||||
if (result.dataMessage) {
|
||||
this.set({dataMessage: result.dataMessage});
|
||||
@@ -172,7 +174,7 @@
|
||||
} else {
|
||||
this.saveErrors(result.errors);
|
||||
if (result.successfulNumbers.length > 0) {
|
||||
this.set({sent: true});
|
||||
this.set({sent: true, expirationStartTimestamp: now});
|
||||
this.sendSyncMessage();
|
||||
}
|
||||
}
|
||||
@@ -188,7 +190,7 @@
|
||||
return;
|
||||
}
|
||||
return textsecure.messaging.sendSyncMessage(
|
||||
dataMessage, this.get('sent_at'), this.get('destination')
|
||||
dataMessage, this.get('sent_at'), this.get('destination'), this.get('expirationStartTimestamp')
|
||||
).then(function() {
|
||||
this.save({synced: true, dataMessage: null});
|
||||
}.bind(this));
|
||||
|
@@ -203,7 +203,7 @@ MessageSender.prototype = {
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
sendSyncMessage: function(encodedDataMessage, timestamp, destination) {
|
||||
sendSyncMessage: function(encodedDataMessage, timestamp, destination, expirationStartTimestamp) {
|
||||
var myNumber = textsecure.storage.user.getNumber();
|
||||
var myDevice = textsecure.storage.user.getDeviceId();
|
||||
if (myDevice == 1) {
|
||||
@@ -217,6 +217,9 @@ MessageSender.prototype = {
|
||||
if (destination) {
|
||||
sentMessage.destination = destination;
|
||||
}
|
||||
if (expirationStartTimestamp) {
|
||||
sentMessage.expirationStartTimestamp = expirationStartTimestamp;
|
||||
}
|
||||
var syncMessage = new textsecure.protobuf.SyncMessage();
|
||||
syncMessage.sent = sentMessage;
|
||||
var contentMessage = new textsecure.protobuf.Content();
|
||||
|
Reference in New Issue
Block a user