Change messages subscription

This commit is contained in:
janherich 2018-01-04 00:34:19 +01:00
parent fc92dafca6
commit 8396442847
No known key found for this signature in database
GPG Key ID: C23B473AFBE94D13
2 changed files with 12 additions and 13 deletions

View File

@ -73,8 +73,8 @@
:group-chat group-chat :group-chat group-chat
:current-public-key current-public-key)]) :current-public-key current-public-key)])
(defview messages-view [chat-id group-chat] (defview messages-view [group-chat]
(letsubs [messages [:get-chat-messages chat-id] (letsubs [messages [:get-current-chat-messages]
current-public-key [:get-current-public-key]] current-public-key [:get-current-public-key]]
[list/flat-list {:data messages [list/flat-list {:data messages
:render-fn #(message-row {:group-chat group-chat :render-fn #(message-row {:group-chat group-chat
@ -86,7 +86,7 @@
:keyboardShouldPersistTaps (if platform/android? :always :handled)}])) :keyboardShouldPersistTaps (if platform/android? :always :handled)}]))
(defview chat [] (defview chat []
(letsubs [{:keys [chat-id group-chat input-text]} [:get-current-chat] (letsubs [{:keys [group-chat input-text]} [:get-current-chat]
show-actions? [:get-current-chat-ui-prop :show-actions?] show-actions? [:get-current-chat-ui-prop :show-actions?]
show-bottom-info? [:get-current-chat-ui-prop :show-bottom-info?] show-bottom-info? [:get-current-chat-ui-prop :show-bottom-info?]
show-emoji? [:get-current-chat-ui-prop :show-emoji?] show-emoji? [:get-current-chat-ui-prop :show-emoji?]
@ -99,7 +99,7 @@
(when (not= height layout-height) (when (not= height layout-height)
(re-frame/dispatch [:set-layout-height height]))))} (re-frame/dispatch [:set-layout-height height]))))}
[chat-toolbar] [chat-toolbar]
[messages-view chat-id group-chat] [messages-view group-chat]
[input/container {:text-empty? (string/blank? input-text)}] [input/container {:text-empty? (string/blank? input-text)}]
(when show-actions? (when show-actions?
[actions/actions-view]) [actions/actions-view])

View File

@ -133,11 +133,10 @@
:value (i18n/label :t/datetime-today)}))) :value (i18n/label :t/datetime-today)})))
(reg-sub (reg-sub
:get-chat-messages :get-current-chat-messages
(fn [[_ chat-id]] :<- [:get-current-chat]
(subscribe [:get-chat-message-datemark-groups chat-id])) (fn [{:keys [messages]}]
(fn [message-datemark-groups] (-> messages message-datemark-groups messages-stream)))
(messages-stream message-datemark-groups)))
(reg-sub (reg-sub
:get-commands-for-chat :get-commands-for-chat