Move Whisper.events out of views and tests

This commit is contained in:
lilia 2017-04-21 13:21:18 -07:00
parent a1c7369347
commit 40af226a4a
6 changed files with 13 additions and 6 deletions

View file

@ -324,5 +324,16 @@
} }
}; };
Whisper.events.on('unauthorized', function() {
if (owsDesktopApp.inboxView) {
owsDesktopApp.inboxView.networkStatusView.update();
}
});
Whisper.events.on('reconnectTimer', function() {
if (owsDesktopApp.inboxView) {
owsDesktopApp.inboxView.networkStatusView.setSocketReconnectInterval(60000);
}
});
})(); })();

View file

@ -15,7 +15,9 @@
installView.hideDots(); installView.hideDots();
} }
installView.$el.show(); installView.$el.show();
Whisper.events.on('contactsync:begin', installView.showSync, installView);
Whisper.events.on('contactsync', function() { Whisper.events.on('contactsync', function() {
installView.close();
bg.openInbox(); bg.openInbox();
window.close(); window.close();
}); });

View file

@ -49,8 +49,6 @@
this.$('#step1').show(); this.$('#step1').show();
this.connect(); this.connect();
this.on('disconnected', this.reconnect); this.on('disconnected', this.reconnect);
this.listenTo(Whisper.events, 'contactsync:begin', this.showSync);
this.listenTo(Whisper.events, 'contactsync', this.close);
}, },
connect: function() { connect: function() {
this.clearQR(); this.clearQR();

View file

@ -19,8 +19,6 @@
window.addEventListener('online', this.update.bind(this)); window.addEventListener('online', this.update.bind(this));
window.addEventListener('offline', this.update.bind(this)); window.addEventListener('offline', this.update.bind(this));
Whisper.events.on('unauthorized', this.update, this);
Whisper.events.on('reconnectTimer', this.onReconnectTimer, this);
this.model = new Backbone.Model(); this.model = new Backbone.Model();
this.listenTo(this.model, 'change', this.onChange); this.listenTo(this.model, 'change', this.onChange);

View file

@ -45,7 +45,6 @@ window.assert = chai.assert;
window.Whisper = window.Whisper || {}; window.Whisper = window.Whisper || {};
window.Whisper.Database = window.Whisper.Database || {}; window.Whisper.Database = window.Whisper.Database || {};
Whisper.Database.id = 'test'; Whisper.Database.id = 'test';
Whisper.events = _.clone(Backbone.Events);
/* /*
* global helpers for tests * global helpers for tests

View file

@ -12257,7 +12257,6 @@ window.assert = chai.assert;
window.Whisper = window.Whisper || {}; window.Whisper = window.Whisper || {};
window.Whisper.Database = window.Whisper.Database || {}; window.Whisper.Database = window.Whisper.Database || {};
Whisper.Database.id = 'test'; Whisper.Database.id = 'test';
Whisper.events = _.clone(Backbone.Events);
/* /*
* global helpers for tests * global helpers for tests