[#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)) (defn open-url [link] (.openURL ^js linking link))
(def set-status-bar-style react-native/StatusBar.setBarStyle) (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] :params [public-key]
:on-success (fn [url] :on-success (fn [url]
(rf/dispatch [:universal-links/save-profile-url public-key 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" :on-error #(log/error "failed to wakuext_shareUserURLWithData"
{:error % {:error %
:public-key public-key})}]}))) :public-key public-key})}]})))

View File

@ -29,7 +29,13 @@
:on-success #(rf/dispatch [:open-modal :on-success #(rf/dispatch [:open-modal
:share-contact])}])) :share-contact])}]))
[public-key]) [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 [quo/action-drawer
[[{:icon :i/edit [[{:icon :i/edit
:label (if has-nickname? :label (if has-nickname?
@ -43,7 +49,7 @@
:accessibility-label :show-qr-code} :accessibility-label :show-qr-code}
{:icon :i/share {:icon :i/share
:label (i18n/label :t/share-profile) :label (i18n/label :t/share-profile)
:on-press not-implemented/alert :on-press on-share-profile
:accessibility-label :share-profile} :accessibility-label :share-profile}
(when has-nickname? (when has-nickname?
{:icon :i/delete {:icon :i/delete