suggestions from jail

This commit is contained in:
Roman Volosovskyi 2016-06-15 11:47:45 +03:00
parent 474729f230
commit 77a53cf040
6 changed files with 9 additions and 13 deletions

View File

@ -61,7 +61,8 @@
path
params
#(dispatch [:suggestions-handler {:command command
:content content} %]))))
:content content
:chat-id current-chat-id} %]))))
(register-handler :start-cancel-command
(u/side-effect!

View File

@ -106,6 +106,4 @@
(register-sub :get-content-suggestions
(fn [db _]
(let [command (reaction (commands/get-chat-command @db))
text (reaction (commands/get-chat-command-content @db))]
(reaction (get-content-suggestions @command @text)))))
(reaction (get-in @db [:suggestions (:current-chat-id @db)]))))

View File

@ -24,7 +24,7 @@
(list-item [suggestion-list-item row]))
(defview content-suggestions-view []
[suggestions [:get :current-suggestion]]
[suggestions [:get-content-suggestions]]
(when (seq suggestions)
[view st/container
[touchable-highlight {:style st/drag-down-touchable

View File

@ -59,9 +59,9 @@
[touchable-highlight {:on-press (fn []
(reset! loop? false)
(set-chat-command msg-id command))
:style st/command-request-image-touchable
:style st/command-request-image-touchable}
;:accessibility-label (label command)
}
[animated-view {:style (st/command-request-image-view command scale-anim-val)}
[image {:source {:uri (:icon command)}
:style st/command-request-image}]]])})))

View File

@ -32,7 +32,4 @@
(defview response-suggestions-view []
[suggestions [:get-content-suggestions]]
(when (seq suggestions)
[view st/suggestions-container
[list-view {:dataSource (to-datasource suggestions)
:keyboardShouldPersistTaps true
:renderRow render-row}]]))
suggestions))

View File

@ -36,9 +36,9 @@
(apply handler params))))
(defn suggestions-handler
[db [_ response-json]]
[db [{:keys [chat-id]} response-json]]
(let [response (json->cljs response-json)]
(assoc db :current-suggestion (generate-hiccup response))))
(assoc-in db [:suggestions chat-id] (generate-hiccup response))))
(defn suggestions-events-handler!
[db [[n data]]]