From e743cbacd0c8dce987720b22022c00c94b21b040 Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Wed, 3 Jun 2020 12:21:10 +0200 Subject: [PATCH] [#10744] Error at attempt to set custom-domain ENS as main Signed-off-by: Andrey Shovkoplyas --- src/status_im/subs.cljs | 14 +++----------- src/status_im/ui/screens/ens/views.cljs | 8 +++++--- src/status_im/ui/screens/home/views.cljs | 2 +- .../ui/screens/home/views/inner_item.cljs | 8 ++++---- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/status_im/subs.cljs b/src/status_im/subs.cljs index 229bb29c7a..03c5ecce6d 100644 --- a/src/status_im/subs.cljs +++ b/src/status_im/subs.cljs @@ -463,15 +463,6 @@ (fn [{:keys [preferred-name]}] preferred-name)) -(re-frame/reg-sub - :multiaccount/my-name - :<- [:multiaccount/public-key] - :<- [:multiaccount/preferred-name] - (fn [[identity preferred-name]] - (if preferred-name - (stateofus/username (str "@" preferred-name)) - (gfycat/generate-gfy identity)))) - (re-frame/reg-sub :multiaccount/default-account :<- [:multiaccount/accounts] @@ -1607,7 +1598,7 @@ [(re-frame/subscribe [:contacts/contact-by-identity identity])]) (fn [[db-contact] _] (if (and (:ens-verified db-contact) (seq (:name db-contact))) - (stateofus/username (str "@" (:name db-contact))) + (str "@" (:name db-contact)) (:alias db-contact)))) (re-frame/reg-sub @@ -1620,7 +1611,8 @@ (if me? (or (:preferred-name current-multiaccount) (gfycat/generate-gfy identity)) - (or contact-name + (or (stateofus/username contact-name) + contact-name (gfycat/generate-gfy identity)))))) (re-frame/reg-sub diff --git a/src/status_im/ui/screens/ens/views.cljs b/src/status_im/ui/screens/ens/views.cljs index 6e2633dba0..8498841906 100644 --- a/src/status_im/ui/screens/ens/views.cljs +++ b/src/status_im/ui/screens/ens/views.cljs @@ -23,7 +23,8 @@ [status-im.ui.screens.chat.styles.message.message :as message.style] [status-im.ui.screens.chat.photos :as photos] [status-im.ui.screens.profile.components.views :as profile.components] - [status-im.utils.debounce :as debounce]) + [status-im.utils.debounce :as debounce] + [clojure.string :as string]) (:require-macros [status-im.utils.views :as views])) (defn- button @@ -627,8 +628,9 @@ [radio/radio (= name preferred-name)]]]))]]]]) (views/defview my-name [] - (views/letsubs [contact-name [:multiaccount/my-name]] - (chat.utils/format-author contact-name message.style/message-author-name-container))) + (views/letsubs [contact-name [:multiaccount/preferred-name]] + (when-not (string/blank? contact-name) + (chat.utils/format-author (str "@" contact-name) message.style/message-author-name-container)))) (defn- registered [names {:keys [preferred-name] :as account} _] [react/view {:style {:flex 1}} diff --git a/src/status_im/ui/screens/home/views.cljs b/src/status_im/ui/screens/home/views.cljs index 266fc8178c..e79df49cb0 100644 --- a/src/status_im/ui/screens/home/views.cljs +++ b/src/status_im/ui/screens/home/views.cljs @@ -113,7 +113,7 @@ {:key-fn :chat-id :keyboard-should-persist-taps :always :data chats - :render-fn inner-item/home-list-item + :render-fn (fn [home-item] [inner-item/home-list-item home-item]) :header (when (or (seq chats) @search-active?) [search-input-wrapper search-filter]) :footer (if (and (not hide-home-tooltip?) (not @search-active?)) diff --git a/src/status_im/ui/screens/home/views/inner_item.cljs b/src/status_im/ui/screens/home/views/inner_item.cljs index 1a77c14f0f..74b9064595 100644 --- a/src/status_im/ui/screens/home/views/inner_item.cljs +++ b/src/status_im/ui/screens/home/views/inner_item.cljs @@ -110,8 +110,8 @@ (let [{:keys [chat-id chat-name color online group-chat public? timestamp last-message]} home-item - private-group? (and group-chat (not public?)) - public-group? (and group-chat public?)] + private-group? (and group-chat (not public?)) + public-group? (and group-chat public?)] [list-item/list-item {:icon [chat-icon.screen/chat-icon-view-chat-list chat-id group-chat chat-name color online false] @@ -129,8 +129,8 @@ :title-row-accessory [message-timestamp (if (pos? (:whisper-timestamp last-message)) (:whisper-timestamp last-message) timestamp)] - :subtitle [message-content-text {:content (:content last-message) - :content-type (:content-type last-message)}] + :subtitle [message-content-text {:content (:content last-message) + :content-type (:content-type last-message)}] :subtitle-row-accessory [unviewed-indicator home-item] :on-press #(do (re-frame/dispatch [:dismiss-keyboard])