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);
|
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.WallClockListener.init(Whisper.events);
|
||||||
Whisper.RotateSignedPreKeyListener.init(Whisper.events);
|
Whisper.RotateSignedPreKeyListener.init(Whisper.events);
|
||||||
|
@ -87,6 +87,14 @@
|
||||||
appView.inboxView.networkStatusView.setSocketReconnectInterval(60000);
|
appView.inboxView.networkStatusView.setSocketReconnectInterval(60000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
[
|
||||||
|
'openInbox',
|
||||||
|
'openInstaller',
|
||||||
|
'openConversation',
|
||||||
|
'openStandalone'
|
||||||
|
].forEach(function(eventName) {
|
||||||
|
appView.listenTo(Whisper.events, eventName, appView[eventName]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
window.getSyncRequest = function() {
|
window.getSyncRequest = function() {
|
||||||
|
|
|
@ -7,15 +7,15 @@
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
this.inboxView = null;
|
this.inboxView = null;
|
||||||
this.installView = null;
|
this.installView = null;
|
||||||
this.events = options.events;
|
},
|
||||||
this.events.on('openStandalone', this.openStandaloneInstaller, this);
|
events: {
|
||||||
this.events.on('openConversation', this.openConversation, this);
|
'openInstaller': 'openInstaller',
|
||||||
this.events.on('openInstaller', this.openInstaller, this);
|
'openInbox': 'openInbox',
|
||||||
this.events.on('openInbox', this.openInbox, this);
|
|
||||||
},
|
},
|
||||||
openView: function(view) {
|
openView: function(view) {
|
||||||
this.el.innerHTML = "";
|
this.el.innerHTML = "";
|
||||||
this.el.append(view.el);
|
this.el.append(view.el);
|
||||||
|
this.delegateEvents();
|
||||||
},
|
},
|
||||||
openInstaller: function() {
|
openInstaller: function() {
|
||||||
this.closeInstaller();
|
this.closeInstaller();
|
||||||
|
@ -26,10 +26,12 @@
|
||||||
}
|
}
|
||||||
this.openView(this.installView);
|
this.openView(this.installView);
|
||||||
},
|
},
|
||||||
openStandaloneInstaller: function() {
|
openStandalone: function() {
|
||||||
|
if (window.config.environment !== 'production') {
|
||||||
this.closeInstaller();
|
this.closeInstaller();
|
||||||
this.installView = new Whisper.StandaloneRegistrationView();
|
this.installView = new Whisper.StandaloneRegistrationView();
|
||||||
this.openView(this.installView);
|
this.openView(this.installView);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
closeInstaller: function() {
|
closeInstaller: function() {
|
||||||
if (this.installView) {
|
if (this.installView) {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
'click .openInstaller': 'openInstaller'
|
'click .openInstaller': 'openInstaller'
|
||||||
},
|
},
|
||||||
openInstaller: function() {
|
openInstaller: function() {
|
||||||
Whisper.events.trigger('openInstaller');
|
this.$el.trigger('openInstaller');
|
||||||
},
|
},
|
||||||
onReconnectTimer: function() {
|
onReconnectTimer: function() {
|
||||||
this.setSocketReconnectInterval(60000);
|
this.setSocketReconnectInterval(60000);
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
var verificationCode = $('#code').val().replace(/\D+/g, "");
|
var verificationCode = $('#code').val().replace(/\D+/g, "");
|
||||||
|
|
||||||
this.accountManager.registerSingleDevice(number, verificationCode).then(function() {
|
this.accountManager.registerSingleDevice(number, verificationCode).then(function() {
|
||||||
Whisper.events.trigger('openInbox');
|
this.$el.trigger('openInbox');
|
||||||
}).catch(this.log.bind(this));
|
}.bind(this)).catch(this.log.bind(this));
|
||||||
},
|
},
|
||||||
log: function (s) {
|
log: function (s) {
|
||||||
console.log(s);
|
console.log(s);
|
||||||
|
|
Loading…
Reference in a new issue