show ens name by default

This commit is contained in:
Andrey Shovkoplyas 2019-12-17 12:17:48 +01:00
parent 1a61ae4b73
commit 5f28dc0a52
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
4 changed files with 20 additions and 43 deletions

View File

@ -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

View File

@ -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

View File

@ -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 =============================================================================================================

View File

@ -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,10 +632,11 @@
[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/view {:style {:padding-vertical 22 :border-color colors/gray-lighter :border-top-width 1}}
(when (> (count names) 1)
[react/view
[react/text {:style {:color colors/gray :margin-horizontal 16}}
(i18n/label :t/ens-chat-settings)]
(when (> (count names) 1)
[profile.components/settings-item
{:label-kw :ens-primary-username
:value preferred-name
@ -644,21 +644,15 @@
{: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)}]}]}
(+ 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}]]