Move message saving out of helpers.js
This commit is contained in:
parent
3bd559bbaa
commit
be82547ea1
2 changed files with 3 additions and 6 deletions
|
@ -21,6 +21,7 @@ textsecure.registerOnLoadFunction(function() {
|
||||||
} else {
|
} else {
|
||||||
if (isRegistrationDone()) {
|
if (isRegistrationDone()) {
|
||||||
textsecure.subscribeToPush(function(message) {
|
textsecure.subscribeToPush(function(message) {
|
||||||
|
Whisper.Messages.addIncomingMessage(message);
|
||||||
console.log("Got message from " + message.pushMessage.source + "." + message.pushMessage.sourceDevice +
|
console.log("Got message from " + message.pushMessage.source + "." + message.pushMessage.sourceDevice +
|
||||||
': "' + getString(message.message.body) + '"');
|
': "' + getString(message.message.body) + '"');
|
||||||
var newUnreadCount = storage.getUnencrypted("unreadCount", 0) + 1;
|
var newUnreadCount = storage.getUnencrypted("unreadCount", 0) + 1;
|
||||||
|
|
|
@ -469,13 +469,9 @@ window.textsecure.subscribeToPush = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var promises = [];
|
var promises = [];
|
||||||
for (var i = 0; i < decrypted.message.attachments.length; i++) {
|
for (var i = 0; i < decrypted.message.attachments.length; i++)
|
||||||
promises[i] = handleAttachment(decrypted.message.attachments[i]);
|
promises[i] = handleAttachment(decrypted.message.attachments[i]);
|
||||||
}
|
return Promise.all(promises).then(message_callback);
|
||||||
return Promise.all(promises).then(function() {
|
|
||||||
Whisper.Messages.addIncomingMessage(decrypted);
|
|
||||||
message_callback(decrypted);
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
}).catch(function(e) {
|
}).catch(function(e) {
|
||||||
console.log("Error handling incoming message: ");
|
console.log("Error handling incoming message: ");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue