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

View File

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