Add MessageSender

textsecure.MessageSender takes server url and credentials and returns
a message sending interface configured for that server.

Used a wrapper function to insert a TextSecureServer instance into
sendmessage.js code at runtime. This will result in function duplication
between different MessageSender objects, pending further refactoring to
use prototypal inheritence.

// FREEBIE
This commit is contained in:
lilia 2015-08-28 14:45:44 -07:00
parent 98aa5156b0
commit 9e9d767a30
3 changed files with 775 additions and 766 deletions

View file

@ -102,6 +102,7 @@
messageReceiver.addEventListener('contactsync', onContactSyncComplete);
window.textsecure.messaging = new textsecure.MessageSender(SERVER_URL, USERNAME, PASSWORD);
if (firstRun === true && textsecure.storage.user.getDeviceId() != '1') {
textsecure.messaging.sendRequestContactSyncMessage().then(function() {
textsecure.messaging.sendRequestGroupSyncMessage();