fix(wallet): Some collectibles were displayed as "can iOS can't fetch collectible error (#20714)
This commit is contained in:
parent
5a93cd755e
commit
940edc2e53
|
@ -79,14 +79,20 @@
|
||||||
[counter-view counter])
|
[counter-view counter])
|
||||||
[rn/view {:style (style/collectible-border theme)}]]]))
|
[rn/view {:style (style/collectible-border theme)}]]]))
|
||||||
|
|
||||||
|
(defn invalid-image?
|
||||||
|
[image-src]
|
||||||
|
(or (nil? image-src)
|
||||||
|
(string/blank? image-src)))
|
||||||
|
|
||||||
(defn view-internal
|
(defn view-internal
|
||||||
[{:keys [container-style square? on-press counter image-src native-ID supported-file?
|
[{:keys [container-style square? on-press counter image-src native-ID supported-file?
|
||||||
on-collectible-load aspect-ratio gradient-color-index]
|
on-collectible-load aspect-ratio gradient-color-index]
|
||||||
:or {gradient-color-index :gradient-1
|
:or {gradient-color-index :gradient-1
|
||||||
on-collectible-load (fn [])}}]
|
on-collectible-load (fn [])}}]
|
||||||
(let [theme (quo.theme/use-theme)
|
(let [theme (quo.theme/use-theme)
|
||||||
[error? set-error] (rn/use-state (or (nil? image-src)
|
[error? set-error] (rn/use-state (invalid-image? image-src))]
|
||||||
(string/blank? image-src)))]
|
(rn/use-effect #(set-error (invalid-image? image-src))
|
||||||
|
[image-src])
|
||||||
[rn/pressable
|
[rn/pressable
|
||||||
{:style (merge container-style (style/container aspect-ratio))
|
{:style (merge container-style (style/container aspect-ratio))
|
||||||
:accessibility-label :expanded-collectible
|
:accessibility-label :expanded-collectible
|
||||||
|
|
|
@ -185,7 +185,7 @@
|
||||||
;; We delay the navigation because we need re-frame to update the DB on time.
|
;; We delay the navigation because we need re-frame to update the DB on time.
|
||||||
;; By doing it, we skip a blink while visiting the collectible detail page.
|
;; By doing it, we skip a blink while visiting the collectible detail page.
|
||||||
[:dispatch-later
|
[:dispatch-later
|
||||||
{:ms 1
|
{:ms 17
|
||||||
:dispatch [:navigate-to :screen/wallet.collectible]}]]})))
|
:dispatch [:navigate-to :screen/wallet.collectible]}]]})))
|
||||||
|
|
||||||
(defn- keep-not-empty-value
|
(defn- keep-not-empty-value
|
||||||
|
|
|
@ -79,12 +79,20 @@
|
||||||
(rf/dispatch [:wallet/clear-collectible-details]))
|
(rf/dispatch [:wallet/clear-collectible-details]))
|
||||||
|
|
||||||
(defn animated-header
|
(defn animated-header
|
||||||
[{:keys [scroll-amount title-opacity page-nav-type picture title description theme id]}]
|
[{:keys [scroll-amount title-opacity page-nav-type theme]}]
|
||||||
(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
|
||||||
(colors/theme-colors colors/white-opa-0 colors/neutral-95-opa-0 theme)
|
(colors/theme-colors colors/white-opa-0
|
||||||
(colors/theme-colors colors/white-opa-50 colors/neutral-95-opa-70-blur theme))]
|
colors/neutral-95-opa-0
|
||||||
|
theme)
|
||||||
|
(colors/theme-colors colors/white-opa-50
|
||||||
|
colors/neutral-95-opa-70-blur
|
||||||
|
theme))
|
||||||
|
{{preview-uri :uri} :preview-url
|
||||||
|
{title :name} :collectible-data
|
||||||
|
{description :name} :collection-data
|
||||||
|
id :id} (rf/sub [:wallet/collectible-details])]
|
||||||
[rn/view {:style (style/animated-header)}
|
[rn/view {:style (style/animated-header)}
|
||||||
[reanimated/blur-view
|
[reanimated/blur-view
|
||||||
{:style {:flex 1
|
{:style {:flex 1
|
||||||
|
@ -97,7 +105,7 @@
|
||||||
[reanimated/view {:style layer-opacity}
|
[reanimated/view {:style layer-opacity}
|
||||||
[quo/page-nav
|
[quo/page-nav
|
||||||
{:type page-nav-type
|
{:type page-nav-type
|
||||||
:picture picture
|
:picture preview-uri
|
||||||
:title title
|
:title title
|
||||||
:description description
|
:description description
|
||||||
:background :blur
|
:background :blur
|
||||||
|
@ -110,7 +118,7 @@
|
||||||
{:content (fn []
|
{:content (fn []
|
||||||
[options-drawer/view
|
[options-drawer/view
|
||||||
{:name title
|
{:name title
|
||||||
:image picture
|
:image preview-uri
|
||||||
:id id}])
|
:id id}])
|
||||||
:theme theme}])}]
|
:theme theme}])}]
|
||||||
:center-opacity title-opacity}]]]]))
|
:center-opacity title-opacity}]]]]))
|
||||||
|
@ -144,10 +152,11 @@
|
||||||
[_]
|
[_]
|
||||||
(let [selected-tab (reagent/atom :overview)
|
(let [selected-tab (reagent/atom :overview)
|
||||||
on-tab-change #(reset! selected-tab %)]
|
on-tab-change #(reset! selected-tab %)]
|
||||||
(fn [{:keys [collectible set-title-bottom theme]}]
|
(fn [{:keys [set-title-bottom theme]}]
|
||||||
(let [title-ref (rn/use-ref-atom nil)
|
(let [title-ref (rn/use-ref-atom nil)
|
||||||
set-title-ref (rn/use-callback #(reset! title-ref %))
|
set-title-ref (rn/use-callback #(reset! title-ref %))
|
||||||
animation-shared-element-id (rf/sub [:animation-shared-element-id])
|
animation-shared-element-id (rf/sub [:animation-shared-element-id])
|
||||||
|
collectible (rf/sub [:wallet/collectible-details])
|
||||||
collectible-owner (rf/sub [:wallet/collectible-details-owner collectible])
|
collectible-owner (rf/sub [:wallet/collectible-details-owner collectible])
|
||||||
aspect-ratio (rf/sub [:wallet/collectible-aspect-ratio])
|
aspect-ratio (rf/sub [:wallet/collectible-aspect-ratio])
|
||||||
gradient-color (rf/sub [:wallet/collectible-gradient-color])
|
gradient-color (rf/sub [:wallet/collectible-gradient-color])
|
||||||
|
@ -196,14 +205,14 @@
|
||||||
token-id
|
token-id
|
||||||
{:images [collectible-image]
|
{:images [collectible-image]
|
||||||
:index 0
|
:index 0
|
||||||
:on-options-press #(rf/dispatch [:show-bottom-sheet
|
:on-options-press #(rf/dispatch
|
||||||
{:content
|
[:show-bottom-sheet
|
||||||
(fn []
|
{:content
|
||||||
[options-drawer/view
|
(fn []
|
||||||
{:name collectible-name
|
[options-drawer/view
|
||||||
:image
|
{:name collectible-name
|
||||||
preview-uri
|
:image preview-uri
|
||||||
:id id}])}])}])))
|
: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
|
||||||
|
@ -241,33 +250,24 @@
|
||||||
|
|
||||||
(defn view
|
(defn view
|
||||||
[_]
|
[_]
|
||||||
(let [{:keys [top]} (safe-area/get-insets)
|
(let [{:keys [top]} (safe-area/get-insets)
|
||||||
theme (quo.theme/use-theme)
|
theme (quo.theme/use-theme)
|
||||||
title-bottom-coord (rn/use-ref-atom 0)
|
title-bottom-coord (rn/use-ref-atom 0)
|
||||||
set-title-bottom (rn/use-callback
|
set-title-bottom (rn/use-callback
|
||||||
(fn [_ y _ height]
|
(fn [_ y _ height]
|
||||||
(reset! title-bottom-coord
|
(reset! title-bottom-coord
|
||||||
(get-title-bottom-y-position y height))))
|
(get-title-bottom-y-position y height))))
|
||||||
scroll-amount (reanimated/use-shared-value 0)
|
scroll-amount (reanimated/use-shared-value 0)
|
||||||
title-opacity (reanimated/use-shared-value 0)
|
title-opacity (reanimated/use-shared-value 0)]
|
||||||
{:keys [collection-data
|
|
||||||
collectible-data
|
|
||||||
preview-url]
|
|
||||||
:as collectible} (rf/sub [:wallet/collectible-details])]
|
|
||||||
[rn/view {:style (style/background-color theme)}
|
[rn/view {:style (style/background-color theme)}
|
||||||
[animated-header
|
[animated-header
|
||||||
{:id (:id collectible)
|
{:scroll-amount scroll-amount
|
||||||
:scroll-amount scroll-amount
|
|
||||||
:title-opacity title-opacity
|
:title-opacity title-opacity
|
||||||
:page-nav-type :title-description
|
:page-nav-type :title-description
|
||||||
:picture (:uri preview-url)
|
|
||||||
:title (:name collectible-data)
|
|
||||||
:description (:name collection-data)
|
|
||||||
:theme theme}]
|
:theme theme}]
|
||||||
[reanimated/scroll-view
|
[reanimated/scroll-view
|
||||||
{:style (style/scroll-view top)
|
{:style (style/scroll-view top)
|
||||||
:on-scroll #(on-scroll % scroll-amount title-opacity title-bottom-coord)}
|
:on-scroll #(on-scroll % scroll-amount title-opacity title-bottom-coord)}
|
||||||
[collectible-details
|
[collectible-details
|
||||||
{:collectible collectible
|
{:set-title-bottom set-title-bottom
|
||||||
:set-title-bottom set-title-bottom
|
|
||||||
:theme theme}]]]))
|
:theme theme}]]]))
|
||||||
|
|
Loading…
Reference in New Issue