Visuals for embedded contacts as well as contact detail screen

This commit is contained in:
Scott Nonnenberg
2018-05-02 19:43:23 -07:00
parent 3ea3e4e256
commit 41be7f126b
17 changed files with 1323 additions and 2 deletions

View File

@@ -146,6 +146,16 @@
'reply',
this.setQuoteMessage
);
this.listenTo(
this.model.messageCollection,
'show-contact-detail',
this.showContactDetail
);
this.listenTo(
this.model.messageCollection,
'open-conversation',
this.openConversation
);
this.lazyUpdateVerified = _.debounce(
this.model.updateVerified.bind(this.model),
@@ -996,6 +1006,41 @@
this.listenBack(view);
},
showContactDetail(contact) {
console.log('showContactDetail', contact); // TODO
// TODO: need to run contact through selector to format email, get absolute path
// think it's probably time to move it to typescript
const view = new Whisper.ReactWrapperView({
Component: Signal.Components.MediaGallery,
props: {
contact,
hasSignalAccount: true,
onSendMessage: () => {
const number =
contact.number && contact.number[0] && contact.number[0].value;
if (number) {
this.openConversation(number);
}
},
},
onClose: () => this.resetPanel(),
});
this.listenBack(view);
},
async openConversation(number) {
console.log('openConversation', number); // TODO
const conversation = await window.ConversationController.getOrCreateAndWait(
number,
'private'
);
window.Whisper.Events.trigger('click', conversation);
},
listenBack(view) {
this.panels = this.panels || [];
if (this.panels.length > 0) {