Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5691049a41 | ||
|
|
db6a014bbd |
Binary file not shown.
|
Before Width: | Height: | Size: 6.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
@@ -108,7 +108,8 @@
|
||||
(when (and (multiaccounts.model/logged-in? db)
|
||||
(= current-theme-type status-im.constants/theme-type-system))
|
||||
{:profile.settings/switch-theme-fx
|
||||
[(get-in db [:profile/profile :appearance]) (:view-id db)]})))
|
||||
[(get-in db [:profile/profile :appearance])
|
||||
(:view-id db) true]})))
|
||||
|
||||
(defn- on-biometric-auth-fail
|
||||
[{:keys [code]}]
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
(defn fallback
|
||||
[{:keys [theme opacity]}]
|
||||
[{:opacity opacity}
|
||||
{:opacity 1
|
||||
{:opacity default-opacity-for-image
|
||||
:background-color (colors/theme-colors colors/neutral-2_5 colors/neutral-90 theme)
|
||||
:border-style :dashed
|
||||
:border-color (colors/theme-colors colors/neutral-20 colors/neutral-80 theme)
|
||||
@@ -60,13 +60,8 @@
|
||||
:padding-right 0
|
||||
:padding-top 4})
|
||||
|
||||
(defn card-detail-text
|
||||
[empty-name? theme]
|
||||
{:flex 1
|
||||
:margin-right 8
|
||||
:color (if empty-name?
|
||||
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme)
|
||||
(colors/theme-colors colors/neutral-100 colors/white theme))})
|
||||
(def card-detail-text
|
||||
{:flex 1})
|
||||
|
||||
(defn card-loader
|
||||
[opacity]
|
||||
@@ -120,7 +115,6 @@
|
||||
[{:opacity opacity}
|
||||
{:flex 1
|
||||
:flex-direction :row
|
||||
:column-gap 8
|
||||
:opacity default-opacity-for-image}])
|
||||
|
||||
(defn supported-file
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(ns quo.components.profile.collectible-list-item.view
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[quo.components.avatars.collection-avatar.view :as collection-avatar]
|
||||
[quo.components.counter.collectible-counter.view :as collectible-counter]
|
||||
[quo.components.icon :as icon]
|
||||
@@ -22,7 +21,7 @@
|
||||
(def cached-load-time 200)
|
||||
(def error-wait-time 800)
|
||||
|
||||
(defn animate-loading-image
|
||||
(defn on-load-end
|
||||
[{:keys [load-time set-state loader-opacity image-opacity]}]
|
||||
(reanimated/animate loader-opacity 0 timing-options-out)
|
||||
(reanimated/animate image-opacity 1 timing-options-in)
|
||||
@@ -61,12 +60,12 @@
|
||||
(assoc prev-state :avatar-loaded? true)))))
|
||||
|
||||
(defn- fallback-view
|
||||
[{:keys [label theme image-opacity on-load-end]}]
|
||||
(rn/use-mount on-load-end)
|
||||
[reanimated/view {:style (style/fallback {:opacity image-opacity :theme theme})}
|
||||
[{:keys [label theme image-opacity]}]
|
||||
[reanimated/view
|
||||
{:style (style/fallback {:opacity image-opacity
|
||||
:theme theme})}
|
||||
[rn/view
|
||||
[icon/icon :i/sad
|
||||
{:color (colors/theme-colors colors/neutral-40 colors/neutral-50 theme)}]]
|
||||
[icon/icon :i/sad {:color (colors/theme-colors colors/neutral-40 colors/neutral-50 theme)}]]
|
||||
[rn/view {:style {:height 4}}]
|
||||
[text/text
|
||||
{:size :paragraph-2
|
||||
@@ -94,43 +93,31 @@
|
||||
[{:keys [community? avatar-image-src collectible-name theme state set-state]}]
|
||||
(let [loader-opacity (reanimated/use-shared-value 1)
|
||||
avatar-opacity (reanimated/use-shared-value 0)
|
||||
[load-time set-load-time] (rn/use-state (datetime/now))
|
||||
set-avatar-loaded (fn []
|
||||
(on-load-avatar {:set-state set-state
|
||||
:load-time load-time
|
||||
:loader-opacity loader-opacity
|
||||
:avatar-opacity avatar-opacity}))
|
||||
empty-name? (string/blank? collectible-name)]
|
||||
(rn/use-mount (fn []
|
||||
(when (string/blank? avatar-image-src)
|
||||
(set-avatar-loaded))))
|
||||
[load-time set-load-time] (rn/use-state (datetime/now))]
|
||||
[rn/view {:style style/card-details-container}
|
||||
[reanimated/view {:style (style/avatar-container avatar-opacity)}
|
||||
(cond
|
||||
(string/blank? avatar-image-src)
|
||||
[loading-square theme]
|
||||
|
||||
community?
|
||||
[preview-list/view {:type :communities :size :size-20}
|
||||
(if community?
|
||||
[preview-list/view
|
||||
{:type :communities
|
||||
:size :size-20}
|
||||
[avatar-image-src]]
|
||||
|
||||
:else
|
||||
[collection-avatar/view
|
||||
{:size :size-20
|
||||
:on-start #(set-load-time (fn [start-time] (- (datetime/now) start-time)))
|
||||
:on-load-end set-avatar-loaded
|
||||
:on-load-end #(on-load-avatar {:set-state set-state
|
||||
:load-time load-time
|
||||
:loader-opacity loader-opacity
|
||||
:avatar-opacity avatar-opacity})
|
||||
:image avatar-image-src}])
|
||||
[rn/view {:style {:width 8}}]
|
||||
[text/text
|
||||
{:size :paragraph-1
|
||||
:weight :semi-bold
|
||||
:ellipsize-mode :tail
|
||||
:number-of-lines 1
|
||||
:style (style/card-detail-text empty-name? theme)}
|
||||
(if empty-name?
|
||||
(i18n/label :t/unknown)
|
||||
collectible-name)]]
|
||||
|
||||
(when-not (:avatar-loaded? state)
|
||||
:style style/card-detail-text}
|
||||
collectible-name]]
|
||||
(when (not (:avatar-loaded? state))
|
||||
[reanimated/view {:style (style/card-loader loader-opacity)}
|
||||
[loading-square theme]
|
||||
[loading-message theme]])]))
|
||||
@@ -141,44 +128,40 @@
|
||||
(let [theme (quo.theme/use-theme)
|
||||
loader-opacity (reanimated/use-shared-value (if supported-file? 1 0))
|
||||
image-opacity (reanimated/use-shared-value (if supported-file? 0 1))
|
||||
[load-time set-load-time] (rn/use-state (datetime/now))
|
||||
set-image-loaded (fn []
|
||||
(animate-loading-image {:load-time load-time
|
||||
:set-state set-state
|
||||
:loader-opacity loader-opacity
|
||||
:image-opacity image-opacity}))]
|
||||
[load-time set-load-time] (rn/use-state (datetime/now))]
|
||||
[rn/view {:style (style/card-view-container theme)}
|
||||
[rn/view {:style {:aspect-ratio 1}}
|
||||
(cond
|
||||
(:image-error? state) [fallback-view
|
||||
{:image-opacity image-opacity
|
||||
:on-load-end set-image-loaded
|
||||
:theme theme
|
||||
:label (i18n/label :t/cant-fetch-info)}]
|
||||
(not supported-file?) [fallback-view
|
||||
{:image-opacity image-opacity
|
||||
:on-load-end set-image-loaded
|
||||
:theme theme
|
||||
:label (i18n/label :t/unsupported-file)}]
|
||||
(not (:image-loaded? state)) [loading-image
|
||||
{:loader-opacity loader-opacity
|
||||
:theme theme
|
||||
:gradient-color-index gradient-color-index}])
|
||||
(:image-error? state)
|
||||
[fallback-view
|
||||
{:image-opacity image-opacity
|
||||
:theme theme
|
||||
:label (i18n/label :t/cant-fetch-info)}]
|
||||
|
||||
(not supported-file?)
|
||||
[fallback-view
|
||||
{:image-opacity image-opacity
|
||||
:theme theme
|
||||
:label (i18n/label :t/unsupported-file)}]
|
||||
|
||||
(not (:image-loaded? state))
|
||||
[loading-image
|
||||
{:loader-opacity loader-opacity
|
||||
:theme theme
|
||||
:gradient-color-index gradient-color-index}])
|
||||
(when supported-file?
|
||||
[reanimated/view {:style (style/supported-file image-opacity)}
|
||||
[rn/image
|
||||
{:style style/image
|
||||
:on-load #(on-load % set-state)
|
||||
:on-load-start #(set-load-time (fn [start-time] (- (datetime/now) start-time)))
|
||||
:on-load-end set-image-loaded
|
||||
:on-load-end #(on-load-end {:load-time load-time
|
||||
:set-state set-state
|
||||
:loader-opacity loader-opacity
|
||||
:image-opacity image-opacity})
|
||||
:on-error #(on-load-error set-state)
|
||||
:source image-src}]])]
|
||||
|
||||
(when (and (or (:image-loaded? state)
|
||||
(not supported-file?))
|
||||
(not (:image-error? state))
|
||||
counter)
|
||||
(when (and (:image-loaded? state) (not (:image-error? state)) counter)
|
||||
[collectible-counter/view
|
||||
{:container-style style/collectible-counter
|
||||
:size :size-24
|
||||
@@ -223,10 +206,10 @@
|
||||
{:style style/image
|
||||
:on-load #(on-load % set-state)
|
||||
:on-load-start #(set-load-time (fn [start-time] (- (datetime/now) start-time)))
|
||||
:on-load-end #(animate-loading-image {:load-time load-time
|
||||
:set-state set-state
|
||||
:loader-opacity loader-opacity
|
||||
:image-opacity image-opacity})
|
||||
:on-load-end #(on-load-end {:load-time load-time
|
||||
:set-state set-state
|
||||
:loader-opacity loader-opacity
|
||||
:image-opacity image-opacity})
|
||||
:on-error #(on-load-error set-state)
|
||||
:source image-src}]])
|
||||
(when (and (:image-loaded? state) (not (:image-error? state)) counter)
|
||||
|
||||
@@ -11,24 +11,38 @@
|
||||
[react-native.core :as rn]
|
||||
[react-native.reanimated :as reanimated]
|
||||
[schema.core :as schema]
|
||||
[utils.datetime :as datetime]
|
||||
[utils.i18n :as i18n]))
|
||||
|
||||
(def loader-out 650)
|
||||
(def image-in 1000)
|
||||
(def timing-options-out 650)
|
||||
(def timing-options-in 1000)
|
||||
(def first-load-time 500)
|
||||
(def cached-load-time 200)
|
||||
(def error-wait-time 800)
|
||||
|
||||
(defn on-load-end
|
||||
[{:keys [loader-opacity image-opacity]}]
|
||||
(reanimated/animate loader-opacity 0 loader-out)
|
||||
(reanimated/animate image-opacity 1 image-in))
|
||||
[{:keys [load-time set-state loader-opacity image-opacity]}]
|
||||
(reanimated/animate loader-opacity 0 timing-options-out)
|
||||
(reanimated/animate image-opacity 1 timing-options-in)
|
||||
(if (> load-time cached-load-time)
|
||||
(js/setTimeout
|
||||
(fn []
|
||||
(set-state (fn [prev-state]
|
||||
(assoc prev-state :image-loaded? true))))
|
||||
first-load-time)
|
||||
(set-state (fn [prev-state]
|
||||
(assoc prev-state :image-loaded? true)))))
|
||||
|
||||
(defn on-load-error
|
||||
[set-error]
|
||||
(js/setTimeout set-error error-wait-time))
|
||||
[set-state]
|
||||
(js/setTimeout (fn []
|
||||
(set-state (fn [prev-state] (assoc prev-state :image-error? true))))
|
||||
error-wait-time))
|
||||
|
||||
(defn- loading-image
|
||||
[{:keys [theme gradient-color-index loader-opacity aspect-ratio]}]
|
||||
[reanimated/view {:style (style/loading-image-with-opacity loader-opacity)}
|
||||
[reanimated/view
|
||||
{:style (style/loading-image-with-opacity loader-opacity)}
|
||||
[gradients/view
|
||||
{:theme theme
|
||||
:container-style (style/gradient-view aspect-ratio)
|
||||
@@ -53,64 +67,62 @@
|
||||
:style {:color (colors/theme-colors colors/neutral-40 colors/neutral-50 theme)}}
|
||||
label]])
|
||||
|
||||
(defn- collectible-image
|
||||
[{:keys [aspect-ratio theme gradient-color-index supported-file? set-error native-ID
|
||||
square? image-src on-collectible-load counter]}]
|
||||
(let [loader-opacity (reanimated/use-shared-value (if supported-file? 1 0))
|
||||
image-opacity (reanimated/use-shared-value (if supported-file? 0 1))]
|
||||
[:<>
|
||||
[loading-image
|
||||
{:aspect-ratio aspect-ratio
|
||||
:loader-opacity loader-opacity
|
||||
:theme theme
|
||||
:gradient-color-index gradient-color-index}]
|
||||
|
||||
[reanimated/view {:style (style/supported-file image-opacity)}
|
||||
[rn/image
|
||||
{:style (style/image square? aspect-ratio theme)
|
||||
:source image-src
|
||||
:native-ID native-ID
|
||||
:on-load-end (fn []
|
||||
(on-load-end {:loader-opacity loader-opacity
|
||||
:image-opacity image-opacity}))
|
||||
:on-error #(on-load-error set-error)
|
||||
:on-load on-collectible-load}]
|
||||
(when counter
|
||||
[counter-view counter])
|
||||
[rn/view {:style (style/collectible-border theme)}]]]))
|
||||
|
||||
(defn view-internal
|
||||
[{:keys [container-style square? on-press counter image-src native-ID supported-file?
|
||||
on-collectible-load aspect-ratio gradient-color-index]
|
||||
:or {gradient-color-index :gradient-1
|
||||
on-collectible-load (fn [])}}]
|
||||
(let [theme (quo.theme/use-theme)
|
||||
[error? set-error] (rn/use-state (or (nil? image-src)
|
||||
(string/blank? image-src)))]
|
||||
on-collectible-load aspect-ratio]}]
|
||||
(let [theme (quo.theme/use-theme)
|
||||
loader-opacity (reanimated/use-shared-value
|
||||
(if supported-file? 1 0))
|
||||
image-opacity (reanimated/use-shared-value
|
||||
(if supported-file? 0 1))
|
||||
[load-time set-load-time] (rn/use-state (datetime/now))
|
||||
[state set-state] (rn/use-state {:image-loaded? false
|
||||
:image-error? (or (nil? image-src)
|
||||
(string/blank?
|
||||
image-src))})]
|
||||
[rn/pressable
|
||||
{:style (merge container-style (style/container aspect-ratio))
|
||||
{:on-press (when (and (not (:image-error? state)) supported-file?) on-press)
|
||||
:accessibility-label :expanded-collectible
|
||||
:on-press (when (and (not error?) supported-file?)
|
||||
on-press)}
|
||||
(if (or (not supported-file?) error?)
|
||||
:style (merge container-style
|
||||
(style/container aspect-ratio))}
|
||||
(cond
|
||||
(not supported-file?)
|
||||
[fallback-view
|
||||
{:label (i18n/label (if-not supported-file?
|
||||
:t/unsupported-file
|
||||
:t/cant-fetch-info))
|
||||
{:aspect-ratio aspect-ratio
|
||||
:label (i18n/label :t/unsupported-file)
|
||||
:counter counter
|
||||
:theme theme
|
||||
:on-mount on-collectible-load}]
|
||||
|
||||
(:image-error? state)
|
||||
[fallback-view
|
||||
{:label (i18n/label :t/cant-fetch-info)
|
||||
:counter counter
|
||||
:theme theme
|
||||
:on-mount on-collectible-load}]
|
||||
[collectible-image
|
||||
|
||||
(not (:image-loaded? state))
|
||||
[loading-image
|
||||
{:aspect-ratio aspect-ratio
|
||||
:loader-opacity loader-opacity
|
||||
:theme theme
|
||||
:supported-file? supported-file?
|
||||
:set-error set-error
|
||||
:native-ID native-ID
|
||||
:square? square?
|
||||
:image-src image-src
|
||||
:on-collectible-load on-collectible-load
|
||||
:counter counter
|
||||
:gradient-color-index gradient-color-index}])]))
|
||||
:gradient-color-index :gradient-5}])
|
||||
(when supported-file?
|
||||
[reanimated/view {:style (style/supported-file image-opacity)}
|
||||
[rn/image
|
||||
{:style (style/image square? aspect-ratio theme)
|
||||
:source image-src
|
||||
:native-ID native-ID
|
||||
:on-load-start #(set-load-time (fn [start-time] (- (datetime/now) start-time)))
|
||||
:on-load-end #(on-load-end {:load-time load-time
|
||||
:set-state set-state
|
||||
:loader-opacity loader-opacity
|
||||
:image-opacity image-opacity})
|
||||
:on-error #(on-load-error set-state)
|
||||
:on-load on-collectible-load}]
|
||||
(when counter
|
||||
[counter-view counter])
|
||||
[rn/view {:style (style/collectible-border theme)}]])]))
|
||||
|
||||
(def ?schema
|
||||
[:=>
|
||||
@@ -125,8 +137,7 @@
|
||||
[:square? {:optional true} [:maybe boolean?]]
|
||||
[:counter {:optional true} [:maybe string?]]
|
||||
[:on-press {:optional true} [:maybe fn?]]
|
||||
[:on-collectible-load {:optional true} [:maybe fn?]]
|
||||
[:gradient-color-index {:optional true} [:maybe keyword?]]]]]
|
||||
[:on-collectible-load {:optional true} [:maybe fn?]]]]]
|
||||
:any])
|
||||
|
||||
(def view (schema/instrument #'view-internal ?schema))
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[:type {:optional true}
|
||||
[:maybe
|
||||
[:enum :default :multiuser :group :channel :community :token :network :multinetwork :account
|
||||
:collectible :address :icon :audio :wallet-user :dapp]]]
|
||||
:collectible :address :icon :audio :wallet-user]]]
|
||||
[:customization-color {:optional true} [:maybe :schema.common/customization-color]]
|
||||
[:container-style {:optional true} [:maybe :map]]
|
||||
[:blur? {:optional true} [:maybe :boolean]]
|
||||
|
||||
@@ -17,18 +17,16 @@
|
||||
[schema.core :as schema]))
|
||||
|
||||
(defn- tag-skeleton
|
||||
[{:keys [size text theme]
|
||||
:or {size 24
|
||||
theme (quo.theme/use-theme)}}
|
||||
logo-component]
|
||||
[rn/view {:style (style/tag-container size)}
|
||||
logo-component
|
||||
[rn/view {:style (style/tag-spacing size)}
|
||||
[text/text
|
||||
{:style (style/text theme)
|
||||
:weight :medium
|
||||
:size (if (= size 24) :paragraph-2 :paragraph-1)}
|
||||
text]]])
|
||||
[{:keys [size text] :or {size 24}} logo-component]
|
||||
(let [theme (quo.theme/use-theme)]
|
||||
[rn/view {:style (style/tag-container size)}
|
||||
logo-component
|
||||
[rn/view {:style (style/tag-spacing size)}
|
||||
[text/text
|
||||
{:style (style/text theme)
|
||||
:weight :medium
|
||||
:size (if (= size 24) :paragraph-2 :paragraph-1)}
|
||||
text]]]))
|
||||
|
||||
(defn- communities-tag
|
||||
[{:keys [size community-logo community-name blur? channel? channel-name]}]
|
||||
@@ -83,100 +81,95 @@
|
||||
context]]]))
|
||||
|
||||
(defn- view-internal
|
||||
[{:keys [type theme size state blur? customization-color profile-picture full-name users
|
||||
[{:keys [type size state blur? customization-color profile-picture full-name users
|
||||
group-name amount token network-logo network-name networks
|
||||
account-name emoji collectible collectible-name collectible-number
|
||||
dapp-name dapp-logo duration container-style]
|
||||
account-name emoji collectible collectible-name collectible-number duration container-style]
|
||||
:or {customization-color :blue
|
||||
type :default
|
||||
state :default
|
||||
theme (quo.theme/use-theme)}
|
||||
state :default}
|
||||
:as props}]
|
||||
[rn/view {:style (merge {:align-items :flex-start} container-style)}
|
||||
[rn/view
|
||||
{:style (style/container {:theme theme
|
||||
:type type
|
||||
:size size
|
||||
:state state
|
||||
:blur? blur?
|
||||
:customization-color customization-color})
|
||||
:accessibility-label :context-tag}
|
||||
(case type
|
||||
:default
|
||||
[tag-skeleton {:theme theme :size size :text full-name}
|
||||
[user-avatar/user-avatar
|
||||
{:full-name full-name
|
||||
:profile-picture profile-picture
|
||||
:size (if (= size 24) :xxs 28)
|
||||
:status-indicator? false
|
||||
:ring? false
|
||||
:customization-color customization-color}]]
|
||||
(let [theme (quo.theme/use-theme)]
|
||||
[rn/view {:style (merge {:align-items :flex-start} container-style)}
|
||||
[rn/view
|
||||
{:style (style/container {:theme theme
|
||||
:type type
|
||||
:size size
|
||||
:state state
|
||||
:blur? blur?
|
||||
:customization-color customization-color})
|
||||
:accessibility-label :context-tag}
|
||||
(case type
|
||||
:default
|
||||
[tag-skeleton {:theme theme :size size :text full-name}
|
||||
[user-avatar/user-avatar
|
||||
{:full-name full-name
|
||||
:profile-picture profile-picture
|
||||
:size (if (= size 24) :xxs 28)
|
||||
:status-indicator? false
|
||||
:ring? false
|
||||
:customization-color customization-color}]]
|
||||
|
||||
:multiuser
|
||||
[preview-list/view {:type :user :size :size-20}
|
||||
users]
|
||||
:multiuser
|
||||
[preview-list/view {:type :user :size :size-20}
|
||||
users]
|
||||
|
||||
:multinetwork
|
||||
[preview-list/view {:type :network :size :size-20}
|
||||
networks]
|
||||
:multinetwork
|
||||
[preview-list/view {:type :network :size :size-20}
|
||||
networks]
|
||||
|
||||
:audio
|
||||
[tag-skeleton {:theme theme :text (str duration)}
|
||||
[rn/view {:style (style/audio-tag-icon-container customization-color theme)}
|
||||
[icons/icon :i/play {:color style/audio-tag-icon-color :size 12}]]]
|
||||
:audio
|
||||
[tag-skeleton {:theme theme :text (str duration)}
|
||||
[rn/view {:style (style/audio-tag-icon-container customization-color theme)}
|
||||
[icons/icon :i/play {:color style/audio-tag-icon-color :size 12}]]]
|
||||
|
||||
:group
|
||||
[tag-skeleton {:theme theme :size size :text group-name}
|
||||
[group-avatar/view
|
||||
{:icon-name :i/members
|
||||
:size (if (= size 24) :size-20 :size-28)
|
||||
:customization-color (colors/custom-color customization-color 50)}]]
|
||||
:group
|
||||
[tag-skeleton {:theme theme :size size :text group-name}
|
||||
[group-avatar/view
|
||||
{:icon-name :i/members
|
||||
:size (if (= size 24) :size-20 :size-28)
|
||||
:customization-color (colors/custom-color customization-color 50)}]]
|
||||
|
||||
(:channel :community)
|
||||
[communities-tag (assoc props :channel? (= type :channel))]
|
||||
(:channel :community)
|
||||
[communities-tag (assoc props :channel? (= type :channel))]
|
||||
|
||||
:token
|
||||
[tag-skeleton {:theme theme :size size :text (str amount " " token)}
|
||||
[token/view
|
||||
{:style (style/token-logo size)
|
||||
:token token
|
||||
:size (if (= size 24) :size-20 :size-28)}]]
|
||||
:token
|
||||
[tag-skeleton {:theme theme :size size :text (str amount " " token)}
|
||||
[token/view
|
||||
{:style (style/token-logo size)
|
||||
:token token
|
||||
:size (if (= size 24) :size-20 :size-28)}]]
|
||||
|
||||
:network
|
||||
[tag-skeleton {:theme theme :size size :text network-name}
|
||||
[rn/image {:style (style/circle-logo size) :source network-logo}]]
|
||||
:network
|
||||
[tag-skeleton {:theme theme :size size :text network-name}
|
||||
[rn/image {:style (style/circle-logo size) :source network-logo}]]
|
||||
|
||||
:collectible
|
||||
[tag-skeleton
|
||||
{:theme theme
|
||||
:size size
|
||||
:text (str collectible-name " #" collectible-number)}
|
||||
[rn/image {:style (style/rounded-logo size) :source collectible}]]
|
||||
:collectible
|
||||
[tag-skeleton
|
||||
{:theme theme
|
||||
:size size
|
||||
:text (str collectible-name " #" collectible-number)}
|
||||
[rn/image {:style (style/rounded-logo size) :source collectible}]]
|
||||
|
||||
:account
|
||||
[tag-skeleton {:theme theme :size size :text account-name}
|
||||
[account-avatar/view
|
||||
{:customization-color customization-color
|
||||
:emoji emoji
|
||||
:size (if (= size 24) 20 28)}]]
|
||||
:account
|
||||
[tag-skeleton {:theme theme :size size :text account-name}
|
||||
[account-avatar/view
|
||||
{:customization-color customization-color
|
||||
:emoji emoji
|
||||
:size (if (= size 24) 20 28)}]]
|
||||
|
||||
:address
|
||||
[address-tag props]
|
||||
:address
|
||||
[address-tag props]
|
||||
|
||||
:icon
|
||||
[icon-tag props]
|
||||
:icon
|
||||
[icon-tag props]
|
||||
|
||||
:wallet-user
|
||||
[tag-skeleton {:theme theme :size size :text full-name}
|
||||
[wallet-user-avatar/wallet-user-avatar
|
||||
{:full-name full-name
|
||||
:size (if (= size 24) :size-20 :size-24)
|
||||
:customization-color customization-color}]]
|
||||
:wallet-user
|
||||
[tag-skeleton {:theme theme :size size :text full-name}
|
||||
[wallet-user-avatar/wallet-user-avatar
|
||||
{:full-name full-name
|
||||
:size (if (= size 24) :size-20 :size-24)
|
||||
:customization-color customization-color}]]
|
||||
|
||||
:dapp
|
||||
[tag-skeleton {:theme theme :size size :text dapp-name}
|
||||
[rn/image {:style (style/circle-logo size) :source dapp-logo}]]
|
||||
|
||||
nil)]])
|
||||
nil)]]))
|
||||
|
||||
(def view (schema/instrument #'view-internal component-schema/?schema))
|
||||
|
||||
@@ -24,13 +24,12 @@
|
||||
(get ui k))
|
||||
|
||||
(def dapps
|
||||
{:coingecko (js/require "../resources/images/dapps/CoinGecko.png")
|
||||
:1inch (js/require "../resources/images/dapps/1inch.png")
|
||||
:aave (js/require "../resources/images/dapps/Aave.png")
|
||||
:uniswap (js/require "../resources/images/dapps/Uniswap.png")
|
||||
:zapper (js/require "../resources/images/dapps/Zapper.png")
|
||||
:zerion (js/require "../resources/images/dapps/Zerion.png")
|
||||
:wallet-connect (js/require "../resources/images/dapps/WalletConnect.png")})
|
||||
{:coingecko (js/require "../resources/images/dapps/CoinGecko.png")
|
||||
:1inch (js/require "../resources/images/dapps/1inch.png")
|
||||
:aave (js/require "../resources/images/dapps/Aave.png")
|
||||
:uniswap (js/require "../resources/images/dapps/Uniswap.png")
|
||||
:zapper (js/require "../resources/images/dapps/Zapper.png")
|
||||
:zerion (js/require "../resources/images/dapps/Zerion.png")})
|
||||
|
||||
(defn get-dapp
|
||||
[k]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
(ns status-im.common.floating-button-page.floating-container.view
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.core :as rn]
|
||||
[status-im.common.floating-button-page.floating-container.style :as style]))
|
||||
@@ -10,10 +9,9 @@
|
||||
[child]
|
||||
(let [theme (quo.theme/use-theme)]
|
||||
[quo/blur
|
||||
{:blur-amount 52
|
||||
:blur-radius 20
|
||||
:blur-type :transparent
|
||||
:blur-overlay-color (colors/theme-colors colors/white-70-blur colors/neutral-95-opa-70-blur theme)}
|
||||
{:blur-amount 12
|
||||
:blur-radius 12
|
||||
:blur-type theme}
|
||||
[rn/view {:style style/blur-inner-container}
|
||||
child]]))
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
:verifyENSURL config/verify-ens-url
|
||||
:verifyENSContractAddress config/verify-ens-contract-address
|
||||
:verifyTransactionChainID config/verify-transaction-chain-id
|
||||
:wakuV2LightClient true
|
||||
:wakuV2LightClient false
|
||||
:previewPrivacy config/blank-preview?
|
||||
:testNetworksEnabled config/test-networks-enabled?})))
|
||||
|
||||
|
||||
@@ -83,7 +83,8 @@
|
||||
[[:profile.settings/switch-theme-fx
|
||||
[(or (:appearance settings)
|
||||
constants/theme-type-dark)
|
||||
:shell-stack]]
|
||||
:shell-stack
|
||||
false]]
|
||||
[:dispatch [:init-root :shell-stack]]
|
||||
[:dispatch [:profile/show-testnet-mode-banner-if-enabled]]]))})))
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[react-native.platform :as platform]
|
||||
[status-im.common.theme.core :as theme]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.setup.hot-reload :as hot-reload]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(re-frame/reg-fx
|
||||
@@ -19,7 +20,7 @@
|
||||
|
||||
(re-frame/reg-fx
|
||||
:profile.settings/switch-theme-fx
|
||||
(fn [[theme-type view-id]]
|
||||
(fn [[theme-type view-id reload-ui?]]
|
||||
(let [theme (if (or (= theme-type constants/theme-type-dark)
|
||||
(and (= theme-type constants/theme-type-system)
|
||||
(theme/device-theme-dark?)))
|
||||
@@ -27,4 +28,8 @@
|
||||
:light)]
|
||||
(theme/set-legacy-theme theme)
|
||||
(rf/dispatch [:theme/switch theme])
|
||||
(rf/dispatch [:reload-status-nav-color view-id]))))
|
||||
(rf/dispatch [:reload-status-nav-color view-id])
|
||||
(when reload-ui?
|
||||
(re-frame/dispatch [:dismiss-all-overlays])
|
||||
(when js/goog.DEBUG
|
||||
(hot-reload/reload))))))
|
||||
|
||||
@@ -95,14 +95,14 @@
|
||||
(rf/reg-event-fx :profile.settings/change-appearance
|
||||
(fn [_ [theme]]
|
||||
{:fx [[:dispatch [:profile.settings/profile-update :appearance theme]]
|
||||
[:profile.settings/switch-theme-fx [theme :appearance]]]}))
|
||||
[:profile.settings/switch-theme-fx [theme :appearance true]]]}))
|
||||
|
||||
(rf/reg-event-fx :profile.settings/switch-theme
|
||||
(fn [{:keys [db]} [theme view-id]]
|
||||
(let [theme (or theme
|
||||
(get-in db [:profile/profile :appearance])
|
||||
constants/theme-type-dark)]
|
||||
{:fx [[:profile.settings/switch-theme-fx [theme view-id]]]})))
|
||||
{:fx [[:profile.settings/switch-theme-fx [theme view-id false]]]})))
|
||||
|
||||
(rf/reg-fx :profile.settings/get-profile-picture
|
||||
(fn [key-uid]
|
||||
|
||||
+3
-7
@@ -36,10 +36,8 @@
|
||||
(defn- address-input
|
||||
[{:keys [input-value on-change-text paste-into-input clear-input]}]
|
||||
(let [empty-input? (string/blank? input-value)
|
||||
on-scan-address (rn/use-callback (fn []
|
||||
(rf/dispatch [:wallet/clean-scanned-address])
|
||||
(rf/dispatch [:open-modal :screen/wallet.scan-address
|
||||
{:on-result on-change-text}])))]
|
||||
on-scan-address (rn/use-callback #(rf/dispatch [:open-modal :screen/wallet.scan-address
|
||||
{:on-result on-change-text}]))]
|
||||
[rn/view {:style style/input-container}
|
||||
[quo/input
|
||||
{:accessibility-label :add-address-to-save
|
||||
@@ -163,9 +161,7 @@
|
||||
(rf/dispatch
|
||||
[:open-modal :screen/settings.save-address]))
|
||||
[address ens-name? address-or-ens])]
|
||||
(rn/use-mount (fn []
|
||||
(rf/dispatch [:wallet/clean-scanned-address])
|
||||
(rf/dispatch [:wallet/clear-address-to-save])))
|
||||
(rn/use-unmount #(rf/dispatch [:wallet/clear-address-to-save]))
|
||||
[quo/overlay {:type :shell}
|
||||
[floating-button-page/view
|
||||
{:footer-container-padding 0
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(def on-collectible-press #(rf/dispatch [:wallet/navigate-to-collectible-details %]))
|
||||
(defn- on-collectible-press
|
||||
[{:keys [id]} aspect-ratio]
|
||||
(rf/dispatch [:wallet/get-collectible-details id aspect-ratio]))
|
||||
|
||||
(defn- on-collectible-long-press
|
||||
[{:keys [preview-url collectible-details id]}]
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
(rf/reg-event-fx :wallet/seed-phrase-entered seed-phrase-entered)
|
||||
|
||||
(defn store-account-generated-with-mnemonic
|
||||
(defn store-account-generated
|
||||
[{:keys [db]} [{:keys [new-account-data keypair-name]}]]
|
||||
(let [new-account (update new-account-data :mnemonic security/mask-data)]
|
||||
{:db (-> db
|
||||
@@ -85,21 +85,20 @@
|
||||
:random-phrase))
|
||||
:fx [[:dispatch [:navigate-back-to :screen/wallet.create-account]]]}))
|
||||
|
||||
(rf/reg-event-fx :wallet/store-account-generated-with-mnemonic store-account-generated-with-mnemonic)
|
||||
(rf/reg-event-fx :wallet/store-account-generated store-account-generated)
|
||||
|
||||
(defn generate-account-for-keypair-with-mnemonic
|
||||
(defn generate-account-for-keypair
|
||||
[{:keys [db]} [{:keys [keypair-name]}]]
|
||||
(let [seed-phrase (-> db :wallet :ui :create-account :new-keypair :seed-phrase)]
|
||||
{:fx [[:effects.wallet/create-account-from-mnemonic
|
||||
{:mnemonic-phrase (security/safe-unmask-data seed-phrase)
|
||||
:paths [constants/path-default-wallet]
|
||||
:on-success (fn [new-account-data]
|
||||
(rf/dispatch [:wallet/store-account-generated-with-mnemonic
|
||||
(rf/dispatch [:wallet/store-account-generated
|
||||
{:new-account-data new-account-data
|
||||
:keypair-name keypair-name}]))}]]}))
|
||||
|
||||
(rf/reg-event-fx :wallet/generate-account-for-keypair-with-mnemonic
|
||||
generate-account-for-keypair-with-mnemonic)
|
||||
(rf/reg-event-fx :wallet/generate-account-for-keypair generate-account-for-keypair)
|
||||
|
||||
(defn clear-create-account-data
|
||||
[{:keys [db]}]
|
||||
@@ -160,19 +159,14 @@
|
||||
(rf/reg-event-fx
|
||||
:wallet/create-keypair-with-account
|
||||
(fn [{db :db} [password account-preferences]]
|
||||
(let [{:keys [workflow
|
||||
keypair-name
|
||||
(let [{:keys [keypair-name
|
||||
new-account-data]} (-> db :wallet :ui :create-account :new-keypair)
|
||||
keypair-type (if (= workflow :workflow/new-keypair.import-private-key)
|
||||
:key
|
||||
:seed)
|
||||
keypair-with-account (create-account.utils/prepare-new-account
|
||||
{:keypair-name keypair-name
|
||||
:keypair-type keypair-type
|
||||
:account-data new-account-data
|
||||
:account-preferences account-preferences})
|
||||
new-address (some-> new-account-data
|
||||
(create-account.utils/first-derived-account keypair-type)
|
||||
(create-account.utils/first-derived-account)
|
||||
(:address)
|
||||
(string/lower-case))
|
||||
unmasked-password (security/safe-unmask-data password)]
|
||||
@@ -182,7 +176,7 @@
|
||||
:on-success [:wallet/add-account-success new-address]
|
||||
:on-error #(log/error "Failed to add Keypair and create account" %)}]]]})))
|
||||
|
||||
(defn import-mnemonic-and-create-keypair-with-account
|
||||
(defn import-and-create-keypair-with-account
|
||||
[{db :db} [{:keys [password account-preferences]}]]
|
||||
(let [account-data (-> db :wallet :ui :create-account :new-keypair :new-account-data)
|
||||
unmasked-mnemonic (security/safe-unmask-data (:mnemonic account-data))
|
||||
@@ -193,8 +187,7 @@
|
||||
:on-success #(rf/dispatch
|
||||
[:wallet/create-keypair-with-account password account-preferences])}]]]}))
|
||||
|
||||
(rf/reg-event-fx :wallet/import-mnemonic-and-create-keypair-with-account
|
||||
import-mnemonic-and-create-keypair-with-account)
|
||||
(rf/reg-event-fx :wallet/import-and-create-keypair-with-account import-and-create-keypair-with-account)
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/derive-address-and-add-account
|
||||
@@ -213,49 +206,3 @@
|
||||
:on-error [:wallet/log-rpc-error
|
||||
{:event :wallet/derive-address-and-add-account
|
||||
:params [derived-from-address [derivation-path]]}]}]]]}))
|
||||
|
||||
(defn import-private-key-and-create-keypair-with-account
|
||||
[{:keys [db]} [{:keys [password account-preferences]}]]
|
||||
(let [private-key (get-in db
|
||||
[:wallet :ui :create-account :new-keypair
|
||||
:new-account-data :private-key])
|
||||
unmasked-private-key (security/safe-unmask-data private-key)
|
||||
unmasked-password (security/safe-unmask-data password)]
|
||||
{:json-rpc/call
|
||||
[{:method "accounts_importPrivateKey"
|
||||
:params [unmasked-private-key unmasked-password]
|
||||
:on-success [:wallet/create-keypair-with-account password account-preferences]
|
||||
:on-error #(log/error "Failed to import private key" %)}]}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/import-private-key-and-create-keypair-with-account
|
||||
import-private-key-and-create-keypair-with-account)
|
||||
|
||||
(defn store-account-generated-with-private-key
|
||||
[{:keys [db]} [{:keys [new-account-data keypair-name]}]]
|
||||
{:db (-> db
|
||||
(update-in [:wallet :ui :create-account :new-keypair]
|
||||
assoc
|
||||
:new-account-data new-account-data
|
||||
:keypair-name keypair-name)
|
||||
(update-in [:wallet :ui :create-account :new-keypair]
|
||||
dissoc
|
||||
:private-key))
|
||||
:fx [[:dispatch [:navigate-back-to :screen/wallet.create-account]]]})
|
||||
|
||||
(rf/reg-event-fx :wallet/store-account-generated-with-private-key
|
||||
store-account-generated-with-private-key)
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/import-private-key-and-generate-account-for-keypair
|
||||
(fn [{:keys [db]} [{:keys [keypair-name]}]]
|
||||
(let [private-key (get-in db [:wallet :ui :create-account :private-key])]
|
||||
{:db (assoc-in db
|
||||
[:wallet :ui :create-account :new-keypair :workflow]
|
||||
:workflow/new-keypair.import-private-key)
|
||||
:fx [[:effects.wallet/create-account-from-private-key
|
||||
{:private-key private-key
|
||||
:on-success (fn [new-account-data]
|
||||
(rf/dispatch [:wallet/store-account-generated-with-private-key
|
||||
{:keypair-name keypair-name
|
||||
:new-account-data new-account-data}]))}]]})))
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
{:new-account-data {"test" "data"
|
||||
:mnemonic masked-mnemonic}
|
||||
:keypair-name "new-keypair-name"}}}}}
|
||||
effects (events/store-account-generated-with-mnemonic {:db db} props)
|
||||
effects (events/store-account-generated {:db db} props)
|
||||
result-db (:db effects)
|
||||
remove-mnemonic #(update-in %
|
||||
[:wallet :ui :create-account :new-keypair :new-account-data]
|
||||
@@ -61,7 +61,7 @@
|
||||
expected-effects [[:effects.wallet/create-account-from-mnemonic
|
||||
{:mnemonic-phrase "test-secret"
|
||||
:paths [constants/path-default-wallet]}]]
|
||||
effects (events/generate-account-for-keypair-with-mnemonic {:db db} props)]
|
||||
effects (events/generate-account-for-keypair {:db db} props)]
|
||||
(is (match?
|
||||
(update-in effects [:fx 0 1] dissoc :on-success)
|
||||
{:fx expected-effects}))
|
||||
|
||||
+7
-7
@@ -63,31 +63,31 @@
|
||||
(let [{:keys [message] :as props}
|
||||
(case state
|
||||
:scanning
|
||||
{:status :default
|
||||
{:type :info
|
||||
:icon :i/scanning
|
||||
:message :t/scanning-for-activity}
|
||||
|
||||
:inactive-address
|
||||
{:status :warning
|
||||
{:type :warning
|
||||
:icon :i/info
|
||||
:message :t/this-account-has-no-activity}
|
||||
|
||||
:active-address
|
||||
{:status :success
|
||||
{:type :success
|
||||
:icon :i/done
|
||||
:message :t/this-address-has-activity}
|
||||
|
||||
:invalid-private-key
|
||||
{:status :error
|
||||
{:type :error
|
||||
:icon :i/info
|
||||
:message :t/invalid-private-key}
|
||||
|
||||
nil)]
|
||||
(when props
|
||||
[quo/info-message
|
||||
(-> props
|
||||
(assoc :size :default :container-style style/indicator)
|
||||
(dissoc :message))
|
||||
(assoc props
|
||||
:size :default
|
||||
:style style/indicator)
|
||||
(i18n/label message)])))
|
||||
|
||||
(defn on-unmount
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[status-im.common.floating-button-page.view :as floating-button-page]
|
||||
[status-im.common.not-implemented :as not-implemented]
|
||||
[status-im.common.validation.general :as validators]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.wallet.add-account.create-account.key-pair-name.style :as style]
|
||||
@@ -24,12 +25,12 @@
|
||||
(defn- next-workflow-step
|
||||
[workflow key-pair-name]
|
||||
(case workflow
|
||||
;; TODO issue #19759. Implement creation account from private key
|
||||
:import-private-key
|
||||
(rf/dispatch [:wallet/import-private-key-and-generate-account-for-keypair
|
||||
{:keypair-name key-pair-name}])
|
||||
(not-implemented/alert)
|
||||
|
||||
(:new-keypair :recovery-phrase)
|
||||
(rf/dispatch [:wallet/generate-account-for-keypair-with-mnemonic
|
||||
(rf/dispatch [:wallet/generate-account-for-keypair
|
||||
{:keypair-name key-pair-name}])
|
||||
|
||||
(do
|
||||
|
||||
@@ -2,57 +2,28 @@
|
||||
(:require [status-im.constants :as constants]))
|
||||
|
||||
(defn first-derived-account
|
||||
[account-data keypair-type]
|
||||
(if (= keypair-type :seed)
|
||||
(some-> account-data
|
||||
:derived
|
||||
first
|
||||
val)
|
||||
account-data))
|
||||
|
||||
(defn get-account-details
|
||||
[keypair-type account account-to-create]
|
||||
(if (= keypair-type :key)
|
||||
{:key-uid (:key-uid account)
|
||||
:public-key (:public-key account)
|
||||
:account-address (:address account)}
|
||||
{:key-uid (:keyUid account)
|
||||
:public-key (:publicKey account-to-create)
|
||||
:account-address (:address account-to-create)}))
|
||||
|
||||
(defn get-account-config
|
||||
[{:keys [account-address key-uid keypair-type public-key account-name emoji color]}]
|
||||
{:address account-address
|
||||
:key-uid key-uid
|
||||
:wallet false
|
||||
:chat false
|
||||
:type keypair-type
|
||||
:path constants/path-default-wallet
|
||||
:public-key public-key
|
||||
:name account-name
|
||||
:emoji emoji
|
||||
:colorID color
|
||||
:hidden false})
|
||||
[account-data]
|
||||
(-> account-data :derived first val))
|
||||
|
||||
(defn prepare-new-account
|
||||
[{:keys [keypair-name keypair-type]
|
||||
{:keys [address] :as account} :account-data
|
||||
{:keys [account-name color emoji]} :account-preferences}]
|
||||
(let [account-to-create (first-derived-account account keypair-type)
|
||||
{:keys [key-uid public-key account-address]} (get-account-details keypair-type
|
||||
account
|
||||
account-to-create)
|
||||
account-config (get-account-config {:account-address
|
||||
account-address
|
||||
:key-uid key-uid
|
||||
:keypair-type keypair-type
|
||||
:public-key public-key
|
||||
:account-name account-name
|
||||
:emoji emoji
|
||||
:color color})]
|
||||
{:key-uid key-uid
|
||||
[{keypair-name :keypair-name
|
||||
{:keys [keyUid address] :as account} :account-data
|
||||
{:keys [account-name color emoji]} :account-preferences}]
|
||||
(let [account-to-create (first-derived-account account)
|
||||
account-config {:address (:address account-to-create)
|
||||
:key-uid keyUid
|
||||
:wallet false
|
||||
:chat false
|
||||
:type :seed
|
||||
:path constants/path-default-wallet
|
||||
:public-key (:publicKey account-to-create)
|
||||
:name account-name
|
||||
:emoji emoji
|
||||
:colorID color
|
||||
:hidden false}]
|
||||
{:key-uid keyUid
|
||||
:name keypair-name
|
||||
:type keypair-type
|
||||
:type :seed
|
||||
:derived-from address
|
||||
:last-used-derivation-index 0
|
||||
:accounts [account-config]}))
|
||||
|
||||
@@ -22,38 +22,37 @@
|
||||
|
||||
(defn- get-keypair-data
|
||||
[{:keys [title primary-keypair? new-keypair? derivation-path customization-color]}]
|
||||
[{:title title
|
||||
:image (if primary-keypair? :avatar :icon)
|
||||
:image-props (if primary-keypair?
|
||||
{:full-name (utils.string/get-initials title 1)
|
||||
:size :xxs
|
||||
:customization-color customization-color}
|
||||
:i/seed)
|
||||
:action (when-not new-keypair? :button)
|
||||
:action-props {:on-press #(rf/dispatch [:navigate-to :screen/wallet.select-keypair])
|
||||
:button-text (i18n/label :t/edit)
|
||||
:alignment :flex-start}
|
||||
:description :text
|
||||
:description-props {:text (i18n/label :t/on-device)}}
|
||||
(when-not (string/blank? derivation-path)
|
||||
(let [formatted-path (string/replace derivation-path #"/" " / ")
|
||||
on-auth-success (fn [password]
|
||||
(rf/dispatch [:navigate-to
|
||||
:screen/wallet.edit-derivation-path
|
||||
{:password password
|
||||
:current-derivation-path formatted-path}]))]
|
||||
{:title (i18n/label :t/derivation-path)
|
||||
:image :icon
|
||||
:image-props :i/derivated-path
|
||||
:action (if (ff/enabled? ::ff/wallet.edit-derivation-path) :button :none)
|
||||
:action-props {:on-press #(rf/dispatch [:standard-auth/authorize
|
||||
{:on-auth-success on-auth-success
|
||||
:auth-button-label (i18n/label :t/continue)}])
|
||||
:button-text (i18n/label :t/edit)
|
||||
:icon-left :i/face-id
|
||||
:alignment :flex-start}
|
||||
:description :text
|
||||
:description-props {:text formatted-path}}))])
|
||||
(let [formatted-path (string/replace derivation-path #"/" " / ")
|
||||
on-auth-success (fn [password]
|
||||
(rf/dispatch [:navigate-to
|
||||
:screen/wallet.edit-derivation-path
|
||||
{:password password
|
||||
:current-derivation-path formatted-path}]))]
|
||||
[{:title title
|
||||
:image (if primary-keypair? :avatar :icon)
|
||||
:image-props (if primary-keypair?
|
||||
{:full-name (utils.string/get-initials title 1)
|
||||
:size :xxs
|
||||
:customization-color customization-color}
|
||||
:i/seed)
|
||||
:action (when-not new-keypair? :button)
|
||||
:action-props {:on-press #(rf/dispatch [:navigate-to :screen/wallet.select-keypair])
|
||||
:button-text (i18n/label :t/edit)
|
||||
:alignment :flex-start}
|
||||
:description :text
|
||||
:description-props {:text (i18n/label :t/on-device)}}
|
||||
{:title (i18n/label :t/derivation-path)
|
||||
:image :icon
|
||||
:image-props :i/derivated-path
|
||||
:action (if (ff/enabled? ::ff/wallet.edit-derivation-path) :button :none)
|
||||
:action-props {:on-press #(rf/dispatch [:standard-auth/authorize
|
||||
{:on-auth-success on-auth-success
|
||||
:auth-button-label (i18n/label :t/continue)}])
|
||||
:button-text (i18n/label :t/edit)
|
||||
:icon-left :i/face-id
|
||||
:alignment :flex-start}
|
||||
:description :text
|
||||
:description-props {:text formatted-path}}]))
|
||||
|
||||
(defn- avatar
|
||||
[{:keys [account-color emoji on-select-emoji]}]
|
||||
@@ -168,59 +167,38 @@
|
||||
:container-style (style/slide-button-container bottom))]}]
|
||||
children))))
|
||||
|
||||
(defn- on-auth-success-mnemonic
|
||||
[password account-preferences]
|
||||
(rf/dispatch
|
||||
[:wallet/import-mnemonic-and-create-keypair-with-account
|
||||
{:password password
|
||||
:account-preferences account-preferences}]))
|
||||
|
||||
(defn- on-auth-success-import-private-key
|
||||
[password account-preferences]
|
||||
(rf/dispatch
|
||||
[:wallet/import-private-key-and-create-keypair-with-account
|
||||
{:password password
|
||||
:account-preferences account-preferences}]))
|
||||
|
||||
(defn add-new-keypair-variant
|
||||
[{{:keys [account-name account-color emoji]} :state}]
|
||||
(fn [{:keys [on-change-text set-account-color set-emoji customization-color keypair-name error]}]
|
||||
(let [{:keys [new-account-data workflow]} (rf/sub [:wallet/create-account-new-keypair])
|
||||
derivation-path (when (not= workflow
|
||||
:workflow/new-keypair.import-private-key)
|
||||
constants/path-default-wallet)]
|
||||
[floating-button
|
||||
{:account-color @account-color
|
||||
:slide-button-props {:on-auth-success (fn on-auth-success [password]
|
||||
(let [account-preferences {:account-name @account-name
|
||||
:color @account-color
|
||||
:emoji @emoji}]
|
||||
(if (= workflow
|
||||
:workflow/new-keypair.import-private-key)
|
||||
(on-auth-success-import-private-key
|
||||
password
|
||||
account-preferences)
|
||||
(on-auth-success-mnemonic
|
||||
password
|
||||
account-preferences))))
|
||||
:disabled? (empty? @account-name)
|
||||
:dependencies [new-account-data]}}
|
||||
[avatar
|
||||
{:account-color @account-color
|
||||
:emoji @emoji
|
||||
:on-select-emoji set-emoji}]
|
||||
[input
|
||||
{:account-color @account-color
|
||||
:account-name @account-name
|
||||
:on-change-text on-change-text
|
||||
:error error}]
|
||||
[color-picker
|
||||
{:account-color @account-color
|
||||
:set-account-color set-account-color}]
|
||||
[new-account-origin
|
||||
{:derivation-path derivation-path
|
||||
:customization-color customization-color
|
||||
:keypair-title keypair-name}]])))
|
||||
(let [on-auth-success (fn [password]
|
||||
(rf/dispatch
|
||||
[:wallet/import-and-create-keypair-with-account
|
||||
{:password password
|
||||
:account-preferences {:account-name @account-name
|
||||
:color @account-color
|
||||
:emoji @emoji}}]))]
|
||||
(fn [{:keys [on-change-text set-account-color set-emoji customization-color keypair-name error]}]
|
||||
(let [{:keys [new-account-data]} (rf/sub [:wallet/create-account-new-keypair])]
|
||||
[floating-button
|
||||
{:account-color @account-color
|
||||
:slide-button-props {:on-auth-success on-auth-success
|
||||
:disabled? (empty? @account-name)
|
||||
:dependencies [new-account-data]}}
|
||||
[avatar
|
||||
{:account-color @account-color
|
||||
:emoji @emoji
|
||||
:on-select-emoji set-emoji}]
|
||||
[input
|
||||
{:account-color @account-color
|
||||
:account-name @account-name
|
||||
:on-change-text on-change-text
|
||||
:error error}]
|
||||
[color-picker
|
||||
{:account-color @account-color
|
||||
:set-account-color set-account-color}]
|
||||
[new-account-origin
|
||||
{:derivation-path constants/path-default-wallet
|
||||
:customization-color customization-color
|
||||
:keypair-title keypair-name}]]))))
|
||||
|
||||
(defn derive-account-variant
|
||||
[{{:keys [account-name account-color emoji]} :state}]
|
||||
@@ -284,33 +262,33 @@
|
||||
:account-name-error account-name-error
|
||||
:emoji-and-color-error? emoji-and-color-error?}]
|
||||
(fn []
|
||||
(let [customization-color (rf/sub [:profile/customization-color])
|
||||
(let [customization-color (rf/sub [:profile/customization-color])
|
||||
;; Having a keypair means the user is importing it or creating it.
|
||||
{:keys [keypair-name workflow]} (rf/sub [:wallet/create-account-new-keypair])
|
||||
accounts-names (rf/sub [:wallet/accounts-names])
|
||||
accounts-emojis-and-colors (rf/sub [:wallet/accounts-emojis-and-colors])
|
||||
on-change-text (rn/use-callback
|
||||
(fn [new-text]
|
||||
(reset! account-name new-text)
|
||||
(reset! account-name-error
|
||||
(common.utils/get-account-name-error new-text
|
||||
accounts-names)))
|
||||
[accounts-names accounts-emojis-and-colors])
|
||||
check-emoji-and-color-error (fn [emoji color]
|
||||
(let [repeated? (accounts-emojis-and-colors [emoji color])]
|
||||
(reset! emoji-and-color-error?
|
||||
(when repeated? :emoji-and-color))))
|
||||
set-account-color (rn/use-callback
|
||||
(fn [new-color]
|
||||
(reset! account-color new-color)
|
||||
(check-emoji-and-color-error @emoji new-color))
|
||||
[accounts-emojis-and-colors @emoji])
|
||||
set-emoji (rn/use-callback
|
||||
(fn [new-emoji]
|
||||
(reset! emoji new-emoji)
|
||||
(check-emoji-and-color-error new-emoji @account-color))
|
||||
[accounts-emojis-and-colors @account-color])
|
||||
error (or @account-name-error @emoji-and-color-error?)]
|
||||
{:keys [keypair-name]} (rf/sub [:wallet/create-account-new-keypair])
|
||||
accounts-names (rf/sub [:wallet/accounts-names])
|
||||
accounts-emojis-and-colors (rf/sub [:wallet/accounts-emojis-and-colors])
|
||||
on-change-text (rn/use-callback
|
||||
(fn [new-text]
|
||||
(reset! account-name new-text)
|
||||
(reset! account-name-error
|
||||
(common.utils/get-account-name-error new-text
|
||||
accounts-names)))
|
||||
[accounts-names accounts-emojis-and-colors])
|
||||
check-emoji-and-color-error (fn [emoji color]
|
||||
(let [repeated? (accounts-emojis-and-colors [emoji color])]
|
||||
(reset! emoji-and-color-error?
|
||||
(when repeated? :emoji-and-color))))
|
||||
set-account-color (rn/use-callback
|
||||
(fn [new-color]
|
||||
(reset! account-color new-color)
|
||||
(check-emoji-and-color-error @emoji new-color))
|
||||
[accounts-emojis-and-colors @emoji])
|
||||
set-emoji (rn/use-callback
|
||||
(fn [new-emoji]
|
||||
(reset! emoji new-emoji)
|
||||
(check-emoji-and-color-error new-emoji @account-color))
|
||||
[accounts-emojis-and-colors @account-color])
|
||||
error (or @account-name-error @emoji-and-color-error?)]
|
||||
|
||||
(rn/use-mount #(check-emoji-and-color-error @emoji @account-color))
|
||||
(rn/use-unmount #(rf/dispatch [:wallet/clear-create-account]))
|
||||
@@ -322,10 +300,8 @@
|
||||
:on-change-text on-change-text
|
||||
:set-account-color set-account-color
|
||||
:set-emoji set-emoji
|
||||
|
||||
:keypair-name keypair-name
|
||||
:error error
|
||||
:workflow workflow}]
|
||||
:error error}]
|
||||
[derive-account-variant
|
||||
{:state state
|
||||
:customization-color customization-color
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(ns status-im.contexts.wallet.collectible.events
|
||||
(:require [camel-snake-kebab.extras :as cske]
|
||||
[clojure.string :as string]
|
||||
[react-native.platform :as platform]
|
||||
[status-im.contexts.wallet.collectible.utils :as collectible-utils]
|
||||
[taoensso.timbre :as log]
|
||||
@@ -45,6 +44,13 @@
|
||||
|
||||
(rf/reg-event-fx :wallet/clear-stored-collectibles clear-stored-collectibles)
|
||||
|
||||
(defn store-last-collectible-details
|
||||
[{:keys [db]} [collectible]]
|
||||
{:db (assoc-in db [:wallet :last-collectible-details] collectible)
|
||||
:dispatch [:navigate-to :screen/wallet.collectible]})
|
||||
|
||||
(rf/reg-event-fx :wallet/store-last-collectible-details store-last-collectible-details)
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/request-new-collectibles-for-account
|
||||
(fn [{:keys [db]} [{:keys [request-id account amount]}]]
|
||||
@@ -160,58 +166,39 @@
|
||||
[:dispatch [:wallet/flush-collectibles-fetched]])]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/navigate-to-collectible-details
|
||||
(fn [{:keys [db]}
|
||||
[{{collectible-id :id :as collectible} :collectible
|
||||
aspect-ratio :aspect-ratio
|
||||
gradient-color :gradient-color}]]
|
||||
:wallet/get-collectible-details
|
||||
(fn [{:keys [db]} [collectible-id aspect-ratio]]
|
||||
(let [request-id 0
|
||||
collectible-id-converted (cske/transform-keys transforms/->PascalCaseKeyword collectible-id)
|
||||
data-type (collectible-data-types :details)
|
||||
request-params [request-id [collectible-id-converted] data-type]]
|
||||
{:db (assoc-in db
|
||||
[:wallet :ui :collectible]
|
||||
{:details collectible
|
||||
:aspect-ratio aspect-ratio
|
||||
:gradient-color gradient-color})
|
||||
{:db (assoc-in db [:wallet :last-collectible-aspect-ratio] aspect-ratio)
|
||||
:fx [[:json-rpc/call
|
||||
[{:method "wallet_getCollectiblesByUniqueIDAsync"
|
||||
:params request-params
|
||||
:on-error (fn [error]
|
||||
(log/error "failed to request collectible"
|
||||
{:event :wallet/navigate-to-collectible-details
|
||||
{:event :wallet/get-collectible-details
|
||||
:error error
|
||||
:params request-params}))}]]
|
||||
;; 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.
|
||||
[:dispatch-later
|
||||
{:ms 1
|
||||
:dispatch [:navigate-to :screen/wallet.collectible]}]]})))
|
||||
|
||||
(defn- keep-not-empty-value
|
||||
[old-value new-value]
|
||||
(if (or (string/blank? new-value) (nil? new-value))
|
||||
old-value
|
||||
new-value))
|
||||
|
||||
(def merge-skipping-empty-values (partial merge-with keep-not-empty-value))
|
||||
:params request-params}))}]]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/get-collectible-details-done
|
||||
(fn [{db :db} [{:keys [message]}]]
|
||||
(let [response (cske/transform-keys transforms/->kebab-case-keyword
|
||||
(transforms/json->clj message))
|
||||
{[collectible] :collectibles} response]
|
||||
(fn [_ [{:keys [message]}]]
|
||||
(let [response (cske/transform-keys transforms/->kebab-case-keyword
|
||||
(transforms/json->clj message))
|
||||
{:keys [collectibles]} response
|
||||
collectible (first collectibles)]
|
||||
(if collectible
|
||||
{:db (update-in db [:wallet :ui :collectible :details] merge-skipping-empty-values collectible)}
|
||||
{:fx [[:dispatch [:wallet/store-last-collectible-details collectible]]]}
|
||||
(log/error "failed to get collectible details"
|
||||
{:event :wallet/get-collectible-details-done
|
||||
:response response})))))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/clear-collectible-details
|
||||
:wallet/clear-last-collectible-details
|
||||
(fn [{:keys [db]}]
|
||||
{:db (update-in db [:wallet :ui] dissoc :collectible)}))
|
||||
{:db (update-in db [:wallet] dissoc :last-collectible-details :last-collectible-aspect-ratio)}))
|
||||
|
||||
(rf/reg-event-fx :wallet/trigger-share-collectible
|
||||
(fn [_ [{:keys [title uri]}]]
|
||||
|
||||
@@ -43,6 +43,18 @@
|
||||
|
||||
(is (match? result-db expected-db))))))
|
||||
|
||||
(deftest store-last-collectible-details-test
|
||||
(testing "store-last-collectible-details"
|
||||
(let [db {:wallet {}}
|
||||
last-collectible {:description "Pandaria"
|
||||
:image-url "https://..."}
|
||||
expected-db {:wallet {:last-collectible-details {:description "Pandaria"
|
||||
:image-url "https://..."}}}
|
||||
effects (events/store-last-collectible-details {:db db}
|
||||
[last-collectible])
|
||||
result-db (:db effects)]
|
||||
(is (match? result-db expected-db)))))
|
||||
|
||||
(deftest request-new-collectibles-for-account-from-signal-test
|
||||
(testing "request new collectibles for account from signal"
|
||||
(let [db {:wallet {}}
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
(def ^:private link-card-space 28)
|
||||
|
||||
(defn view
|
||||
[{:keys [collectible-data]}]
|
||||
(let [window-width (rf/sub [:dimensions/window-width])
|
||||
item-width (- (/ window-width 2) link-card-space)
|
||||
link-card-container-style (style/link-card item-width)
|
||||
collectible-about {:cards []}]
|
||||
[]
|
||||
(let [window-width (rf/sub [:dimensions/window-width])
|
||||
item-width (- (/ window-width 2) link-card-space)
|
||||
{:keys [collectible-data]} (rf/sub [:wallet/last-collectible-details])
|
||||
link-card-container-style (style/link-card item-width)
|
||||
collectible-about {:cards []}]
|
||||
[:<>
|
||||
[rn/view {:style style/title}
|
||||
[quo/text
|
||||
|
||||
@@ -21,25 +21,27 @@
|
||||
:container-style style/traits-item}])
|
||||
|
||||
(defn- traits-section
|
||||
[traits]
|
||||
[rn/view
|
||||
[quo/section-label
|
||||
{:section (i18n/label :t/traits)
|
||||
:container-style style/traits-title-container}]
|
||||
[rn/flat-list
|
||||
{:render-fn trait-item
|
||||
:data traits
|
||||
:key :collectibles-list
|
||||
:key-fn :id
|
||||
:num-columns 2
|
||||
:content-container-style style/traits-container}]])
|
||||
[]
|
||||
(let [traits (rf/sub [:wallet/last-collectible-details-traits])]
|
||||
(when (pos? (count traits))
|
||||
[rn/view
|
||||
[quo/section-label
|
||||
{:section (i18n/label :t/traits)
|
||||
:container-style style/traits-title-container}]
|
||||
[rn/flat-list
|
||||
{:render-fn trait-item
|
||||
:data traits
|
||||
:key :collectibles-list
|
||||
:key-fn :id
|
||||
:num-columns 2
|
||||
:content-container-style style/traits-container}]])))
|
||||
|
||||
(defn- info
|
||||
[{:keys [chain-id account]}]
|
||||
(let [{:keys [network-name]} (rf/sub [:wallet/network-details-by-chain-id chain-id])
|
||||
subtitle (some-> network-name
|
||||
name
|
||||
string/capitalize)]
|
||||
[]
|
||||
(let [chain-id (rf/sub [:wallet/last-collectible-details-chain-id])
|
||||
{:keys [network-name]} (rf/sub [:wallet/network-details-by-chain-id chain-id])
|
||||
subtitle (string/capitalize (name (or network-name "")))
|
||||
{:keys [name emoji color]} (rf/sub [:wallet/last-collectible-details-owner])]
|
||||
[rn/view {:style style/info-container}
|
||||
[rn/view {:style style/account}
|
||||
[quo/data-item
|
||||
@@ -47,10 +49,10 @@
|
||||
:status :default
|
||||
:size :default
|
||||
:title (i18n/label :t/account-title)
|
||||
:subtitle name
|
||||
:emoji emoji
|
||||
:subtitle-type :account
|
||||
:subtitle (:name account)
|
||||
:emoji (:emoji account)
|
||||
:customization-color (:color account)}]]
|
||||
:customization-color color}]]
|
||||
[rn/view {:style style/network}
|
||||
[quo/data-item
|
||||
{:subtitle-type :network
|
||||
@@ -62,12 +64,7 @@
|
||||
:subtitle subtitle}]]]))
|
||||
|
||||
(defn view
|
||||
[collectible]
|
||||
(let [owner-account (rf/sub [:wallet/collectible-details-owner collectible])
|
||||
traits (-> collectible :collectible-data :traits)]
|
||||
[:<>
|
||||
[info
|
||||
{:chain-id (-> collectible :id :contract-id :chain-id)
|
||||
:account owner-account}]
|
||||
(when (pos? (count traits))
|
||||
[traits-section traits])]))
|
||||
[]
|
||||
[:<>
|
||||
[info]
|
||||
[traits-section]])
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
[status-im.contexts.wallet.collectible.tabs.overview.view :as overview]))
|
||||
|
||||
(defn view
|
||||
[{:keys [selected-tab collectible]}]
|
||||
[{:keys [selected-tab]}]
|
||||
(case selected-tab
|
||||
:overview [overview/view collectible]
|
||||
:about [about/view collectible]
|
||||
:overview [overview/view]
|
||||
:about [about/view]
|
||||
:activity [activity/view]
|
||||
nil))
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
:balance
|
||||
js/parseInt))
|
||||
|
||||
(def supported-collectible-types
|
||||
(def ^:const supported-collectible-types
|
||||
#{"image/jpeg"
|
||||
"image/gif"
|
||||
"image/bmp"
|
||||
|
||||
@@ -76,10 +76,11 @@
|
||||
(defn navigate-back-and-clear-collectible
|
||||
[]
|
||||
(rf/dispatch [:navigate-back])
|
||||
(rf/dispatch [:wallet/clear-collectible-details]))
|
||||
(js/setTimeout #(rf/dispatch [:wallet/clear-last-collectible-details]) 700))
|
||||
|
||||
(defn animated-header
|
||||
[{:keys [scroll-amount title-opacity page-nav-type picture title description theme id]}]
|
||||
[{:keys [scroll-amount title-opacity page-nav-type picture title description theme
|
||||
id]}]
|
||||
(let [blur-amount (header-animations/use-blur-amount scroll-amount)
|
||||
layer-opacity (header-animations/use-layer-opacity
|
||||
scroll-amount
|
||||
@@ -148,9 +149,8 @@
|
||||
(let [title-ref (rn/use-ref-atom nil)
|
||||
set-title-ref (rn/use-callback #(reset! title-ref %))
|
||||
animation-shared-element-id (rf/sub [:animation-shared-element-id])
|
||||
collectible-owner (rf/sub [:wallet/collectible-details-owner collectible])
|
||||
aspect-ratio (rf/sub [:wallet/collectible-aspect-ratio])
|
||||
gradient-color (rf/sub [:wallet/collectible-gradient-color])
|
||||
collectible-owner (rf/sub [:wallet/last-collectible-details-owner])
|
||||
aspect-ratio (rf/sub [:wallet/last-collectible-aspect-ratio])
|
||||
{:keys [id
|
||||
preview-url
|
||||
collection-data
|
||||
@@ -181,36 +181,35 @@
|
||||
[rn/view
|
||||
[gradient-layer preview-uri]
|
||||
[quo/expanded-collectible
|
||||
{:aspect-ratio aspect-ratio
|
||||
:image-src preview-uri
|
||||
:container-style (style/preview-container)
|
||||
:gradient-color-index gradient-color
|
||||
:counter (utils/collectible-owned-counter total-owned)
|
||||
:native-ID (when (= animation-shared-element-id token-id) :shared-element)
|
||||
:supported-file? (utils/supported-file? (:animation-media-type collectible-data))
|
||||
:on-press (fn []
|
||||
(if svg?
|
||||
(js/alert "Can't visualize SVG images in lightbox")
|
||||
(rf/dispatch
|
||||
[:lightbox/navigate-to-lightbox
|
||||
token-id
|
||||
{:images [collectible-image]
|
||||
:index 0
|
||||
:on-options-press #(rf/dispatch [:show-bottom-sheet
|
||||
{:content
|
||||
(fn []
|
||||
[options-drawer/view
|
||||
{:name collectible-name
|
||||
:image
|
||||
preview-uri
|
||||
:id id}])}])}])))
|
||||
:on-collectible-load (fn []
|
||||
;; We need to delay the measurement because the
|
||||
;; navigation has an animation
|
||||
(js/setTimeout
|
||||
#(some-> @title-ref
|
||||
(oops/ocall "measureInWindow" set-title-bottom))
|
||||
300))}]]
|
||||
{:aspect-ratio aspect-ratio
|
||||
:image-src preview-uri
|
||||
:container-style (style/preview-container)
|
||||
:counter (utils/collectible-owned-counter total-owned)
|
||||
:native-ID (when (= animation-shared-element-id token-id) :shared-element)
|
||||
:supported-file? (utils/supported-file? (:animation-media-type collectible-data))
|
||||
:on-press (fn []
|
||||
(if svg?
|
||||
(js/alert "Can't visualize SVG images in lightbox")
|
||||
(rf/dispatch
|
||||
[:lightbox/navigate-to-lightbox
|
||||
token-id
|
||||
{:images [collectible-image]
|
||||
:index 0
|
||||
:on-options-press #(rf/dispatch [:show-bottom-sheet
|
||||
{:content
|
||||
(fn []
|
||||
[options-drawer/view
|
||||
{:name collectible-name
|
||||
:image
|
||||
preview-uri
|
||||
:id id}])}])}])))
|
||||
:on-collectible-load (fn []
|
||||
;; We need to delay the measurement because the
|
||||
;; navigation has an animation
|
||||
(js/setTimeout
|
||||
#(some-> @title-ref
|
||||
(oops/ocall "measureInWindow" set-title-bottom))
|
||||
300))}]]
|
||||
[rn/view {:style (style/background-color theme)}
|
||||
[header collectible-name collection-name collection-image set-title-ref]
|
||||
[cta-buttons
|
||||
@@ -226,43 +225,39 @@
|
||||
:default-active @selected-tab
|
||||
:on-change on-tab-change
|
||||
:data tabs-data}]
|
||||
[tabs/view
|
||||
{:selected-tab @selected-tab
|
||||
:collectible collectible}]]]))))
|
||||
|
||||
(defn- get-title-bottom-y-position
|
||||
[y-element-position element-height]
|
||||
(let [{:keys [top]} (safe-area/get-insets)
|
||||
title-height -56]
|
||||
(+ y-element-position
|
||||
element-height
|
||||
title-height
|
||||
(when platform/ios? (* top -2)))))
|
||||
[tabs/view {:selected-tab @selected-tab}]]]))))
|
||||
|
||||
(defn view
|
||||
[_]
|
||||
(let [{:keys [top]} (safe-area/get-insets)
|
||||
theme (quo.theme/use-theme)
|
||||
title-bottom-coord (rn/use-ref-atom 0)
|
||||
set-title-bottom (rn/use-callback
|
||||
(fn [_ y _ height]
|
||||
(reset! title-bottom-coord
|
||||
(get-title-bottom-y-position y height))))
|
||||
scroll-amount (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])]
|
||||
(let [{:keys [top]} (safe-area/get-insets)
|
||||
theme (quo.theme/use-theme)
|
||||
title-bottom-coord (rn/use-ref-atom 0)
|
||||
set-title-bottom (rn/use-callback
|
||||
(fn [_ y _ height]
|
||||
(reset! title-bottom-coord
|
||||
(+ y
|
||||
height
|
||||
-56
|
||||
(when platform/ios?
|
||||
(* top -2))))))
|
||||
scroll-amount (reanimated/use-shared-value 0)
|
||||
title-opacity (reanimated/use-shared-value 0)
|
||||
collectible (rf/sub [:wallet/last-collectible-details])
|
||||
{:keys [preview-url
|
||||
collection-data
|
||||
collectible-data]} collectible
|
||||
{preview-uri :uri} preview-url
|
||||
{collectible-name :name} collectible-data
|
||||
{collection-name :name} collection-data]
|
||||
[rn/view {:style (style/background-color theme)}
|
||||
[animated-header
|
||||
{:id (:id collectible)
|
||||
:scroll-amount scroll-amount
|
||||
:title-opacity title-opacity
|
||||
:page-nav-type :title-description
|
||||
:picture (:uri preview-url)
|
||||
:title (:name collectible-data)
|
||||
:description (:name collection-data)
|
||||
:picture preview-uri
|
||||
:title collectible-name
|
||||
:description collection-name
|
||||
:theme theme}]
|
||||
[reanimated/scroll-view
|
||||
{:style (style/scroll-view top)
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
:networks networks
|
||||
:align-center? true
|
||||
:networks-on-press #(rf/dispatch [:show-bottom-sheet {:content network-filter/view}])
|
||||
:right-side [(when (and (ff/enabled? ::ff/wallet.wallet-connect)
|
||||
:right-side [(when (and (ff/enabled? ::wallet.wallet-connect)
|
||||
(not watch-only?))
|
||||
{:icon-name :i/dapps
|
||||
:on-press #(rf/dispatch [:navigate-to :screen/wallet.connected-dapps])})
|
||||
|
||||
@@ -13,34 +13,25 @@
|
||||
[{:keys [preview-url collection-data collectible-data total-owned on-press on-long-press]
|
||||
:as collectible}
|
||||
index]
|
||||
(let [gradient-color (keyword (str "gradient-" (inc (mod index 5))))
|
||||
on-press-fn (rn/use-callback
|
||||
(fn [aspect-ratio]
|
||||
(when (fn? on-press)
|
||||
(on-press {:collectible (dissoc collectible :on-press :on-long-press)
|
||||
:aspect-ratio aspect-ratio
|
||||
:gradient-color gradient-color}))))
|
||||
on-long-press-fn (rn/use-callback
|
||||
(fn [aspect-ratio]
|
||||
(when on-long-press
|
||||
(on-long-press
|
||||
(dissoc collectible :on-press :on-long-press)
|
||||
aspect-ratio))))]
|
||||
(let [on-press-fn (rn/use-callback #(when on-press
|
||||
(on-press collectible %)))
|
||||
on-long-press-fn (rn/use-callback #(when on-long-press
|
||||
(on-long-press collectible)))]
|
||||
[quo/collectible-list-item
|
||||
{:type :card
|
||||
:image-src (:uri preview-url)
|
||||
:avatar-image-src (:image-url collection-data)
|
||||
:collectible-name (:name collectible-data)
|
||||
:collectible-name (:name collection-data)
|
||||
:supported-file? (utils/supported-file? (:animation-media-type collectible-data))
|
||||
:gradient-color-index gradient-color
|
||||
:gradient-color-index (keyword (str "gradient-" (inc (mod index 5))))
|
||||
:counter (utils/collectible-owned-counter total-owned)
|
||||
:container-style style/collectible-container
|
||||
:on-press on-press-fn
|
||||
:on-long-press on-long-press-fn}]))
|
||||
|
||||
(defn view
|
||||
[{:keys [collectibles filtered? on-end-reached on-collectible-press
|
||||
current-account-address on-collectible-long-press]}]
|
||||
[{:keys [collectibles filtered? on-end-reached
|
||||
on-collectible-press current-account-address on-collectible-long-press]}]
|
||||
(let [theme (quo.theme/use-theme)
|
||||
no-results-match-query? (and filtered? (empty? collectibles))]
|
||||
(cond
|
||||
|
||||
@@ -177,7 +177,7 @@
|
||||
"This function returns token values in the props of token-value (quo) component"
|
||||
[{:keys [token color currency currency-symbol]}]
|
||||
(let [balance (calculate-total-token-balance token)
|
||||
fiat-value (calculate-token-fiat-value
|
||||
fiat-unformatted-value (calculate-token-fiat-value
|
||||
{:currency currency
|
||||
:balance balance
|
||||
:token token})
|
||||
@@ -191,7 +191,7 @@
|
||||
crypto-value (get-standard-crypto-format token balance)
|
||||
fiat-value (get-standard-fiat-format crypto-value
|
||||
currency-symbol
|
||||
fiat-value)]
|
||||
fiat-unformatted-value)]
|
||||
{:token (:symbol token)
|
||||
:token-name (:name token)
|
||||
:state :default
|
||||
@@ -201,10 +201,11 @@
|
||||
(neg? change-pct-24hour) :negative
|
||||
:else :empty)
|
||||
:customization-color color
|
||||
:values {:crypto-value crypto-value
|
||||
:fiat-value fiat-value
|
||||
:fiat-change formatted-token-price
|
||||
:percentage-change percentage-change}}))
|
||||
:values {:crypto-value crypto-value
|
||||
:fiat-value fiat-value
|
||||
:fiat-unformatted-value fiat-unformatted-value
|
||||
:fiat-change formatted-token-price
|
||||
:percentage-change percentage-change}}))
|
||||
|
||||
(defn get-multichain-address
|
||||
[networks address]
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
(ns status-im.contexts.wallet.connected-dapps.scan-dapp.style
|
||||
(:require [quo.foundations.colors :as colors]))
|
||||
|
||||
(def subtitle-container
|
||||
{:flex-direction :row
|
||||
:align-items :center
|
||||
:padding-horizontal 20
|
||||
:gap 4})
|
||||
|
||||
(def subtitle-text
|
||||
{:color colors/white})
|
||||
@@ -1,44 +0,0 @@
|
||||
(ns status-im.contexts.wallet.connected-dapps.scan-dapp.view
|
||||
(:require [quo.core :as quo]
|
||||
[quo.foundations.resources :as quo.resources]
|
||||
[quo.theme]
|
||||
[react-native.core :as rn]
|
||||
[react-native.hooks :as hooks]
|
||||
[status-im.common.scan-qr-code.view :as scan-qr-code]
|
||||
[status-im.contexts.wallet.connected-dapps.scan-dapp.style :as style]
|
||||
[utils.debounce :as debounce]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(let [{:keys [keyboard-shown]} (hooks/use-keyboard)
|
||||
{:keys [name emoji color]} (rf/sub [:wallet/current-viewing-account])]
|
||||
(rn/use-mount
|
||||
(fn []
|
||||
(when keyboard-shown
|
||||
(rn/dismiss-keyboard!))))
|
||||
[scan-qr-code/view
|
||||
{:title (i18n/label :t/scan-qr)
|
||||
:subtitle [rn/view style/subtitle-container
|
||||
[quo/context-tag
|
||||
{:theme :dark
|
||||
:type :account
|
||||
:size 24
|
||||
:account-name name
|
||||
:emoji emoji
|
||||
:customization-color color}]
|
||||
[quo/text
|
||||
{:style style/subtitle-text
|
||||
:size :paragraph-1}
|
||||
(i18n/label :t/wallet-connect-via)]
|
||||
[quo/context-tag
|
||||
{:theme :dark
|
||||
:type :dapp
|
||||
:size 24
|
||||
:dapp-name (i18n/label :t/wallet-connect-label)
|
||||
:dapp-logo (quo.resources/get-dapp :wallet-connect)}]]
|
||||
:on-success-scan (fn [scanned-text]
|
||||
(debounce/debounce-and-dispatch
|
||||
[:wallet-connect/on-scan-connection scanned-text]
|
||||
300))}]))
|
||||
@@ -90,7 +90,7 @@
|
||||
{:title (i18n/label :t/connected-dapps)
|
||||
:wallet-account wallet-account
|
||||
:on-close #(rf/dispatch [:navigate-back])
|
||||
:on-add #(rf/dispatch [:navigate-to :screen/wallet.scan-dapp])}]
|
||||
:on-add #(js/alert "Feature not implemented")}]
|
||||
(if (empty? pairings)
|
||||
[quo/empty-state
|
||||
{:title (i18n/label :t/no-dapps)
|
||||
|
||||
@@ -58,11 +58,11 @@
|
||||
:emoji-hash emojiHash
|
||||
:key-uid keyUid
|
||||
:public-key publicKey
|
||||
:private-key (security/mask-data privateKey)})))))
|
||||
:private-key privateKey})))))
|
||||
|
||||
(rf/reg-fx
|
||||
:effects.wallet/create-account-from-private-key
|
||||
(fn [{:keys [private-key on-success on-error]}]
|
||||
(fn [[private-key on-success on-error]]
|
||||
(-> (create-account-from-private-key private-key)
|
||||
(promesa/then (partial rf/call-continuation on-success))
|
||||
(promesa/catch (partial rf/call-continuation on-error)))))
|
||||
|
||||
@@ -362,19 +362,15 @@
|
||||
|
||||
(rf/reg-event-fx :wallet/address-validation-success
|
||||
(fn [{:keys [db]}]
|
||||
{:db (update-in db
|
||||
[:wallet :ui :search-address]
|
||||
assoc
|
||||
:valid-ens-or-address? true
|
||||
:loading? false)}))
|
||||
{:db (-> db
|
||||
(assoc-in [:wallet :ui :search-address :valid-ens-or-address?] true)
|
||||
(assoc-in [:wallet :ui :search-address :loading?] false))}))
|
||||
|
||||
(rf/reg-event-fx :wallet/address-validation-failed
|
||||
(fn [{:keys [db]}]
|
||||
{:db (update-in db
|
||||
[:wallet :ui :search-address]
|
||||
assoc
|
||||
:valid-ens-or-address? false
|
||||
:loading? false)}))
|
||||
{:db (-> db
|
||||
(assoc-in [:wallet :ui :search-address :valid-ens-or-address?] false)
|
||||
(assoc-in [:wallet :ui :search-address :loading?] false))}))
|
||||
|
||||
(rf/reg-event-fx :wallet/clean-local-suggestions
|
||||
(fn [{:keys [db]}]
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
:name (:name collectible-data)
|
||||
:image (:uri preview-url)}])}]))
|
||||
|
||||
(def on-collectible-press #(rf/dispatch [:wallet/navigate-to-collectible-details %]))
|
||||
(defn- on-collectible-press
|
||||
[{:keys [id]} aspect-ratio]
|
||||
(rf/dispatch [:wallet/get-collectible-details id aspect-ratio]))
|
||||
|
||||
(defn view
|
||||
[{:keys [selected-tab]}]
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
{:collectibles collectibles
|
||||
:filtered? search-performed?
|
||||
:on-end-reached #(rf/dispatch [:wallet/request-collectibles-for-current-viewing-account])
|
||||
:on-collectible-press (fn [{:keys [collectible]}]
|
||||
:on-collectible-press (fn [collectible]
|
||||
(rf/dispatch [:wallet/set-collectible-to-send
|
||||
{:collectible collectible
|
||||
:current-screen :screen/wallet.select-asset}]))}]))
|
||||
|
||||
@@ -67,7 +67,8 @@
|
||||
:session-networks session-networks
|
||||
:address (-> without-watched
|
||||
first
|
||||
:address))
|
||||
:address)
|
||||
)
|
||||
:fx [[:dispatch
|
||||
[:open-modal :screen/wallet.wallet-connect-session-proposal]]]}
|
||||
{:fx [[:dispatch
|
||||
@@ -189,25 +190,27 @@
|
||||
(fn [_ [scanned-text]]
|
||||
(let [parsed-uri (wallet-connect/parse-uri scanned-text)
|
||||
version (:version parsed-uri)
|
||||
valid-wc-uri? (wc-utils/valid-uri? parsed-uri)
|
||||
expired? (-> parsed-uri
|
||||
:expiryTimestamp
|
||||
wc-utils/timestamp-expired?)
|
||||
version-supported? (wc-utils/version-supported? version)]
|
||||
(if (or (not valid-wc-uri?) expired? (not version-supported?))
|
||||
(cond
|
||||
expired?
|
||||
{:fx [[:dispatch
|
||||
[:toasts/upsert
|
||||
{:type :negative
|
||||
:theme :dark
|
||||
:text (cond (not valid-wc-uri?)
|
||||
(i18n/label :t/wallet-connect-wrong-qr)
|
||||
:text (i18n/label :t/wallet-connect-qr-expired)}]]]}
|
||||
|
||||
expired?
|
||||
(i18n/label :t/wallet-connect-qr-expired)
|
||||
(not version-supported?)
|
||||
{:fx [[:dispatch
|
||||
[:toasts/upsert
|
||||
{:type :negative
|
||||
:theme :dark
|
||||
:text (i18n/label :t/wallet-connect-version-not-supported
|
||||
{:version version})}]]]}
|
||||
|
||||
(not version-supported?)
|
||||
(i18n/label :t/wallet-connect-version-not-supported
|
||||
{:version version}))}]]]}
|
||||
:else
|
||||
{:fx [[:dispatch [:wallet-connect/pair scanned-text]]]}))))
|
||||
|
||||
(rf/reg-event-fx
|
||||
|
||||
@@ -123,6 +123,16 @@
|
||||
(hide-bottom-sheet new-cofx)
|
||||
{:show-bottom-sheet {:theme theme}}))))))
|
||||
|
||||
(rf/defn dismiss-all-overlays
|
||||
{:events [:dismiss-all-overlays]}
|
||||
[_]
|
||||
{:dispatch-n [[:hide-popover]
|
||||
[:hide-visibility-status-popover]
|
||||
[:hide-bottom-sheet]
|
||||
[:bottom-sheet-hidden]
|
||||
[:bottom-sheet/hide-old-navigation-overlay]
|
||||
[:toasts/close-all-toasts]]})
|
||||
|
||||
(rf/defn set-view-id
|
||||
{:events [:set-view-id]}
|
||||
[{:keys [db]} view-id]
|
||||
|
||||
@@ -108,7 +108,6 @@
|
||||
[status-im.contexts.wallet.bridge.select-asset.view :as wallet-bridge-select-asset]
|
||||
[status-im.contexts.wallet.collectible.view :as wallet-collectible]
|
||||
[status-im.contexts.wallet.common.scan-account.view :as wallet-scan-address]
|
||||
[status-im.contexts.wallet.connected-dapps.scan-dapp.view :as wallet-scan-dapp]
|
||||
[status-im.contexts.wallet.connected-dapps.view :as wallet-connected-dapps]
|
||||
[status-im.contexts.wallet.send.from.view :as wallet-select-from]
|
||||
[status-im.contexts.wallet.send.select-address.view :as wallet-select-address]
|
||||
@@ -412,6 +411,10 @@
|
||||
:options {:insets {:top? true}}
|
||||
:component wallet-accounts/view}
|
||||
|
||||
{:name :screen/wallet.connected-dapps
|
||||
:options {:insets {:top? true}}
|
||||
:component wallet-connected-dapps/view}
|
||||
|
||||
{:name :screen/wallet.wallet-connect-session-proposal
|
||||
:options {:sheet? true}
|
||||
:component wallet-connect-session-proposal/view}
|
||||
@@ -546,16 +549,6 @@
|
||||
:options {:sheet? true}
|
||||
:component wallet-connect-send-transaction/view}
|
||||
|
||||
{:name :screen/wallet.connected-dapps
|
||||
:options {:insets {:top? true}}
|
||||
:component wallet-connected-dapps/view}
|
||||
|
||||
{:name :screen/wallet.scan-dapp
|
||||
:options (merge
|
||||
options/dark-screen
|
||||
{:modalPresentationStyle :overCurrentContext})
|
||||
:component wallet-scan-dapp/view}
|
||||
|
||||
;; Settings
|
||||
|
||||
{:name :screen/settings-password
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
(defn- preview-url
|
||||
[{{collectible-image-url :image-url
|
||||
animation-url :animation-url
|
||||
animation-media-type :animation-media-type} :collectible-data}]
|
||||
animation-media-type :animation-media-type} :collectible-data
|
||||
{collection-image-url :image-url} :collection-data}]
|
||||
(cond
|
||||
(svg-animation? animation-url animation-media-type)
|
||||
{:uri animation-url
|
||||
@@ -33,7 +34,7 @@
|
||||
{:uri collectible-image-url}
|
||||
|
||||
:else
|
||||
{:uri nil}))
|
||||
{:uri collection-image-url}))
|
||||
|
||||
(defn add-collectibles-preview-url
|
||||
[collectibles]
|
||||
@@ -90,36 +91,35 @@
|
||||
current-account-collectibles))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:wallet/collectible
|
||||
:<- [:wallet/ui]
|
||||
:-> :collectible)
|
||||
:wallet/last-collectible-details
|
||||
:<- [:wallet]
|
||||
(fn [wallet]
|
||||
(let [last-collectible (:last-collectible-details wallet)]
|
||||
(assoc last-collectible :preview-url (preview-url last-collectible)))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:wallet/collectible-details
|
||||
:<- [:wallet/collectible]
|
||||
:wallet/last-collectible-aspect-ratio
|
||||
:<- [:wallet]
|
||||
(fn [wallet]
|
||||
(:last-collectible-aspect-ratio wallet)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:wallet/last-collectible-details-chain-id
|
||||
:<- [:wallet/last-collectible-details]
|
||||
(fn [collectible]
|
||||
(as-> collectible $
|
||||
(:details $)
|
||||
(assoc $ :preview-url (preview-url $)))))
|
||||
(get-in collectible [:id :contract-id :chain-id])))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:wallet/collectible-aspect-ratio
|
||||
:<- [:wallet/collectible]
|
||||
:wallet/last-collectible-details-traits
|
||||
:<- [:wallet/last-collectible-details]
|
||||
(fn [collectible]
|
||||
(:aspect-ratio collectible 1)))
|
||||
(get-in collectible [:collectible-data :traits])))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:wallet/collectible-gradient-color
|
||||
:<- [:wallet/collectible]
|
||||
(fn [collectible]
|
||||
(:gradient-color collectible :gradient-1)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:wallet/collectible-details-owner
|
||||
:<- [:wallet/accounts]
|
||||
(fn [accounts [_ collectible]]
|
||||
(let [collectible-address (-> collectible :ownership first :address)]
|
||||
(some #(when (= (:address %) collectible-address)
|
||||
%)
|
||||
accounts))))
|
||||
|
||||
:wallet/last-collectible-details-owner
|
||||
:<- [:wallet/last-collectible-details]
|
||||
:<- [:wallet]
|
||||
(fn [[collectible wallet]]
|
||||
(let [address (:address (first (:ownership collectible)))
|
||||
account (get-in wallet [:accounts address])]
|
||||
account)))
|
||||
|
||||
@@ -2,25 +2,49 @@
|
||||
(:require
|
||||
[cljs.test :refer [is testing]]
|
||||
[re-frame.db :as rf-db]
|
||||
[status-im.subs.root]
|
||||
[status-im.subs.wallet.collectibles]
|
||||
status-im.subs.root
|
||||
status-im.subs.wallet.collectibles
|
||||
[test-helpers.unit :as h]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(def collectible-owner-wallet
|
||||
{:ui {:collectible {:details {:ownership [{:address "0x1"}]}}}
|
||||
:accounts {"0x1" {:address "0x1"
|
||||
:name "account 1"
|
||||
:color "army"}}})
|
||||
(def ^:private traits
|
||||
[{:trait-type "Background"
|
||||
:value "Gradient 5"
|
||||
:display-type ""
|
||||
:max-value ""}
|
||||
{:trait-type "Skin"
|
||||
:value "Pale"
|
||||
:display-type ""
|
||||
:max-value ""}
|
||||
{:trait-type "Clothes"
|
||||
:value "Naked"
|
||||
:display-type ""
|
||||
:max-value ""}])
|
||||
|
||||
(h/deftest-sub :wallet/collectible-details-owner
|
||||
(def ^:private collectible-owner-wallet
|
||||
{:last-collectible-details {:ownership [{:address "0x1"}]}
|
||||
:accounts {"0x1" {:name "account 1"
|
||||
:color "army"}}})
|
||||
|
||||
(h/deftest-sub :wallet/last-collectible-details-chain-id
|
||||
[sub-name]
|
||||
(testing "correct chain-id of the last collectible should be returned"
|
||||
(swap! rf-db/app-db assoc-in [:wallet :last-collectible-details :id :contract-id :chain-id] "1")
|
||||
(let [result (rf/sub [sub-name])]
|
||||
(is (= "1" result)))))
|
||||
|
||||
(h/deftest-sub :wallet/last-collectible-details-traits
|
||||
[sub-name]
|
||||
(testing "correct traits of the last collectible should be returned"
|
||||
(swap! rf-db/app-db assoc-in [:wallet :last-collectible-details :collectible-data :traits] traits)
|
||||
(let [result (rf/sub [sub-name])]
|
||||
(is (= traits result)))))
|
||||
|
||||
(h/deftest-sub :wallet/last-collectible-details-owner
|
||||
[sub-name]
|
||||
(testing "correct owner of the last collectible should be returned"
|
||||
(swap! rf-db/app-db assoc :wallet collectible-owner-wallet)
|
||||
(let [collectible (-> collectible-owner-wallet :ui :collectible :details)
|
||||
result (rf/sub [sub-name collectible])]
|
||||
(is (= {:name "account 1"
|
||||
:color "army"
|
||||
:address "0x1"
|
||||
:network-preferences-names #{}}
|
||||
(swap! rf-db/app-db assoc-in [:wallet] collectible-owner-wallet)
|
||||
(let [result (rf/sub [sub-name])]
|
||||
(is (= {:name "account 1"
|
||||
:color "army"}
|
||||
result)))))
|
||||
|
||||
@@ -496,11 +496,13 @@
|
||||
:<- [:profile/currency]
|
||||
:<- [:profile/currency-symbol]
|
||||
(fn [[{:keys [color]} tokens currency currency-symbol]]
|
||||
(mapv #(utils/calculate-token-value {:token %
|
||||
:color color
|
||||
:currency currency
|
||||
:currency-symbol currency-symbol})
|
||||
tokens)))
|
||||
(let [calculated-tokens (mapv #(utils/calculate-token-value {:token %
|
||||
:color color
|
||||
:currency currency
|
||||
:currency-symbol currency-symbol})
|
||||
tokens)]
|
||||
(vec (sort-by #(get-in % [:values :fiat-unformatted-value]) > calculated-tokens)))))
|
||||
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/aggregated-tokens
|
||||
@@ -522,16 +524,19 @@
|
||||
:<- [:profile/currency]
|
||||
:<- [:profile/currency-symbol]
|
||||
(fn [[aggregated-tokens color currency currency-symbol]]
|
||||
(let [balance (utils/calculate-balance-from-tokens {:currency currency
|
||||
:tokens aggregated-tokens})
|
||||
formatted-balance (utils/prettify-balance currency-symbol balance)]
|
||||
(let [balance (utils/calculate-balance-from-tokens {:currency currency
|
||||
:tokens aggregated-tokens})
|
||||
formatted-balance (utils/prettify-balance currency-symbol balance)
|
||||
token-values (mapv #(utils/calculate-token-value {:token %
|
||||
:color color
|
||||
:currency currency
|
||||
:currency-symbol currency-symbol})
|
||||
aggregated-tokens)
|
||||
sorted-token-values (sort-by #(-> % :values :fiat-unformatted-value) > token-values)]
|
||||
{:balance balance
|
||||
:formatted-balance formatted-balance
|
||||
:tokens (mapv #(utils/calculate-token-value {:token %
|
||||
:color color
|
||||
:currency currency
|
||||
:currency-symbol currency-symbol})
|
||||
aggregated-tokens)})))
|
||||
:tokens sorted-token-values})))
|
||||
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/network-preference-details
|
||||
|
||||
@@ -2733,11 +2733,8 @@
|
||||
"dapp-will-be-able-to": "{{dapp-name}} will be able to:",
|
||||
"check-your-account-balance-and-activity": "Check your account balance and activity",
|
||||
"request-txns-and-message-signing": "Request transactions and message signing",
|
||||
"wallet-connect-label": "WalletConnect",
|
||||
"wallet-connect-via": "via",
|
||||
"wallet-connect-qr-expired": "WalletConnect QR has expired",
|
||||
"wallet-connect-version-not-supported": "WalletConnect version {{version}} is not supported",
|
||||
"wallet-connect-wrong-qr": "It’s not a WalletConnect QR",
|
||||
"add-network-preferences": "Add network preferences",
|
||||
"saved-address-network-preference-selection-description": "Only change if you know which networks the address owner is happy to to receive funds on",
|
||||
"add-preferences": "Add preferences",
|
||||
|
||||
Reference in New Issue
Block a user