mirror of
https://github.com/status-im/status-react.git
synced 2025-02-18 05:48:12 +00:00
fix(wallet): native share should point to opensea link (#20222)
This commit is contained in:
parent
f93e372d18
commit
fd3a21a320
@ -16,12 +16,13 @@
|
|||||||
(rf/dispatch [:wallet/get-collectible-details id]))
|
(rf/dispatch [:wallet/get-collectible-details id]))
|
||||||
|
|
||||||
(defn- on-collectible-long-press
|
(defn- on-collectible-long-press
|
||||||
[{:keys [preview-url collectible-details]}]
|
[{:keys [preview-url collectible-details id]}]
|
||||||
(rf/dispatch [:show-bottom-sheet
|
(rf/dispatch [:show-bottom-sheet
|
||||||
{:content (fn []
|
{:content (fn []
|
||||||
[options-drawer/view
|
[options-drawer/view
|
||||||
{:name (:name collectible-details)
|
{:name (:name collectible-details)
|
||||||
:image (:uri preview-url)}])}]))
|
:image (:uri preview-url)
|
||||||
|
:id id}])}]))
|
||||||
|
|
||||||
(defn- on-end-reached
|
(defn- on-end-reached
|
||||||
[]
|
[]
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
(ns status-im.contexts.wallet.collectible.events
|
(ns status-im.contexts.wallet.collectible.events
|
||||||
(:require [camel-snake-kebab.extras :as cske]
|
(:require [camel-snake-kebab.extras :as cske]
|
||||||
|
[react-native.platform :as platform]
|
||||||
[status-im.contexts.wallet.collectible.utils :as collectible-utils]
|
[status-im.contexts.wallet.collectible.utils :as collectible-utils]
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
[utils.ethereum.chain :as chain]
|
[utils.ethereum.chain :as chain]
|
||||||
@ -200,25 +201,35 @@
|
|||||||
|
|
||||||
(rf/reg-event-fx :wallet/trigger-share-collectible
|
(rf/reg-event-fx :wallet/trigger-share-collectible
|
||||||
(fn [_ [{:keys [title uri]}]]
|
(fn [_ [{:keys [title uri]}]]
|
||||||
{:fx [[:effects.share/open
|
{:fx [[:dispatch
|
||||||
{:title title
|
[:open-share
|
||||||
:message title
|
{:options (if platform/ios?
|
||||||
:url uri}]]}))
|
{:activityItemSources
|
||||||
|
[{:placeholderItem {:type :text
|
||||||
|
:content uri}
|
||||||
|
:item {:default {:type :url
|
||||||
|
:content uri}}
|
||||||
|
:linkMetadata {:title title}}]}
|
||||||
|
{:title title
|
||||||
|
:subject title
|
||||||
|
:url uri
|
||||||
|
:isNewTask true})}]]]}))
|
||||||
|
|
||||||
(rf/reg-event-fx :wallet/share-collectible
|
(rf/reg-event-fx :wallet/share-collectible
|
||||||
(fn [_ [{:keys [title uri in-sheet?]}]]
|
(fn [{:keys [db]} [{:keys [title token-id contract-address chain-id]}]]
|
||||||
(if in-sheet?
|
(let [uri (collectible-utils/get-opensea-collectible-url
|
||||||
|
{:chain-id chain-id
|
||||||
|
:token-id token-id
|
||||||
|
:contract-address contract-address
|
||||||
|
:test-networks-enabled? (get-in db [:profile/profile :test-networks-enabled?])
|
||||||
|
:is-goerli-enabled? (get-in db [:profile/profile :is-goerli-enabled?])})]
|
||||||
{:fx [[:dispatch
|
{:fx [[:dispatch
|
||||||
[:hide-bottom-sheet]]
|
[:hide-bottom-sheet]]
|
||||||
[:dispatch-later
|
[:dispatch-later
|
||||||
{:ms 600
|
{:ms 600
|
||||||
:dispatch [:wallet/trigger-share-collectible
|
:dispatch [:wallet/trigger-share-collectible
|
||||||
{:title title
|
{:title title
|
||||||
:uri uri}]}]]}
|
:uri uri}]}]]})))
|
||||||
{:fx [[:dispatch
|
|
||||||
[:wallet/trigger-share-collectible
|
|
||||||
{:title title
|
|
||||||
:uri uri}]]]})))
|
|
||||||
|
|
||||||
(rf/reg-event-fx
|
(rf/reg-event-fx
|
||||||
:wallet/navigate-to-opensea
|
:wallet/navigate-to-opensea
|
||||||
|
@ -7,15 +7,18 @@
|
|||||||
[utils.url :as url]))
|
[utils.url :as url]))
|
||||||
|
|
||||||
(defn view
|
(defn view
|
||||||
[{:keys [image name chain-id address]}]
|
[{:keys [image name id]}]
|
||||||
(let [uri (url/replace-port image (rf/sub [:mediaserver/port]))]
|
(let [chain-id (get-in id [:contract-id :chain-id])
|
||||||
|
token-id (:token-id id)
|
||||||
|
contract-address (get-in id [:contract-id :address])
|
||||||
|
uri (url/replace-port image (rf/sub [:mediaserver/port]))]
|
||||||
[quo/action-drawer
|
[quo/action-drawer
|
||||||
[[{:icon :i/link
|
[[{:icon :i/link
|
||||||
:accessibility-label :view-on-etherscan
|
:accessibility-label :view-on-etherscan
|
||||||
:on-press (fn []
|
:on-press (fn []
|
||||||
(rf/dispatch [:wallet/navigate-to-chain-explorer-from-bottom-sheet
|
(rf/dispatch [:wallet/navigate-to-chain-explorer-from-bottom-sheet
|
||||||
(external-links/get-explorer-url-by-chain-id chain-id)
|
(external-links/get-explorer-url-by-chain-id chain-id)
|
||||||
address]))
|
contract-address]))
|
||||||
:label (i18n/label :t/view-on-eth)
|
:label (i18n/label :t/view-on-eth)
|
||||||
:right-icon :i/external}]
|
:right-icon :i/external}]
|
||||||
[{:icon :i/save
|
[{:icon :i/save
|
||||||
@ -34,6 +37,14 @@
|
|||||||
:accessibility-label :share-collectible
|
:accessibility-label :share-collectible
|
||||||
:label (i18n/label :t/share-collectible)
|
:label (i18n/label :t/share-collectible)
|
||||||
:on-press #(rf/dispatch [:wallet/share-collectible
|
:on-press #(rf/dispatch [:wallet/share-collectible
|
||||||
{:in-sheet? true
|
{:token-id token-id
|
||||||
:title name
|
:contract-address contract-address
|
||||||
:uri uri}])}]]]))
|
:chain-id chain-id
|
||||||
|
:title name}])}]]]))
|
||||||
|
|
||||||
|
"222"
|
||||||
|
"https://nft-cdn.alchemy.com/eth-mainnet/219530f9b3a7901f02169334d593823e"
|
||||||
|
"Tengria #913"
|
||||||
|
{:contract-id {:chain-id 1 :address "0x1a4ceef5d575c2228d142ef862a9b60be8161e7f"} :token-id "913"}
|
||||||
|
|
||||||
|
{:contract-id {:chain-id 1 :address "0x1a4ceef5d575c2228d142ef862a9b60be8161e7f"} :token-id "913"}
|
||||||
|
@ -79,7 +79,8 @@
|
|||||||
(js/setTimeout #(rf/dispatch [:wallet/clear-last-collectible-details]) 700))
|
(js/setTimeout #(rf/dispatch [:wallet/clear-last-collectible-details]) 700))
|
||||||
|
|
||||||
(defn animated-header
|
(defn animated-header
|
||||||
[{:keys [scroll-amount title-opacity page-nav-type picture title description theme]}]
|
[{:keys [scroll-amount title-opacity page-nav-type picture title description theme
|
||||||
|
id]}]
|
||||||
(let [blur-amount (header-animations/use-blur-amount scroll-amount)
|
(let [blur-amount (header-animations/use-blur-amount scroll-amount)
|
||||||
layer-opacity (header-animations/use-layer-opacity
|
layer-opacity (header-animations/use-layer-opacity
|
||||||
scroll-amount
|
scroll-amount
|
||||||
@ -110,7 +111,8 @@
|
|||||||
{:content (fn []
|
{:content (fn []
|
||||||
[options-drawer/view
|
[options-drawer/view
|
||||||
{:name title
|
{:name title
|
||||||
:image picture}])
|
:image picture
|
||||||
|
:id id}])
|
||||||
:theme theme}])}]
|
:theme theme}])}]
|
||||||
:center-opacity title-opacity}]]]]))
|
:center-opacity title-opacity}]]]]))
|
||||||
|
|
||||||
@ -197,7 +199,8 @@
|
|||||||
[options-drawer/view
|
[options-drawer/view
|
||||||
{:name collectible-name
|
{:name collectible-name
|
||||||
:image
|
:image
|
||||||
preview-uri}])}])}])))
|
preview-uri
|
||||||
|
:id id}])}])}])))
|
||||||
:on-collectible-load (fn []
|
:on-collectible-load (fn []
|
||||||
;; We need to delay the measurement because the
|
;; We need to delay the measurement because the
|
||||||
;; navigation has an animation
|
;; navigation has an animation
|
||||||
@ -246,7 +249,8 @@
|
|||||||
{collection-name :name} collection-data]
|
{collection-name :name} collection-data]
|
||||||
[rn/view {:style (style/background-color theme)}
|
[rn/view {:style (style/background-color theme)}
|
||||||
[animated-header
|
[animated-header
|
||||||
{:scroll-amount scroll-amount
|
{:id (:id collectible)
|
||||||
|
:scroll-amount scroll-amount
|
||||||
:title-opacity title-opacity
|
:title-opacity title-opacity
|
||||||
:page-nav-type :title-description
|
:page-nav-type :title-description
|
||||||
:picture preview-uri
|
:picture preview-uri
|
||||||
|
@ -9,16 +9,13 @@
|
|||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(defn- on-collectible-long-press
|
(defn- on-collectible-long-press
|
||||||
[{:keys [preview-url collectible-details id]}]
|
[{:keys [preview-url :collectible-data id]}]
|
||||||
(let [chain-id (get-in id [:contract-id :chain-id])
|
(rf/dispatch [:show-bottom-sheet
|
||||||
address (get-in id [:contract-id :address])]
|
{:content (fn []
|
||||||
(rf/dispatch [:show-bottom-sheet
|
[options-drawer/view
|
||||||
{:content (fn []
|
{:id id
|
||||||
[options-drawer/view
|
:name (:name collectible-data)
|
||||||
{:chain-id chain-id
|
:image (:uri preview-url)}])}]))
|
||||||
:address address
|
|
||||||
:name (:name collectible-details)
|
|
||||||
:image (:uri preview-url)}])}])))
|
|
||||||
|
|
||||||
(defn- on-collectible-press
|
(defn- on-collectible-press
|
||||||
[{:keys [id]}]
|
[{:keys [id]}]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user