Add session store logging
// FREEBIE
This commit is contained in:
parent
1bd0855d93
commit
1e1b87bbbd
1 changed files with 10 additions and 1 deletions
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue