Fix status display by providing public key in message data
This commit is contained in:
parent
ffaa85f133
commit
a08a98c491
|
@ -3,7 +3,6 @@
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[reagent.core :as reagent]
|
[reagent.core :as reagent]
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[taoensso.timbre :as log]
|
|
||||||
[status-im.ui.components.connectivity.styles :as styles]
|
[status-im.ui.components.connectivity.styles :as styles]
|
||||||
[status-im.i18n :as i18n]))
|
[status-im.i18n :as i18n]))
|
||||||
|
|
||||||
|
|
|
@ -140,19 +140,19 @@
|
||||||
(if (and group-chat (not outgoing))
|
(if (and group-chat (not outgoing))
|
||||||
[message-with-name-and-avatar text message]
|
[message-with-name-and-avatar text message]
|
||||||
[text-only-message text message])
|
[text-only-message text message])
|
||||||
[react/view (message.style/delivery-status outgoing)
|
[react/view {:style (message.style/delivery-status outgoing)}
|
||||||
[message/message-delivery-status message]]])}))))
|
[message/message-delivery-status message]]])}))))
|
||||||
|
|
||||||
(views/defview messages-view [{:keys [chat-id group-chat]}]
|
(views/defview messages-view [{:keys [chat-id group-chat]}]
|
||||||
(views/letsubs [chat-id* (atom nil)
|
(views/letsubs [messages [:get-current-chat-messages-stream]
|
||||||
scroll-ref (atom nil)
|
current-public-key [:get-current-public-key]]
|
||||||
scroll-timer (atom nil)
|
(let [chat-id* (atom nil)
|
||||||
scroll-height (atom nil)]
|
scroll-ref (atom nil)
|
||||||
(let [_ (when (or (not @chat-id*) (not= @chat-id* chat-id))
|
scroll-timer (atom nil)
|
||||||
|
scroll-height (atom nil)
|
||||||
|
_ (when (or (not @chat-id*) (not= @chat-id* chat-id))
|
||||||
(reset! chat-id* chat-id)
|
(reset! chat-id* chat-id)
|
||||||
(js/setTimeout #(when scroll-ref (.scrollToEnd @scroll-ref)) 400))
|
(js/setTimeout #(when @scroll-ref (.scrollToEnd @scroll-ref)) 400))]
|
||||||
messages (re-frame/subscribe [:get-current-chat-messages-stream])
|
|
||||||
current-public-key (re-frame/subscribe [:get-current-public-key])]
|
|
||||||
[react/view {:style styles/messages-view}
|
[react/view {:style styles/messages-view}
|
||||||
[react/scroll-view {:scrollEventThrottle 16
|
[react/scroll-view {:scrollEventThrottle 16
|
||||||
:headerHeight styles/messages-list-vertical-padding
|
:headerHeight styles/messages-list-vertical-padding
|
||||||
|
@ -169,9 +169,11 @@
|
||||||
:ref #(reset! scroll-ref %)}
|
:ref #(reset! scroll-ref %)}
|
||||||
[react/view
|
[react/view
|
||||||
(doall
|
(doall
|
||||||
(for [[index {:keys [from content message-id type value] :as message-obj}] (map-indexed vector (reverse @messages))]
|
(for [[index {:keys [from content message-id type value] :as message-obj}] (map-indexed vector (reverse messages))]
|
||||||
^{:key (or message-id (str type value))}
|
^{:key (or message-id (str type value))}
|
||||||
[message content (= from @current-public-key) (assoc message-obj :group-chat group-chat)]))]]])))
|
[message content (= from current-public-key)
|
||||||
|
(assoc message-obj :group-chat group-chat
|
||||||
|
:current-public-key current-public-key)]))]]])))
|
||||||
|
|
||||||
(views/defview chat-text-input []
|
(views/defview chat-text-input []
|
||||||
(views/letsubs [inp-ref (atom nil)]
|
(views/letsubs [inp-ref (atom nil)]
|
||||||
|
|
Loading…
Reference in New Issue