From a9b4d86b009fcccaa532d6095c27b9a1223d0e1f Mon Sep 17 00:00:00 2001 From: flexsurfer Date: Mon, 6 May 2024 11:58:13 +0200 Subject: [PATCH] Patch "Show QR Code" functionality (#19893) --- src/status_im/common/home/actions/view.cljs | 27 +++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/status_im/common/home/actions/view.cljs b/src/status_im/common/home/actions/view.cljs index 6766c3a66f..968b28f5f2 100644 --- a/src/status_im/common/home/actions/view.cljs +++ b/src/status_im/common/home/actions/view.cljs @@ -277,23 +277,29 @@ :sub-label nil :chevron? false})) -;; TODO(OmarBasem): Requires design input. (defn show-qr-entry - [] + [public-key] (entry {:icon :i/qr-code :label (i18n/label :t/show-qr) - :on-press #(js/alert "TODO: to be implemented, requires design input") + :on-press (fn [] + (rf/dispatch [:universal-links/generate-profile-url + {:public-key public-key + :on-success #(rf/dispatch [:open-modal + :share-contact])}])) :danger? false :accessibility-label :show-qr-code :sub-label nil :chevron? false})) -;; TODO(OmarBasem): to be implemented. (defn share-profile-entry - [] + [public-key] (entry {:icon :i/share :label (i18n/label :t/share-profile) - :on-press #(js/alert "TODO: to be implemented") + :on-press (fn [] + (rf/dispatch [:universal-links/generate-profile-url + {:public-key public-key + :on-success #(rf/dispatch [:open-share + {:options {:message %}}])}])) :danger? false :accessibility-label :share-profile :sub-label nil @@ -419,9 +425,6 @@ (notifications-entry false)) (when (and config/fetch-messages-enabled? inside-chat?) (chat-actions/fetch-messages chat-id)) - (when public? - (when config/show-not-implemented-features? - (show-qr-entry))) (when public? (when config/show-not-implemented-features? (share-group-entry)))]) @@ -467,10 +470,8 @@ [[(view-profile-entry public-key) (when-not (= current-pub-key public-key) (edit-nickname-entry public-key)) - (when config/show-not-implemented-features? - (show-qr-entry)) - (when config/show-not-implemented-features? - (share-profile-entry))] + (show-qr-entry public-key) + (share-profile-entry public-key)] [(when-not (= current-pub-key public-key) (when config/show-not-implemented-features? (mark-untrustworthy-entry)))