mirror of
https://github.com/status-im/status-react.git
synced 2025-02-02 22:25:12 +00:00
This commit is contained in:
parent
a0de31ebb6
commit
f5348df929
@ -124,9 +124,11 @@
|
|||||||
(remove (fn [[k {:keys [hidden?]}]] hidden?))
|
(remove (fn [[k {:keys [hidden?]}]] hidden?))
|
||||||
(into {}))
|
(into {}))
|
||||||
{:keys [dapp?]} (get-in db [:contacts chat-id])]
|
{:keys [dapp?]} (get-in db [:contacts chat-id])]
|
||||||
(if (and dapp? (str/blank? chat-text))
|
(when dapp?
|
||||||
(dispatch [:set-in [:chats chat-id :parameter-boxes :message] nil])
|
(if (str/blank? chat-text)
|
||||||
(dispatch [::check-dapp-suggestions chat-id chat-text]))
|
(dispatch [:set-in [:chats chat-id :parameter-boxes :message] nil])
|
||||||
|
(when (every? empty? [requests commands])
|
||||||
|
(dispatch [::check-dapp-suggestions chat-id chat-text]))))
|
||||||
(-> db
|
(-> db
|
||||||
(assoc-in [:chats chat-id :request-suggestions] requests)
|
(assoc-in [:chats chat-id :request-suggestions] requests)
|
||||||
(assoc-in [:chats chat-id :command-suggestions] all-commands)))))
|
(assoc-in [:chats chat-id :command-suggestions] all-commands)))))
|
||||||
|
@ -88,13 +88,13 @@
|
|||||||
(subs command-name 1)))
|
(subs command-name 1)))
|
||||||
possible-actions)
|
possible-actions)
|
||||||
(first))]
|
(first))]
|
||||||
{:command command
|
{:command command
|
||||||
:metadata (if (not= :any to-message-id)
|
:metadata (if (and (nil? (:to-message-id input-metadata)) (not= :any to-message-id))
|
||||||
(assoc input-metadata :to-message-id to-message-id)
|
(assoc input-metadata :to-message-id to-message-id)
|
||||||
input-metadata)
|
input-metadata)
|
||||||
:args (if (empty? seq-arguments)
|
:args (if (empty? seq-arguments)
|
||||||
(rest command-args)
|
(rest command-args)
|
||||||
seq-arguments)}))))
|
seq-arguments)}))))
|
||||||
([{:keys [current-chat-id] :as db} chat-id]
|
([{:keys [current-chat-id] :as db} chat-id]
|
||||||
(selected-chat-command db chat-id (get-in db [:chats chat-id :input-text]))))
|
(selected-chat-command db chat-id (get-in db [:chats chat-id :input-text]))))
|
||||||
|
|
||||||
|
@ -56,13 +56,10 @@
|
|||||||
:component-will-unmount
|
:component-will-unmount
|
||||||
#(reset! loop? false)
|
#(reset! loop? false)
|
||||||
:reagent-render
|
:reagent-render
|
||||||
(fn [message-id {:keys [execute-immediately?] command-icon :icon :as command} status-initialized?]
|
(fn [message-id {command-icon :icon :as command} on-press-handler]
|
||||||
(when command
|
(when command
|
||||||
[touchable-highlight
|
[touchable-highlight
|
||||||
{:on-press (if execute-immediately?
|
{:on-press on-press-handler
|
||||||
#(dispatch [:execute-command-immediately command])
|
|
||||||
(when (and (not @answered?) status-initialized?)
|
|
||||||
#(set-chat-command message-id command)))
|
|
||||||
:style (st/command-request-image-touchable)
|
:style (st/command-request-image-touchable)
|
||||||
:accessibility-label (id/chat-request-message-button (:name command))}
|
:accessibility-label (id/chat-request-message-button (:name 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)}
|
||||||
@ -83,11 +80,14 @@
|
|||||||
command (if (and params command)
|
command (if (and params command)
|
||||||
(merge command {:prefill prefill
|
(merge command {:prefill prefill
|
||||||
:prefill-bot-db (or prefill-bot-db prefillBotDb)})
|
:prefill-bot-db (or prefill-bot-db prefillBotDb)})
|
||||||
command)]
|
command)
|
||||||
|
on-press-handler (if (:execute-immediately? command)
|
||||||
|
#(dispatch [:execute-command-immediately command])
|
||||||
|
(when (and (not @answered?) @status-initialized?)
|
||||||
|
#(set-chat-command message-id command)))]
|
||||||
[view st/comand-request-view
|
[view st/comand-request-view
|
||||||
[touchable-highlight
|
[touchable-highlight
|
||||||
{:on-press (when (and (not @answered?) @status-initialized?)
|
{:on-press on-press-handler}
|
||||||
#(set-chat-command message-id command))}
|
|
||||||
[view st/command-request-message-view
|
[view st/command-request-message-view
|
||||||
(if (and @markup
|
(if (and @markup
|
||||||
(not (string? @markup)))
|
(not (string? @markup)))
|
||||||
@ -100,4 +100,4 @@
|
|||||||
[text {:style st/style-sub-text
|
[text {:style st/style-sub-text
|
||||||
:font :default}
|
:font :default}
|
||||||
(:request-text command)]])
|
(:request-text command)]])
|
||||||
[request-button message-id command @status-initialized?]]))))
|
[request-button message-id command on-press-handler]]))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user