another attempt to fix #772
This commit is contained in:
parent
d82bf5eeda
commit
125d1c8dff
|
@ -172,6 +172,8 @@
|
|||
;; fixes https://github.com/status-im/status-react/issues/594
|
||||
;; todo: revisit with more clever solution
|
||||
(let [text' (if (= text (str chat-consts/command-char " ")) chat-consts/command-char text)]
|
||||
(when (string/blank? text)
|
||||
(dispatch [:set-in [:suggestions current-chat-id] nil]))
|
||||
(if (console? current-chat-id)
|
||||
(dispatch [::check-input-for-commands text'])
|
||||
(dispatch [::check-suggestions current-chat-id text']))))))
|
||||
|
|
|
@ -203,9 +203,9 @@
|
|||
[messages-view group-chat]]
|
||||
;; todo uncomment this
|
||||
#_(when @group-chat [typing-all])
|
||||
(if command?
|
||||
[response-view]
|
||||
(when-not command?
|
||||
[suggestion-container])
|
||||
[response-view]
|
||||
(when show-emoji?
|
||||
[emoji-view])
|
||||
[chat-message-input-view]
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
[status-im.utils.name :refer [shortened-name]]
|
||||
[status-im.utils.js-resources :as js-res]
|
||||
[status-im.commands.utils :as cu]
|
||||
[taoensso.timbre :as log]))
|
||||
[taoensso.timbre :as log]
|
||||
[clojure.string :as s]))
|
||||
|
||||
(defn drag-icon []
|
||||
[view st/drag-container
|
||||
|
@ -154,13 +155,14 @@
|
|||
(defn response-view []
|
||||
(let [response-height (anim/create-value c/input-height)
|
||||
command (subscribe [:get-chat-command])
|
||||
text (subscribe [:get-chat-input-text])
|
||||
suggestions (subscribe [:get-content-suggestions])
|
||||
errors (subscribe [:validation-errors])
|
||||
custom-errors (subscribe [:custom-validation-errors])]
|
||||
(fn []
|
||||
(when (or (:fullscreen @command)
|
||||
(= :response (:type @command))
|
||||
(seq @suggestions)
|
||||
(and (not (s/blank? @text)) (seq @suggestions))
|
||||
(seq @errors)
|
||||
(seq @custom-errors))
|
||||
[container response-height
|
||||
|
|
|
@ -42,10 +42,11 @@
|
|||
:else nil)))
|
||||
|
||||
(defn suggestions-handler!
|
||||
[{:keys [contacts] :as db} [{:keys [chat-id]} {:keys [result]}]]
|
||||
[{:keys [contacts chats] :as db} [{:keys [chat-id]} {:keys [result]}]]
|
||||
(let [{:keys [markup webViewUrl]} (:returned result)
|
||||
{:keys [dapp? dapp-url]} (get contacts chat-id)
|
||||
hiccup (generate-hiccup markup)
|
||||
text (get-in chats [chat-id :input-text])
|
||||
hiccup (when-not (s/blank? text) (generate-hiccup markup))
|
||||
web-view-url (if (and (= webViewUrl "dapp-url") dapp? dapp-url)
|
||||
(get-contact-translated chat-id :dapp-url dapp-url)
|
||||
webViewUrl)]
|
||||
|
@ -59,13 +60,13 @@
|
|||
(log/debug "Suggestion event: " data)
|
||||
(let [{:keys [dapp?]} (get-in db [:contacts current-chat-id])
|
||||
command? (= :command (:type (cm/get-chat-command db)))]
|
||||
(case (keyword n)
|
||||
:set-value (if command?
|
||||
(dispatch [:fill-chat-command-content data])
|
||||
(when dapp?
|
||||
(dispatch [:set-chat-input-text data])))
|
||||
;; todo show error?
|
||||
nil)))
|
||||
(case (keyword n)
|
||||
:set-value (if command?
|
||||
(dispatch [:fill-chat-command-content data])
|
||||
(when dapp?
|
||||
(dispatch [:set-chat-input-text data])))
|
||||
;; todo show error?
|
||||
nil)))
|
||||
|
||||
(defn print-error-message! [message]
|
||||
(fn [_ params]
|
||||
|
|
Loading…
Reference in New Issue