Compare commits

..
70 changed files with 982 additions and 633 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

+1
View File
@@ -49,6 +49,7 @@
:Text {}
:StatusBar {}
:ScrollView {}
:SafeAreaView {}
:KeyboardAvoidingView {}
:TextInput {}
:Image {}
@@ -2,26 +2,30 @@
(:require [quo.foundations.colors :as colors]))
(defn- circle-color
[customization-color]
(colors/custom-color customization-color 50 20))
[customization-color neutral? theme]
(if neutral?
(colors/theme-colors colors/neutral-80-opa-5 colors/white-opa-5 theme)
(colors/custom-color customization-color 50 20)))
(defn- text-color
[customization-color theme]
(colors/theme-colors
(colors/custom-color customization-color 50)
(colors/custom-color customization-color 60)
theme))
[customization-color neutral? theme]
(if neutral?
(colors/theme-colors colors/neutral-80-opa-70 colors/white-opa-70 theme)
(colors/theme-colors
(colors/custom-color customization-color 50)
(colors/custom-color customization-color 60)
theme)))
(defn container
[circle-size customization-color]
[circle-size customization-color neutral? theme]
{:width circle-size
:height circle-size
:border-radius circle-size
:text-align :center
:justify-content :center
:align-items :center
:background-color (circle-color customization-color)})
:background-color (circle-color customization-color neutral? theme)})
(defn text
[customization-color theme]
{:color (text-color customization-color theme)})
[customization-color neutral? theme]
{:color (text-color customization-color neutral? theme)})
@@ -1,5 +1,6 @@
(ns quo.components.avatars.wallet-user-avatar.view
(:require [quo.components.avatars.wallet-user-avatar.style :as style]
(:require [clojure.string :as string]
[quo.components.avatars.wallet-user-avatar.style :as style]
[quo.components.markdown.text :as text]
[quo.theme :as quo.theme]
[react-native.core :as rn]
@@ -40,18 +41,21 @@
:customization-color - keyword (default: nil) - color of the avatar
:size - keyword (default: last element of properties object) - size of the
avatar
:monospace? - boolean (default: false) - use monospace font"
[{:keys [full-name customization-color size theme monospace?]
:monospace? - boolean (default: false) - use monospace font
:lowercase? - boolean (default: false) - lowercase text
:neutral? - boolean (default: false) - use neutral colors variant"
[{:keys [full-name customization-color size theme monospace? lowercase? neutral?]
:or {size biggest-possible}}]
(let [circle-size (:size (size properties))
small? (check-if-size-small size)]
small? (check-if-size-small size)
initials (utils.string/get-initials full-name (if small? 1 2))]
[rn/view
{:style (style/container circle-size customization-color)}
{:style (style/container circle-size customization-color neutral? theme)}
[text/text
{:accessibility-label :wallet-user-avatar
:size (:font-size (size properties))
:weight (if monospace? :monospace (:font-weight (size properties)))
:style (style/text customization-color theme)}
(utils.string/get-initials full-name (if small? 1 2))]]))
:style (style/text customization-color neutral? theme)}
(if lowercase? (string/lower-case initials) initials)]]))
(def wallet-user-avatar (quo.theme/with-theme view-internal))
@@ -13,11 +13,11 @@
[{:keys [theme address networks blur?]}]
[rn/view {:style style/left-container}
[wallet-user-avatar/wallet-user-avatar
{:size :medium
:f-name "0"
:l-name "x"
{:size :size-32
:full-name "0 x"
:monospace? true
:uppercase? false}]
:lowercase? true
:neutral? true}]
[rn/view {:style style/account-container}
[text/text {:size :paragraph-1}
(map (fn [network]
@@ -25,8 +25,8 @@
[text/text
{:size :paragraph-1
:weight :semi-bold
:style {:color (colors/resolve-color network theme)}}
(str (subs (name network) 0 3) ":")])
:style {:color (colors/resolve-color (:network-name network) theme)}}
(str (:short-name network) ":")])
networks)
[text/text
{:size :paragraph-1
@@ -1,6 +1,5 @@
(ns quo.components.list-items.saved-address.view
(:require
[clojure.string :as string]
[quo.components.avatars.wallet-user-avatar.view :as wallet-user-avatar]
[quo.components.icon :as icon]
[quo.components.list-items.saved-address.style :as style]
@@ -13,27 +12,23 @@
(defn- left-container
[{:keys [blur? theme name ens address customization-color]}]
(let [names (remove string/blank? (string/split name " "))
first-name (if (> (count names) 0) (first names) "")
last-name (if (> (count names) 1) (last names) "")]
[rn/view {:style style/left-container}
[wallet-user-avatar/wallet-user-avatar
{:size :medium
:f-name first-name
:l-name last-name
:customization-color customization-color}]
[rn/view {:style style/account-container}
[text/text
{:weight :semi-bold
:size :paragraph-1
:style style/name-text}
name]
[text/text {:size :paragraph-2}
[text/text
{:size :paragraph-2
:weight :monospace
:style (style/account-address blur? theme)}
(or ens (address/get-shortened-key address))]]]]))
[rn/view {:style style/left-container}
[wallet-user-avatar/wallet-user-avatar
{:size :size-32
:full-name name
:customization-color customization-color}]
[rn/view {:style style/account-container}
[text/text
{:weight :semi-bold
:size :paragraph-1
:style style/name-text}
name]
[text/text {:size :paragraph-2}
[text/text
{:size :paragraph-2
:weight :monospace
:style (style/account-address blur? theme)}
(or ens (address/get-shortened-key address))]]]])
(defn- internal-view
[]
@@ -26,21 +26,25 @@
(def info
{:flex-direction :row
:align-items :center})
:align-items :center
:width "70%"})
(def token-info
{:height 40})
{:height 40
:flex 1})
(def token-image
{:width 32
:height 32
:border-width 1
:border-radius 16
:border-color colors/neutral-80-opa-5
:margin-right 8})
{:width 32
:height 32
:border-width 1
:border-radius 16
:border-color colors/neutral-80-opa-5
:margin-right 8
:background-color colors/neutral-80-opa-5})
(def values-container
{:align-items :flex-end})
{:align-items :flex-end
:max-width "30%"})
(defn fiat-value
[theme]
@@ -15,11 +15,14 @@
{:source (or (:source token) token)
:style style/token-image}]
[rn/view {:style style/token-info}
[text/text {:weight :semi-bold} label]
[text/text
{:weight :semi-bold
:number-of-lines 1}
(if-not (empty? label) label "-")]
[preview-list/view
{:type :network
:size :size-14
:number 3}
:number (count networks)}
networks]]])
(defn- values
@@ -30,12 +33,14 @@
:accessibility-label :check-icon}]
[rn/view {:style style/values-container}
[text/text
{:weight :medium
:size :paragraph-2}
{:weight :medium
:size :paragraph-2
:number-of-lines 1}
token-value]
[text/text
{:style (style/fiat-value theme)
:size :paragraph-2}
{:style (style/fiat-value theme)
:size :paragraph-2
:number-of-lines 1}
fiat-value]]))
(defn- view-internal
@@ -36,7 +36,7 @@
:blur? false
:type :digit} 1])
(h/is-truthy (h/query-by-label-text :text-label))
(h/fire-event :press (h/query-by-label-text :keyboard-key-1))
(h/fire-event :press (h/query-by-label-text :keyboard-key))
(h/was-called on-press)))
(h/test "Is not pressable when disabled is true"
@@ -47,5 +47,5 @@
:blur? false
:type :digit} 1])
(h/is-truthy (h/query-by-label-text :text-label))
(h/fire-event :press (h/query-by-label-text :keyboard-key-1))
(h/fire-event :press (h/query-by-label-text :keyboard-key))
(h/was-not-called on-press))))
@@ -7,11 +7,6 @@
[react-native.core :as rn]
[reagent.core :as reagent]))
(defn- label->accessibility-label
[label]
(let [label-name (if (keyword? label) (name label) label)]
(keyword (str "keyboard-key-" label-name))))
(defn- view-internal
[]
(let [pressed? (reagent/atom false)]
@@ -19,11 +14,9 @@
(let [label-color (style/get-label-color disabled? theme blur?)
background-color (style/toggle-background-color @pressed? blur? theme)]
[rn/pressable
{:accessibility-label (label->accessibility-label label)
{:accessibility-label :keyboard-key
:disabled (or disabled? (not label))
:on-press (fn []
(when on-press
(on-press label)))
:on-press (fn [] (on-press label))
:on-press-in #(reset! pressed? true)
:on-press-out #(reset! pressed? false)
:style (style/container background-color)}
@@ -17,15 +17,13 @@
(defn- view-internal
[]
(fn [{:keys [disabled? theme blur? left-action delete-key? on-press on-delete]
:or {left-action :none}}]
(fn [{:keys [disabled? theme blur? left-action delete-key? on-press]}]
[rn/view
{:style style/container}
(for [row-index (range 1 4)]
^{:key row-index}
[rn/view {:style style/row-container}
(for [column-index (range 1 4)]
^{:key (str row-index column-index)}
[keyboard-item
{:item (+ (* (dec row-index) 3) column-index)
:type :digit
@@ -60,10 +58,10 @@
:theme theme}]
(if delete-key?
[keyboard-item
{:item :i/travel
{:item :i/delete
:type :key
:disabled? disabled?
:on-press on-delete
:on-press on-press
:blur? blur?
:theme theme}]
[keyboard-item])]]))
@@ -1,6 +1,7 @@
(ns quo.components.settings.data-item.component-spec
(:require
[quo.core :as quo]
[quo.foundations.resources :as quo.resources]
[test-helpers.component :as h]))
(h/describe
@@ -161,7 +162,8 @@
:subtitle "Description"
:icon :i/placeholder
:emoji "🎮"
:customization-color :yellow}])
:customization-color :yellow
:network-image (quo.resources/get-network :ethereum)}])
(h/is-truthy (h/query-by-label-text :description-image)))
(h/test "description emoji is visible when description is account"
@@ -7,7 +7,6 @@
[quo.components.markdown.text :as text]
[quo.components.settings.data-item.style :as style]
[quo.foundations.colors :as colors]
[quo.foundations.resources :as quo.resources]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[utils.i18n :as i18n]))
@@ -17,7 +16,8 @@
[rn/view {:style (style/loading-container size blur? theme)}])
(defn- left-subtitle
[{:keys [theme size description icon icon-color blur? subtitle customization-color emoji]}]
[{:keys [theme size description icon icon-color blur? subtitle customization-color emoji
network-image]}]
[rn/view {:style style/subtitle-container}
(when (not= :small size)
[rn/view {:style (style/subtitle-icon-container description)}
@@ -33,7 +33,7 @@
:type :default}]
:network [rn/image
{:accessibility-label :description-image
:source (quo.resources/tokens :eth)
:source network-image
:style style/image}]
nil)])
[text/text
@@ -60,7 +60,7 @@
(defn- left-side
"The description can either be given as a string `description` or a component `custom-subtitle`"
[{:keys [theme title status size blur? description custom-subtitle icon subtitle label icon-color
customization-color
customization-color network-image
emoji]
:as props}]
[rn/view {:style style/left-side}
@@ -85,7 +85,8 @@
:blur? blur?
:subtitle subtitle
:customization-color customization-color
:emoji emoji}]))])
:emoji emoji
:network-image network-image}]))])
(defn- right-side
[{:keys [label icon-right? right-icon icon-color communities-list]}]
@@ -0,0 +1,28 @@
(ns quo.components.text-combinations.channel-name.component-spec
(:require [quo.components.text-combinations.channel-name.view :as channel-name]
[test-helpers.component :as h]))
(h/describe "Channel name"
(h/test "Renders Default"
(h/render [channel-name/view {:channel-name "Test channel"}])
(h/is-truthy (h/get-by-text "# Test channel")))
(h/test "Renders unlocked icon"
(h/render [channel-name/view
{:channel-name "Test channel"
:unlocked? true}])
(h/is-truthy (h/get-by-label-text :channel-name-unlocked-icon)))
(h/test "Renders muted icon"
(h/render [channel-name/view
{:channel-name "Test channel"
:muted? true}])
(h/is-truthy (h/get-by-label-text :channel-name-muted-icon)))
(h/test "Renders muted and unlocked icon"
(h/render [channel-name/view
{:channel-name "Test channel"
:muted? true
:unlocked? true}])
(h/is-truthy (h/get-by-label-text :channel-name-unlocked-icon))
(h/is-truthy (h/get-by-label-text :channel-name-muted-icon))))
@@ -0,0 +1,30 @@
(ns quo.components.text-combinations.channel-name.style
(:require [quo.foundations.colors :as colors]))
(def container {:flex-direction :row})
(def icons-container
{:flex-direction :row
:padding-top 8
:padding-bottom 4
:margin-left 6})
(def icon {:width 20 :height 20})
(def icons-gap {:width 4})
(defn- blur-icon-color
[theme]
(colors/theme-colors colors/neutral-80-opa-40 colors/white-opa-40 theme))
(defn unlocked-icon-color
[theme blur?]
(if blur?
(blur-icon-color theme)
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme)))
(defn muted-icon-color
[theme blur?]
(if blur?
(blur-icon-color theme)
(colors/theme-colors colors/neutral-40 colors/neutral-60 theme)))
@@ -0,0 +1,40 @@
(ns quo.components.text-combinations.channel-name.view
(:require [quo.components.icon :as icon]
[quo.components.markdown.text :as text]
[quo.components.text-combinations.channel-name.style :as style]
[quo.theme]
[react-native.core :as rn]))
(defn icons
[{:keys [theme unlocked? muted? blur?]}]
[rn/view {:style style/icons-container}
(when unlocked?
[rn/view
{:style style/icon
:accessibility-label :channel-name-unlocked-icon}
[icon/icon :i/unlocked
{:color (style/unlocked-icon-color theme blur?)
:size 20}]])
(when (and unlocked? muted?)
[rn/view {:style style/icons-gap}])
(when muted?
[rn/view
{:style style/icon
:accessibility-label :channel-name-muted-icon}
[icon/icon :i/muted
{:color (style/muted-icon-color theme blur?)
:size 20}]])])
(defn- view-internal
[{:keys [unlocked? muted? channel-name] :as props}]
[rn/view {:style style/container}
[text/text
{:size :heading-1
:weight :semi-bold}
(str "# " channel-name)]
(when (or unlocked? muted?)
[icons props])])
(def view (quo.theme/with-theme view-internal))
@@ -28,3 +28,9 @@
{:flex-direction :row
:align-items :center
:justify-content :space-between})
(defn subtitle
[blur? theme]
{:color (if blur?
colors/white-opa-40
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme))})
+15 -13
View File
@@ -11,6 +11,7 @@
[quo.foundations.colors :as colors]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[react-native.platform :as platform]
[reagent.core :as reagent]
[utils.i18n :as i18n]))
@@ -19,11 +20,6 @@
(let [first-name (first (string/split full-name #" "))]
(i18n/label :t/keypair-title {:name first-name})))
(defn details-string
[address stored]
(str (when address (str address " ∙ "))
(if (= stored :on-device) (i18n/label :t/on-device) (i18n/label :t/on-keycard))))
(defn avatar
[{{:keys [full-name]} :details
avatar-type :type
@@ -67,15 +63,21 @@
[{:keys [details stored blur? theme]}]
(let [{:keys [address]} details]
[rn/view
{:style {:flex-direction :row
:align-items :center}}
{:style {:flex-direction :row
:align-items :center}
:accessibility-label :details}
[text/text
{:size :paragraph-2
:accessibility-label :details
:style {:color (if blur?
colors/white-opa-40
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme))}}
(details-string address stored)]
{:size :paragraph-2
:style (style/subtitle blur? theme)}
address]
[text/text
{:size :paragraph-2
:style (merge (style/subtitle blur? theme) {:bottom (if platform/ios? 2 -2)})}
" ∙ "]
[text/text
{:size :paragraph-2
:style (style/subtitle blur? theme)}
(if (= stored :on-device) (i18n/label :t/on-device) (i18n/label :t/on-keycard))]
(when (= stored :on-keycard)
[rn/view {:style {:margin-left 4}}
[icon/icon :i/keycard-card
@@ -14,10 +14,7 @@
:padding-bottom 4
:height 36
:flex-direction :row
:justify-content :space-between
;;
:background-color :pink
})
:justify-content :space-between})
(def token
{:width 32
@@ -25,12 +22,14 @@
(defn text-input
[theme]
(assoc typography/heading-1
:font-weight "600"
:color (colors/theme-colors colors/neutral-100 colors/white theme)
:padding 0
;; TODO: fix the padding
:height "100%"))
(merge typography/heading-1
{:font-weight "600"
:margin-left 8
:margin-right (if platform/ios? 6 4)
:color (colors/theme-colors colors/neutral-100 colors/white theme)
:padding 0
:text-align :center
:height "100%"}))
(defn divider
[width theme]
+60 -94
View File
@@ -1,107 +1,73 @@
(ns quo.components.wallet.token-input.view
(:require
[clojure.string :as string]
[quo.components.buttons.button.view :as button]
[quo.components.dividers.divider-line.view :as divider-line]
[quo.components.markdown.text :as text]
[quo.components.tags.network-tags.view :as network-tag]
[quo.components.wallet.token-input.style :as style]
[quo.foundations.colors :as colors]
[quo.foundations.common :as common]
[oops.core :as oops]
[quo.foundations.resources :as resources]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[react-native.platform :as platform]
[reagent.core :as reagent]))
[clojure.string :as string]
[quo.components.buttons.button.view :as button]
[quo.components.dividers.divider-line.view :as divider-line]
[quo.components.markdown.text :as text]
[quo.components.tags.network-tags.view :as network-tag]
[quo.components.wallet.token-input.style :as style]
[quo.foundations.colors :as colors]
[quo.foundations.common :as common]
[quo.foundations.resources :as resources]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[reagent.core :as reagent]))
(defn calc-value
[crypto? currency token value conversion]
(let [num-value (if (string? value) (parse-double (or value "0")) value)]
(if crypto?
(str (get common/currency-label currency) (.toFixed (* num-value conversion) 2))
(str (.toFixed (/ num-value conversion) 2) " " (string/upper-case (or (clj->js token) ""))))))
(if crypto?
(str (get common/currency-label currency) (.toFixed (* value conversion) 2))
(str (.toFixed (/ value conversion) 2) " " (string/upper-case (clj->js token)))))
(defn- view-internal
[]
(let [width (:width (rn/get-window))
value (reagent/atom nil)
value (reagent/atom 0)
crypto? (reagent/atom true)
input-ref (atom nil)]
(fn [{:keys [theme token currency conversion networks title customization-color
on-swap container-style show-keyboard?]
:or {show-keyboard? true}
external-value :value}]
(let [number-of-chars (count (or external-value @value))
text-unit-position (+ 23
(* (if (<= number-of-chars 1)
0
(- number-of-chars 1))
15.333))]
[rn/view
{:style (merge
(style/main-container width)
container-style)}
[rn/view {:style style/amount-container}
[rn/pressable
{:on-press #(when @input-ref (.focus ^js @input-ref))
:style {:flex 1
:background-color :orange
}}
[rn/image
{:style style/token
:source (resources/get-token token)}]
[rn/view {:style {:background-color :lightblue
;;
:position :absolute
:top 0
:bottom 0
:left 40
:right 0
}}
[rn/text-input
{:ref #(reset! input-ref %)
:auto-focus true
:placeholder "0"
:placeholder-text-color (colors/theme-colors colors/neutral-40
colors/neutral-50
theme)
:default-value (or external-value @value)
:keyboard-type :numeric
:max-length 12
:on-change-text #(reset! value %)
:style (style/text-input theme)
:selection-color customization-color
:show-soft-input-on-focus show-keyboard?}]
;;
[rn/view {:style {:position :absolute
:bottom 1
:left text-unit-position}}
[text/text
{:size :paragraph-2
:weight :semi-bold
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}}
(string/upper-case (or (clj->js (if @crypto? token currency)) ""))]]]]
[button/button
{:icon true
:icon-only? true
:size 32
:on-press (fn []
(swap! crypto? not)
(when on-swap
(on-swap @crypto?)))
:type :outline
:accessibility-label :reorder}
:i/reorder]]
[divider-line/view {:container-style {:margin-vertical 8}}]
[rn/view {:style style/data-container}
[network-tag/view {:networks networks :title title}]
[text/text
{:size :paragraph-2
:weight :medium
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}}
(calc-value @crypto? currency token (or external-value @value) conversion)]]]))))
(fn [{:keys [theme token currency conversion networks title customization-color]}]
[rn/view {:style (style/main-container width)}
[rn/view {:style style/amount-container}
[rn/pressable
{:on-press #(when @input-ref (.focus ^js @input-ref))
:style {:flex-direction :row
:flex-grow 1
:align-items :flex-end}}
[rn/image
{:style style/token
:source (resources/get-token token)}]
[rn/text-input
{:ref #(reset! input-ref %)
:placeholder "0"
:placeholder-text-color (colors/theme-colors colors/neutral-40 colors/neutral-50 theme)
:keyboard-type :numeric
:max-length 12
:default-value @value
:on-change-text #(reset! value %)
:style (style/text-input theme)
:selection-color customization-color}]
[text/text
{:size :paragraph-2
:weight :semi-bold
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)
:margin-right 8
:padding-bottom 2}}
(string/upper-case (clj->js (if @crypto? token currency)))]]
[button/button
{:icon true
:icon-only? true
:size 32
:on-press #(swap! crypto? not)
:type :outline
:accessibility-label :reorder}
:i/reorder]]
[divider-line/view {:container-style {:margin-vertical 8}}]
[rn/view {:style style/data-container}
[network-tag/view {:networks networks :title title}]
[text/text
{:size :paragraph-2
:weight :medium
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}}
(calc-value @crypto? currency token @value conversion)]]])))
(def view (quo.theme/with-theme view-internal))
+2
View File
@@ -136,6 +136,7 @@
quo.components.tags.tags
quo.components.tags.tiny-tag.view
quo.components.tags.token-tag.view
quo.components.text-combinations.channel-name.view
quo.components.text-combinations.view
quo.components.wallet.account-card.view
quo.components.wallet.account-origin.view
@@ -369,6 +370,7 @@
;;;; Text combinations
(def text-combinations quo.components.text-combinations.view/view)
(def channel-name quo.components.text-combinations.channel-name.view/view)
;;;; Wallet
(def account-card quo.components.wallet.account-card.view/view)
+1
View File
@@ -75,6 +75,7 @@
[quo.components.tags.status-tags-component-spec]
[quo.components.tags.summary-tag.component-spec]
[quo.components.tags.tiny-tag.component-spec]
[quo.components.text-combinations.channel-name.component-spec]
[quo.components.wallet.account-card.component-spec]
[quo.components.wallet.account-origin.component-spec]
[quo.components.wallet.account-overview.component-spec]
+185 -8
View File
@@ -33,14 +33,191 @@
(get dapps k))
(def tokens
{:eth (js/require "../resources/images/tokens/mainnet/ETH-token.png")
:knc (js/require "../resources/images/tokens/mainnet/KNC.png")
:mana (js/require "../resources/images/tokens/mainnet/MANA.png")
:rare (js/require "../resources/images/tokens/mainnet/RARE.png")
:dai (js/require "../resources/images/tokens/mainnet/DAI.png")
:fxc (js/require "../resources/images/tokens/mainnet/FXC.png")
:usdt (js/require "../resources/images/tokens/mainnet/USDT.png")
:snt (js/require "../resources/images/tokens/mainnet/SNT.png")})
{:0-native (js/require "../resources/images/tokens/mainnet/0-native.png")
:0xbtc (js/require "../resources/images/tokens/mainnet/0XBTC.png")
:1st (js/require "../resources/images/tokens/mainnet/1ST.png")
:abt (js/require "../resources/images/tokens/mainnet/ABT.png")
:abyss (js/require "../resources/images/tokens/mainnet/ABYSS.png")
:ae (js/require "../resources/images/tokens/mainnet/AE.png")
:agld (js/require "../resources/images/tokens/mainnet/AGLD.png")
:akro (js/require "../resources/images/tokens/mainnet/AKRO.png")
:amb (js/require "../resources/images/tokens/mainnet/AMB.png")
:ampl (js/require "../resources/images/tokens/mainnet/AMPL.png")
:ant (js/require "../resources/images/tokens/mainnet/ANT.png")
:appc (js/require "../resources/images/tokens/mainnet/APPC.png")
:ast (js/require "../resources/images/tokens/mainnet/AST.png")
:atmchain (js/require "../resources/images/tokens/mainnet/ATMChain.png")
:ausdc (js/require "../resources/images/tokens/mainnet/aUSDC.png")
:bal (js/require "../resources/images/tokens/mainnet/BAL.png")
:bam (js/require "../resources/images/tokens/mainnet/BAM.png")
:band (js/require "../resources/images/tokens/mainnet/BAND.png")
:bat (js/require "../resources/images/tokens/mainnet/BAT.png")
:blt (js/require "../resources/images/tokens/mainnet/BLT.png")
:blz (js/require "../resources/images/tokens/mainnet/BLZ.png")
:bnb (js/require "../resources/images/tokens/mainnet/BNB.png")
:bnt (js/require "../resources/images/tokens/mainnet/BNT.png")
:brln (js/require "../resources/images/tokens/mainnet/BRLN.png")
:btm (js/require "../resources/images/tokens/mainnet/BTM.png")
:btu (js/require "../resources/images/tokens/mainnet/BTU.png")
:cdai (js/require "../resources/images/tokens/mainnet/cDAI.png")
:cdt (js/require "../resources/images/tokens/mainnet/CDT.png")
:centra (js/require "../resources/images/tokens/mainnet/Centra.png")
:cfi (js/require "../resources/images/tokens/mainnet/CFI.png")
:ck (js/require "../resources/images/tokens/mainnet/CK.png")
:cnd (js/require "../resources/images/tokens/mainnet/CND.png")
:cob (js/require "../resources/images/tokens/mainnet/COB.png")
:comp (js/require "../resources/images/tokens/mainnet/COMP.png")
:crv (js/require "../resources/images/tokens/mainnet/CRV.png")
:cvc (js/require "../resources/images/tokens/mainnet/CVC.png")
:dai (js/require "../resources/images/tokens/mainnet/DAI.png")
:dat (js/require "../resources/images/tokens/mainnet/DAT.png")
:data (js/require "../resources/images/tokens/mainnet/DATA.png")
:dcn (js/require "../resources/images/tokens/mainnet/DCN.png")
:dgd (js/require "../resources/images/tokens/mainnet/DGD.png")
:dgx (js/require "../resources/images/tokens/mainnet/DGX.png")
:dlt (js/require "../resources/images/tokens/mainnet/DLT.png")
:dnt (js/require "../resources/images/tokens/mainnet/DNT.png")
:dpy (js/require "../resources/images/tokens/mainnet/DPY.png")
:drt (js/require "../resources/images/tokens/mainnet/DRT.png")
:dta (js/require "../resources/images/tokens/mainnet/DTA.png")
:edg (js/require "../resources/images/tokens/mainnet/EDG.png")
:edo (js/require "../resources/images/tokens/mainnet/EDO.png")
:ekg (js/require "../resources/images/tokens/mainnet/EKG.png")
:eko (js/require "../resources/images/tokens/mainnet/EKO.png")
:elf (js/require "../resources/images/tokens/mainnet/ELF.png")
:emona (js/require "../resources/images/tokens/mainnet/EMONA.png")
:eng (js/require "../resources/images/tokens/mainnet/ENG.png")
:enj (js/require "../resources/images/tokens/mainnet/ENJ.png")
:ens (js/require "../resources/images/tokens/mainnet/ENS.png")
:eos (js/require "../resources/images/tokens/mainnet/EOS.png")
:equad (js/require "../resources/images/tokens/mainnet/EQUAD.png")
:eth (js/require "../resources/images/tokens/mainnet/ETH-token.png")
:eth2x-fli (js/require "../resources/images/tokens/mainnet/ETH2x-FLI.png")
:ethos (js/require "../resources/images/tokens/mainnet/ETHOS.png")
:evx (js/require "../resources/images/tokens/mainnet/EVX.png")
:fuel (js/require "../resources/images/tokens/mainnet/FUEL.png")
:fun (js/require "../resources/images/tokens/mainnet/FUN.png")
:fxc (js/require "../resources/images/tokens/mainnet/FXC.png")
:gdc (js/require "../resources/images/tokens/mainnet/GDC.png")
:gen (js/require "../resources/images/tokens/mainnet/GEN.png")
:glm (js/require "../resources/images/tokens/mainnet/GLM.png")
:gno (js/require "../resources/images/tokens/mainnet/GNO.png")
:gnt (js/require "../resources/images/tokens/mainnet/GNT.png")
:grid (js/require "../resources/images/tokens/mainnet/GRID.png")
:grt (js/require "../resources/images/tokens/mainnet/GRT.png")
:hez (js/require "../resources/images/tokens/mainnet/HEZ.png")
:hst (js/require "../resources/images/tokens/mainnet/HST.png")
:ht (js/require "../resources/images/tokens/mainnet/HT.png")
:icn (js/require "../resources/images/tokens/mainnet/ICN.png")
:icos (js/require "../resources/images/tokens/mainnet/ICOS.png")
:iost (js/require "../resources/images/tokens/mainnet/IOST.png")
:kdo (js/require "../resources/images/tokens/mainnet/KDO.png")
:kin (js/require "../resources/images/tokens/mainnet/KIN.png")
:knc (js/require "../resources/images/tokens/mainnet/KNC.png")
:kudos (js/require "../resources/images/tokens/mainnet/Kudos.png")
:lend (js/require "../resources/images/tokens/mainnet/LEND.png")
:link (js/require "../resources/images/tokens/mainnet/LINK.png")
:lisk (js/require "../resources/images/tokens/mainnet/LISK.png")
:loom (js/require "../resources/images/tokens/mainnet/LOOM.png")
:lpt (js/require "../resources/images/tokens/mainnet/LPT.png")
:lrc (js/require "../resources/images/tokens/mainnet/LRC.png")
:mana (js/require "../resources/images/tokens/mainnet/MANA.png")
:mco (js/require "../resources/images/tokens/mainnet/MCO.png")
:mda (js/require "../resources/images/tokens/mainnet/MDA.png")
:met (js/require "../resources/images/tokens/mainnet/MET.png")
:mfg (js/require "../resources/images/tokens/mainnet/MFG.png")
:mgo (js/require "../resources/images/tokens/mainnet/MGO.png")
:mkr (js/require "../resources/images/tokens/mainnet/MKR.png")
:mln (js/require "../resources/images/tokens/mainnet/MLN.png")
:moc (js/require "../resources/images/tokens/mainnet/MOC.png")
:mod (js/require "../resources/images/tokens/mainnet/MOD.png")
:mth (js/require "../resources/images/tokens/mainnet/MTH.png")
:mtl (js/require "../resources/images/tokens/mainnet/MTL.png")
:myb (js/require "../resources/images/tokens/mainnet/MYB.png")
:nexo (js/require "../resources/images/tokens/mainnet/NEXO.png")
:nexxo (js/require "../resources/images/tokens/mainnet/NEXXO.png")
:nmr (js/require "../resources/images/tokens/mainnet/NMR.png")
:npxs (js/require "../resources/images/tokens/mainnet/NPXS.png")
:ogn (js/require "../resources/images/tokens/mainnet/OGN.png")
:omg (js/require "../resources/images/tokens/mainnet/OMG.png")
:otn (js/require "../resources/images/tokens/mainnet/OTN.png")
:oxt (js/require "../resources/images/tokens/mainnet/OXT.png")
:pax (js/require "../resources/images/tokens/mainnet/PAX.png")
:paxg (js/require "../resources/images/tokens/mainnet/PAXG.png")
:pay (js/require "../resources/images/tokens/mainnet/PAY.png")
:pbtc (js/require "../resources/images/tokens/mainnet/PBTC.png")
:plr (js/require "../resources/images/tokens/mainnet/PLR.png")
:poe (js/require "../resources/images/tokens/mainnet/POE.png")
:poly (js/require "../resources/images/tokens/mainnet/POLY.png")
:powr (js/require "../resources/images/tokens/mainnet/POWR.png")
:ppp (js/require "../resources/images/tokens/mainnet/PPP.png")
:ppt (js/require "../resources/images/tokens/mainnet/PPT.png")
:pt (js/require "../resources/images/tokens/mainnet/PT.png")
:qkc (js/require "../resources/images/tokens/mainnet/QKC.png")
:qrl (js/require "../resources/images/tokens/mainnet/QRL.png")
:qsp (js/require "../resources/images/tokens/mainnet/QSP.png")
:r (js/require "../resources/images/tokens/mainnet/R.png")
:rae (js/require "../resources/images/tokens/mainnet/RAE.png")
:rare (js/require "../resources/images/tokens/mainnet/RARE.png")
:rcn (js/require "../resources/images/tokens/mainnet/RCN.png")
:rdn (js/require "../resources/images/tokens/mainnet/RDN.png")
:ren (js/require "../resources/images/tokens/mainnet/REN.png")
:rep (js/require "../resources/images/tokens/mainnet/REP.png")
:req (js/require "../resources/images/tokens/mainnet/REQ.png")
:rhoc (js/require "../resources/images/tokens/mainnet/RHOC.png")
:rlc (js/require "../resources/images/tokens/mainnet/RLC.png")
:rol (js/require "../resources/images/tokens/mainnet/ROL.png")
:sai (js/require "../resources/images/tokens/mainnet/SAI.png")
:salt (js/require "../resources/images/tokens/mainnet/SALT.png")
:san (js/require "../resources/images/tokens/mainnet/SAN.png")
:sngls (js/require "../resources/images/tokens/mainnet/SNGLS.png")
:snm (js/require "../resources/images/tokens/mainnet/SNM.png")
:snt (js/require "../resources/images/tokens/mainnet/SNT.png")
:snx (js/require "../resources/images/tokens/mainnet/SNX.png")
:socks (js/require "../resources/images/tokens/mainnet/SOCKS.png")
:spank (js/require "../resources/images/tokens/mainnet/SPANK.png")
:spike (js/require "../resources/images/tokens/mainnet/SPIKE.png")
:spn (js/require "../resources/images/tokens/mainnet/SPN.png")
:st (js/require "../resources/images/tokens/mainnet/ST.png")
:storj (js/require "../resources/images/tokens/mainnet/STORJ.png")
:storm (js/require "../resources/images/tokens/mainnet/STORM.png")
:strk (js/require "../resources/images/tokens/mainnet/STRK.png")
:stx (js/require "../resources/images/tokens/mainnet/STX.png")
:sub (js/require "../resources/images/tokens/mainnet/SUB.png")
:supr (js/require "../resources/images/tokens/mainnet/SUPR.png")
:susd (js/require "../resources/images/tokens/mainnet/sUSD.png")
:taas (js/require "../resources/images/tokens/mainnet/TAAS.png")
:taud (js/require "../resources/images/tokens/mainnet/TAUD.png")
:tcad (js/require "../resources/images/tokens/mainnet/TCAD.png")
:tgbp (js/require "../resources/images/tokens/mainnet/TGBP.png")
:tkn (js/require "../resources/images/tokens/mainnet/TKN.png")
:tkx (js/require "../resources/images/tokens/mainnet/TKX.png")
:tnt (js/require "../resources/images/tokens/mainnet/TNT.png")
:trst (js/require "../resources/images/tokens/mainnet/TRST.png")
:trx (js/require "../resources/images/tokens/mainnet/TRX.png")
:tusd (js/require "../resources/images/tokens/mainnet/TUSD.png")
:ubi (js/require "../resources/images/tokens/mainnet/UBI.png")
:ubt (js/require "../resources/images/tokens/mainnet/UBT.png")
:ukg (js/require "../resources/images/tokens/mainnet/UKG.png")
:uni (js/require "../resources/images/tokens/mainnet/UNI.png")
:upp (js/require "../resources/images/tokens/mainnet/UPP.png")
:usdc (js/require "../resources/images/tokens/mainnet/USDC.png")
:usds (js/require "../resources/images/tokens/mainnet/USDS.png")
:usdt (js/require "../resources/images/tokens/mainnet/USDT.png")
:veri (js/require "../resources/images/tokens/mainnet/VERI.png")
:vgx (js/require "../resources/images/tokens/mainnet/VGX.png")
:vib (js/require "../resources/images/tokens/mainnet/VIB.png")
:wabi (js/require "../resources/images/tokens/mainnet/WaBi.png")
:wbtc (js/require "../resources/images/tokens/mainnet/WBTC.png")
:weth (js/require "../resources/images/tokens/mainnet/WETH.png")
:wings (js/require "../resources/images/tokens/mainnet/WINGS.png")
:wtc (js/require "../resources/images/tokens/mainnet/WTC.png")
:xaur (js/require "../resources/images/tokens/mainnet/XAUR.png")
:xpa (js/require "../resources/images/tokens/mainnet/XPA.png")
:xrl (js/require "../resources/images/tokens/mainnet/XRL.png")
:xuc (js/require "../resources/images/tokens/mainnet/XUC.png")
:zrx (js/require "../resources/images/tokens/mainnet/ZRX.png")
:zsc (js/require "../resources/images/tokens/mainnet/ZSC.png")})
(defn get-token
[k]
+1
View File
@@ -17,6 +17,7 @@
(def view (reagent/adapt-react-class (.-View ^js react-native)))
(def scroll-view (reagent/adapt-react-class (.-ScrollView ^js react-native)))
(def safe-area-view (reagent/adapt-react-class (.-SafeAreaView ^js react-native)))
(def ^:private image-native
(reagent/adapt-react-class (.-Image ^js react-native)))
@@ -82,4 +82,7 @@
"wallet-owned-collectibles-filtering-done" {:fx [[:dispatch
[:wallet/owned-collectibles-filtering-done
event]]]}
"wallet-get-collectibles-details-done" {:fx [[:dispatch
[:wallet/get-collectible-details-done
event]]]}
(log/warn ::unknown-wallet-event :type type :event event)))
+4 -4
View File
@@ -31,8 +31,8 @@
(let [old-network-status (:network-status db)
old-network-type (:network/type db)
connectivity-status (if isConnected :online :offline)
status-changed? (= connectivity-status old-network-status)
type-changed? (= type old-network-type)]
status-changed? (not= connectivity-status old-network-status)
type-changed? (not= type old-network-type)]
(log/debug "[net-info]"
"old-network-status" old-network-status
"old-network-type" old-network-type
@@ -40,9 +40,9 @@
"type" type
"details" details)
(rf/merge cofx
(when-not status-changed?
(when status-changed?
(change-network-status isConnected))
(when-not type-changed?
(when type-changed?
(change-network-type old-network-type type (:is-connection-expensive details))))))
(defn add-net-info-listener
+2 -1
View File
@@ -74,7 +74,8 @@
:Nameserver "8.8.8.8"
:PeerExchange true
:Port 0
:UDPPort 0})
:UDPPort 0
:LightClient true})
(def login-node-config
{:WalletConfig (cond-> {:Enabled true}
+1 -1
View File
@@ -193,7 +193,7 @@
(def regx-address #"^0x[a-fA-F0-9]{40}$")
(def regx-address-contains #"(?i)0x[a-fA-F0-9]{40}")
(def regx-starts-with-uuid #"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")
(def regx-address-fragment #"^0x[a-fA-F0-9]{1,40}$")
(def regx-full-or-partial-address #"^0x[a-fA-F0-9]{1,40}$")
(def ^:const dapp-permission-contact-code "contact-code")
(def ^:const dapp-permission-web3 "web3")
@@ -8,6 +8,10 @@
[utils.re-frame :as rf]
[utils.url :as url]))
;; these constants are used when there is no width or height defined for a specific image
(def ^:const fallback-image-width 1000)
(def ^:const fallback-image-height 1000)
(defn calculate-dimensions
[width height max-container-width max-container-height]
(let [max-width (if (> width height) max-container-width (* 1.5 constants/image-size))
@@ -15,7 +19,12 @@
{:width (min width max-width) :height (min height max-height)}))
(defn image-message
[index {:keys [content image-width image-height message-id] :as message} {:keys [on-long-press]}
[index
{:keys [content image-width image-height message-id]
:as message
:or {image-width fallback-image-width
image-height fallback-image-height}}
{:keys [on-long-press]}
message-container-data]
(let [insets (safe-area/get-insets)
{:keys [window-width padding-left padding-right avatar-container-width
+43 -26
View File
@@ -151,6 +151,34 @@
(reset! filtered-data nil)
(reset! search-text ""))
(defn f-view
[{:keys [render-emojis? search-text on-change-text clear-states active-category scroll-ref theme]
:as sheet-opts}]
(let [search-active? (pos? (count @search-text))]
;; rendering emojis is heavy on the UI thread, we need to delay rendering until the navigation
;; animation completes. 250 is based on the default 300ms navigation duration.
(rn/use-effect #(js/setTimeout (fn [] (reset! render-emojis? true)) 250))
[rn/keyboard-avoiding-view
{:style style/flex-spacer
:keyboard-vertical-offset 8}
[rn/view {:style style/flex-spacer}
[rn/view {:style style/search-input-container}
[quo/input
{:small? true
:placeholder (i18n/label :t/emoji-search-placeholder)
:icon-name :i/search
:value @search-text
:on-change-text on-change-text
:clearable? search-active?
:on-clear clear-states}]]
(when @render-emojis?
[render-list sheet-opts])
(when-not search-active?
[footer
{:theme theme
:active-category active-category
:scroll-ref scroll-ref}])]]))
(defn- view-internal
[_]
(let [{:keys [on-select]} (rf/sub [:get-screen-params])
@@ -158,6 +186,7 @@
set-scroll-ref #(reset! scroll-ref %)
search-text (reagent/atom "")
filtered-data (reagent/atom nil)
render-emojis? (reagent/atom false)
active-category (reagent/atom constants/default-category)
clear-states #(clear {:active-category active-category
:filtered-data filtered-data
@@ -179,31 +208,19 @@
{:event event
:active-category active-category
:should-update-active-category? (nil? @filtered-data)}))]
(fn [{:keys [theme] :as sheet-opts}]
(let [search-active? (pos? (count @search-text))]
[rn/keyboard-avoiding-view
{:style style/flex-spacer
:keyboard-vertical-offset 8}
[rn/view {:style style/flex-spacer}
[rn/view {:style style/search-input-container}
[quo/input
{:small? true
:placeholder (i18n/label :t/emoji-search-placeholder)
:icon-name :i/search
:value @search-text
:on-change-text on-change-text
:clearable? search-active?
:on-clear clear-states}]]
[render-list
(merge {:filtered-data @filtered-data
:set-scroll-ref set-scroll-ref
:on-select on-select
:on-viewable-items-changed on-viewable-items-changed}
sheet-opts)]
(when-not search-active?
[footer
{:theme theme
:active-category active-category
:scroll-ref scroll-ref}])]]))))
(fn [sheet-opts]
[:f> f-view
(merge sheet-opts
{:render-emojis? render-emojis?
:search-text search-text
:on-change-text on-change-text
:clear-states clear-states
:filtered-data @filtered-data
:set-scroll-ref set-scroll-ref
:on-select on-select
:on-viewable-items-changed on-viewable-items-changed
:active-category active-category
:scroll-ref scroll-ref})])))
(def view (quo.theme/with-theme view-internal))
+1 -2
View File
@@ -8,8 +8,7 @@
(defn login
[]
{;; Temporary fix until https://github.com/status-im/status-go/issues/3024 is
;; resolved
{;; Temporary fix until https://github.com/status-im/status-go/issues/3024 is resolved
:wakuV2Nameserver "8.8.8.8"
:openseaAPIKey config/opensea-api-key
:poktToken config/POKT_TOKEN
@@ -158,6 +158,8 @@
[status-im2.contexts.quo-preview.tags.tags :as tags]
[status-im2.contexts.quo-preview.tags.tiny-tag :as tiny-tag]
[status-im2.contexts.quo-preview.tags.token-tag :as token-tag]
[status-im2.contexts.quo-preview.text-combinations.channel-name :as
channel-name]
[status-im2.contexts.quo-preview.text-combinations.preview :as
text-combinations]
[status-im2.contexts.quo-preview.wallet.account-card :as account-card]
@@ -445,7 +447,9 @@
{:name :token-tag
:component token-tag/view}]
:text-combinations [{:name :text-combinations
:component text-combinations/view}]
:component text-combinations/view}
{:name :channel-name
:component channel-name/view}]
:wallet [{:name :account-card :component account-card/view}
{:name :account-origin :component account-origin/view}
{:name :account-overview
@@ -1,6 +1,7 @@
(ns status-im2.contexts.quo-preview.settings.data-item
(:require
[quo.core :as quo]
[quo.foundations.resources :as quo.resources]
[reagent.core :as reagent]
[status-im2.common.resources :as resources]
[status-im2.contexts.quo-preview.preview :as preview]))
@@ -50,6 +51,7 @@
:right-icon :i/chevron-right
:emoji "🎮"
:customization-color :yellow
:network-image (quo.resources/get-network :ethereum)
:communities-list communities-list})]
(fn []
[preview/preview-container
@@ -0,0 +1,29 @@
(ns status-im2.contexts.quo-preview.text-combinations.channel-name
(:require [quo.core :as quo]
[reagent.core :as reagent]
[status-im2.contexts.quo-preview.preview :as preview]))
(def descriptor
[{:key :channel-name
:type :text}
{:key :unlocked?
:type :boolean}
{:key :muted?
:type :boolean}
{:key :blur?
:type :boolean}])
(defn view
[]
(let [state (reagent/atom {:channel-name "random"
:unlocked? true
:muted? true
:blur? false})]
(fn []
[preview/preview-container
{:state state
:descriptor descriptor
:show-blur-background? true
:blur? (:blur? @state)}
[quo/channel-name @state]])))
@@ -4,7 +4,7 @@
[quo.foundations.resources :as quo.resources]
[react-native.core :as rn]
[status-im2.contexts.wallet.account.bridge.style :as style]
[status-im2.contexts.wallet.common.sheets.account-options.view :as account-options]
[status-im2.contexts.wallet.common.account-switcher.view :as account-switcher]
[status-im2.contexts.wallet.common.temp :as temp]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@@ -18,17 +18,9 @@
(let [networks (rf/sub [:wallet/network-details])
networks-logos (map network-logo networks)]
[rn/view {:style {:flex 1}}
[quo/page-nav
{:icon-name :i/close
:on-press #(rf/dispatch [:navigate-back])
:accessibility-label :top-bar
:right-side :account-switcher
:account-switcher {:customization-color :purple
:on-press #(rf/dispatch [:show-bottom-sheet
{:content account-options/view
:gradient-cover? true
:customization-color :purple}])
:emoji "🍑"}}]
[account-switcher/view
{:on-press #(rf/dispatch [:navigate-back])
:accessibility-label :top-bar}]
[quo/text-combinations
{:container-style style/header-container
:title (i18n/label :t/bridge)}]
@@ -5,7 +5,7 @@
[reagent.core :as reagent]
[status-im2.contexts.wallet.account.style :as style]
[status-im2.contexts.wallet.account.tabs.view :as tabs]
[status-im2.contexts.wallet.common.sheets.account-options.view :as account-options]
[status-im2.contexts.wallet.common.account-switcher.view :as account-switcher]
[status-im2.contexts.wallet.common.temp :as temp]
[status-im2.contexts.wallet.common.utils :as utils]
[utils.i18n :as i18n]
@@ -32,23 +32,10 @@
[]
(let [selected-tab (reagent/atom (:id (first tabs-data)))]
(fn []
(let [{:keys [name color emoji balance]} (rf/sub [:wallet/current-viewing-account])
networks (rf/sub [:wallet/network-details])]
(let [{:keys [name color balance]} (rf/sub [:wallet/current-viewing-account])
]
[rn/view {:style {:flex 1}}
[quo/page-nav
{:type :wallet-networks
:background :blur
:icon-name :i/close
:on-press #(rf/dispatch [:wallet/close-account-page])
:networks networks
:networks-on-press #(js/alert "Pressed Networks")
:right-side :account-switcher
:account-switcher {:customization-color color
:on-press #(rf/dispatch [:show-bottom-sheet
{:content account-options/view
:gradient-cover? true
:customization-color color}])
:emoji emoji}}]
[account-switcher/view {:on-press #(rf/dispatch [:wallet/close-account-page])}]
[quo/account-overview
{:current-value (utils/prettify-balance balance)
:account-name name
@@ -4,10 +4,15 @@
{:margin-top 100
:margin-bottom 34})
(def preview
(def preview-container
{:margin-horizontal 8
:margin-top 12})
(def preview
{:width "100%"
:aspect-ratio 1
:border-radius 16})
(def header
{:margin-horizontal 20
:margin-top 16
@@ -17,6 +22,9 @@
{:flex-direction :row
:margin-top 6})
(def collection-avatar-container
{:margin-right 8})
(def buttons-container
{:flex-direction :row
:align-items :stretch
@@ -50,13 +58,13 @@
{:margin-left 6
:flex 1})
(def traits-section
{:margin-horizontal 20
:margin-top 8})
(def traits-title-container
{:margin-left 20
:margin-top 8})
(def traits-item
{:margin-horizontal 6
:flex 1})
{:margin 6
:flex 1})
(def traits-container
{:margin-horizontal 14
@@ -1,20 +1,23 @@
(ns status-im2.contexts.wallet.collectible.view
(:require
[clojure.string :as string]
[quo.core :as quo]
[quo.foundations.resources :as quo.resources]
[react-native.core :as rn]
[status-im2.common.scroll-page.view :as scroll-page]
[status-im2.contexts.wallet.collectible.style :as style]
[status-im2.contexts.wallet.common.temp :as temp]
[utils.i18n :as i18n]))
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn header
[{:keys [name description collection-image]}]
[{:keys [name description collection-image-url]}]
[rn/view {:style style/header}
[quo/text
{:weight :semi-bold
:size :heading-1} name]
[rn/view style/collection-container
[quo/collection-avatar {:image collection-image}]
[rn/view {:style style/collection-container}
[rn/view {:style style/collection-avatar-container}
[quo/collection-avatar {:image collection-image-url}]]
[quo/text
{:weight :semi-bold
:size :paragraph-1}
@@ -57,53 +60,61 @@
(defn traits-section
[traits]
[rn/view {:style style/traits-section}
[quo/section-label
{:section (i18n/label :t/traits)}]]
[rn/flat-list
{:render-fn (fn [{:keys [title subtitle]}]
[rn/view {:style style/traits-item}
[quo/data-item
{:description :default
:card? true
:status :default
:size :default
:title title
:subtitle subtitle}]])
:data traits
:key :collectibles-list
:key-fn :id
:num-columns 2
:content-container-style style/traits-container}])
(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 (fn [{:keys [trait-type value]}]
[quo/data-item
{:description :default
:card? true
:status :default
:size :default
:title trait-type
:subtitle value
:container-style style/traits-item}])
:data traits
:key :collectibles-list
:key-fn :id
:num-columns 2
:content-container-style style/traits-container}]]))
(defn info
[]
[rn/view
{:style style/info-container}
[rn/view {:style style/account}
[quo/data-item
{:description :account
:card? true
:status :default
:size :default
:title (i18n/label :t/account-title)
:subtitle "Collectibles vault"
:emoji "🎮"
:customization-color :yellow}]]
[chain-id]
(let [network (rf/sub [:wallet/network-details-by-chain-id
chain-id])
network-keyword (get network :network-name)
network-name (string/capitalize (name network-keyword))]
[rn/view
{:style style/info-container}
[rn/view {:style style/account}
[quo/data-item
{:description :account
:card? true
:status :default
:size :default
:title (i18n/label :t/account-title)
:subtitle "Collectibles vault"
:emoji "🎮"
:customization-color :yellow}]]
[rn/view {:style style/network}
[quo/data-item
{:description :network
:card? true
:status :default
:size :default
:title (i18n/label :t/network)
:subtitle (i18n/label :t/mainnet)}]]])
[rn/view {:style style/network}
[quo/data-item
{:description :network
:card? true
:status :default
:size :default
:title (i18n/label :t/network)
:network-image (quo.resources/get-network network-keyword)
:subtitle network-name}]]]))
(defn view
[]
(let [{:keys [name description image traits] :as props} temp/collectible-details]
(let [collectible-details (rf/sub [:wallet/last-collectible-details])
{:keys [name description preview-url traits id]} collectible-details
chain-id (get-in id [:contract-id :chain-id])]
[scroll-page/scroll-page
{:navigate-back? true
:height 148
@@ -112,13 +123,14 @@
:description description
:right-side [{:icon-name :i/options
:on-press #(js/alert "pressed")}]
:picture image}}
:picture preview-url}}
[rn/view {:style style/container}
[rn/image
{:source image
:style style/preview}]
[header props]
[rn/view {:style style/preview-container}
[rn/image
{:source preview-url
:style style/preview}]]
[header collectible-details]
[cta-buttons]
[tabs]
[info]
[info chain-id]
[traits-section traits]]]))
@@ -0,0 +1,22 @@
(ns status-im2.contexts.wallet.common.account-switcher.view
(:require [quo.core :as quo]
[status-im2.contexts.wallet.common.sheets.account-options.view :as account-options]
[utils.re-frame :as rf]))
(defn view
[{:keys [on-press accessibility-label] :or {accessibility-label :top-bar}}]
(let [{:keys [color emoji]} (rf/sub [:wallet/current-viewing-account])
networks (rf/sub [:wallet/network-details])]
[quo/page-nav
{:icon-name :i/close
:on-press on-press
:accessibility-label accessibility-label
:networks networks
:networks-on-press #(js/alert "Pressed Networks")
:right-side :account-switcher
:account-switcher {:customization-color color
:on-press #(rf/dispatch [:show-bottom-sheet
{:content account-options/view
:gradient-cover? true
:customization-color color}])
:emoji emoji}}]))
@@ -21,11 +21,13 @@
:style {:flex 1}
:content-container-style {:align-items :center}
:num-columns 2
:render-fn (fn [{:keys [preview-url]}]
:render-fn (fn [{:keys [preview-url id]}]
[quo/collectible
{:images [preview-url]
:on-press #(rf/dispatch
[:navigate-to
:wallet-collectible])}])}])))
:on-press (fn []
(rf/dispatch [:wallet/get-collectible-details id])
(rf/dispatch
[:navigate-to
:wallet-collectible]))}])}])))
(def view (quo.theme/with-theme view-internal))
@@ -22,9 +22,7 @@
[quo/button {:on-press #(rf/dispatch [:navigate-to :wallet-create-account])}
"Create Account"]
[quo/button {:on-press #(rf/dispatch [:navigate-to :wallet-saved-addresses])}
"Saved Addresses"]
[quo/button {:on-press #(rf/dispatch [:navigate-to :wallet-send-input-amount])}
"Send: input amount"]])
"Saved Addresses"]])
(defn wallet-overview-state
[networks]
@@ -65,56 +63,6 @@
:percentage-change "0.00"
:fiat-change "€0.00"}}])
(def collectibles
[{:image (status.resources/get-mock-image :collectible1)
:id 1}
{:image (status.resources/get-mock-image :collectible2)
:id 2}
{:image (status.resources/get-mock-image :collectible3)
:id 3}
{:image (status.resources/get-mock-image :collectible4)
:id 4}
{:image (status.resources/get-mock-image :collectible5)
:id 5}
{:image (status.resources/get-mock-image :collectible6)
:id 6}])
(def collectible-details
nil
#_{:name "#5946"
:description "Bored Ape Yacht Club"
:image (status.resources/get-mock-image :collectible-monkey)
:collection-image (status.resources/get-mock-image :bored-ape)
:traits [{:title "Background"
:subtitle "Blue"
:id 1}
{:title "Clothes"
:subtitle "Bayc T Black"
:id 2}
{:title "Eyes"
:subtitle "Sleepy"
:id 3}
{:title "Fur"
:subtitle "Black"
:id 4}
{:title "Hat"
:subtitle "Beanie"
:id 5}
{:title "Mouth"
:subtitle "Bored Pipe"
:id 6}]})
(def account-overview-state
{:current-value "€0.00"
:account-name "Account 1"
:account :default
:customization-color :blue})
(def network-names
[{:network-name :ethereum :short-name "eth"}
{:network-name :optimism :short-name "opt"}
{:network-name :arbitrum :short-name "arb1"}])
(def address "0x39cf6E0Ba4C4530735616e1Ee7ff5FbCB726fBd4")
(def data-item-state
@@ -29,7 +29,7 @@
(/ n (Math/pow 10 (utils.number/parse-int decimals)))
0))
(defn- total-token-value-in-all-chains
(defn total-token-value-in-all-chains
[{:keys [balances-per-chain decimals]}]
(->> balances-per-chain
(vals)
@@ -43,3 +43,12 @@
(* (total-token-value-in-all-chains token)
(-> token :market-values-per-currency :usd :price))))
(reduce +)))
(defn network-list
[{:keys [balances-per-chain]} networks]
(into #{}
(mapv (fn [chain-id]
(first (filter #(or (= (:chain-id %) chain-id)
(= (:related-chain-id %) chain-id))
networks)))
(keys balances-per-chain))))
@@ -223,6 +223,14 @@
(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)})
(rf/reg-event-fx :wallet/store-last-collectible-details store-last-collectible-details)
(rf/reg-event-fx
:wallet/request-collectibles
(fn [{:keys [db]} [{:keys [start-at-index new-request?]}]]
@@ -259,6 +267,32 @@
[:wallet/request-collectibles
{:start-at-index start-at-index}]])]})))
(rf/reg-event-fx :wallet/get-collectible-details
(fn [_ [collectible-id]]
(let [request-id 0
collectible-id-converted (cske/transform-keys csk/->PascalCaseKeyword collectible-id)
request-params [request-id [collectible-id-converted]]]
{:json-rpc/call [{:method "wallet_getCollectiblesDetailsAsync"
:params request-params
:on-error (fn [error]
(log/error "failed to request collectible"
{:event :wallet/get-collectible-details
:error error
:params request-params}))}]})))
(rf/reg-event-fx :wallet/get-collectible-details-done
(fn [_ [{:keys [message]}]]
(let [response (cske/transform-keys csk/->kebab-case-keyword
(types/json->clj message))
{:keys [collectibles]} response
collectible (first collectibles)]
(if 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/fetch-address-suggestions
(fn [{:keys [db]} [address]]
{:db (assoc db
@@ -52,3 +52,14 @@
effects (events/clear-stored-collectibles {:db db})
result-db (:db effects)]
(is (= result-db expected-db))))))
(deftest store-last-collectible-details
(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 (= result-db expected-db)))))
@@ -30,9 +30,7 @@
(defn- new-account-card-data
[]
{:customization-color (rf/sub [:profile/customization-color])
:on-press #(rf/dispatch [:navigate-to :wallet-send-input-amount
] ;[:show-bottom-sheet {:content new-account}]
)
:on-press #(rf/dispatch [:show-bottom-sheet {:content new-account}])
:type :add-account})
(def tabs-data
@@ -1,80 +0,0 @@
(ns status-im2.contexts.wallet.send.input-amount.component-spec
(:require
[re-frame.core :as re-frame]
[status-im2.contexts.wallet.send.input-amount.view :as input-amount]
[test-helpers.component :as h]))
(defn setup-subs
[subscriptions]
(doseq [keyval subscriptions]
(re-frame/reg-sub
(key keyval)
(fn [_] (val keyval)))))
(def sub-mocks
{:profile/profile {:currency :usd}
:wallet/network-details [{:source 525
:short-name "eth"
:network-name :ethereum
:chain-id 1
:related-chain-id 5}]})
(h/describe "Send > input amount screen"
(h/test "Default render"
(setup-subs sub-mocks)
(h/render [input-amount/view {}])
(h/is-truthy (h/get-by-text "0"))
(h/is-truthy (h/get-by-text "ETH"))
(h/is-truthy (h/get-by-text "$0.00"))
(h/is-disabled (h/get-by-label-text :button-one)))
(h/test "Fill token input and confirm"
(setup-subs sub-mocks)
(let [on-confirm (h/mock-fn)]
(h/render [input-amount/view {:on-confirm on-confirm}])
(h/fire-event :press (h/query-by-label-text :keyboard-key-1))
(h/fire-event :press (h/query-by-label-text :keyboard-key-2))
(h/fire-event :press (h/query-by-label-text :keyboard-key-3))
(h/fire-event :press (h/query-by-label-text :keyboard-key-.))
(h/fire-event :press (h/query-by-label-text :keyboard-key-4))
(h/fire-event :press (h/query-by-label-text :keyboard-key-5))
(h/wait-for #(h/is-truthy (h/get-by-text "$1234.50")))
(h/is-truthy (h/get-by-label-text :button-one))
(h/fire-event :press (h/get-by-label-text :button-one))
(h/was-called on-confirm)))
(h/test "Try to fill more than limit"
(setup-subs sub-mocks)
(h/render [input-amount/view {}])
(h/fire-event :press (h/query-by-label-text :keyboard-key-2))
(h/fire-event :press (h/query-by-label-text :keyboard-key-9))
(h/fire-event :press (h/query-by-label-text :keyboard-key-5))
(h/wait-for #(h/is-truthy (h/get-by-text "$290.00")))
(h/fire-event :press (h/query-by-label-text :keyboard-key-backspace))
(h/fire-event :press (h/query-by-label-text :keyboard-key-8))
(h/fire-event :press (h/query-by-label-text :keyboard-key-5))
(h/wait-for #(h/is-truthy (h/get-by-text "$2850.00"))))
(h/test "Switch from crypto to fiat and check limit"
(setup-subs sub-mocks)
(h/render [input-amount/view {}])
(h/fire-event :press (h/query-by-label-text :keyboard-key-2))
(h/fire-event :press (h/query-by-label-text :keyboard-key-0))
(h/wait-for #(h/is-truthy (h/get-by-text "$200.00")))
(h/fire-event :press (h/query-by-label-text :reorder))
(h/wait-for #(h/is-truthy (h/get-by-text "2.00 ETH")))
(h/fire-event :press (h/query-by-label-text :keyboard-key-5))
(h/fire-event :press (h/query-by-label-text :keyboard-key-5))
(h/wait-for #(h/is-truthy (h/get-by-text "205.50 ETH")))
(h/fire-event :press (h/query-by-label-text :keyboard-key-5))
(h/wait-for #(h/is-truthy (h/get-by-text "205.50 ETH")))))
@@ -1,8 +0,0 @@
(ns status-im2.contexts.wallet.send.input-amount.style)
(def screen
{:flex 1})
(def input-container
{:padding-top 12
:padding-bottom 0})
@@ -1,93 +0,0 @@
(ns status-im2.contexts.wallet.send.input-amount.view
(:require
[clojure.string :as string]
[quo.core :as quo]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im2.contexts.wallet.send.input-amount.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn- make-limit-label
[{:keys [amount currency]}]
(str amount " " (string/upper-case (name currency))))
(defn- make-new-input
[current v]
(let [dot "."
max-length 12
length-owerflow? (>= (count current) max-length)
ignore-extra-dot? (and (= v dot) (string/includes? current dot))
ignore-value? (or
ignore-extra-dot?
length-owerflow?)]
(if ignore-value?
current
(str current v))))
(defn- view-internal
[_]
(let [token :eth
{:keys [currency]} (rf/sub [:profile/profile])
networks (rf/sub [:wallet/network-details])
conversion-rate 10
limit-crypto 100000000
limit-fiat (* limit-crypto conversion-rate)
input-value (reagent/atom "")
current-limit (reagent/atom {:amount limit-crypto
:currency token})
handle-swap (fn [crypto?]
(let [num-value (parse-double @input-value)]
(reset! current-limit (if crypto?
{:amount limit-crypto
:currency token}
{:amount limit-fiat
:currency currency}))
(when (> num-value (:amount @current-limit))
(reset! input-value ""))))
handle-keyboard-press (fn [v]
(let [current-value @input-value
new-value (make-new-input current-value v)
num-value (parse-double new-value)]
(when (<= num-value (:amount @current-limit))
(reset! input-value new-value))))
handle-delete (fn [_]
(swap! input-value #(subs % 0 (dec (count %)))))]
(fn [{:keys [on-confirm]
:or {on-confirm #(js/alert "Confirmed")}}]
(let [limit-label (make-limit-label @current-limit)]
[rn/view
{:style style/screen}
[quo/page-nav
{:background :blur
:icon-name :i/arrow-left
:on-press #(rf/dispatch [:navigate-back])
:right-side :account-switcher
:account-switcher {:customization-color :yellow
:emoji "🎮"
:on-press #(js/alert "Switch account")}}]
[quo/token-input
{:container-style style/input-container
:token token
:currency currency
:networks networks
:title (i18n/label :t/send-limit {:limit limit-label})
:conversion conversion-rate
:show-keyboard? false
:value @input-value
:on-swap handle-swap}]
;; Network routing content to be added
[rn/scroll-view]
[quo/bottom-actions
{:actions :1-action
:button-one-label (i18n/label :t/confirm)
:button-one-props {:disabled? (empty? @input-value)
:on-press on-confirm}}]
[quo/numbered-keyboard
{:left-action :dot
:delete-key? true
:on-press handle-keyboard-press
:on-delete handle-delete}]]))))
(def view (quo.theme/with-theme view-internal))
@@ -7,6 +7,7 @@
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im2.constants :as constants]
[status-im2.contexts.wallet.common.account-switcher.view :as account-switcher]
[status-im2.contexts.wallet.item-types :as types]
[status-im2.contexts.wallet.send.select-address.style :as style]
[utils.debounce :as debounce]
@@ -50,7 +51,10 @@
send-address (rf/sub [:wallet/send-address])
valid-ens-or-address? (rf/sub [:wallet/valid-ens-or-address?])]
[quo/address-input
{:on-focus #(reset! input-focused? true)
{:on-focus (fn []
(when (empty? @input-value)
(rf/dispatch [:wallet/clean-local-suggestions]))
(reset! input-focused? true))
:on-blur #(reset! input-focused? false)
:on-scan (fn []
(rn/dismiss-keyboard!)
@@ -66,7 +70,7 @@
300)
:on-change-text (fn [text]
(let [starts-like-eth-address (re-matches
constants/regx-address-fragment
constants/regx-full-or-partial-address
text)]
(when-not (= scanned-address text)
(rf/dispatch [:wallet/clean-scanned-address]))
@@ -86,8 +90,8 @@
^{:key (str network)}
[quo/text
{:size :paragraph-2
:style {:color (colors/resolve-color network theme)}}
(str (subs (name network) 0 3) ":")])
:style {:color (colors/resolve-color (:network-name network) theme)}}
(str (:short-name network) ":")])
networks)
[quo/text
{:size :paragraph-2
@@ -130,29 +134,20 @@
[]
(let [margin-top (safe-area/get-top)
selected-tab (reagent/atom (:id (first tabs-data)))
on-close #(rf/dispatch [:navigate-back])
on-close (fn []
(rf/dispatch [:wallet/clean-scanned-address])
(rf/dispatch [:wallet/clean-local-suggestions])
(rf/dispatch [:navigate-back]))
on-change-tab #(reset! selected-tab %)
input-value (reagent/atom "")
input-focused? (reagent/atom false)]
(fn []
(let [valid-ens-or-address? (boolean (rf/sub [:wallet/valid-ens-or-address?]))]
(rn/use-effect (fn []
(fn []
(rf/dispatch [:wallet/clean-scanned-address])
(rf/dispatch [:wallet/clean-local-suggestions]))))
[rn/scroll-view
{:content-container-style (style/container margin-top)
:keyboard-should-persist-taps :handled
:scroll-enabled false}
[quo/page-nav
{:icon-name :i/close
:on-press on-close
:accessibility-label :top-bar
:right-side :account-switcher
:account-switcher {:customization-color :purple
:on-press #(js/alert "Not implemented yet")
:state :default
:emoji "🍑"}}]
[account-switcher/view {:on-press on-close}]
[quo/text-combinations
{:title (i18n/label :t/send-to)
:container-style style/title-container
@@ -173,7 +168,10 @@
:type :primary
:disabled? (not valid-ens-or-address?)
:container-style style/button
:on-press #(js/alert "Not implemented yet")}
:on-press (fn []
(rf/dispatch [:wallet/select-send-address @input-value])
(rf/dispatch [:navigate-to-within-stack
[:wallet-select-asset :wallet-select-address]]))}
(i18n/label :t/continue)])]
[:<>
[quo/tabs
@@ -0,0 +1,21 @@
(ns status-im2.contexts.wallet.send.select-asset.style
(:require [react-native.navigation :as navigation]
[react-native.platform :as platform]))
(def container
{:flex 1
:padding-top (when platform/android? (navigation/status-bar-height))})
(def title-container
{:margin-horizontal 20
:margin-vertical 12})
(defn empty-container-style
[margin-bottom]
{:justify-content :center
:flex 1
:margin-bottom margin-bottom})
(def search-input-container
{:padding-horizontal 20
:padding-vertical 8})
@@ -0,0 +1,108 @@
(ns status-im2.contexts.wallet.send.select-asset.view
(:require
[clojure.string :as string]
[quo.core :as quo]
[quo.foundations.resources :as quo.resources]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im2.contexts.wallet.send.select-asset.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(def tabs-data
[{:id :tab/assets :label (i18n/label :t/assets) :accessibility-label :assets-tab}
{:id :tab/collectibles :label (i18n/label :t/collectibles) :accessibility-label :collectibles-tab}])
(defn- asset-component
[]
(fn [token _ _ _]
(let [on-press #(js/alert "Not implemented yet")
total-balance-formatted (.toFixed (:total-balance token) 2)
balance-fiat-formatted (.toFixed (:total-balance-fiat token) 2)
currency-symbol "$"]
[quo/token-network
{:token (quo.resources/get-token (keyword (string/lower-case (:symbol token))))
:label (:name token)
:token-value (str total-balance-formatted " " (:symbol token))
:fiat-value (str currency-symbol balance-fiat-formatted)
:networks (:networks token)
:on-press on-press}])))
(defn- asset-list
[search-text]
(let [filtered-tokens (rf/sub [:wallet/tokens-filtered search-text])]
[rn/flat-list
{:data filtered-tokens
:style {:flex 1}
:content-container-style {:padding-horizontal 8}
:keyboard-should-persist-taps :handled
:key-fn :id
:on-scroll-to-index-failed identity
:render-fn asset-component}]))
(defn- tab-view
[search-text selected-tab]
(case selected-tab
:tab/assets [asset-list search-text]
:tab/collectibles [quo/empty-state
{:title (i18n/label :t/no-collectibles)
:description (i18n/label :t/no-collectibles-description)
:placeholder? true
:container-style (style/empty-container-style (safe-area/get-top))}]))
(defn- search-input
[search-text]
(let [on-change-text #(reset! search-text %)]
(fn []
[rn/view {:style style/search-input-container}
[quo/input
{:small? true
:placeholder (i18n/label :t/search-assets)
:icon-name :i/search
:value @search-text
:on-change-text on-change-text}]])))
(defn- f-view-internal
[]
(let [selected-tab (reagent/atom (:id (first tabs-data)))
search-text (reagent/atom "")
on-close #(rf/dispatch [:navigate-back-within-stack
:wallet-select-asset])]
(fn []
[rn/safe-area-view {:style style/container}
[rn/scroll-view
{:content-container-style {:flex 1}
:keyboard-should-persist-taps :handled
:scroll-enabled false}
[quo/page-nav
{:icon-name :i/arrow-left
:on-press on-close
:accessibility-label :top-bar
:right-side :account-switcher
:account-switcher {:customization-color :purple
:on-press #(js/alert "Not implemented yet")
:state :default
:emoji "🍑"}}]
[quo/text-combinations
{:title (i18n/label :t/select-asset)
:container-style style/title-container
:title-accessibility-label :title-label}]
[quo/segmented-control
{:size 32
:blur? false
:symbol false
:default-active :tab/assets
:container-style {:margin-horizontal 20
:margin-vertical 8}
:data tabs-data
:on-change #(reset! selected-tab %)}]
[search-input search-text]
[tab-view @search-text @selected-tab]]])))
(defn- view-internal
[]
[:f> f-view-internal])
(def view (quo.theme/with-theme view-internal))
+21 -8
View File
@@ -4,17 +4,24 @@
[status-im2.contexts.wallet.item-types :as types]))
(def ens-local-suggestion-saved-address-mock
{:type types/saved-address
:name "Pedro"
:ens "pedro.eth"
:address "0x4732894732894738294783294723894723984"
:networks [:ethereum :optimism]})
{:type types/saved-address
:name "Pedro"
:ens "pedro.eth"
:address "0x4732894732894738294783294723894723984"
:customization-color :purple
:networks [{:network-name :ethereum
:short-name "eth"}
{:network-name :optimism
:short-name "opt"}]})
(def ens-local-suggestion-mock
{:type types/address
:ens "pedro.eth"
:address "0x4732894732894738294783294723894723984"
:networks [:ethereum :optimism]})
:networks [{:network-name :ethereum
:short-name "eth"}
{:network-name :optimism
:short-name "opt"}]})
(def address-local-suggestion-saved-contact-address-mock
{:type types/saved-contact-address
@@ -32,12 +39,18 @@
:name "Peter Lamborginski"
:address "0x12FaBc34De56Ef78A9B0Cd12Ef3456AbC7D8E9F0"
:customization-color :magenta
:networks [:ethereum :optimism]})
:networks [{:network-name :ethereum
:short-name "eth"}
{:network-name :optimism
:short-name "opt"}]})
(def address-local-suggestion-mock
{:type types/address
:address "0x1233cD34De56Ef78A9B0Cd12Ef3456AbC7123dee"
:networks [:ethereum :optimism]})
:networks [{:network-name :ethereum
:short-name "eth"}
{:network-name :optimism
:short-name "opt"}]})
(defn find-matching-addresses
[substring]
+1 -2
View File
@@ -4,5 +4,4 @@
[status-im2.contexts.chat.messages.content.audio.component-spec]
[status-im2.contexts.communities.actions.community-options.component-spec]
[status-im2.contexts.wallet.add-address-to-watch.component-spec]
[status-im2.contexts.wallet.create-account.edit-derivation-path.component-spec]
[status-im2.contexts.wallet.send.input-amount.component-spec]))
[status-im2.contexts.wallet.create-account.edit-derivation-path.component-spec]))
@@ -69,11 +69,11 @@
(deftest add-contact-test
(h/log-headline :add-contact-test)
(let
[compressed-key "zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gA"
public-key (str "0x048a6773339d11ccf5fd81677b7e54daeec544a1287"
"bd92b725047ad6faa9a9b9f8ea86ed5a226d2a994f5f4"
"6d0b43321fd8de7b7997a166e67905c8c73cd37cea")
primary-name "zQ3...9cX9gA"]
[compressed-key "zQ3shMwgSMKHVznoowceZMxWde9HUnkQEVSGvvex8UFpFNErL"
public-key (str "0x0407e9dc435fe366cb0b4c4f35cbd925438c0f46fe0"
"ed2a86050325bc8856e26898c17e31dee2602b9429c91"
"ecf65a41d62ac1f2f0823c0710dcb536e79af2763c")
primary-name "zQ3...pFNErL"]
(rf-test/run-test-async
(h/with-app-initialized
(h/with-account
+6 -7
View File
@@ -49,8 +49,8 @@
[status-im2.contexts.wallet.edit-account.view :as wallet-edit-account]
[status-im2.contexts.wallet.saved-addresses.view :as wallet-saved-addresses]
[status-im2.contexts.wallet.scan-account.view :as scan-address]
[status-im2.contexts.wallet.send.input-amount.view :as wallet-send-input-amount]
[status-im2.contexts.wallet.send.select-address.view :as wallet-select-address]
[status-im2.contexts.wallet.send.select-asset.view :as wallet-select-asset]
[status-im2.navigation.options :as options]
[status-im2.navigation.transitions :as transitions]))
@@ -278,7 +278,7 @@
:component wallet-collectible/view}
{:name :wallet-select-keypair
:options {:insets {:top? true}}
:options {:insets {:top? true :bottom? true}}
:component wallet-select-keypair/view}
{:name :wallet-create-account
@@ -288,15 +288,14 @@
{:name :wallet-saved-addresses
:component wallet-saved-addresses/view}
{:name :wallet-send-input-amount
:options {:modalPresentationStyle :overCurrentContext
:insets {:top? true}}
:component wallet-send-input-amount/view}
{:name :wallet-select-address
:options {:modalPresentationStyle :overCurrentContext}
:component wallet-select-address/view}
{:name :wallet-select-asset
:options {:insets {:top? true}}
:component wallet-select-asset/view}
{:name :scan-address
:options (merge
options/dark-screen
@@ -18,3 +18,9 @@
(assoc collectible :preview-url (preview-url collectible)))
(:collectibles wallet))))
(re-frame/reg-sub
:wallet/last-collectible-details
:<- [:wallet]
(fn [wallet]
(let [last-collectible (:last-collectible-details wallet)]
(assoc last-collectible :preview-url (preview-url last-collectible)))))
+6
View File
@@ -41,3 +41,9 @@
:chain-id chain-id
:related-chain-id related-chain-id)))
networks)))
(re-frame/reg-sub
:wallet/network-details-by-chain-id
:<- [:wallet/network-details]
(fn [networks [_ chain-id]]
(some #(when (= chain-id (:chain-id %)) %) networks)))
+25 -1
View File
@@ -1,5 +1,6 @@
(ns status-im2.subs.wallet.wallet
(:require [re-frame.core :as rf]
(:require [clojure.string :as string]
[re-frame.core :as rf]
[status-im2.contexts.wallet.common.utils :as utils]
[utils.number]))
@@ -59,3 +60,26 @@
(-> wallet
(get-in [:accounts current-viewing-account-address])
(assoc :balance (get balances current-viewing-account-address)))))
(rf/reg-sub
:wallet/tokens-filtered
:<- [:wallet/current-viewing-account]
:<- [:wallet/network-details]
(fn [[account networks] [_ query]]
(let [tokens (map (fn [token]
(assoc token
:networks (utils/network-list token networks)
:total-balance (utils/total-token-value-in-all-chains token)
:total-balance-fiat (utils/calculate-balance token)))
(:tokens account))
sorted-tokens
(sort-by :name compare tokens)
filtered-tokens
(filter #(or (string/starts-with? (string/lower-case (:name %))
(string/lower-case query))
(string/starts-with? (string/lower-case (:symbol %))
(string/lower-case query)))
sorted-tokens)]
(println filtered-tokens "3421342342432")
filtered-tokens)))
+3 -3
View File
@@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "v0.171.11",
"commit-sha1": "8a4c2d8d2f17117aa0a00338e83b0f753ebf1328",
"src-sha256": "160qnl9dsl1ypvqg9w6z8wps4fvgq3qxi16piymhrlzgssdwkz8h"
"version": "fix/community-offline-updates",
"commit-sha1": "49d0e9465b423e15e1139898de19df626a5cf62d",
"src-sha256": "1dgg0jjv54i2270j790m2n89hxdrrzpcnxmf8frif6jr4jk6bf0n"
}
+14 -8
View File
@@ -1,15 +1,15 @@
import os
import re
import signal
import requests
import time
from contextlib import contextmanager
from dataclasses import dataclass
from datetime import datetime
from http.client import RemoteDisconnected
from os import environ
from time import sleep
import pytest
import requests
from _pytest.runner import runtestprotocol
from requests.exceptions import ConnectionError as c_er
@@ -169,31 +169,36 @@ def _upload_time_limit(seconds):
signal.signal(signal.SIGALRM, signal_handler)
signal.alarm(seconds)
try:
start_time = time.time()
yield
print("Apk upload took %s seconds" % round(time.time() - start_time))
finally:
signal.alarm(0)
class UploadApkException(Exception):
pass
def _upload_and_check_response(apk_file_path):
with _upload_time_limit(600):
with open(apk_file_path, 'rb') as f:
resp = sauce.storage._session.request('post', '/v1/storage/upload', files={'payload': f})
with _upload_time_limit(1000):
resp = sauce.storage.upload(apk_file_path)
try:
if resp['item']['name'] != test_suite_data.apk_name:
if resp.name != test_suite_data.apk_name:
raise UploadApkException("Incorrect apk was uploaded to Sauce storage, response:\n%s" % resp)
except KeyError:
except AttributeError:
raise UploadApkException("Error when uploading apk to Sauce storage, response:\n%s" % resp)
def _upload_and_check_response_with_retries(apk_file_path, retries=3):
for _ in range(retries):
try:
_upload_and_check_response(apk_file_path)
break
except (ConnectionError, RemoteDisconnected):
sleep(10)
time.sleep(10)
def _download_apk(url):
# Absolute path adde to handle CI runs.
@@ -212,6 +217,7 @@ def _download_apk(url):
return apk_path
def pytest_configure(config):
global option
option = config.option
@@ -155,17 +155,18 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.chat_2.set_reaction(url_message)
try:
self.chat_1.chat_element_by_text(url_message).emojis_below_message().wait_for_element_text(1)
except Failed:
except (Failed, NoSuchElementException):
self.errors.append("Link message reaction is not shown for the sender")
self.home_2.just_fyi("Check 'Open in Status' option")
url_to_open = 'http://status.app'
# url_to_open = 'http://status.app'
url_to_open = 'https://www.ethereum.org/en/run-a-node/'
self.chat_1.send_message(url_to_open)
chat_element = self.chat_2.chat_element_by_text(url_to_open)
if chat_element.is_element_displayed(120):
chat_element.click_on_link_inside_message_body()
web_view = self.chat_2.open_in_status_button.click()
if not web_view.element_by_text('Make the jump to web3').is_element_displayed(60):
if not web_view.element_by_text("Take full control. Run your own node.").is_element_displayed(60):
self.errors.append('URL was not opened from 1-1 chat')
else:
self.errors.append("Message with URL was not received")
@@ -515,7 +516,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="new_seven_2")
@pytest.mark.xdist_group(name="new_six_2")
@marks.new_ui_critical
class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase):
+5 -2
View File
@@ -423,8 +423,11 @@ class HomeView(BaseView):
chat = self.get_chat_view()
self.start_a_new_chat_bottom_sheet_button.click()
for user_name in user_names_to_add:
chat.get_username_checkbox(user_name).click_until_presence_of_element(
chat.get_username_checkbox(user_name, state_on=True))
check_box = chat.get_username_checkbox(user_name)
if not check_box.is_element_displayed():
raise NoSuchElementException(
"User with the name '%s' is not in contacts list so can't create a group chat" % user_name)
check_box.click_until_presence_of_element(chat.get_username_checkbox(user_name, state_on=True))
self.setup_chat_button.click()
chat.chat_name_editbox.send_keys(group_chat_name)
chat.create_button.click()
+1 -1
View File
@@ -2391,6 +2391,6 @@
"address-already-in-use": "Address already being used",
"address-copied": "Address copied",
"no-dapps-description": "We want dApps!",
"send-limit": "Max: {{limit}}"
"select-asset": "Select asset"
}