From 5f28dc0a520f65ad334c9723d998f4098f01a335 Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Tue, 17 Dec 2019 12:17:48 +0100 Subject: [PATCH] show ens name by default --- src/status_im/chat/models/input.cljs | 3 +- src/status_im/ens/core.cljs | 8 ----- src/status_im/subs.cljs | 12 ++------ src/status_im/ui/screens/ens/views.cljs | 40 +++++++++++-------------- 4 files changed, 20 insertions(+), 43 deletions(-) diff --git a/src/status_im/chat/models/input.cljs b/src/status_im/chat/models/input.cljs index e71a4bb803..edf7c69ce1 100644 --- a/src/status_im/chat/models/input.cljs +++ b/src/status_im/chat/models/input.cljs @@ -90,8 +90,7 @@ (when-not (string/blank? input-text) (let [{:keys [message-id]} (get-in db [:chats current-chat-id :metadata :responding-to-message]) - show-name? (get-in db [:multiaccount :show-name?]) - preferred-name (when show-name? (get-in db [:multiaccount :preferred-name])) + preferred-name (get-in db [:multiaccount :preferred-name]) emoji? (message-content/emoji-only-content? {:text input-text :response-to message-id})] (fx/merge cofx diff --git a/src/status_im/ens/core.cljs b/src/status_im/ens/core.cljs index a1276a7d08..4dfeab39e2 100644 --- a/src/status_im/ens/core.cljs +++ b/src/status_im/ens/core.cljs @@ -229,14 +229,6 @@ {:preferred-name name} {})) -(fx/defn switch-show-username - {:events [::switch-show-username]} - [{:keys [db] :as cofx} _] - (let [show-name? (not (get-in db [:multiaccount :show-name?]))] - (multiaccounts.update/multiaccount-update cofx - {:show-name? show-name?} - {}))) - (fx/defn on-registration-failure "TODO not sure there is actually anything to do here it should only be called if the user cancels the signing diff --git a/src/status_im/subs.cljs b/src/status_im/subs.cljs index 9d7cca1071..3cf11b305b 100644 --- a/src/status_im/subs.cljs +++ b/src/status_im/subs.cljs @@ -1885,12 +1885,6 @@ (fn [multiaccount] (:preferred-name multiaccount))) -(re-frame/reg-sub - :ens/show? - :<- [:multiaccount] - (fn [multiaccount] - (:show-name? multiaccount))) - (re-frame/reg-sub :ens/search-screen :<- [:ens/registration] @@ -1950,12 +1944,10 @@ :<- [:multiaccount/usernames] :<- [:multiaccount] :<- [:ens/preferred-name] - :<- [:ens/show?] - (fn [[names multiaccount preferred-name show?]] + (fn [[names multiaccount preferred-name]] {:names names :multiaccount multiaccount - :preferred-name preferred-name - :show? (or show? false)})) + :preferred-name preferred-name})) ;;SIGNING ============================================================================================================= diff --git a/src/status_im/ui/screens/ens/views.cljs b/src/status_im/ui/screens/ens/views.cljs index 010b760105..928b8f7a8a 100644 --- a/src/status_im/ui/screens/ens/views.cljs +++ b/src/status_im/ui/screens/ens/views.cljs @@ -590,8 +590,7 @@ {:title s :subtitle (when stateofus-username stateofus/domain) :on-press action - :icon :main-icons/username - :accessories [:chevron]}])) + :icon :main-icons/username}])) (defn- name-list [names preferred-name] [react/view {:style {:flex 1 :margin-top 16}} @@ -633,32 +632,27 @@ [name-item {:name name :action #(re-frame/dispatch [::ens/navigate-to-name name])}])] [react/text {:style {:color colors/gray :font-size 15}} (i18n/label :t/ens-no-usernames)])] - [react/view {:style {:padding-top 22 :border-color colors/gray-lighter :border-top-width 1}} - [react/text {:style {:color colors/gray :margin-horizontal 16}} - (i18n/label :t/ens-chat-settings)] + [react/view {:style {:padding-vertical 22 :border-color colors/gray-lighter :border-top-width 1}} (when (> (count names) 1) - [profile.components/settings-item - {:label-kw :ens-primary-username - :value preferred-name - :action-fn #(re-frame/dispatch [:bottom-sheet/show-sheet - {:content - (fn [] (name-list names preferred-name)) - :content-height - (+ 72 (* (min 4 (count names)) 64))}])}]) - [profile.components/settings-switch-item - {:label-kw :ens-show-username - :action-fn #(re-frame/dispatch [::ens/switch-show-username]) - :value show?}]] - (let [message {:content {:parsed-text [{:type "paragraph", :children [{:literal (i18n/label :t/ens-test-message)}]}]} + [react/view + [react/text {:style {:color colors/gray :margin-horizontal 16}} + (i18n/label :t/ens-chat-settings)] + [profile.components/settings-item + {:label-kw :ens-primary-username + :value preferred-name + :action-fn #(re-frame/dispatch [:bottom-sheet/show-sheet + {:content + (fn [] (name-list names preferred-name)) + :content-height + (+ 72 (* (min 4 (count names)) 64))}])}]])] + (let [message {:content {:parsed-text + [{:type "paragraph" + :children [{:literal (i18n/label :t/ens-test-message)}]}]} :content-type constants/content-type-text :timestamp-str "9:41 AM"}] [react/view [react/view {:padding-left 60} - (if show? - ^{:key "ens-name"} - [message/message-author-name public-key] - ^{:key "generated"} - [message/message-author-name nil name])] + [message/message-author-name public-key]] [react/view {:flex-direction :row} [react/view {:padding-left 16 :padding-right 8 :padding-top 4} [photos/photo (multiaccounts/displayed-photo account) {:size 36}]]