[fix 3346] remove unknown status subtitle from 1-1 chat

Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
Eric Dvorsak 2018-05-10 16:45:40 +02:00 committed by Julien Eluard
parent 01a4869397
commit e5aae3fafb
No known key found for this signature in database
GPG Key ID: 6FD7DB5437FCBEF6
2 changed files with 34 additions and 38 deletions

View File

@ -46,13 +46,9 @@
{:flex-direction :row
:flex 1})
(defnstyle chat-name-view [show-actions]
{:flex 1
:justify-content :center
:android {:align-items :flex-start
:margin-left (if show-actions 66 18)
:padding-bottom 6}
:ios {:align-items :center}})
(defnstyle chat-name-view [has-subtitle?]
{:flex 1
:margin-top (if has-subtitle? 0 6)})
(def chat-name-text
{:color component.styles/color-gray6

View File

@ -37,14 +37,13 @@
(str (i18n/label :t/sync-in-progress) " " percentage "% " currentBlock)))
(defview last-activity [{:keys [online-text sync-state accessibility-label]}]
[state [:get :sync-data]]
[react/text {:style st/last-activity-text
:accessibility-label accessibility-label}
(case sync-state
:in-progress (in-progress-text state)
:synced (i18n/label :t/sync-synced)
online-text)])
(defview last-activity [{:keys [sync-state accessibility-label]}]
(letsubs [state [:get :sync-data]]
[react/text {:style st/last-activity-text
:accessibility-label accessibility-label}
(case sync-state
:in-progress (in-progress-text state)
:synced (i18n/label :t/sync-synced))]))
(defn- group-last-activity [{:keys [contacts sync-state public?]}]
(if (or (= sync-state :in-progress)
@ -67,26 +66,27 @@
accounts [:get-accounts]
contact [:get-current-chat-contact]
sync-state [:sync-state]]
[react/view {:style st/toolbar-container}
[react/view (when-not group-chat [photos/member-photo chat-id])]
[react/view (st/chat-name-view (or (empty? accounts)
show-actions?))
(let [chat-name (if (string/blank? name)
(generate-gfy chat-id)
(or (i18n/get-contact-translated chat-id :name name)
(i18n/label :t/chat-name)))]
[react/text {:style st/chat-name-text
:number-of-lines 1
:font :toolbar-title
:accessibility-label :chat-name-text}
(if public?
(str "#" chat-name)
chat-name)])
(if group-chat
[group-last-activity {:contacts contacts
:public? public?
:sync-state sync-state}]
[last-activity {:online-text (online-text contact chat-id)
:sync-state sync-state
:accessibility-label :last-seen-text}])]]))
(let [has-subtitle? (or group-chat (not= :done sync-state))]
[react/view {:style st/toolbar-container}
(when-not group-chat
[react/view {:margin-right 5}
[photos/member-photo chat-id]])
[react/view (st/chat-name-view has-subtitle?)
(let [chat-name (if (string/blank? name)
(generate-gfy chat-id)
(or (i18n/get-contact-translated chat-id :name name)
(i18n/label :t/chat-name)))]
[react/text {:style st/chat-name-text
:number-of-lines 1
:font :toolbar-title
:accessibility-label :chat-name-text}
(if public?
(str "#" chat-name)
chat-name)])
(if group-chat
[group-last-activity {:contacts contacts
:public? public?
:sync-state sync-state}]
(when has-subtitle?
[last-activity {:sync-state sync-state
:accessibility-label :last-seen-text}]))]])))