Get standalone registration working in development

Whisper.events.trigger('openStandalone') to open the standalone
registration view.

// FREEBIE
This commit is contained in:
lilia 2017-04-19 10:34:19 -07:00 committed by Scott Nonnenberg
parent e60111f34d
commit de3816b094
No known key found for this signature in database
GPG key ID: A4931C09644C654B
7 changed files with 185 additions and 126 deletions

View file

@ -8,28 +8,41 @@
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);
},
openView: function(view) {
this.el.innerHTML = "";
this.el.append(view.el);
},
openInstaller: function() {
this.closeInstaller();
this.installView = new Whisper.InstallView();
if (Whisper.Registration.everDone()) {
this.installView.selectStep(3);
this.installView.hideDots();
}
this.el.innerHTML = "";
this.el.append(this.installView.el);
this.openView(this.installView);
},
openStandaloneInstaller: function() {
this.closeInstaller();
this.installView = new Whisper.StandaloneRegistrationView();
this.openView(this.installView);
},
closeInstaller: function() {
if (this.installView) {
this.installView.remove();
this.installView = null;
}
},
openInbox: function(options) {
options = options || {};
_.defaults(options, {initialLoadComplete: false});
console.log('open inbox');
if (this.installView) {
this.installView.remove();
this.installView = null;
}
this.closeInstaller();
if (!this.inboxView) {
return ConversationController.loadPromise().then(function() {
@ -38,13 +51,11 @@
window: window,
initialLoadComplete: initialLoadComplete
});
this.el.innerHTML = "";
this.el.append(this.inboxView.el);
this.openView(this.inboxView);
}.bind(this));
} else {
if (!$.contains(this.$el, this.inboxView.$el)) {
this.el.innerHTML = "";
this.el.append(this.inboxView.el);
this.openView(this.inboxView);
}
window.focus(); // FIXME
return Promise.resolve();