Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarBasem committed Feb 19, 2024
1 parent 01e1f09 commit 756c123
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns status-im.contexts.wallet.create-account.new-keypair.backup-recovery-phrase.view
(:require
[clojure.string :as string]
[native-module.core :as native-module]
[quo.core :as quo]
[quo.theme :as quo.theme]
Expand Down Expand Up @@ -49,9 +50,9 @@
random-phrase (reagent/atom [])]
(fn []
(rn/use-effect
(fn []
(native-module/get-random-mnemonic #(reset! secret-phrase (clojure.string/split % #"\s")))
(native-module/get-random-mnemonic #(reset! random-phrase (clojure.string/split % #"\s")))))
(fn []
(native-module/get-random-mnemonic #(reset! secret-phrase (string/split % #"\s")))
(native-module/get-random-mnemonic #(reset! random-phrase (string/split % #"\s")))))
[rn/view {:style {:flex 1}}
[quo/page-nav
{:icon-name :i/close
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
[]
(let [keypair-name (reagent/atom "")]
(fn []
(let [{:keys [secret-phrase]} (rf/sub [:wallet/ui])
customization-color (rf/sub [:profile/customization-color])]
(let [customization-color (rf/sub [:profile/customization-color])]
[rn/view {:style {:flex 1}}
[quo/page-nav
{:icon-name :i/arrow-left
Expand Down
53 changes: 31 additions & 22 deletions src/status_im/contexts/wallet/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -387,25 +387,34 @@
:subject title
:message content})]]}))

(rf/reg-event-fx :wallet/store-secret-phrase
(fn [{:keys [db]} [{:keys [secret-phrase random-phrase]}]]
{:db (-> db
(assoc-in [:wallet :ui :create-account :secret-phrase] secret-phrase)
(assoc-in [:wallet :ui :create-account :random-phrase] random-phrase))
:fx [[:dispatch-later [{:ms 20 :dispatch [:navigate-to :wallet-check-your-backup]}]]]}))

(rf/reg-event-fx :wallet/new-keypair-created
(fn [{: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]]]}))

(rf/reg-event-fx :wallet/new-keypair-continue
(fn [{:keys [db]} [{:keys [keypair-name]}]]
(let [secret-phrase (get-in db [:wallet :ui :create-account :secret-phrase])]
{:fx [[:effects.wallet/create-account-from-mnemonic
{:secret-phrase secret-phrase
:keypair-name keypair-name}]]})))

(rf/reg-event-fx :wallet/clear-new-keypair
(fn [{:keys [db]}]
{:db (update-in db [:wallet :ui :create-account] dissoc :new-keypair)}))
(defn store-secret-phrase
[{:keys [db]} [{:keys [secret-phrase random-phrase]}]]
{:db (-> db
(assoc-in [:wallet :ui :create-account :secret-phrase] secret-phrase)
(assoc-in [:wallet :ui :create-account :random-phrase] random-phrase))
:fx [[:dispatch-later [{:ms 20 :dispatch [:navigate-to :wallet-check-your-backup]}]]]})

(rf/reg-event-fx :wallet/store-secret-phrase store-secret-phrase)


(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]]]})

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

(defn new-keypair-continue
[{:keys [db]} [{:keys [keypair-name]}]]
(let [secret-phrase (get-in db [:wallet :ui :create-account :secret-phrase])]
{:fx [[:effects.wallet/create-account-from-mnemonic
{:secret-phrase secret-phrase
:keypair-name keypair-name}]]}))

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

(defn clear-new-keypair
[{:keys [db]}]
{:db (update-in db [:wallet :ui :create-account] dissoc :new-keypair)})

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

0 comments on commit 756c123

Please sign in to comment.