Collect references to Whisper.events
Fixup // FREEBIE
This commit is contained in:
parent
f7c7e2251d
commit
a2e0fa59c1
4 changed files with 23 additions and 13 deletions
|
@ -65,7 +65,7 @@
|
|||
init(true);
|
||||
});
|
||||
|
||||
var appView = window.owsDesktopApp.appView = new Whisper.AppView({el: $('body'), events: Whisper.events});
|
||||
var appView = window.owsDesktopApp.appView = new Whisper.AppView({el: $('body')});
|
||||
|
||||
Whisper.WallClockListener.init(Whisper.events);
|
||||
Whisper.RotateSignedPreKeyListener.init(Whisper.events);
|
||||
|
@ -87,6 +87,14 @@
|
|||
appView.inboxView.networkStatusView.setSocketReconnectInterval(60000);
|
||||
});
|
||||
|
||||
[
|
||||
'openInbox',
|
||||
'openInstaller',
|
||||
'openConversation',
|
||||
'openStandalone'
|
||||
].forEach(function(eventName) {
|
||||
appView.listenTo(Whisper.events, eventName, appView[eventName]);
|
||||
});
|
||||
});
|
||||
|
||||
window.getSyncRequest = function() {
|
||||
|
|
|
@ -7,15 +7,15 @@
|
|||
initialize: function(options) {
|
||||
this.inboxView = null;
|
||||
this.installView = null;
|
||||
this.events = options.events;
|
||||
this.events.on('openStandalone', this.openStandaloneInstaller, this);
|
||||
this.events.on('openConversation', this.openConversation, this);
|
||||
this.events.on('openInstaller', this.openInstaller, this);
|
||||
this.events.on('openInbox', this.openInbox, this);
|
||||
},
|
||||
events: {
|
||||
'openInstaller': 'openInstaller',
|
||||
'openInbox': 'openInbox',
|
||||
},
|
||||
openView: function(view) {
|
||||
this.el.innerHTML = "";
|
||||
this.el.append(view.el);
|
||||
this.delegateEvents();
|
||||
},
|
||||
openInstaller: function() {
|
||||
this.closeInstaller();
|
||||
|
@ -26,10 +26,12 @@
|
|||
}
|
||||
this.openView(this.installView);
|
||||
},
|
||||
openStandaloneInstaller: function() {
|
||||
this.closeInstaller();
|
||||
this.installView = new Whisper.StandaloneRegistrationView();
|
||||
this.openView(this.installView);
|
||||
openStandalone: function() {
|
||||
if (window.config.environment !== 'production') {
|
||||
this.closeInstaller();
|
||||
this.installView = new Whisper.StandaloneRegistrationView();
|
||||
this.openView(this.installView);
|
||||
}
|
||||
},
|
||||
closeInstaller: function() {
|
||||
if (this.installView) {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
'click .openInstaller': 'openInstaller'
|
||||
},
|
||||
openInstaller: function() {
|
||||
Whisper.events.trigger('openInstaller');
|
||||
this.$el.trigger('openInstaller');
|
||||
},
|
||||
onReconnectTimer: function() {
|
||||
this.setSocketReconnectInterval(60000);
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
var verificationCode = $('#code').val().replace(/\D+/g, "");
|
||||
|
||||
this.accountManager.registerSingleDevice(number, verificationCode).then(function() {
|
||||
Whisper.events.trigger('openInbox');
|
||||
}).catch(this.log.bind(this));
|
||||
this.$el.trigger('openInbox');
|
||||
}.bind(this)).catch(this.log.bind(this));
|
||||
},
|
||||
log: function (s) {
|
||||
console.log(s);
|
||||
|
|
Loading…
Reference in a new issue