Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallet: Keypair feature flag #19333

Merged
merged 6 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/quo/components/list_items/quiz_item/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:flex-direction :row
:justify-content :space-between
:align-items :center
:max-height 56
:height 56
:padding 12
:border-radius 12
:opacity (if (= state :disabled) 0.3 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

(defn view
[{:keys [track-text customization-color auth-button-label on-auth-success on-auth-fail
auth-button-icon-left size blur? container-style disabled?]
auth-button-icon-left size blur? container-style disabled? dependencies]
:or {container-style {:flex 1}}}]
(let [theme (quo.theme/use-theme-value)
auth-method (rf/sub [:auth-method])
Expand All @@ -24,7 +24,7 @@
:on-auth-success on-auth-success
:on-auth-fail on-auth-fail
:auth-button-label auth-button-label}]))
[theme])]
(into [] (concat [theme] dependencies)))]
[quo/slide-button
{:container-style container-style
:size size
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/contexts/wallet/create_account/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
(defn new-keypair-created
[{:keys [db]} [{:keys [new-keypair]}]]
{:db (assoc-in db [:wallet :ui :create-account :new-keypair] new-keypair)
:fx [[:dispatch [:navigate-back-to :wallet-create-account]]]})
:fx [[:dispatch [:navigate-back-to :screen/wallet.create-account]]]})

(rf/reg-event-fx :wallet/new-keypair-created new-keypair-created)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
(defn blur
[theme]
{:style {:flex 1}
:blur-radius 20
:blur-radius 25
:blur-type (quo.theme/theme-value :light :dark theme)
:blur-amount 20})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
:scroll-enabled false}])

(defn- step-item
[item index _ checked?]
[item index _ {:keys [checked? customization-color]}]
[rn/view {:style style/step-item}
[quo/selectors
{:type :checkbox
:on-change #(swap! checked? assoc (keyword (str index)) %)}]
{:type :checkbox
:customization-color customization-color
:on-change #(swap! checked? assoc (keyword (str index)) %)}]
[quo/text {:style {:margin-left 12}} (i18n/label item)]])

(defn- f-view
Expand Down Expand Up @@ -61,7 +62,8 @@
[quo/page-top
{:title (i18n/label :t/backup-recovery-phrase)
:description :text
:description-text (i18n/label :t/backup-recovery-phrase-description)}]
:description-text (i18n/label :t/backup-recovery-phrase-description)
:container-style {:padding-bottom 8}}]
[rn/view {:style (style/seed-phrase-container theme)}
(when (pos? (count @secret-phrase))
[:<>
Expand All @@ -86,7 +88,8 @@
[rn/flat-list
{:data step-labels
:render-fn step-item
:render-data checked?
:render-data {:checked? checked?
:customization-color customization-color}
:scroll-enabled false}]])
(if @revealed?
[rn/view {:style style/slide-button}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@

(def cheat-description
{:padding-horizontal 20
:padding-top 4
:padding-top 8
:padding-bottom 8})
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

(def header-container
{:margin-horizontal 20
:margin-vertical 12})
:margin-top 12
:margin-bottom 20})

(def bottom-action
{:position :absolute
:bottom 12
:left 0
:right 0})
{:margin-horizontal -20})
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[quo.core :as quo]
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im.common.floating-button-page.view :as floating-button-page]
[status-im.contexts.wallet.create-account.new-keypair.keypair-name.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
Expand All @@ -15,26 +16,30 @@
(fn []
(let [customization-color (rf/sub [:profile/customization-color])]
[rn/view {:style {:flex 1}}
[quo/page-nav
{:icon-name :i/arrow-left
:on-press #(rf/dispatch [:navigate-back])
:accessibility-label :top-bar}]
[quo/text-combinations
{:container-style style/header-container
:title (i18n/label :t/keypair-name)
:description (i18n/label :t/keypair-name-description)}]
[quo/input
{:container-style {:margin-horizontal 20}
:placeholder (i18n/label :t/keypair-name-input-placeholder)
:label (i18n/label :t/keypair-name)
:char-limit keypair-name-max-length
:on-change-text #(reset! keypair-name %)}]
[quo/bottom-actions
{:actions :one-action
:button-one-label (i18n/label :t/continue)
:button-one-props {:disabled? (or (zero? (count @keypair-name))
(> (count @keypair-name) keypair-name-max-length))
:customization-color customization-color
:on-press #(rf/dispatch [:wallet/new-keypair-continue
{:keypair-name @keypair-name}])}
:container-style style/bottom-action}]]))))
[floating-button-page/view
{:header [quo/page-nav
{:icon-name :i/arrow-left
:on-press #(rf/dispatch [:navigate-back])
:accessibility-label :top-bar}]
:footer [quo/bottom-actions
{:actions :one-action
:button-one-label (i18n/label :t/continue)
:button-one-props {:disabled? (or (zero? (count @keypair-name))
(> (count @keypair-name)
keypair-name-max-length))
:customization-color customization-color
:on-press #(rf/dispatch [:wallet/new-keypair-continue
{:keypair-name
@keypair-name}])}
:container-style style/bottom-action}]}
[quo/text-combinations
{:container-style style/header-container
:title (i18n/label :t/keypair-name)
:description (i18n/label :t/keypair-name-description)}]
[quo/input
{:container-style {:margin-horizontal 20}
:placeholder (i18n/label :t/keypair-name-input-placeholder)
:label (i18n/label :t/keypair-name)
:char-limit keypair-name-max-length
:auto-focus true
:on-change-text #(reset! keypair-name %)}]]]))))
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,11 @@
:action :none}))))

(defn- keypair
[item index _ {:keys [profile-picture compressed-key selected-key-uid set-selected-key-uid]}]
(let [main-account (first (:accounts item))
color (:customization-color main-account)
accounts (parse-accounts (:accounts item))]
[item index _
{:keys [profile-picture compressed-key selected-key-uid set-selected-key-uid customization-color]}]
(let [accounts (parse-accounts (:accounts item))]
[quo/keypair
{:customization-color color
{:customization-color customization-color
:profile-picture (when (zero? index) profile-picture)
:status-indicator false
:type (if (zero? index) :default-keypair :other)
Expand All @@ -75,6 +74,7 @@
selected-keypair (rf/sub [:wallet/selected-keypair-uid])
profile-picture (rf/sub [:profile/image])
[selected-key-uid set-selected-key-uid] (rn/use-state selected-keypair)]
(rn/use-mount #(rf/dispatch [:wallet/get-keypairs]))
[rn/view {:style {:flex 1}}
[quo/page-nav
{:icon-name :i/close
Expand All @@ -96,7 +96,8 @@
:render-data {:profile-picture profile-picture
:compressed-key compressed-key
:selected-key-uid selected-key-uid
:set-selected-key-uid set-selected-key-uid}
:set-selected-key-uid set-selected-key-uid
:customization-color customization-color}
:initial-num-to-render 1
:content-container-style {:padding-bottom 60}}]
[quo/bottom-actions
Expand Down
10 changes: 4 additions & 6 deletions src/status_im/contexts/wallet/create_account/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
[status-im.contexts.wallet.create-account.style :as style]
[status-im.contexts.wallet.create-account.utils :as create-account.utils]
[status-im.contexts.wallet.sheets.account-origin.view :as account-origin]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[utils.responsiveness :refer [iphone-11-Pro-20-pixel-from-width]]
Expand All @@ -32,10 +31,7 @@
:customization-color customization-color}
:i/seed)
:action (when-not new-keypair? :button)
:action-props {:on-press (fn []
(ff/alert ::ff/wallet.bridge-token
#(rf/dispatch [:navigate-to
:screen/wallet.select-keypair])))
:action-props {:on-press #(rf/dispatch [:navigate-to :screen/wallet.select-keypair])
:button-text (i18n/label :t/edit)
:alignment :flex-start}
:description :text
Expand Down Expand Up @@ -97,6 +93,7 @@
(i18n/label :t/keypair-title
{:name (:name keypair)})
(:name keypair)))]
(rn/use-unmount #(rf/dispatch [:wallet/clear-new-keypair]))
[rn/view {:style {:flex 1}}
[quo/page-nav
{:type :no-title
Expand Down Expand Up @@ -166,7 +163,8 @@
(create-existing-keypair-account password)))
:auth-button-label (i18n/label :t/confirm)
:disabled? (empty? @account-name)
:container-style (style/slide-button-container bottom)}]]))))
:container-style (style/slide-button-container bottom)
:dependencies [new-keypair]}]]))))

(defn- view-internal
[]
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/feature_flags.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

(defonce ^:private feature-flags-config
(reagent/atom
{::wallet.edit-default-keypair (enabled-in-env? :FLAG_EDIT_DEFAULT_KEYPAIR)
{::wallet.bridge-token (enabled-in-env? :FLAG_BRIDGE_TOKEN_ENABLED)
::wallet.edit-derivation-path (enabled-in-env? :FLAG_EDIT_DERIVATION_PATH)
::wallet.remove-account (enabled-in-env? :FLAG_REMOVE_ACCOUNT_ENABLED)
::wallet.network-filter (enabled-in-env? :FLAG_NETWORK_FILTER_ENABLED)
Expand Down