From 1e1b87bbbdd82c9591b40443719d38287b663393 Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 17 Feb 2016 10:46:29 -0800 Subject: [PATCH] Add session store logging // FREEBIE --- js/axolotl_store.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/axolotl_store.js b/js/axolotl_store.js index bc2d692c..e9e67217 100644 --- a/js/axolotl_store.js +++ b/js/axolotl_store.js @@ -167,17 +167,21 @@ }, getSession: function(encodedNumber) { + console.log('getSession', encodedNumber); if (encodedNumber === null || encodedNumber === undefined) throw new Error("Tried to get session for undefined/null number"); return new Promise(function(resolve) { var session = new Session({id: encodedNumber}); + console.log('fetching session for', encodedNumber); session.fetch().always(function() { + console.log('returned session for', encodedNumber); resolve(session.get('record')); }); }); }, putSession: function(encodedNumber, record) { + console.log('putSession', encodedNumber); if (encodedNumber === null || encodedNumber === undefined) throw new Error("Tried to put session for undefined/null number"); return new Promise(function(resolve) { @@ -185,12 +189,17 @@ var deviceId = parseInt(textsecure.utils.unencodeNumber(encodedNumber)[1]); var session = new Session({id: encodedNumber}); + console.log('fetching session for', encodedNumber); session.fetch().always(function() { + console.log('saving session for', encodedNumber); session.save({ record: record, deviceId: deviceId, number: number - }).always(resolve); + }).always(function() { + console.log('saved session for', encodedNumber); + resolve(); + }); }); }); },