fix: show pubkey in add contact input when available (#19187)
This commit is contained in:
parent
fd24a80904
commit
6d74d0396e
|
@ -61,9 +61,10 @@
|
||||||
(reset! input-value clipboard-text)
|
(reset! input-value clipboard-text)
|
||||||
(rf/dispatch [:contacts/set-new-identity
|
(rf/dispatch [:contacts/set-new-identity
|
||||||
{:input clipboard-text}])))]
|
{:input clipboard-text}])))]
|
||||||
(let [{:keys [scanned]} (rf/sub [:contacts/new-identity])
|
(let [{:keys [scanned] contact-public-key :id} (rf/sub [:contacts/new-identity])
|
||||||
empty-input? (and (string/blank? @input-value)
|
contact-public-key-or-scanned (or contact-public-key scanned)
|
||||||
(string/blank? scanned))]
|
empty-input? (and (string/blank? @input-value)
|
||||||
|
(string/blank? contact-public-key-or-scanned))]
|
||||||
[rn/view {:style style/input-and-scan-container}
|
[rn/view {:style style/input-and-scan-container}
|
||||||
[quo/input
|
[quo/input
|
||||||
{:accessibility-label :enter-contact-code-input
|
{:accessibility-label :enter-contact-code-input
|
||||||
|
@ -80,15 +81,16 @@
|
||||||
:button (when empty-input?
|
:button (when empty-input?
|
||||||
{:on-press paste-on-input
|
{:on-press paste-on-input
|
||||||
:text (i18n/label :t/paste)})
|
:text (i18n/label :t/paste)})
|
||||||
;; NOTE: `scanned` has priority over `@input-value`, we clean it when the input is updated
|
;; NOTE: `contact-public-key-or-scanned` has priority over `@input-value`,
|
||||||
;; so that it's `nil` and `@input-value` is shown. To fastly clean it, we use
|
;; we clean it when the input is updated so that it's `nil` and
|
||||||
;; `dispatch-sync`. This call could be avoided if `::qr-scanner/scan-code` were able to
|
;; `@input-value`is shown. To fastly clean it, we use `dispatch-sync`.
|
||||||
|
;; This call could be avoided if `::qr-scanner/scan-code` were able to
|
||||||
;; receive a callback function, not only a re-frame event as callback.
|
;; receive a callback function, not only a re-frame event as callback.
|
||||||
:value (or scanned @input-value)
|
:value (or contact-public-key-or-scanned @input-value)
|
||||||
:on-change-text (fn [new-text]
|
:on-change-text (fn [new-text]
|
||||||
(reset! input-value new-text)
|
(reset! input-value new-text)
|
||||||
(as-> [:contacts/set-new-identity {:input new-text}] $
|
(as-> [:contacts/set-new-identity {:input new-text}] $
|
||||||
(if (string/blank? scanned)
|
(if (string/blank? contact-public-key-or-scanned)
|
||||||
(debounce/debounce-and-dispatch $ 600)
|
(debounce/debounce-and-dispatch $ 600)
|
||||||
(rf/dispatch-sync $))))}]
|
(rf/dispatch-sync $))))}]
|
||||||
[rn/view {:style style/scan-button-container}
|
[rn/view {:style style/scan-button-container}
|
||||||
|
|
Loading…
Reference in New Issue