From fa94340b6a06a8964157c64280749f285c40b310 Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Mon, 1 May 2017 10:42:17 +0300 Subject: [PATCH] fixes https://github.com/status-im/status-react/issues/871 --- src/status_im/accounts/login/handlers.cljs | 7 +++++-- src/status_im/accounts/login/screen.cljs | 15 +++++++++++---- src/status_im/accounts/login/styles.cljs | 9 +++++++++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/status_im/accounts/login/handlers.cljs b/src/status_im/accounts/login/handlers.cljs index 8eed1806c6..4586a84175 100644 --- a/src/status_im/accounts/login/handlers.cljs +++ b/src/status_im/accounts/login/handlers.cljs @@ -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)))) diff --git a/src/status_im/accounts/login/screen.cljs b/src/status_im/accounts/login/screen.cljs index e6041d31f5..eb01920cfb 100644 --- a/src/status_im/accounts/login/screen.cljs +++ b/src/status_im/accounts/login/screen.cljs @@ -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])]) diff --git a/src/status_im/accounts/login/styles.cljs b/src/status_im/accounts/login/styles.cljs index 1126c94628..47dd327c97 100644 --- a/src/status_im/accounts/login/styles.cljs +++ b/src/status_im/accounts/login/styles.cljs @@ -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})