From 1d760d9eefd9cf32d648e33bf5bc97dc399a33bc Mon Sep 17 00:00:00 2001 From: Dmitry Novotochinov Date: Thu, 26 Sep 2019 16:47:40 +0300 Subject: [PATCH] [#8989] hide keycard settings for regular accounts [#9019] hide Add new account in Wallet for keycard users [#9023] fix redirect on keycard setup cancel --- src/status_im/hardwallet/core.cljs | 9 +++++++-- src/status_im/init/core.cljs | 2 +- src/status_im/ui/screens/profile/user/views.cljs | 13 +++++++++---- src/status_im/ui/screens/wallet/accounts/views.cljs | 6 ++++-- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/status_im/hardwallet/core.cljs b/src/status_im/hardwallet/core.cljs index 143fa9a6424..884d18e512e 100644 --- a/src/status_im/hardwallet/core.cljs +++ b/src/status_im/hardwallet/core.cljs @@ -249,8 +249,9 @@ (fx/merge cofx (remove-listener-to-hardware-back-button) (navigation/navigate-reset {:index 0 - :actions [{:routeName (if (:multiaccounts/multiaccounts db) - :multiaccounts :intro)}]}))) + :actions [{:routeName (if (seq (:multiaccounts/multiaccounts db)) + :multiaccounts + :intro)}]}))) (fx/defn load-finishing-screen {:events [:keycard.onboarding.recovery-phrase-confirm-word2.ui/next-pressed @@ -675,6 +676,10 @@ flow (get-in db [:hardwallet :flow])] (fx/merge cofx {:db (-> db + (update :hardwallet + dissoc :secrets :card-state :multiaccount-wallet-address + :multiaccount-whisper-public-key + :application-info) (assoc-in [:hardwallet :setup-step] :begin) (assoc-in [:hardwallet :on-card-connected] :hardwallet/get-application-info) (assoc-in [:hardwallet :on-card-read] :hardwallet/check-card-state) diff --git a/src/status_im/init/core.cljs b/src/status_im/init/core.cljs index d489f8aff89..33cee9de92d 100644 --- a/src/status_im/init/core.cljs +++ b/src/status_im/init/core.cljs @@ -28,7 +28,7 @@ :initial-props initial-props :desktop/desktop (merge desktop (:desktop/desktop app-db)) :network/type type - :hardwallet hardwallet + :hardwallet (dissoc hardwallet :secrets) :supported-biometric-auth supported-biometric-auth :view-id view-id :push-notifications/stored stored)}) diff --git a/src/status_im/ui/screens/profile/user/views.cljs b/src/status_im/ui/screens/profile/user/views.cljs index 7d3264e76a0..457620f3290 100644 --- a/src/status_im/ui/screens/profile/user/views.cljs +++ b/src/status_im/ui/screens/profile/user/views.cljs @@ -108,7 +108,8 @@ opts)]) (defn- flat-list-content [preferred-name registrar tribute-to-talk - active-contacts-count show-backup-seed?] + active-contacts-count show-backup-seed? + keycard-account?] [(cond-> {:title (or preferred-name :t/ens-usernames) :subtitle (if (boolean registrar) (if preferred-name @@ -163,7 +164,8 @@ :accessories [:chevron] :on-press #(re-frame/dispatch [:navigate-to :sync-settings])} (when (and platform/android? - config/hardwallet-enabled?) + config/hardwallet-enabled? + keycard-account?) {:icon :main-icons/keycard :title :t/keycard :accessibility-label :keycard-button @@ -198,7 +200,9 @@ {:keys [public-key preferred-name seed-backed-up? - mnemonic] + mnemonic + keycard-key-uid + address] :as multiaccount} [:multiaccount] active-contacts-count [:contacts/active-count] tribute-to-talk [:tribute-to-talk/profile] @@ -214,7 +218,8 @@ header (header multiaccount) content (flat-list-content preferred-name registrar tribute-to-talk - active-contacts-count show-backup-seed?) + active-contacts-count show-backup-seed? + keycard-key-uid) ;; generated toolbar and content with header generated-view (large-toolbar/generate-view diff --git a/src/status_im/ui/screens/wallet/accounts/views.cljs b/src/status_im/ui/screens/wallet/accounts/views.cljs index bb469c22452..806b7d07fd2 100644 --- a/src/status_im/ui/screens/wallet/accounts/views.cljs +++ b/src/status_im/ui/screens/wallet/accounts/views.cljs @@ -149,13 +149,15 @@ [icons/icon :main-icons/more {:accessibility-label :accounts-more-options}]]]])) (views/defview accounts [] - (views/letsubs [{:keys [accounts]} [:multiaccount]] + (views/letsubs [{:keys [accounts address keycard-key-uid]} [:multiaccount]] [react/scroll-view {:horizontal true} [react/view {:flex-direction :row :padding-top 11 :padding-bottom 12} (for [account accounts] ^{:key account} [account-card account]) - [add-card]]])) + ; TODO: enable keycard support for adding new accounts + (when-not keycard-key-uid + [add-card])]])) (defn accounts-overview [] [react/view {:flex 1}