Fix message key so that message status updates work

This commit is contained in:
Vitaliy Vlasov 2018-08-27 17:06:00 +03:00
parent 9136dd0d3f
commit 400e8b6d99
No known key found for this signature in database
GPG Key ID: A7D57C347F2B2964
1 changed files with 28 additions and 27 deletions

View File

@ -27,31 +27,32 @@
:as current-chat}] :as current-chat}]
(views/letsubs [chat-name [:get-current-chat-name] (views/letsubs [chat-name [:get-current-chat-name]
{:keys [pending? whisper-identity photo-path]} [:get-current-chat-contact]] {:keys [pending? whisper-identity photo-path]} [:get-current-chat-contact]]
[react/view {:style styles/toolbar-chat-view} [react/view
[react/view {:style {:flex-direction :row [react/view {:style styles/toolbar-chat-view}
:flex 1}} [react/view {:style {:flex-direction :row
(if public? :flex 1}}
[react/view {:style (styles/topic-image color)} (if public?
[react/text {:style styles/topic-text} [react/view {:style (styles/topic-image color)}
(string/capitalize (second chat-name))]] [react/text {:style styles/topic-text}
[react/image {:style styles/chat-icon (string/capitalize (second chat-name))]]
:source {:uri photo-path}}]) [react/image {:style styles/chat-icon
[react/view {:style (styles/chat-title-and-type pending?)} :source {:uri photo-path}}])
[react/text {:style styles/chat-title [react/view {:style (styles/chat-title-and-type pending?)}
:font :medium} [react/text {:style styles/chat-title
chat-name] :font :medium}
(cond pending? chat-name]
[react/text {:style styles/add-contact-text (cond pending?
:on-press #(re-frame/dispatch [:add-contact whisper-identity])} [react/text {:style styles/add-contact-text
(i18n/label :t/add-to-contacts)] :on-press #(re-frame/dispatch [:add-contact whisper-identity])}
public? (i18n/label :t/add-to-contacts)]
[react/text {:style styles/public-chat-text} public?
(i18n/label :t/public-chat)])]] [react/text {:style styles/public-chat-text}
[react/view (i18n/label :t/public-chat)])]]
(when (and (not group-chat) (not public?)) [react/view
[react/text {:style (styles/profile-actions-text colors/black) (when (and (not group-chat) (not public?))
:on-press #(re-frame/dispatch [:show-profile-desktop whisper-identity])} [react/text {:style (styles/profile-actions-text colors/black)
(i18n/label :t/view-profile)]) :on-press #(re-frame/dispatch [:show-profile-desktop whisper-identity])}
(i18n/label :t/view-profile)])
[react/text {:style (styles/profile-actions-text colors/black) [react/text {:style (styles/profile-actions-text colors/black)
:on-press #(re-frame/dispatch [:chat.ui/clear-history-pressed])} :on-press #(re-frame/dispatch [:chat.ui/clear-history-pressed])}
@ -59,7 +60,7 @@
[react/text {:style (styles/profile-actions-text colors/black) [react/text {:style (styles/profile-actions-text colors/black)
:on-press #(re-frame/dispatch [:chat.ui/delete-chat-pressed chat-id])} :on-press #(re-frame/dispatch [:chat.ui/delete-chat-pressed chat-id])}
(i18n/label :t/delete-chat)]]] (i18n/label :t/delete-chat)]]]
[connectivity/error-view {:top 2}])) [connectivity/error-view {:top 2}]]))
(views/defview message-author-name [{:keys [outgoing from] :as message}] (views/defview message-author-name [{:keys [outgoing from] :as message}]
(views/letsubs [current-account [:get-current-account] (views/letsubs [current-account [:get-current-account]
@ -170,7 +171,7 @@
[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 message-obj}
[message content (= from current-public-key) [message content (= from current-public-key)
(assoc message-obj :group-chat group-chat (assoc message-obj :group-chat group-chat
:current-public-key current-public-key)]))]]]))) :current-public-key current-public-key)]))]]])))