Wallet: share address (#18121)

* wallet: share address
This commit is contained in:
Omar Basem 2023-12-15 08:11:06 +04:00 committed by GitHub
parent ed53fecf47
commit 6f3bf98e83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 27 deletions

View File

@ -3,8 +3,10 @@
["react-native-share" :default react-native-share])) ["react-native-share" :default react-native-share]))
(defn open (defn open
[options on-success on-error] ([options]
(-> ^js react-native-share (open options #() #()))
(.open (clj->js options)) ([options on-success on-error]
(.then on-success) (-> ^js react-native-share
(.catch on-error))) (.open (clj->js options))
(.then on-success)
(.catch on-error))))

View File

@ -2,6 +2,8 @@
(:require (:require
[quo.core :as quo] [quo.core :as quo]
[react-native.core :as rn] [react-native.core :as rn]
[react-native.platform :as platform]
[react-native.share :as share]
[status-im2.contexts.profile.utils :as profile.utils] [status-im2.contexts.profile.utils :as profile.utils]
[status-im2.contexts.wallet.account.tabs.about.style :as style] [status-im2.contexts.wallet.account.tabs.about.style :as style]
[utils.i18n :as i18n] [utils.i18n :as i18n]
@ -9,28 +11,45 @@
(defn about-options (defn about-options
[] []
[quo/action-drawer (let [{:keys [address] :as account} (rf/sub [:wallet/current-viewing-account])
[[{:icon :i/link share-title (str (:name account) " " (i18n/label :t/address))]
:accessibility-label :view-on-eth [quo/action-drawer
:label (i18n/label :t/view-on-eth) [[{:icon :i/link
:right-icon :i/external} :accessibility-label :view-on-eth
{:icon :i/link :label (i18n/label :t/view-on-eth)
:accessibility-label :view-on-opt :right-icon :i/external}
:label (i18n/label :t/view-on-opt) {:icon :i/link
:right-icon :i/external} :accessibility-label :view-on-opt
{:icon :i/link :label (i18n/label :t/view-on-opt)
:accessibility-label :view-on-arb :right-icon :i/external}
:label (i18n/label :t/view-on-arb) {:icon :i/link
:right-icon :i/external} :accessibility-label :view-on-arb
{:icon :i/copy :label (i18n/label :t/view-on-arb)
:accessibility-label :copy-address :right-icon :i/external}
:label (i18n/label :t/copy-address)} {:icon :i/copy
{:icon :i/qr-code :accessibility-label :copy-address
:accessibility-label :show-address-qr :label (i18n/label :t/copy-address)}
:label (i18n/label :t/show-address-qr)} {:icon :i/qr-code
{:icon :i/share :accessibility-label :show-address-qr
:accessibility-label :share-address :label (i18n/label :t/show-address-qr)}
:label (i18n/label :t/share-address)}]]]) {:icon :i/share
:accessibility-label :share-address
:label (i18n/label :t/share-address)
:on-press (fn []
(rf/dispatch [:hide-bottom-sheet])
(js/setTimeout
#(share/open
(if platform/ios?
{:activityItemSources [{:placeholderItem {:type "text"
:content address}
:item {:default {:type "text"
:content
address}}
:linkMetadata {:title share-title}}]}
{:title share-title
:subject share-title
:message address}))
600))}]]]))
(defn view (defn view
[] []