Andrey Shovkoplyas 2017-05-01 10:42:17 +03:00 committed by Roman Volosovskyi
parent 2f1271e6af
commit fa94340b6a
3 changed files with 25 additions and 6 deletions

View File

@ -10,7 +10,7 @@
(defmethod nav/preload-data! :login
[db]
(update db :login dissoc :error :password))
(update db :login dissoc :error :password :processing))
(defn set-login-from-qr
[{:keys [login] :as db} [_ _ login-info]]
@ -69,8 +69,11 @@
error (:error data)
success (zero? (count error))]
(log/debug "Logged in account: ")
(dispatch [:set-in [:login :processing] false])
(if success
(logged-in db address)
(dispatch [:set-in [:login :error] error])))))))
(fn [db [_ _ _ account-creation?]]
(assoc db :account-creation? account-creation?)))
(-> db
(assoc :account-creation? account-creation?)
(assoc-in [:login :processing] true))))

View File

@ -21,8 +21,10 @@
:actions [{:image :blank}]
:title (i18n/label :t/sign-in-to-status)}])
(def password-text-input (atom nil))
(defview login []
[{:keys [address photo-path name password error]} [:get :login]]
[{:keys [address photo-path name password error processing]} [:get :login]]
[view ast/accounts-container
[status-bar {:type :transparent}]
[login-toolbar]
@ -30,7 +32,8 @@
[view st/login-badge-container
[account-bage address photo-path name]
[view {:height 8}]
[text-input-with-label {:label (i18n/label :t/password)
[text-input-with-label {:ref #(reset! password-text-input %)
:label (i18n/label :t/password)
:auto-capitalize :none
:hide-underline? true
:on-change-text #(do
@ -40,6 +43,10 @@
:secure-text-entry true
:error (when (pos? (count error)) (i18n/label :t/wrong-password))}]]
[view {:margin-top 16}
[touchable-highlight {:on-press #(dispatch [:login-account address password])}
[touchable-highlight {:on-press #(do
(.blur @password-text-input)
(dispatch [:login-account address password]))}
[view st/sign-in-button
[text {:style st/sign-it-text} (i18n/label :t/sign-in)]]]]]])
[text {:style st/sign-it-text} (i18n/label :t/sign-in)]]]]]
(when processing
[view st/processing-view])])

View File

@ -32,3 +32,12 @@
:height 52
:ios {:border-radius 8}
:android {:border-radius 4}})
(def processing-view
{:position :absolute
:top 0
:bottom 0
:right 0
:left 0
:background-color common/color-black
:opacity 0.1})