From 28a0d10367a52b3949592af80e672e808a4bbafd Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Sat, 25 Jun 2016 21:30:43 +0300 Subject: [PATCH] some improvements --- src/status_im/chat/handlers.cljs | 5 ++--- src/status_im/chat/handlers/animation.cljs | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/status_im/chat/handlers.cljs b/src/status_im/chat/handlers.cljs index 3d1d213cab..b7ff184891 100644 --- a/src/status_im/chat/handlers.cljs +++ b/src/status_im/chat/handlers.cljs @@ -305,9 +305,8 @@ (commands/unstage-command db staged-command))) (register-handler :set-chat-command - [(after #(dispatch [:command-edit-mode])) - ;(after #(dispatch [:animate-show-response])) - ] + [(after invoke-suggestions-handler!) + (after #(dispatch [:command-edit-mode]))] (fn [db [_ command-key]] (commands/set-chat-command db command-key))) diff --git a/src/status_im/chat/handlers/animation.cljs b/src/status_im/chat/handlers/animation.cljs index 80ca0ac379..b3faa364c4 100644 --- a/src/status_im/chat/handlers/animation.cljs +++ b/src/status_im/chat/handlers/animation.cljs @@ -16,11 +16,11 @@ (register-handler name [(path :animations) middleware] handler))) (animation-handler :animate-cancel-command - (after #(dispatch [:text-edit-mode])) - (fn [db _] - (assoc db - :to-response-height input-height - :messages-offset? false))) + (after #(dispatch [:text-edit-mode])) + (fn [db _] + (assoc db + :to-response-height input-height + :messages-offset? false))) (def response-height (+ input-height response-height-normal)) @@ -41,12 +41,14 @@ (if (and suggestions? (not= 0.1 current)) identity inc)))))) -(animation-handler :animate-show-response +(register-handler :animate-show-response [(after #(dispatch [:command-edit-mode]))] - (fn [db] - (assoc db :messages-offset? true + (fn [{:keys [current-chat-id] :as db}] + (let [suggestions? (seq (get-in db [:suggestions current-chat-id])) + height (if suggestions? middle-height minimum-suggestion-height)] + (update db :animations assoc :messages-offset? true :messages-offset-max request-info-height - :to-response-height response-height))) + :to-response-height height)))) (defn fix-height [height-key height-signal-key suggestions-key minimum] @@ -72,7 +74,6 @@ (and under-middle-position? moving-down?) minimum)] - (println height-key new-fixed) (-> db (assoc-in [:animations height-key] new-fixed) (update-in [:animations height-signal-key] inc)))))