[fix #1604]: Commands send, request, location are sent several times if quickly tap on send button
This commit is contained in:
parent
65f2f51632
commit
a40f9bc8c1
|
@ -39,7 +39,8 @@
|
||||||
to (get-in contacts [chat-id :address])
|
to (get-in contacts [chat-id :address])
|
||||||
jail-params {:parameters params
|
jail-params {:parameters params
|
||||||
:context (generate-context current-account-id chat-id to group-id)}]
|
:context (generate-context current-account-id chat-id to group-id)}]
|
||||||
{:call-jail {:jail-id jail-id
|
{:db db
|
||||||
|
:call-jail {:jail-id jail-id
|
||||||
:path path
|
:path path
|
||||||
:params jail-params
|
:params jail-params
|
||||||
:callback-events-creator (fn [jail-response]
|
:callback-events-creator (fn [jail-response]
|
||||||
|
|
|
@ -384,8 +384,7 @@
|
||||||
|
|
||||||
validationHandler
|
validationHandler
|
||||||
[[::execute-validation-handler
|
[[::execute-validation-handler
|
||||||
validationHandler parameters error-events-creator proceed-events]
|
validationHandler parameters error-events-creator proceed-events]]
|
||||||
[:set-chat-ui-props {:sending-in-progress? false}]]
|
|
||||||
|
|
||||||
:default
|
:default
|
||||||
proceed-events)]
|
proceed-events)]
|
||||||
|
|
|
@ -46,11 +46,10 @@
|
||||||
[command-view (= index 0) command])]]])
|
[command-view (= index 0) command])]]])
|
||||||
|
|
||||||
(defn- basic-text-input [_]
|
(defn- basic-text-input [_]
|
||||||
(let [input-text (subscribe [:chat :input-text])
|
(let [input-text (subscribe [:chat :input-text])
|
||||||
command (subscribe [:selected-chat-command])
|
command (subscribe [:selected-chat-command])
|
||||||
sending-in-progress? (subscribe [:get-current-chat-ui-prop :sending-in-progress?])
|
input-focused? (subscribe [:get-current-chat-ui-prop :input-focused?])
|
||||||
input-focused? (subscribe [:get-current-chat-ui-prop :input-focused?])
|
input-ref (atom nil)]
|
||||||
input-ref (atom nil)]
|
|
||||||
(fn [{:keys [set-layout-height-fn set-container-width-fn height single-line-input?]}]
|
(fn [{:keys [set-layout-height-fn set-container-width-fn height single-line-input?]}]
|
||||||
[react/text-input
|
[react/text-input
|
||||||
{:ref #(when %
|
{:ref #(when %
|
||||||
|
@ -59,7 +58,7 @@
|
||||||
:accessibility-label :chat-message-input
|
:accessibility-label :chat-message-input
|
||||||
:multiline (not single-line-input?)
|
:multiline (not single-line-input?)
|
||||||
:default-value (or @input-text "")
|
:default-value (or @input-text "")
|
||||||
:editable (not @sending-in-progress?)
|
:editable true
|
||||||
:blur-on-submit false
|
:blur-on-submit false
|
||||||
:on-focus #(dispatch [:set-chat-ui-props {:input-focused? true
|
:on-focus #(dispatch [:set-chat-ui-props {:input-focused? true
|
||||||
:show-emoji? false}])
|
:show-emoji? false}])
|
||||||
|
@ -142,10 +141,9 @@
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
(defn- seq-input [_]
|
(defn- seq-input [_]
|
||||||
(let [command (subscribe [:selected-chat-command])
|
(let [command (subscribe [:selected-chat-command])
|
||||||
arg-pos (subscribe [:current-chat-argument-position])
|
arg-pos (subscribe [:current-chat-argument-position])
|
||||||
seq-arg-input-text (subscribe [:chat :seq-argument-input-text])
|
seq-arg-input-text (subscribe [:chat :seq-argument-input-text])]
|
||||||
sending-in-progress? (subscribe [:get-current-chat-ui-prop :sending-in-progress?])]
|
|
||||||
(fn [{:keys [command-width container-width]}]
|
(fn [{:keys [command-width container-width]}]
|
||||||
(when (get-in @command [:command :sequential-params])
|
(when (get-in @command [:command :sequential-params])
|
||||||
(let [{:keys [placeholder hidden type]} (get-in @command [:command :params @arg-pos])]
|
(let [{:keys [placeholder hidden type]} (get-in @command [:command :params @arg-pos])]
|
||||||
|
@ -158,7 +156,7 @@
|
||||||
:placeholder placeholder
|
:placeholder placeholder
|
||||||
:accessibility-label :chat-request-input
|
:accessibility-label :chat-request-input
|
||||||
:blur-on-submit false
|
:blur-on-submit false
|
||||||
:editable (not @sending-in-progress?)
|
:editable true
|
||||||
:on-focus #(dispatch [:set-chat-ui-props {:show-emoji? false}])
|
:on-focus #(dispatch [:set-chat-ui-props {:show-emoji? false}])
|
||||||
:on-submit-editing (fn []
|
:on-submit-editing (fn []
|
||||||
(when-not (or (str/blank? @seq-arg-input-text)
|
(when-not (or (str/blank? @seq-arg-input-text)
|
||||||
|
|
Loading…
Reference in New Issue