From 618b1f81e2835e5f6d07d02be7a429f018ec325a Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Wed, 15 Jul 2020 12:15:57 +0300 Subject: [PATCH] [#10914] Show proper username in chat on opening from background --- src/status_im/ui/screens/chat/toolbar_content.cljs | 12 ++++++------ src/status_im/ui/screens/chat/views.cljs | 9 +++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/status_im/ui/screens/chat/toolbar_content.cljs b/src/status_im/ui/screens/chat/toolbar_content.cljs index d6bad19039..b2e4ba015d 100644 --- a/src/status_im/ui/screens/chat/toolbar_content.cljs +++ b/src/status_im/ui/screens/chat/toolbar_content.cljs @@ -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? diff --git a/src/status_im/ui/screens/chat/views.cljs b/src/status_im/ui/screens/chat/views.cljs index a60d018dba..4f6385eae4 100644 --- a/src/status_im/ui/screens/chat/views.cljs +++ b/src/status_im/ui/screens/chat/views.cljs @@ -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