From 83a19a8817748f7f7617408761d02d0ff7c62eeb Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Wed, 15 Jun 2016 11:47:45 +0300 Subject: [PATCH] suggestions from jail Former-commit-id: 77a53cf0402d61b74e4bbd72dea6c11a88595b0d --- src/status_im/chat/handlers.cljs | 3 ++- src/status_im/chat/subs.cljs | 4 +--- src/status_im/chat/views/content_suggestions.cljs | 2 +- src/status_im/chat/views/request_message.cljs | 4 ++-- src/status_im/chat/views/response_suggestions.cljs | 5 +---- src/status_im/commands/handlers/jail.cljs | 4 ++-- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/status_im/chat/handlers.cljs b/src/status_im/chat/handlers.cljs index d66ab6440b..130635175a 100644 --- a/src/status_im/chat/handlers.cljs +++ b/src/status_im/chat/handlers.cljs @@ -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! diff --git a/src/status_im/chat/subs.cljs b/src/status_im/chat/subs.cljs index fc805b3183..2402bed67a 100644 --- a/src/status_im/chat/subs.cljs +++ b/src/status_im/chat/subs.cljs @@ -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)])))) diff --git a/src/status_im/chat/views/content_suggestions.cljs b/src/status_im/chat/views/content_suggestions.cljs index bcf5103606..d2eb8b63b4 100644 --- a/src/status_im/chat/views/content_suggestions.cljs +++ b/src/status_im/chat/views/content_suggestions.cljs @@ -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 diff --git a/src/status_im/chat/views/request_message.cljs b/src/status_im/chat/views/request_message.cljs index 907fc52311..0e5117769a 100644 --- a/src/status_im/chat/views/request_message.cljs +++ b/src/status_im/chat/views/request_message.cljs @@ -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}]]])}))) diff --git a/src/status_im/chat/views/response_suggestions.cljs b/src/status_im/chat/views/response_suggestions.cljs index 54eed3bb7d..bffe80175b 100644 --- a/src/status_im/chat/views/response_suggestions.cljs +++ b/src/status_im/chat/views/response_suggestions.cljs @@ -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)) diff --git a/src/status_im/commands/handlers/jail.cljs b/src/status_im/commands/handlers/jail.cljs index 436f1d75cd..2e45635869 100644 --- a/src/status_im/commands/handlers/jail.cljs +++ b/src/status_im/commands/handlers/jail.cljs @@ -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]]]