-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
81cb058
commit 541b2e0
Showing
5 changed files
with
46 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 39 additions & 32 deletions
71
src/status_im/contexts/settings/wallet/keypairs_and_accounts/actions/view.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,51 @@ | ||
(ns status-im.contexts.settings.wallet.keypairs-and-accounts.actions.view | ||
(:require [quo.core :as quo] | ||
[react-native.core :as rn] | ||
[status-im.contexts.settings.wallet.keypairs-and-accounts.remove.view :as remove-key-pair] | ||
[utils.i18n :as i18n] | ||
[utils.re-frame :as rf])) | ||
|
||
(defn on-rename-key-pair | ||
[key-pair] | ||
(rf/dispatch [:open-modal :screen/settings.rename-keypair key-pair])) | ||
|
||
(defn on-remove-key-pair | ||
[key-pair] | ||
(rf/dispatch [:show-bottom-sheet | ||
{:theme :dark | ||
:content (fn [] | ||
[remove-key-pair/view key-pair])}])) | ||
|
||
(defn on-show-qr | ||
[data] | ||
(rf/dispatch [:open-modal :screen/settings.encrypted-key-pair-qr data])) | ||
|
||
(defn view | ||
[props key-pair] | ||
(let [has-paired-device (rf/sub [:pairing/has-paired-devices])] | ||
[props keypair] | ||
(let [has-paired-device (rf/sub [:pairing/has-paired-devices]) | ||
missing-keypair? (= (:stored props) :missing) | ||
on-scan-qr (rn/use-callback #(rf/dispatch [:open-modal :screen/settings.scan-keypair-qr | ||
[(:key-uid keypair)]]) | ||
[keypair]) | ||
on-show-qr (rn/use-callback #(rf/dispatch [:open-modal | ||
:screen/settings.encrypted-key-pair-qr | ||
keypair]) | ||
[keypair]) | ||
on-remove-keypair (rn/use-callback #(rf/dispatch | ||
[:show-bottom-sheet | ||
{:theme :dark | ||
:content (fn [] | ||
[remove-key-pair/view keypair])}]) | ||
[keypair]) | ||
on-rename-keypair (rn/use-callback #(rf/dispatch [:open-modal :screen/settings.rename-keypair | ||
keypair]) | ||
[keypair])] | ||
[:<> | ||
[quo/drawer-top props] | ||
[quo/action-drawer | ||
[(when has-paired-device | ||
[{:icon :i/qr-code | ||
:accessibility-label :show-key-pr-qr | ||
:label (i18n/label :t/show-encrypted-qr-of-key-pairs) | ||
:on-press #(on-show-qr key-pair)}]) | ||
(if-not missing-keypair? | ||
[{:icon :i/qr-code | ||
:accessibility-label :show-key-pr-qr | ||
:label (i18n/label :t/show-encrypted-qr-of-key-pairs) | ||
:on-press on-show-qr}] | ||
[{:icon :i/scan | ||
:accessibility-label :import-by-scan-qr | ||
:label (i18n/label :t/import-by-scanning-encrypted-qr) | ||
:on-press on-scan-qr}])) | ||
(when (= (:type props) :keypair) | ||
(concat | ||
[{:icon :i/edit | ||
:accessibility-label :rename-key-pair | ||
:label (i18n/label :t/rename-key-pair) | ||
:on-press #(on-rename-key-pair key-pair)}] | ||
[{:icon :i/delete | ||
:accessibility-label :remove-key-pair | ||
:add-divider? true | ||
:danger? true | ||
:label (i18n/label :t/remove-key-pair-and-derived-accounts) | ||
:on-press #(on-remove-key-pair key-pair)}]))]]])) | ||
[{:icon :i/edit | ||
:accessibility-label :rename-key-pair | ||
:label (i18n/label :t/rename-key-pair) | ||
:on-press on-rename-keypair} | ||
{:icon :i/delete | ||
:accessibility-label :remove-key-pair | ||
:add-divider? true | ||
:danger? true | ||
:label (i18n/label :t/remove-key-pair-and-derived-accounts) | ||
:on-press on-remove-keypair}])]]])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters