Skip to content

Commit

Permalink
[#10434] Disable touch events during autologin
Browse files Browse the repository at this point in the history
  • Loading branch information
rasom committed May 12, 2020
1 parent 461e67a commit 0cc8704
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 34 deletions.
12 changes: 7 additions & 5 deletions src/status_im/multiaccounts/biometric/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,14 @@

(fx/defn biometric-auth
{:events [:biometric-authenticate]}
[cofx]
(authenticate
[{:keys [db] :as cofx}]
(fx/merge
cofx
#(re-frame/dispatch [:biometric-auth-done %])
{:reason (i18n/label :t/biometric-auth-reason-login)
:ios-fallback-label (i18n/label :t/biometric-auth-login-ios-fallback-label)}))
{:db (assoc db :disable-touch-events? false)}
(authenticate
#(re-frame/dispatch [:biometric-auth-done %])
{:reason (i18n/label :t/biometric-auth-reason-login)
:ios-fallback-label (i18n/label :t/biometric-auth-login-ios-fallback-label)})))

(fx/defn enable
{:events [:biometric/enable]}
Expand Down
15 changes: 10 additions & 5 deletions src/status_im/multiaccounts/login/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
{:db (-> db
(assoc-in [:multiaccounts/login :processing] true)
(dissoc :intro-wizard)
(update :hardwallet dissoc :flow))
(update :hardwallet dissoc :flow)
(assoc :disable-touch-events? true))
::login [(types/clj->json {:name name
:key-uid key-uid
:photo-path photo-path})
Expand Down Expand Up @@ -294,7 +295,8 @@
:card-read-in-progress?
:pin
:multiaccount)
(assoc :logged-in-since now))
(assoc :logged-in-since now
:disable-touch-events? false))
::json-rpc/call
[{:method "web3_clientVersion"
:on-success #(re-frame/dispatch [::initialize-web3-client-version %])}]}
Expand Down Expand Up @@ -354,9 +356,12 @@
(let [keycard-multiaccount? (boolean (get-in db [:multiaccounts/multiaccounts key-uid :keycard-pairing]))]
(log/debug "[login] get-credentials"
"keycard-multiacc?" keycard-multiaccount?)
(if keycard-multiaccount?
(keychain/get-hardwallet-keys cofx key-uid)
(keychain/get-user-password cofx key-uid))))
(fx/merge
cofx
{:db (assoc db :disable-touch-events? true)}
(if keycard-multiaccount?
(keychain/get-hardwallet-keys key-uid)
(keychain/get-user-password key-uid)))))

(fx/defn get-auth-method-success
"Auth method: nil - not supported, \"none\" - not selected, \"password\", \"biometric\", \"biometric-prepare\""
Expand Down
1 change: 1 addition & 0 deletions src/status_im/signals/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"error" error)
(if error
{:db (-> db
(assoc :disable-touch-events? false)
(update :multiaccounts/login dissoc :processing)
(assoc-in [:multiaccounts/login :error]
;; NOTE: the only currently known error is
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
(reg-root-key-sub :app-active-since :app-active-since)
(reg-root-key-sub :connectivity/ui-status-properties :connectivity/ui-status-properties)
(reg-root-key-sub :logged-in-since :logged-in-since)

(reg-root-key-sub :disable-touch-events? :disable-touch-events?)
;;NOTE this one is not related to ethereum network
;; it is about cellular network/ wifi network
(reg-root-key-sub :network/type :network/type)
Expand Down
49 changes: 26 additions & 23 deletions src/status_im/ui/screens/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -97,26 +97,29 @@
:component-will-unmount utils.universal-links/finalize
:reagent-render
(fn []
[react/safe-area-provider
^{:key (str @colors/theme @reloader/cnt)}
[react/view {:flex 1
:background-color colors/black-persist}
[navigation/navigation-container
(merge {:ref (fn [r]
(navigation/set-navigator-ref r))
:onStateChange on-state-change
:enableURLHandling false}
(when debug?
{:enableURLHandling true
:initialState @state}))
[main-app-navigator]]
[wallet/prepare-transaction]
[wallet/request-transaction]
[wallet/select-account]
[signing/signing]
[bottom-sheet]
[popover/popover]
(when debug?
[reloader/reload-view @reloader/cnt])
(when config/keycard-test-menu-enabled?
[hardwallet.test-menu/test-menu])]])}))
(let [disbale-touch-events?
@(re-frame/subscribe [:disable-touch-events?])]
[react/safe-area-provider
^{:key (str @colors/theme @reloader/cnt)}
[react/view {:flex 1
:background-color colors/black-persist
:pointer-events disbale-touch-events?}
[navigation/navigation-container
(merge {:ref (fn [r]
(navigation/set-navigator-ref r))
:onStateChange on-state-change
:enableURLHandling false}
(when debug?
{:enableURLHandling true
:initialState @state}))
[main-app-navigator]]
[wallet/prepare-transaction]
[wallet/request-transaction]
[wallet/select-account]
[signing/signing]
[bottom-sheet]
[popover/popover]
(when debug?
[reloader/reload-view @reloader/cnt])
(when config/keycard-test-menu-enabled?
[hardwallet.test-menu/test-menu])]]))}))

0 comments on commit 0cc8704

Please sign in to comment.