From 47732e7b5b5e5e27920714111c0cbb438784eba9 Mon Sep 17 00:00:00 2001 From: Gheorghe Pinzaru Date: Wed, 29 Jan 2020 16:04:26 +0300 Subject: [PATCH] Remove contact indicator from userpic Add contact indicator in 1:1 as a text. Fixes #9826 Fix e2e explicitly define line height On android and iOs line height is different, explicitly define so it will be the same in both platforms. Signed-off-by: Gheorghe Pinzaru --- .../ui/components/chat_icon/screen.cljs | 23 +++--------- .../ui/components/chat_icon/styles.cljs | 36 ------------------- .../ui/screens/chat/styles/main.cljs | 7 ++-- .../ui/screens/chat/toolbar_content.cljs | 11 +++++- test/appium/views/home_view.py | 2 +- translations/en.json | 2 ++ 6 files changed, 22 insertions(+), 59 deletions(-) diff --git a/src/status_im/ui/components/chat_icon/screen.cljs b/src/status_im/ui/components/chat_icon/screen.cljs index 1c9e2a4219..de86d00104 100644 --- a/src/status_im/ui/components/chat_icon/screen.cljs +++ b/src/status_im/ui/components/chat_icon/screen.cljs @@ -36,20 +36,12 @@ [react/view online-dot-left] [react/view online-dot-right]]]]) -(defn pending-contact-badge - [{:keys [pending-wrapper pending-outer-circle pending-inner-circle]}] - [react/view pending-wrapper - [react/view pending-outer-circle - [react/view pending-inner-circle]]]) - (defn chat-icon-view - [{:keys [photo-path added?] :as contact} group-chat name _online styles & [hide-dapp?]] + [contact group-chat name _online styles] [react/view (:container styles) (if-not group-chat [photos/photo (multiaccounts/displayed-photo contact) styles] - [default-chat-icon name styles]) - (when (and contact (not added?)) - [pending-contact-badge styles])]) + [default-chat-icon name styles])]) (defn chat-icon-view-toolbar [contact group-chat name color online] @@ -59,30 +51,23 @@ :online-view styles/online-view :online-dot-left styles/online-dot-left :online-dot-right styles/online-dot-right - :pending-wrapper styles/pending-wrapper - :pending-outer-circle styles/pending-outer-circle - :pending-inner-circle styles/pending-inner-circle :size 36 :chat-icon styles/chat-icon-chat-toolbar :default-chat-icon (styles/default-chat-icon-chat-toolbar color) :default-chat-icon-text styles/default-chat-icon-text}]) (defn chat-icon-view-chat-list - [contact group-chat name color online & [hide-dapp?]] + [contact group-chat name color online] [chat-icon-view contact group-chat name online {:container styles/container-chat-list :online-view-wrapper styles/online-view-wrapper :online-view styles/online-view :online-dot-left styles/online-dot-left :online-dot-right styles/online-dot-right - :pending-wrapper styles/pending-wrapper - :pending-outer-circle styles/pending-outer-circle - :pending-inner-circle styles/pending-inner-circle :size 40 :chat-icon styles/chat-icon-chat-list :default-chat-icon (styles/default-chat-icon-chat-list color) - :default-chat-icon-text styles/default-chat-icon-text} - hide-dapp?]) + :default-chat-icon-text styles/default-chat-icon-text}]) (defn custom-icon-view-list [name color & [size]] diff --git a/src/status_im/ui/components/chat_icon/styles.cljs b/src/status_im/ui/components/chat_icon/styles.cljs index 7f75124485..2b98042c0b 100644 --- a/src/status_im/ui/components/chat_icon/styles.cljs +++ b/src/status_im/ui/components/chat_icon/styles.cljs @@ -214,42 +214,6 @@ :height image-size :border-radius (/ image-size 2)})) -(def pending-wrapper - {:position :absolute - :bottom 0 - :right 0 - :width 12 - :height 12 - :border-radius 6 - :background-color :white - :align-items :center - :justify-content :center}) - -(def pending-view-menu-wrapper - {:position :absolute - :bottom 2 - :right 2 - :width 12 - :height 12 - :border-radius 6 - :background-color :white - :align-items :center - :justify-content :center}) - -(def pending-outer-circle - {:background-color colors/blue - :width 8 - :height 8 - :border-radius 4 - :align-items :center - :justify-content :center}) - -(def pending-inner-circle - {:background-color :white - :width 4 - :height 4 - :border-radius 2}) - (defn profile-icon-mask [size] {:height size :width size diff --git a/src/status_im/ui/screens/chat/styles/main.cljs b/src/status_im/ui/screens/chat/styles/main.cljs index b0ee9b7660..e8fc3cd84f 100644 --- a/src/status_im/ui/screens/chat/styles/main.cljs +++ b/src/status_im/ui/screens/chat/styles/main.cljs @@ -6,6 +6,7 @@ (def toolbar-container {:flex 1 + :align-items :center :flex-direction :row}) (def messages-container @@ -39,8 +40,9 @@ :justify-content :center}) (def chat-name-text - {:typography :main-medium - :margin-top -3}) + {:typography :main-medium + :font-size 15 + :line-height 22}) (def group-icon {:margin-top 4 @@ -50,6 +52,7 @@ (def toolbar-subtitle {:typography :caption + :line-height 16 :color colors/text-gray}) (def last-activity-text diff --git a/src/status_im/ui/screens/chat/toolbar_content.cljs b/src/status_im/ui/screens/chat/toolbar_content.cljs index 8a09c306aa..14c25976df 100644 --- a/src/status_im/ui/screens/chat/toolbar_content.cljs +++ b/src/status_im/ui/screens/chat/toolbar_content.cljs @@ -39,19 +39,28 @@ (i18n/label :members-active-none) (i18n/label-pluralize cnt :t/members-active))))]])) +(defn- contact-indicator [{:keys [added?]}] + [react/view {:flex-direction :row} + [react/text {:style st/toolbar-subtitle} + (if added? + (i18n/label :chat-is-a-contact) + (i18n/label :chat-is-not-a-contact))]]) + (defview toolbar-content-view [] (letsubs [{:keys [group-chat color online contacts chat-name contact public? chat-id] :as chat} [:chats/current-chat] sync-state [:sync-state]] (let [has-subtitle? (or group-chat (not= :done sync-state))] [react/view {:style st/toolbar-container} - [react/view {:margin-right 8} + [react/view {:margin-right 10} [chat-icon.screen/chat-icon-view-toolbar contact group-chat chat-name color online]] [react/view {:style st/chat-name-view} [react/text {:style st/chat-name-text :number-of-lines 1 :accessibility-label :chat-name-text} chat-name] + (when contact + [contact-indicator contact]) (if group-chat [group-last-activity {:contacts contacts :public? public? diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index b15091847e..883a36f6c2 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -113,7 +113,7 @@ class ChatElement(BaseButton): # TODO: commented until accessibility-id will be added back # locator_str = "//*[@content-desc='unread-messages-count-text']" # self.locator = self.Locator.xpath_selector(parent_locator + locator_str) - locator_str = "/android.view.ViewGroup[3]//android.widget.TextView" + locator_str = "/android.view.ViewGroup[2]//android.widget.TextView" self.locator = self.Locator.xpath_selector(parent_locator + locator_str) diff --git a/translations/en.json b/translations/en.json index 65f7f9104a..123cc544c5 100644 --- a/translations/en.json +++ b/translations/en.json @@ -671,6 +671,8 @@ "message-reply": "Reply", "message-syncing": "Message syncing", "messages": "Messages", + "chat-is-a-contact": "Contact", + "chat-is-not-a-contact": "Not a contact", "might-break": "Might break some ÐApps", "migrations-erase-multiaccounts-data-button": "Erase multiaccount's db", "migrations-failed-content": "{{message}}\nschema version: initial {{initial-version}}, current {{current-version}}, last {{last-version}}\n\nPlease let us know about this problem at #status public chat. If you press \"Cancel\" button, nothing will happen. If you press \"{{erase-multiaccounts-data-button-text}}\" button, multiaccount's db will be removed and you will be able to unlock multiaccount. All multiaccount's data will be lost.",