[#7451] Stickers support on desktop

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2019-02-08 13:59:30 +01:00
parent 8def565664
commit 448581058c
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
2 changed files with 21 additions and 9 deletions

View File

@ -138,7 +138,7 @@
[react/text {:style styles/system-message-text}
text]]])
(views/defview message-with-name-and-avatar [text {:keys [from first-in-group? timestamp] :as message}]
(defn message-wrapper [{:keys [from first-in-group? timestamp] :as message} item]
[react/view
(when first-in-group?
[react/view {:style {:flex-direction :row :margin-top 24}}
@ -149,7 +149,10 @@
(time/timestamp->time timestamp)]])
[react/view {:style styles/not-first-in-group-wrapper}
[photo-placeholder]
[message-without-timestamp text message]]])
item]])
(views/defview message-with-name-and-avatar [text message]
[message-wrapper message [message-without-timestamp text message]])
(defmulti message (fn [_ _ {:keys [content-type]}] content-type))
@ -164,6 +167,12 @@
[react/view {:style styles/message-command-container}
[message/message-content-command message]]]])
(defmethod message constants/content-type-sticker
[_ _ {:keys [content] :as message}]
[message-wrapper message
[react/image {:style {:margin 10 :width 140 :height 140}
:source {:uri (:uri content)}}]])
(views/defview message-content-status [text message]
[react/view
[system-message text message]])

View File

@ -54,13 +54,16 @@
:number-of-lines 1
:style (styles/chat-name current?)}
name]]
(if (and (:uri (:content last-message) (= constants/content-type-sticker (:content-type last-message))))
[react/image {:style {:margin 2 :width 30 :height 30}
:source {:uri (:uri (:content last-message))}}]
[react/text {:ellipsize-mode :tail
:number-of-lines 1
:style styles/chat-last-message}
(if (= constants/content-type-command (:content-type last-message))
[chat-item/command-short-preview last-message]
(or (:text last-message-content)
(i18n/label :no-messages-yet)))]]
(i18n/label :no-messages-yet)))])]
[react/view {:style styles/timestamp}
[chat-item/message-timestamp (:timestamp last-message)]
(when (pos? unviewed-messages-count)