suggestions from jail

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -36,9 +36,9 @@
(apply handler params)))) (apply handler params))))
(defn suggestions-handler (defn suggestions-handler
[db [_ response-json]] [db [{:keys [chat-id]} response-json]]
(let [response (json->cljs 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! (defn suggestions-events-handler!
[db [[n data]]] [db [[n data]]]