A few fixes for the contact detail screen (#2374)

* Only show 'send message' on contact detail when user has account

* Make contact detail headers visible in dark mode

* Fix vertical scrolling for very large contact in detail pane

* Fix a couple comment typos
This commit is contained in:
Scott Nonnenberg 2018-05-23 12:15:46 -07:00 committed by GitHub
parent 84759d813e
commit d54aedcefa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 8 deletions

View file

@ -1007,19 +1007,20 @@
this.listenBack(view);
},
showContactDetail(contact) {
showContactDetail({ contact, hasSignalAccount }) {
const regionCode = storage.get('regionCode');
const { contactSelector } = Signal.Types.Contact;
const { getAbsoluteAttachmentPath } = window.Signal.Migrations;
const view = new Whisper.ReactWrapperView({
Component: Signal.Components.ContactDetail,
className: 'contact-detail-pane panel',
props: {
contact: contactSelector(contact, {
regionCode,
getAbsoluteAttachmentPath,
}),
hasSignalAccount: true,
hasSignalAccount,
onSendMessage: () => {
const number =
contact.number && contact.number[0] && contact.number[0].value;

View file

@ -457,15 +457,27 @@
contact.number && contact.number[0] && contact.number[0].value;
const haveConversation =
number && Boolean(window.ConversationController.get(number));
const hasLocalSignalAccount = number && haveConversation;
const hasLocalSignalAccount =
this.contactHasSignalAccount || (number && haveConversation);
// We store this value on this. because a re-render shouldn't kick off another
// profile check, going to the web.
this.contactHasSignalAccount = hasLocalSignalAccount;
const onSendMessage = number
? () => {
this.model.trigger('open-conversation', number);
}
: null;
const onOpenContact = () => {
this.model.trigger('show-contact-detail', contact);
const onOpenContact = async () => {
// First let's finish our check with the central server to see if this user has
// a signal account. Then we won't have to do it a second time for the detail
// screen.
await this.checkingProfile;
this.model.trigger('show-contact-detail', {
contact,
hasSignalAccount: this.contactHasSignalAccount,
});
};
const getProps = ({ hasSignalAccount }) => ({
@ -496,18 +508,21 @@
// If we can't verify a signal account locally, we'll go to the Signal Server.
if (number && !hasLocalSignalAccount) {
// eslint-disable-next-line more/no-then
window.textsecure.messaging
this.checkingProfile = window.textsecure.messaging
.getProfile(number)
.then(() => {
this.contactHasSignalAccount = true;
if (!this.contactView) {
return;
}
this.contactView.update(getProps({ hasSignalAccount: true }));
})
.catch(() => {
// No account available, or network connectivity problem
});
} else {
this.checkingProfile = Promise.resolve();
}
},
isImageWithoutCaption() {