App loading screen: show messages processed so far

Also, show the same loading screen on index.js before we've bootstrapped
the app.

FREEBIE
This commit is contained in:
Scott Nonnenberg 2017-07-25 16:00:06 -07:00
parent e36aa524c9
commit 305bd6b3b8
10 changed files with 110 additions and 25 deletions

View file

@ -38245,6 +38245,8 @@ var TextSecureServer = (function() {
*/
function MessageReceiver(url, ports, username, password, signalingKey) {
this.count = 0;
this.url = url;
this.signalingKey = signalingKey;
this.username = username;
@ -38357,11 +38359,23 @@ MessageReceiver.prototype.extend({
}.bind(this);
var scheduleDispatch = function() {
// resetting count to zero so everything queued after this starts over again
this.count = 0;
this.pending = this.pending.then(dispatchEmpty, dispatchEmpty);
}.bind(this);
Promise.all(incoming).then(scheduleDispatch, scheduleDispatch);
},
updateProgress: function(count) {
// count by 10s
if (count % 10 !== 0) {
return;
}
var ev = new Event('progress');
ev.count = count;
this.dispatchEvent(ev);
},
queueAllCached: function() {
this.getAllFromCache().then(function(items) {
for (var i = 0, max = items.length; i < max; i += 1) {
@ -38446,6 +38460,7 @@ MessageReceiver.prototype.extend({
return textsecure.storage.unprocessed.remove(id);
},
queueDecryptedEnvelope: function(envelope, plaintext) {
var count = this.count += 1;
var id = this.getEnvelopeId(envelope);
console.log('queueing decrypted envelope', id);
@ -38454,11 +38469,14 @@ MessageReceiver.prototype.extend({
this.pending = this.pending.then(taskWithTimeout, taskWithTimeout);
return this.pending.catch(function(error) {
return this.pending.then(function() {
this.updateProgress(count);
}.bind(this), function(error) {
console.log('queueDecryptedEnvelope error handling envelope', id, ':', error && error.stack ? error.stack : error);
});
},
queueEnvelope: function(envelope) {
var count = this.count += 1;
var id = this.getEnvelopeId(envelope);
console.log('queueing envelope', id);
@ -38467,7 +38485,9 @@ MessageReceiver.prototype.extend({
this.pending = this.pending.then(taskWithTimeout, taskWithTimeout);
return this.pending.catch(function(error) {
return this.pending.then(function() {
this.updateProgress(count);
}.bind(this), function(error) {
console.log('queueEnvelope error handling envelope', id, ':', error && error.stack ? error.stack : error);
});
},