[Fix] Keypair name in account about tab (#19505)
This commit fixes the display of the correct keypair name (where the account is generated from) in the About tab. Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This commit is contained in:
parent
34930a7136
commit
e104a9a935
|
@ -5,9 +5,12 @@
|
||||||
[:type {:optional true} [:enum :default-keypair :recovery-phrase :private-key]]
|
[:type {:optional true} [:enum :default-keypair :recovery-phrase :private-key]]
|
||||||
[:stored {:optional true} [:enum :on-device :on-keycard]]])
|
[:stored {:optional true} [:enum :on-device :on-keycard]]])
|
||||||
|
|
||||||
|
(def ^:private ?keypair-name
|
||||||
|
[:map
|
||||||
|
[:keypair-name {:optional true} [:maybe :string]]])
|
||||||
|
|
||||||
(def ^:private ?default-keypair
|
(def ^:private ?default-keypair
|
||||||
[:map
|
[:map
|
||||||
[:user-name {:optional true} [:maybe :string]]
|
|
||||||
[:profile-picture {:optional true} [:maybe :schema.common/image-source]]
|
[:profile-picture {:optional true} [:maybe :schema.common/image-source]]
|
||||||
[:derivation-path {:optional true} [:maybe :string]]
|
[:derivation-path {:optional true} [:maybe :string]]
|
||||||
[:on-press {:optional true} [:maybe fn?]]
|
[:on-press {:optional true} [:maybe fn?]]
|
||||||
|
@ -23,7 +26,7 @@
|
||||||
[:catn
|
[:catn
|
||||||
[:props
|
[:props
|
||||||
[:multi {:dispatch :type}
|
[:multi {:dispatch :type}
|
||||||
[:default-keypair [:merge ?base ?default-keypair]]
|
[:default-keypair [:merge ?base ?default-keypair ?keypair-name]]
|
||||||
[:recovery-phrase [:merge ?base ?recovery-phrase]]
|
[:recovery-phrase [:merge ?base ?recovery-phrase ?keypair-name]]
|
||||||
[:private-key ?base]]]]
|
[:private-key ?base]]]]
|
||||||
:any])
|
:any])
|
||||||
|
|
|
@ -12,14 +12,14 @@
|
||||||
[utils.i18n :as i18n]))
|
[utils.i18n :as i18n]))
|
||||||
|
|
||||||
(defn- row-title
|
(defn- row-title
|
||||||
[type user-name]
|
[type keypair-name]
|
||||||
[text/text
|
[text/text
|
||||||
{:weight :medium
|
{:weight :medium
|
||||||
:size :paragraph-1}
|
:size :paragraph-1}
|
||||||
(case type
|
(case type
|
||||||
:default-keypair (i18n/label :t/user-keypair {:name user-name})
|
:default-keypair (i18n/label :t/user-keypair {:name keypair-name})
|
||||||
:derivation-path (i18n/label :t/derivation-path)
|
:derivation-path (i18n/label :t/derivation-path)
|
||||||
(i18n/label :t/trip-accounts))])
|
keypair-name)])
|
||||||
|
|
||||||
(defn- row-icon
|
(defn- row-icon
|
||||||
[customization-color profile-picture type secondary-color]
|
[customization-color profile-picture type secondary-color]
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
{:color secondary-color}]])])
|
{:color secondary-color}]])])
|
||||||
|
|
||||||
(defn- list-view
|
(defn- list-view
|
||||||
[{:keys [type stored customization-color profile-picture user-name theme secondary-color]}]
|
[{:keys [type stored customization-color profile-picture keypair-name theme secondary-color]}]
|
||||||
(let [stored-name (if (= :on-device stored)
|
(let [stored-name (if (= :on-device stored)
|
||||||
(i18n/label :t/on-device)
|
(i18n/label :t/on-device)
|
||||||
(i18n/label :t/on-keycard))]
|
(i18n/label :t/on-keycard))]
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
:stored stored
|
:stored stored
|
||||||
:customization-color customization-color
|
:customization-color customization-color
|
||||||
:profile-picture profile-picture
|
:profile-picture profile-picture
|
||||||
:title user-name
|
:title keypair-name
|
||||||
:subtitle stored-name
|
:subtitle stored-name
|
||||||
:theme theme
|
:theme theme
|
||||||
:secondary-color secondary-color}]))
|
:secondary-color secondary-color}]))
|
||||||
|
|
|
@ -67,6 +67,8 @@
|
||||||
[]
|
[]
|
||||||
(let [{:keys [customization-color] :as profile} (rf/sub [:profile/profile-with-image])
|
(let [{:keys [customization-color] :as profile} (rf/sub [:profile/profile-with-image])
|
||||||
{:keys [address path watch-only?]} (rf/sub [:wallet/current-viewing-account])
|
{:keys [address path watch-only?]} (rf/sub [:wallet/current-viewing-account])
|
||||||
|
{keypair-name :name
|
||||||
|
keypair-type :type} (rf/sub [:wallet/current-viewing-account-keypair])
|
||||||
networks (rf/sub [:wallet/network-preference-details])]
|
networks (rf/sub [:wallet/network-preference-details])]
|
||||||
[rn/scroll-view
|
[rn/scroll-view
|
||||||
{:style style/about-tab
|
{:style style/about-tab
|
||||||
|
@ -88,10 +90,10 @@
|
||||||
:on-press #(rf/dispatch [:show-bottom-sheet {:content about-options}])}]
|
:on-press #(rf/dispatch [:show-bottom-sheet {:content about-options}])}]
|
||||||
(when (not watch-only?)
|
(when (not watch-only?)
|
||||||
[quo/account-origin
|
[quo/account-origin
|
||||||
{:type :default-keypair
|
{:type (if (= keypair-type "seed") :recovery-phrase :default-keypair)
|
||||||
:stored :on-device
|
:stored :on-device
|
||||||
:profile-picture (profile.utils/photo profile)
|
:profile-picture (profile.utils/photo profile)
|
||||||
:customization-color customization-color
|
:customization-color customization-color
|
||||||
:derivation-path path
|
:derivation-path path
|
||||||
:user-name (profile.utils/displayed-name profile)
|
:keypair-name keypair-name
|
||||||
:on-press #(js/alert "To be implemented")}])]))
|
:on-press #(js/alert "To be implemented")}])]))
|
||||||
|
|
|
@ -71,7 +71,6 @@
|
||||||
selected-keypair (rf/sub [:wallet/selected-keypair-uid])
|
selected-keypair (rf/sub [:wallet/selected-keypair-uid])
|
||||||
profile-picture (rf/sub [:profile/image])
|
profile-picture (rf/sub [:profile/image])
|
||||||
[selected-key-uid set-selected-key-uid] (rn/use-state selected-keypair)]
|
[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}}
|
[rn/view {:style {:flex 1}}
|
||||||
[quo/page-nav
|
[quo/page-nav
|
||||||
{:icon-name :i/close
|
{:icon-name :i/close
|
||||||
|
|
|
@ -99,6 +99,7 @@
|
||||||
:wallet/remove-account-success
|
:wallet/remove-account-success
|
||||||
(fn [_ [toast-message _]]
|
(fn [_ [toast-message _]]
|
||||||
{:fx [[:dispatch [:wallet/get-accounts]]
|
{:fx [[:dispatch [:wallet/get-accounts]]
|
||||||
|
[:dispatch [:wallet/get-keypairs]]
|
||||||
[:dispatch-later
|
[:dispatch-later
|
||||||
{:ms 100
|
{:ms 100
|
||||||
:dispatch [:hide-bottom-sheet]}]
|
:dispatch [:hide-bottom-sheet]}]
|
||||||
|
@ -183,6 +184,7 @@
|
||||||
:navigate-to-account address
|
:navigate-to-account address
|
||||||
:new-account? true)
|
:new-account? true)
|
||||||
:fx [[:dispatch [:wallet/get-accounts]]
|
:fx [[:dispatch [:wallet/get-accounts]]
|
||||||
|
[:dispatch [:wallet/get-keypairs]]
|
||||||
[:dispatch [:wallet/clear-new-keypair]]]}))
|
[:dispatch [:wallet/clear-new-keypair]]]}))
|
||||||
|
|
||||||
(rf/reg-event-fx :wallet/add-account
|
(rf/reg-event-fx :wallet/add-account
|
||||||
|
|
|
@ -215,6 +215,13 @@
|
||||||
(assoc :balance balance
|
(assoc :balance balance
|
||||||
:formatted-balance formatted-balance)))))
|
:formatted-balance formatted-balance)))))
|
||||||
|
|
||||||
|
(rf/reg-sub
|
||||||
|
:wallet/current-viewing-account-keypair
|
||||||
|
:<- [:wallet/current-viewing-account]
|
||||||
|
:<- [:wallet/keypairs]
|
||||||
|
(fn [[{:keys [key-uid]} keypairs]]
|
||||||
|
(first (filter #(= key-uid (:key-uid %)) keypairs))))
|
||||||
|
|
||||||
(rf/reg-sub
|
(rf/reg-sub
|
||||||
:wallet/current-viewing-account-tokens-in-selected-networks
|
:wallet/current-viewing-account-tokens-in-selected-networks
|
||||||
:<- [:wallet/current-viewing-account]
|
:<- [:wallet/current-viewing-account]
|
||||||
|
|
Loading…
Reference in New Issue