[#10914] Show proper username in chat on opening from background

This commit is contained in:
Roman Volosovskyi 2020-07-15 12:15:57 +03:00
parent b7bc7c4e5d
commit 618b1f81e2
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
2 changed files with 11 additions and 10 deletions

View File

@ -2,7 +2,8 @@
(:require [status-im.i18n :as i18n]
[status-im.ui.components.chat-icon.screen :as chat-icon.screen]
[status-im.ui.components.react :as react]
[status-im.ui.screens.chat.styles.main :as st])
[status-im.ui.screens.chat.styles.main :as st]
[re-frame.core :as re-frame])
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
(defn- group-last-activity [{:keys [contacts public?]}]
@ -15,12 +16,11 @@
(i18n/label :members-active-none)
(i18n/label-pluralize cnt :t/members-active))))]])
(defview one-to-one-name [from]
(letsubs [contact-name [:contacts/contact-name-by-identity from]]
contact-name))
(defn one-to-one-name [from]
@(re-frame.core/subscribe [:contacts/contact-name-by-identity from]))
(defview contact-indicator [contact-id]
(letsubs [added? [:contacts/contact-added? contact-id]]
(defn contact-indicator [contact-id]
(let [added? @(re-frame/subscribe [:contacts/contact-added? contact-id])]
[react/view {:flex-direction :row}
[react/text {:style st/toolbar-subtitle}
(if added?

View File

@ -40,8 +40,8 @@
[sheets/actions current-chat])
:height 256}])}]}])
(defview add-contact-bar [public-key]
(letsubs [added? [:contacts/contact-added? public-key]]
(defn add-contact-bar [public-key]
(let [added? @(re-frame/subscribe [:contacts/contact-added? public-key])]
(when-not added?
[react/touchable-highlight
{:on-press
@ -85,8 +85,9 @@
(i18n/label :t/empty-chat-description-one-to-one)
contact-name)])])
(defview chat-intro-one-to-one [{:keys [chat-id] :as opts}]
(letsubs [contact-name [:contacts/contact-name-by-identity chat-id]]
(defn chat-intro-one-to-one [{:keys [chat-id] :as opts}]
(let [contact-name @(re-frame/subscribe
[:contacts/contact-name-by-identity chat-id])]
(chat-intro (assoc opts :contact-name contact-name))))
(defn chat-intro-header-container