[#19101] feat: share contact profile (#19154)

This commit is contained in:
Mohsen 2024-03-10 18:56:45 +03:00 committed by GitHub
parent e283a72454
commit 7065f4abd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 3 deletions

View File

@ -224,3 +224,7 @@
(defn open-url [link] (.openURL ^js linking link))
(def set-status-bar-style react-native/StatusBar.setBarStyle)
(defn sharing
[content]
(.share (.-Share ^js react-native) (clj->js content)))

View File

@ -186,7 +186,7 @@
:params [public-key]
:on-success (fn [url]
(rf/dispatch [:universal-links/save-profile-url public-key url])
(when (fn? on-success) (on-success)))
(when (fn? on-success) (on-success url)))
:on-error #(log/error "failed to wakuext_shareUserURLWithData"
{:error %
:public-key public-key})}]})))

View File

@ -29,7 +29,13 @@
:on-success #(rf/dispatch [:open-modal
:share-contact])}]))
[public-key])
has-nickname? (rn/use-memo (fn [] (not (string/blank? nickname))) [nickname])]
has-nickname? (rn/use-memo (fn [] (not (string/blank? nickname))) [nickname])
on-share-profile (rn/use-callback
(fn []
(rf/dispatch [:universal-links/generate-profile-url
{:public-key public-key
:on-success #(rn/sharing {:message %})}]))
[public-key])]
[quo/action-drawer
[[{:icon :i/edit
:label (if has-nickname?
@ -43,7 +49,7 @@
:accessibility-label :show-qr-code}
{:icon :i/share
:label (i18n/label :t/share-profile)
:on-press not-implemented/alert
:on-press on-share-profile
:accessibility-label :share-profile}
(when has-nickname?
{:icon :i/delete