Pre-filling /send response with amount (#996)

This commit is contained in:
alwx 2017-04-19 12:26:10 +03:00 committed by Roman Volosovskyi
parent d9bef7e77f
commit 4e488d91b9
3 changed files with 9 additions and 8 deletions

View File

@ -1,5 +1,4 @@
var TopLevel = {
"abs" : function () {},
"ActionSheetIOS" : function () {},
"addEntropy" : function () {},
"addEventListener" : function () {},

View File

@ -37,19 +37,22 @@
(handlers/register-handler
:select-chat-input-command
(handlers/side-effect!
(fn [{:keys [current-chat-id chat-ui-props] :as db} [_ {:keys [name prefill] :as command} metadata]]
(fn [{:keys [current-chat-id chat-ui-props] :as db}
[_ {:keys [name prefill sequential-params] :as command} metadata]]
(dispatch [:set-chat-input-text (str const/command-char
name
const/spacing-char
(input-model/join-command-args prefill))])
(when-not sequential-params
(input-model/join-command-args prefill)))])
(dispatch [:set-chat-input-metadata metadata])
(dispatch [:set-chat-ui-props :show-suggestions? false])
(dispatch [:set-chat-ui-props :result-box nil])
(dispatch [:set-chat-ui-props :validation-messages nil])
(dispatch [:load-chat-parameter-box command 0])
(if (:sequential-params command)
(if sequential-params
(js/setTimeout
#(dispatch [:chat-input-focus :seq-input-ref])
#(do (dispatch [:chat-input-focus :seq-input-ref])
(dispatch [:set-chat-seq-arg-input-text (str/join const/spacing-char prefill)]))
100)
(dispatch [:chat-input-focus :input-ref])))))

View File

@ -17,8 +17,7 @@
(defn set-chat-command [message-id command]
(let [command-key (keyword (:name command))
metadata (-> (:set-params command)
(assoc :to-message-id message-id))]
metadata {:to-message-id message-id}]
(dispatch [:select-chat-input-command command metadata])))
(def min-scale 1)
@ -79,7 +78,7 @@
params (:params content)
{:keys [command content]} (parse-command-request commands content)
command (if (and params command)
(merge command {:set-params params})
(merge command {:prefill (vals params)})
command)]
[view st/comand-request-view
[touchable-highlight