Fix #22 Confirmation code stops after first try

This commit is contained in:
virvar 2016-04-25 12:06:59 +03:00
parent b4c9c72481
commit 94660fb812
1 changed files with 6 additions and 6 deletions

View File

@ -40,9 +40,10 @@
(defn sync-contacts [] (defn sync-contacts []
(dispatch [:sync-contacts on-sync-contacts])) (dispatch [:sync-contacts on-sync-contacts]))
(defn on-send-code-response [body] (defn on-send-code-response [msg-id body]
(if (:confirmed body) (if (:confirmed body)
(do (dispatch [:received-msg (do (dispatch [:set-chat-command-request msg-id nil])
(dispatch [:received-msg
{:msg-id (random/id) {:msg-id (random/id)
:content "Confirmed" :content "Confirmed"
:content-type text-content-type :content-type text-content-type
@ -58,13 +59,12 @@
:from "console" :from "console"
:to "me"}]))) :to "me"}])))
(defn send-code [code] (defn send-code [msg-id code]
(dispatch [:sign-up-confirm code on-send-code-response])) (dispatch [:sign-up-confirm code (partial on-send-code-response msg-id)]))
(defn- handle-confirmation-code [msg-id command-key content] (defn- handle-confirmation-code [msg-id command-key content]
(dispatch [:set-chat-command-request msg-id nil])
(when (= command-key :confirmation-code) (when (= command-key :confirmation-code)
(send-code content))) (send-code msg-id content)))
;; -- Send phone number ---------------------------------------- ;; -- Send phone number ----------------------------------------
(defn on-sign-up-response [] (defn on-sign-up-response []