Compare commits

..
Author SHA1 Message Date
Ibrahem Khalil 59553362d1 Merge branch 'develop' into 17116 2023-12-04 15:19:39 +02:00
Mohamed Javid 56d135f1f8 Implemented Wallet - Account Switcher (#18003)
This commit:

- Implements the Wallet Account Switcher for easy switching between wallet accounts
- Updates the About tab in the accounts screen to display the correct account address and derivation path along with the profile.
- Updates the account-item component to pass the state from the parent and refactors the depreciated color functions
- Moves the handle-bar in the bottom sheet to a standalone component 
- Adds customization-color in account-origin component

---------

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2023-12-04 18:47:03 +05:30
Mohsen a7178a4950 [#17572] fix: 'Join Community' notification is not getting dismissed (#17834) 2023-12-04 15:24:06 +03:00
Siddarth Kumar 3cd302b271 fix: get rid of :redef-in-file warning (#18053) 2023-12-04 14:18:43 +05:30
yqrashawn 1e797273b6 fix: change system time backward break image server (#17989) 2023-12-04 16:12:50 +08:00
Ibrkhalil 2f1ee972c2 Better syntax 2023-12-03 16:27:11 +02:00
Ibrkhalil 3b3743d7a7 Handle uniqueness 2023-12-03 16:26:00 +02:00
Ibrkhalil 3a1737b65e Bump go 2023-12-03 16:01:14 +02:00
Ibrkhalil 2b78d323dc clean 2023-12-03 15:45:45 +02:00
Ibrkhalil 79ee136826 Cater for sending community URL 2023-12-03 15:43:43 +02:00
Ibrkhalil bf3886ea18 Bump go 2023-12-03 13:04:54 +02:00
Ibrkhalil ff1068b53b Lint 2023-12-03 12:16:21 +02:00
Ibrahem Khalil 622df31a12 Change default value for loading? 2023-12-02 19:01:45 +02:00
Ibrahem Khalil ab8f65e6fa Merge branch 'develop' into 17116 2023-12-02 18:49:33 +02:00
Ibrkhalil 9674142fdc Bump go 2023-12-02 18:39:09 +02:00
Ibrkhalil e18ca22ff7 Add component 2023-12-02 18:37:24 +02:00
Ibrkhalil 31c226fcba Bump go and update endpoint 2023-12-02 11:17:50 +02:00
Ibrkhalil 292e3b7167 Bump go 2023-12-02 10:18:52 +02:00
Ibrkhalil 4c818ebaa6 Bump go 2023-12-02 10:15:07 +02:00
frank 8ff67bf344 fix: Cannot mark as read messages in communities (#18029)
* fix: Cannot mark as read messages in communities

* rename messenger-response to _messenger-response
2023-12-02 09:05:21 +08:00
Ulises Manuel 3fee21c73a [#17923] text combinations - standard title component (#17939)
* Simplify tag components by turning them to from-1

* Add standard-title component, preview screen and tests
2023-12-01 15:49:49 -06:00
Ibrkhalil a83fa4df87 Improvements 2023-11-29 22:20:00 +02:00
Ibrkhalil 3782cd5808 clean 2023-11-29 21:57:59 +02:00
Ibrkhalil d1b094f986 Bump go 2023-11-29 21:57:00 +02:00
Ibrahem Khalil 6a8f061627 Merge branch 'develop' into 17116 2023-11-26 14:18:58 +02:00
Ibrkhalil eef9f45834 Add community invitation type 2023-11-26 14:18:16 +02:00
Ibrahem Khalil 865659552d Merge branch 'develop' into 17116 2023-11-21 19:52:22 +02:00
ibrkhalil 656e545957 Bump status-go 2023-11-21 19:48:06 +02:00
Ibrahem f9979a14c2 Test 2023-08-28 16:49:06 +03:00
69 changed files with 1160 additions and 1109 deletions
@@ -0,0 +1,17 @@
(ns quo.components.ios.drawer-bar.style
(:require
[quo.foundations.colors :as colors]
[quo.theme :as theme]))
(def handle-container
{:padding-vertical 8
:height 20
:align-items :center})
(defn handle
[{:keys [theme]}]
{:width 32
:height 4
:background-color (colors/theme-colors colors/neutral-100 colors/white theme)
:opacity (theme/theme-value 0.05 0.1 theme)
:border-radius 100})
@@ -0,0 +1,12 @@
(ns quo.components.ios.drawer-bar.view
(:require
[quo.components.ios.drawer-bar.style :as style]
[quo.theme :as quo.theme]
[react-native.core :as rn]))
(defn- view-internal
[props]
[rn/view {:style style/handle-container}
[rn/view {:style (style/handle props)}]])
(def view (quo.theme/with-theme view-internal))
@@ -13,7 +13,7 @@
(h/render [account/view])
(h/fire-event :on-press-in (h/get-by-label-text :container))
(h/wait-for #(h/has-style (h/query-by-label-text :container)
{:backgroundColor (colors/custom-color :blue 50 5)})))
{:backgroundColor (colors/resolve-color :blue :light 5)})))
(h/test "on-press-in changes state to :pressed with blur? enabled"
(h/render [account/view {:blur? true}])
@@ -21,31 +21,26 @@
(h/wait-for #(h/has-style (h/query-by-label-text :container)
{:backgroundColor colors/white-opa-5})))
(h/test "on-press-out changes state to :active"
(h/render [account/view])
(h/fire-event :on-press-in (h/get-by-label-text :container))
(h/fire-event :on-press-out (h/get-by-label-text :container))
(h/wait-for #(h/has-style (h/query-by-label-text :container)
{:backgroundColor (colors/custom-color :blue 50 10)})))
(h/test "render with state :active"
(h/render [account/view {:state :active}])
(h/has-style (h/query-by-label-text :container)
{:backgroundColor (colors/resolve-color :blue :light 10)}))
(h/test "on-press-out changes state to :active with blur? enabled"
(h/render [account/view {:blur? true}])
(h/fire-event :on-press-in (h/get-by-label-text :container))
(h/fire-event :on-press-out (h/get-by-label-text :container))
(h/wait-for #(h/has-style (h/query-by-label-text :container)
{:backgroundColor colors/white-opa-10})))
(h/test "render with state :active and blur? enabled"
(h/render [account/view
{:blur? true
:state :active}])
(h/has-style (h/query-by-label-text :container)
{:backgroundColor colors/white-opa-10}))
(h/test "on-press-out changes state to :selected"
(h/render [account/view {:selectable? true}])
(h/fire-event :on-press-in (h/get-by-label-text :container))
(h/fire-event :on-press-out (h/get-by-label-text :container))
(h/wait-for #(h/is-truthy (h/query-by-label-text :check-icon))))
(h/test "render with state :selected"
(h/render [account/view {:state :selected}])
(h/is-truthy (h/query-by-label-text :check-icon)))
(h/test "on-press-out calls on-press"
(h/test "calls on-press"
(let [on-press (h/mock-fn)]
(h/render [account/view {:on-press on-press}])
(h/fire-event :on-press-in (h/get-by-label-text :container))
(h/fire-event :on-press-out (h/get-by-label-text :container))
(h/fire-event :on-press (h/get-by-label-text :container))
(h/was-called on-press)))
(h/test "renders token props if type :tag"
@@ -3,12 +3,12 @@
[quo.foundations.colors :as colors]))
(defn- background-color
[{:keys [state blur? customization-color]}]
(cond (or (= state :pressed) (= state :selected))
(if blur? colors/white-opa-5 (colors/custom-color customization-color 50 5))
[{:keys [state pressed? blur? customization-color]}]
(cond (or pressed? (= state :selected))
(if blur? colors/white-opa-5 (colors/resolve-color customization-color :light 5))
(= state :active)
(if blur? colors/white-opa-10 (colors/custom-color customization-color 50 10))
(and (= state :pressed) blur?) colors/white-opa-10
(if blur? colors/white-opa-10 (colors/resolve-color customization-color :light 10))
(and pressed? blur?) colors/white-opa-10
:else :transparent))
(defn container
+35 -55
View File
@@ -94,62 +94,42 @@
[icon/icon :i/check
{:color (if blur?
colors/white
(colors/theme-colors (colors/custom-color customization-color 50)
(colors/custom-color customization-color 60)
theme))}]])
(defn- f-internal-view
[]
(let [state (reagent/atom :default)
active-or-selected? (atom false)
timer (atom nil)
on-press-in (fn []
(when-not (= @state :selected)
(reset! timer (js/setTimeout #(reset! state :pressed) 100))))]
(fn [{:keys [type selectable? blur? customization-color on-press]
:or {customization-color :blue
type :default
blur? false}
:as props}]
(let [on-press-out (fn []
(let [new-state (if @active-or-selected?
:default
(if (and (= type :default) selectable?)
:selected
:active))]
(when @timer (js/clearTimeout @timer))
(reset! timer nil)
(reset! active-or-selected? (or (= new-state :active)
(= new-state :selected)))
(reset! state new-state)
(when on-press
(on-press))))]
(rn/use-effect
#(cond (and selectable? (= type :default) (= @state :active)) (reset! state :selected)
(and (not selectable?) (= type :default) (= @state :selected)) (reset! state :active))
[selectable?])
[rn/pressable
{:style (style/container
{:state @state :blur? blur? :customization-color customization-color})
:on-press-in on-press-in
:on-press-out on-press-out
:accessibility-label :container}
[account-view props]
[rn/view {:style (when (= type :tag) style/token-tag-container)}
(when (or (= type :balance-neutral)
(= type :balance-negative)
(= type :balance-positive))
[balance-view props])
(when (= type :tag)
[token-tag props])
(when (= type :action)
[options-button props])
(when (and (= type :default)
(= @state :selected))
[check-icon props])]]))))
(colors/resolve-color customization-color theme))}]])
(defn- internal-view
[props]
[:f> f-internal-view props])
[_]
(let [pressed? (reagent/atom false)
on-press-in #(reset! pressed? true)
on-press-out #(reset! pressed? false)]
(fn [{:keys [type state blur? customization-color on-press]
:or {customization-color :blue
type :default
state :default
blur? false}
:as props}]
[rn/pressable
{:style (style/container
{:state state
:blur? blur?
:customization-color customization-color
:pressed? @pressed?})
:on-press-in on-press-in
:on-press on-press
:on-press-out on-press-out
:accessibility-label :container}
[account-view props]
[rn/view {:style (when (= type :tag) style/token-tag-container)}
(cond
(#{:balance-neutral :balance-negative :balance-positive} type)
[balance-view props]
(= type :tag)
[token-tag props]
(= type :action)
[options-button props]
(and (= type :default) (= state :selected))
[check-icon props])]])))
(def view (quo.theme/with-theme internal-view))
@@ -0,0 +1,35 @@
(ns quo.components.status-link-previews.community.component-spec
(:require
[quo.components.status-link-previews.community.view :as view]
[test-helpers.component :as h]))
(def props
{:title "Some title"
:description "Some description"
:link "status.im"
:logo "data:image/png,logo-x"
:thumbnail "data:image/png,whatever"
:member-count 20
:active-members-count 20})
(h/describe "Status link previews - Community"
(h/test "default render"
(h/render [view/view])
(h/is-truthy (h/query-by-label-text :link-preview))
(h/is-null (h/query-by-label-text :button-enable-preview)))
(h/test "renders with most common props"
(h/render [view/view props])
(h/is-truthy (h/query-by-text (:title props)))
(h/is-truthy (h/query-by-text (:description props)))
(h/is-truthy (h/query-by-text (:link props)))
(h/is-truthy (h/query-by-label-text :logo))
(h/is-truthy (h/query-by-label-text :thumbnail)))
(h/test "does not render thumbnail if prop is not present"
(h/render [view/view (dissoc props :thumbnail)])
(h/is-null (h/query-by-label-text :thumbnail)))
(h/test "does not render logo if prop is not present"
(h/render [view/view (dissoc props :logo)])
(h/is-null (h/query-by-label-text :logo))))
@@ -0,0 +1,51 @@
(ns quo.components.status-link-previews.community.style
(:require [quo.foundations.colors :as colors]))
(defn loading-circle
[theme]
{:background-color (colors/theme-colors colors/neutral-5 colors/neutral-80 theme)
:margin-right 4
:width 16
:height 16
:border-radius 16})
(defn loading-stat
[theme]
{:background-color (colors/theme-colors colors/neutral-5 colors/neutral-80 theme)
:margin-right 4
:width 32
:height 8
:border-radius 16})
(def loading-stat-container {:flex-direction :row :align-items :center :margin-right 12})
(defn loading-first-line-bar
[theme]
{:style {:background-color (colors/theme-colors colors/neutral-5 colors/neutral-80 theme)
:width 145
:height 16
:border-radius 6}})
(defn loading-second-line-bar
[theme]
{:background-color (colors/theme-colors colors/neutral-5 colors/neutral-80 theme)
:width 112
:height 8
:border-radius 6
:margin-bottom 17})
(defn loading-thumbnail-box
[theme]
{:background-color (colors/theme-colors colors/neutral-5 colors/neutral-80 theme)
:margin-right 4
:width 271
:height 139
:border-radius 16})
(def thumbnail
{:width "100%"
:height 139
:margin-top 8
:border-radius 12})
(def row-spacing {:flex-direction :row :margin-bottom 12})
@@ -0,0 +1,101 @@
(ns quo.components.status-link-previews.community.view
(:require
[quo.components.community.community-stat.view :as community-stat]
[quo.components.links.link-preview.style :as style]
[quo.components.markdown.text :as text]
[quo.components.status-link-previews.community.style :as status-link-previews-style]
[quo.theme :as theme]
[react-native.core :as rn]))
(defn- description-comp
[description members-count active-members-count]
[rn/view
[text/text
{:size :paragraph-2
:number-of-lines 3
:accessibility-label :description} description]
[rn/view {:flex-direction :row :margin-top 12}
[community-stat/view
{:value members-count
:icon :i/members
:accessibility-label :members-count
:style {:margin-right 12}}]
[community-stat/view
{:value (or active-members-count 0)
:icon :i/active-members
:accessibility-label :active-members-count}]]])
(defn- title-comp
[title]
[text/text
{:size :paragraph-1
:number-of-lines 1
:weight :semi-bold
:style style/title
:accessibility-label :title}
title])
(defn- thumbnail-comp
[thumbnail]
[rn/image
{:style status-link-previews-style/thumbnail
:source (if (string? thumbnail)
{:uri thumbnail}
thumbnail)
:accessibility-label :thumbnail}])
(defn- logo-comp
[logo]
[rn/image
{:accessibility-label :logo
:source (if (string? logo)
{:uri logo}
logo)
:style style/logo}])
(defn- stat-loading
[theme]
[rn/view {:style status-link-previews-style/loading-stat-container}
[rn/view {:style (status-link-previews-style/loading-circle theme)}]
[rn/view {:style (status-link-previews-style/loading-stat theme)}]])
(defn- loading-view
[theme]
[rn/view
{:accessibility-label :loading}
[rn/view {:style status-link-previews-style/row-spacing}
[rn/view (status-link-previews-style/loading-circle theme)]
[rn/view (status-link-previews-style/loading-first-line-bar theme)]]
[rn/view {:style (status-link-previews-style/loading-second-line-bar theme)}]
[rn/view status-link-previews-style/row-spacing
[stat-loading theme]
[stat-loading theme]]
[rn/view {:style (status-link-previews-style/loading-thumbnail-box theme)}]])
(defn f-internal-view
[{:keys [title description loading? thumbnail-size icon banner members-count active-members-count
theme on-press]
:or {loading? false}}]
[rn/touchable-opacity
{:style (merge (style/container (not loading?))
{:width 295
:height 245})
:accessibility-label :link-preview
:on-press on-press}
(if loading?
[loading-view theme]
[:<>
[rn/view {:style style/header-container}
(when icon
[logo-comp icon])
[title-comp title]]
(when description
[description-comp description members-count active-members-count])
(when banner
[thumbnail-comp banner thumbnail-size])])])
(defn- internal-view
[props]
[:f> f-internal-view props])
(def view (theme/with-theme internal-view))
+18 -27
View File
@@ -17,30 +17,21 @@
{:width size})))
(defn base-tag
[_]
(fn
[{:keys [id
size
disabled?
border-color
border-width
background-color
on-press
accessibility-label
type
labelled?]
:or {size 32}} children]
[rn/touchable-without-feedback
(merge {:disabled disabled?
:accessibility-label accessibility-label}
(when on-press
{:on-press #(on-press id)}))
[rn/view
{:style (merge (style-container size
disabled?
border-color
border-width
background-color
labelled?
type))}
children]]))
[{:keys [id size disabled? border-color border-width background-color on-press
accessibility-label type labelled?]
:or {size 32}}
children]
[rn/touchable-without-feedback
(merge {:disabled disabled?
:accessibility-label accessibility-label}
(when on-press
{:on-press #(on-press id)}))
[rn/view
{:style (merge (style-container size
disabled?
border-color
border-width
background-color
labelled?
type))}
children]])
+29 -39
View File
@@ -4,7 +4,7 @@
[quo.components.markdown.text :as text]
[quo.components.tags.base-tag :as base-tag]
[quo.foundations.colors :as colors]
[quo.theme :as theme]
[quo.theme]
[react-native.core :as rn]))
(def themes
@@ -66,54 +66,44 @@
text-color)
label])])
(defn tag
(defn tag-internal
"opts
{:type :icon/:emoji/:label
:label string
:size 32/24
:on-press fn
:blurred? true/false
:blurred? true/false
:resource icon/image
:labelled? true/false
:disabled? true/false}
opts
- `blurred` boolean: use to determine border color if the background is blurred
- `type` can be icon or emoji with or without a tag label
- `labelled` boolean: is true if tag has label else false"
[_ _]
(fn
[{:keys [id
on-press
disabled?
size
active
accessibility-label
label
resource
type
labelled?
blurred?
icon-color
override-theme]
:or {size 32}}]
(let [state (cond disabled? :disabled
active :active
:else :default)
{:keys [border-color blurred-border-color text-color]}
(get-in themes [(or override-theme (theme/get-theme)) state])]
[rn/view {:style {:align-items :center}}
[base-tag/base-tag
{:id id
:size size
:border-width 1
:border-color (if blurred?
blurred-border-color
border-color)
:on-press on-press
:accessibility-label accessibility-label
:disabled? disabled?
:type type
:labelled? (if (= type :label) true labelled?)}
[tag-resources size type resource icon-color label text-color labelled?]]])))
[{:keys [id on-press disabled? size active accessibility-label label resource type
labelled? blurred? icon-color theme]
:or {size 32}}]
(let [state (cond
disabled? :disabled
active :active
:else :default)
{:keys [border-color
blurred-border-color
text-color]} (get-in themes [theme state])]
[rn/view {:style {:align-items :center}}
[base-tag/base-tag
{:id id
:size size
:border-width 1
:border-color (if blurred?
blurred-border-color
border-color)
:on-press on-press
:accessibility-label accessibility-label
:disabled? disabled?
:type type
:labelled? (if (= type :label) true labelled?)}
[tag-resources size type resource icon-color label text-color labelled?]]]))
(def tag (quo.theme/with-theme tag-internal))
@@ -0,0 +1,51 @@
(ns quo.components.text-combinations.standard-title.component-spec
(:require [quo.components.text-combinations.standard-title.view :as standard-title]
[test-helpers.component :as h]))
(h/describe "Text combinations - Standard title"
(h/test "Default render"
(h/render [standard-title/view {:title "This is a title"}])
(h/is-truthy (h/get-by-text "This is a title")))
(h/test "Counter variant"
(h/render [standard-title/view
{:title "This is a title"
:right :counter
:counter-left 50
:counter-right 100}])
(h/is-truthy (h/get-by-text "50/100")))
(h/describe "Action variant"
(h/test "Default render"
(let [on-press-fn (h/mock-fn)]
(h/render [standard-title/view
{:title "This is a title"
:right :action
:on-press on-press-fn}])
(h/is-truthy (h/get-by-text "This is a title"))))
(h/test "Action fired"
(let [on-press-fn (h/mock-fn)]
(h/render [standard-title/view
{:title "This is a title"
:right :action
:on-press on-press-fn}])
(h/fire-event :on-press (h/get-by-label-text :standard-title-action))
(h/was-called-times on-press-fn 1))))
(h/describe "Tag variant"
(h/test "Default render"
(h/render [standard-title/view
{:title "This is a title"
:right :tag}])
(h/is-truthy (h/get-by-text "This is a title")))
(h/test "Tag callback fired"
(let [on-press-fn (h/mock-fn)]
(h/render [standard-title/view
{:title "This is a title"
:right :tag
:on-press on-press-fn}])
(h/fire-event :on-press (h/get-by-label-text :standard-title-tag))
(h/was-called-times on-press-fn 1)))))
@@ -0,0 +1,24 @@
(ns quo.components.text-combinations.standard-title.style
(:require [quo.foundations.colors :as colors]))
(def container
{:flex-direction :row
:justify-content :space-between})
(def right-container {:margin-left 20})
(def right-counter
{:padding-top 12
:padding-bottom 2})
(defn right-counter-text
[blur? theme]
{:color (if blur?
(colors/theme-colors colors/neutral-80-opa-40 colors/white-opa-40 theme)
(colors/theme-colors colors/neutral-40 colors/neutral-50 theme))})
(defn right-tag-icon-color
[blur? theme]
(if blur?
(colors/theme-colors colors/neutral-80-opa-70 colors/white-opa-70 theme)
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme)))
@@ -0,0 +1,68 @@
(ns quo.components.text-combinations.standard-title.view
(:require [clojure.string :as string]
[quo.components.buttons.button.view :as button]
[quo.components.markdown.text :as text]
[quo.components.tags.tag :as tag]
[quo.components.text-combinations.standard-title.style :as style]
[quo.theme]
[react-native.core :as rn]
[utils.number]))
(defn- get-counter-number
[n]
(let [parsed-number (utils.number/parse-int n)]
(if (< n 10)
(str "0" parsed-number)
parsed-number)))
(defn- right-counter
[{:keys [blur? theme counter-left counter-right]}]
[rn/view {:style style/right-counter}
[text/text
{:size :paragraph-2
:weight :regular
:style (style/right-counter-text blur? theme)}
(str (get-counter-number counter-left)
"/"
(get-counter-number counter-right))]])
(defn- right-action
[{:keys [customization-color on-press icon]
:or {icon :i/placeholder}}]
[button/button
{:accessibility-label :standard-title-action
:size 32
:icon-only? true
:customization-color customization-color
:on-press on-press}
icon])
(defn- right-tag
[{:keys [theme blur? on-press icon label]
:or {icon :i/placeholder}}]
(let [labelled? (not (string/blank? label))]
[tag/tag
{:accessibility-label :standard-title-tag
:size 32
:type :icon
:resource icon
:on-press on-press
:labelled? labelled?
:label (when labelled? label)
:blurred? blur?
:icon-color (style/right-tag-icon-color blur? theme)}]))
(defn- view-internal
[{:keys [title right] :as props}]
[rn/view {:style style/container}
[text/text {:size :heading-1 :weight :semi-bold}
title]
(when right
[rn/view {:style style/right-container}
(case right
:counter [right-counter props]
:action [right-action props]
:tag [right-tag props]
nil)])])
(def view (quo.theme/with-theme view-internal))
@@ -20,12 +20,13 @@
(i18n/label :t/trip-accounts))])
(defn- row-icon
[profile-picture type secondary-color]
[customization-color profile-picture type secondary-color]
(case type
:default-keypair [user-avatar/user-avatar
{:size :xxs
:ring? false
:profile-picture profile-picture}]
{:size :xxs
:ring? false
:customization-color customization-color
:profile-picture profile-picture}]
:recovery-phrase [icons/icon
:i/seed
{:accessibility-label :recovery-phrase-icon
@@ -41,10 +42,11 @@
nil))
(defn- row-view
[{:keys [type theme secondary-color profile-picture title stored subtitle on-press]}]
[{:keys [type theme secondary-color customization-color profile-picture title stored subtitle
on-press]}]
[rn/view {:style (style/row-container type theme)}
[rn/view {:style style/icon-container}
[row-icon profile-picture type secondary-color]]
[row-icon customization-color profile-picture type secondary-color]]
[rn/view
{:style style/row-content-container}
[row-title type title]
@@ -68,18 +70,19 @@
{:color secondary-color}]])])
(defn- list-view
[{:keys [type stored profile-picture user-name theme secondary-color]}]
[{:keys [type stored customization-color profile-picture user-name theme secondary-color]}]
(let [stored-name (if (= :on-device stored)
(i18n/label :t/on-device)
(i18n/label :t/on-keycard))]
[row-view
{:type type
:stored stored
:profile-picture profile-picture
:title user-name
:subtitle stored-name
:theme theme
:secondary-color secondary-color}]))
{:type type
:stored stored
:customization-color customization-color
:profile-picture profile-picture
:title user-name
:subtitle stored-name
:theme theme
:secondary-color secondary-color}]))
(defn- card-view
[theme derivation-path secondary-color on-press]
@@ -105,12 +108,13 @@
(def view
"Create an account-origin UI component.
| key | values |
| ------------------|------------------------------------------------|
| :type | :default-keypair :recovery-phrase :private-key
| :stored | :on-device :on-keycard
| :profile-picture | image source
| :derivation-path | string
| :user-name | string
| :on-press | function"
| key | values |
| ----------------------|------------------------------------------------|
| :type | :default-keypair :recovery-phrase :private-key
| :stored | :on-device :on-keycard
| :profile-picture | image source
| :customization-color | profile color
| :derivation-path | string
| :user-name | string
| :on-press | function"
(quo.theme/with-theme view-internal))
@@ -4,7 +4,7 @@
(defn container
[networks? theme]
{:width "100%"
{:width 335
:height (if networks? 90 56)
:border-radius 16
:border-width 1
@@ -43,7 +43,7 @@
:align-items :flex-end}}
[rn/image
{:style style/token
:source (resources/get-token (keyword (string/lower-case token)))}]
:source (resources/get-token token)}]
[rn/text-input
(cond-> {:auto-focus true
:ref #(reset! input-ref %)
+11 -1
View File
@@ -66,6 +66,7 @@
quo.components.inputs.recovery-phrase.view
quo.components.inputs.search-input.view
quo.components.inputs.title-input.view
quo.components.ios.drawer-bar.view
quo.components.keycard.view
quo.components.links.link-preview.view
quo.components.links.url-preview-list.view
@@ -124,6 +125,7 @@
quo.components.settings.settings-item.view
quo.components.share.qr-code.view
quo.components.share.share-qr-code.view
quo.components.status-link-previews.community.view
quo.components.switchers.group-messaging-card.view
quo.components.tabs.account-selector
quo.components.tabs.segmented-tab
@@ -139,6 +141,7 @@
quo.components.tags.tiny-tag.view
quo.components.tags.token-tag.view
quo.components.text-combinations.channel-name.view
quo.components.text-combinations.standard-title.view
quo.components.text-combinations.view
quo.components.wallet.account-card.view
quo.components.wallet.account-origin.view
@@ -267,6 +270,9 @@
(def search-input quo.components.inputs.search-input.view/search-input)
(def title-input quo.components.inputs.title-input.view/view)
;;;; iOS
(def drawer-bar quo.components.ios.drawer-bar.view/view)
;;;; Numbered Keyboard
(def keyboard-key quo.components.numbered-keyboard.keyboard-key.view/view)
(def numbered-keyboard quo.components.numbered-keyboard.numbered-keyboard.view/view)
@@ -276,6 +282,9 @@
(def url-preview quo.components.links.url-preview.view/view)
(def url-preview-list quo.components.links.url-preview-list.view/view)
;;;; Status links
(def status-link-preview-community quo.components.status-link-previews.community.view/view)
;;;; List items
(def account-item quo.components.list-items.account.view/view)
(def account-list-card quo.components.list-items.account-list-card.view/view)
@@ -375,8 +384,9 @@
(def token-tag quo.components.tags.token-tag.view/view)
;;;; Text combinations
(def text-combinations quo.components.text-combinations.view/view)
(def channel-name quo.components.text-combinations.channel-name.view/view)
(def standard-title quo.components.text-combinations.standard-title.view/view)
(def text-combinations quo.components.text-combinations.view/view)
;;;; Wallet
(def account-card quo.components.wallet.account-card.view/view)
+67 -27
View File
@@ -147,15 +147,48 @@
preferred-name (get-in db [:profile/profile :preferred-name])
emoji? (message-content/emoji-only-content? {:text input-text
:response-to message-id})]
{:chat-id current-chat-id
:content-type (if emoji?
constants/content-type-emoji
constants/content-type-text)
:text input-text
:response-to message-id
:ens-name preferred-name
:link-previews (map #(select-keys % [:url :title :description :thumbnail])
(get-in db [:chat/link-previews :unfurled]))})))
{:chat-id current-chat-id
:content-type (if emoji?
constants/content-type-emoji
constants/content-type-text)
:text input-text
:response-to message-id
:ens-name preferred-name
:link-previews (map #(select-keys % [:url :title :description :thumbnail])
(get-in db [:chat/link-previews :unfurled]))
:status-link-previews (map (fn [item]
{:url (:url item)
:community
{:community-id (get-in item [:community :community-id])
:color (get-in item
[:community :color])
:description (get-in item
[:community :description])
:display-name (get-in item
[:community :display-name])
:members-count (get-in item
[:community :members-count])
:active-members-count (get-in item
[:community :active-members-count])
:icon {:data-uri (get-in item
[:community :icon
:data-uri])
:width (get-in item
[:community :icon
:width])
:height (get-in item
[:community :icon
:height])}
:banner {:data-uri (get-in item
[:community :banner
:data-uri])
:width (get-in item
[:community :banner
:width])
:height (get-in item
[:community :banner
:height])}}})
(get-in db [:chat/status-link-previews :unfurled]))})))
(defn build-image-messages
[{db :db} chat-id input-text]
@@ -193,6 +226,7 @@
(rf/merge cofx
(clean-input current-chat-id)
(link-preview/reset-unfurled)
(link-preview/clear-status-link-previews)
(mentions/clear-mentions))))
(rf/defn send-messages
@@ -205,6 +239,7 @@
(rf/merge cofx
(clean-input (:current-chat-id db))
(link-preview/reset-unfurled)
(link-preview/clear-status-link-previews)
(chat.message/send-messages messages)))))
(rf/defn send-audio-message
@@ -239,25 +274,30 @@
:as cofx} text {:keys [message-id quoted-message chat-id]}]
(rf/merge
cofx
{:json-rpc/call [{:method "wakuext_editMessage"
:params [{:id message-id
:text text
:content-type (if (message-content/emoji-only-content?
{:text text
:response-to quoted-message})
constants/content-type-emoji
constants/content-type-text)
:linkPreviews (map #(-> %
(select-keys [:url :title :description
:thumbnail])
data-store-messages/->link-preview-rpc)
(get-in db [:chat/link-previews :unfurled]))}]
:js-response true
:on-error #(log/error "failed to edit message " %)
:on-success (fn [result]
(re-frame/dispatch [:sanitize-messages-and-process-response
result]))}]}
{:json-rpc/call
[{:method "wakuext_editMessage"
:params [{:id message-id
:text text
:content-type (if (message-content/emoji-only-content?
{:text text
:response-to quoted-message})
constants/content-type-emoji
constants/content-type-text)
:linkPreviews (map #(-> %
(select-keys [:url :title :description
:thumbnail])
data-store-messages/->link-preview-rpc)
(get-in db [:chat/link-previews :unfurled]))
:statusLinkPreviews (map
data-store-messages/<-status-link-previews-rpc
(get-in db [:chat/status-link-previews :unfurled]))}]
:js-response true
:on-error #(log/error "failed to edit message " %)
:on-success (fn [result]
(re-frame/dispatch [:sanitize-messages-and-process-response
result]))}]}
(link-preview/reset-unfurled)
(link-preview/clear-status-link-previews)
(cancel-message-edit)))
(rf/defn send-current-message
+2 -2
View File
@@ -76,9 +76,9 @@
(rf/defn handle-mark-all-read-in-community-successful
{:events [::mark-all-read-in-community-successful]}
[{:keys [db] :as cofx} chat-ids]
[{:keys [db] :as cofx} {:keys [chats] :as _messenger-response}]
(rf/merge cofx
{:db (reduce mark-chat-all-read db chat-ids)
{:db (reduce mark-chat-all-read db (map :id chats))
:dispatch [:activity-center.notifications/fetch-unread-count]}))
(rf/defn handle-mark-all-read
+1 -1
View File
@@ -326,7 +326,7 @@
(conj contacts user-pk)
contacts)]
(when (seq pks)
{:json-rpc/call [{:method "wakuext_shareCommunity"
{:json-rpc/call [{:method "wakuext_shareCommunityV2"
:params [{:communityId community-id
:users pks}]
:js-response true
+1 -1
View File
@@ -14,6 +14,6 @@
(rf/merge cofx
(multiaccounts.update/multiaccount-update
:currency
"USD"
currency
{})
(prices/update-prices)))
+17 -2
View File
@@ -5,7 +5,8 @@
[utils.re-frame :as rf]))
(defn ->rpc
[{:keys [content] :as message}]
[{:keys [content]
:as message}]
(cond-> message
content
(assoc :text (:text content)
@@ -16,6 +17,18 @@
:community-id :communityId
:clock-value :clock})))
(defn- <-status-link-previews-rpc
[preview]
(-> preview
(update :community
set/rename-keys
{:communityId :community-id
:displayName :display-name
:membersCount :members-count
:activeMembersCount :active-members-count})
(update-in [:community :banner] set/rename-keys {:dataUri :data-uri})
(update-in [:community :icon] set/rename-keys {:dataUri :data-uri})))
(defn- <-link-preview-rpc
[preview]
(update preview :thumbnail set/rename-keys {:dataUri :data-uri}))
@@ -53,8 +66,10 @@
:new :new?
:albumImagesCount :album-images-count
:displayName :display-name
:linkPreviews :link-previews})
:linkPreviews :link-previews
:statusLinkPreviews :status-link-previews})
(update :link-previews #(map <-link-preview-rpc %))
(update :status-link-previews #(map <-status-link-previews-rpc %))
(update :quoted-message
set/rename-keys
{:parsedText :parsed-text
+2 -1
View File
@@ -172,7 +172,8 @@
:use-mailservers? true
:recovered recovered}
config/default-multiaccount)
;; The address from which we derive any chat account/encryption keys
;; The address from which we derive any chat
;; account/encryption keys
eip1581-address
(assoc :eip1581-address eip1581-address)
save-mnemonic?
+1
View File
@@ -104,6 +104,7 @@
;;; Link previews
(reg-root-key-sub :link-previews-whitelist :link-previews-whitelist)
(reg-root-key-sub :chat/link-previews :chat/link-previews)
(reg-root-key-sub :chat/status-link-previews :chat/status-link-previews)
;;commands
(reg-root-key-sub :commands/select-account :commands/select-account)
+32 -15
View File
@@ -5,32 +5,49 @@
[taoensso.timbre :as log]
[utils.re-frame :as rf]))
(defn- image->rpc [image] (set/rename-keys image {:data-uri :dataUri}))
(defn- link-preview->rpc
[preview]
(update preview
:thumbnail
(fn [thumbnail]
(set/rename-keys thumbnail {:data-uri :dataUri}))))
(image->rpc thumbnail))))
(defn- status-link-preview->rpc
[preview]
(update preview
:community
(fn [community]
(-> community
(set/rename-keys {:community-id :communityId
:display-name :displayName
:members-count :membersCount
:active-members-count :activeMembersCount})
(update :banner image->rpc)
(update :icon image->rpc)))))
(defn build-message
[msg]
(-> msg
(update :link-previews #(map link-preview->rpc %))
(update :status-link-previews #(set (map status-link-preview->rpc %)))
(set/rename-keys
{:album-id :albumId
:audio-duration-ms :audioDurationMs
:audio-path :audioPath
:chat-id :chatId
:community-id :communityId
:content-type :contentType
:ens-name :ensName
:image-height :imageHeight
:image-path :imagePath
:image-width :imageWidth
:link-previews :linkPreviews
:response-to :responseTo
:sticker :sticker
:text :text})))
{:album-id :albumId
:audio-duration-ms :audioDurationMs
:audio-path :audioPath
:chat-id :chatId
:community-id :communityId
:content-type :contentType
:ens-name :ensName
:image-height :imageHeight
:image-path :imagePath
:image-width :imageWidth
:link-previews :linkPreviews
:status-link-previews :statusLinkPreviews
:response-to :responseTo
:sticker :sticker
:text :text})))
(rf/defn send-chat-messages
[_ messages]
@@ -14,8 +14,7 @@
transactions-management-enabled?
wakuv2-flag
current-fleet
webview-debug
test-networks-enabled?]}]
webview-debug]}]
(keep
identity
[{:size :small
@@ -96,15 +95,6 @@
[:profile.settings/change-webview-debug (not webview-debug)])
:accessory :switch
:active webview-debug}
{:size :small
:title "Test Networks Enabled"
:accessibility-label :test-networks-enabled
:container-margin-bottom 8
:on-press
#(re-frame/dispatch
[:profile.settings/change-test-networks-enabled (not test-networks-enabled?)])
:accessory :switch
:active test-networks-enabled?}
{:size :small
:title (i18n/label :t/waku-bloom-filter-mode)
:accessibility-label :waku-bloom-filter-mode-settings-switch
@@ -127,8 +117,7 @@
(views/defview advanced-settings
[]
(views/letsubs [{:keys [webview-debug
test-networks-enabled?]} [:profile/profile]
(views/letsubs [{:keys [webview-debug]} [:profile/profile]
network-name [:network-name]
waku-bloom-filter-mode [:waku/bloom-filter-mode]
wakuv2-flag [:waku/v2-flag]
@@ -144,7 +133,6 @@
:dev-mode? false
:wakuv2-flag wakuv2-flag
:waku-bloom-filter-mode waku-bloom-filter-mode
:webview-debug webview-debug
:test-networks-enabled? test-networks-enabled?})
:webview-debug webview-debug})
:key-fn (fn [_ i] (str i))
:render-fn render-item}]))
+21 -3
View File
@@ -246,8 +246,8 @@
assets (get visible-tokens chain)
tokens (->> (vals all-tokens)
(remove #(or (:hidden? %)
;;if not scan-all-tokens? remove
;;not visible tokens
;;if not scan-all-tokens? remove not
;;visible tokens
(and (not scan-all-tokens?)
(not (get assets (:symbol %))))))
(reduce (fn [acc {:keys [address symbol]}]
@@ -1075,7 +1075,7 @@
(re-frame/reg-fx
;;TODO: this could be replaced by a single API call on status-go side
:wallet-legacy/initialize-wallet
(fn [[network-id callback]]
(fn [[network-id network callback]]
(-> (js/Promise.all
(clj->js
[(js/Promise.
@@ -1083,6 +1083,24 @@
(json-rpc/call {:method "accounts_getAccounts"
:on-success resolve-fn
:on-error reject})))
(js/Promise.
(fn [resolve-fn _]
(json-rpc/call
{:method "wallet_addEthereumChain"
:params
[{:isTest false
:tokenOverrides []
:rpcUrl (get-in network [:config :UpstreamConfig :URL])
:chainColor "green"
:chainName (:name network)
:nativeCurrencyDecimals 10
:shortName "erc20"
:layer 1
:chainId (int network-id)
:enabled false
:fallbackURL (get-in network [:config :UpstreamConfig :URL])}]
:on-success resolve-fn
:on-error (fn [_] (resolve-fn nil))})))
(js/Promise.
(fn [resolve-fn _]
(json-rpc/call {:method "wallet_getTokens"
@@ -1,19 +1,8 @@
(ns status-im2.common.bottom-sheet.style
(:require
[quo.foundations.colors :as colors]
[quo.theme :as theme]
[react-native.platform :as platform]))
(defn handle
[theme]
{:width 32
:height 4
:background-color (colors/theme-colors colors/neutral-100 colors/white theme)
:opacity (theme/theme-value 0.05 0.1 theme)
:border-radius 100
:align-self :center
:margin-vertical 8})
(defn sheet
[{:keys [top]} window-height selected-item]
{:position :absolute
+3 -2
View File
@@ -63,7 +63,7 @@
item-height (reagent/atom 0)]
(fn [{:keys [hide? insets theme]}
{:keys [content selected-item padding-bottom-override border-radius on-close shell?
gradient-cover? customization-color]
gradient-cover? customization-color hide-handle?]
:or {border-radius 12}}]
(let [{window-height :height} (rn/get-window)
bg-opacity (reanimated/use-shared-value 0)
@@ -122,7 +122,8 @@
[quo/gradient-cover
{:customization-color customization-color
:opacity 0.4}]])
[rn/view {:style (style/handle theme)}]
(when-not hide-handle?
[quo/drawer-bar])
[content]]]]]))))
(defn- internal-view
@@ -14,11 +14,8 @@
(defn authorize
[{:keys [on-enter-password biometric-auth? on-auth-success on-auth-fail on-close
auth-button-label theme blur? auth-button-icon-left]}]
(println auth-button-label "dasasdasdadsdas")
(biometric/get-supported-type
(fn [biometric-type]
(println biometric-type "biometric-type")
(if (and biometric-auth? biometric-type)
(biometric/authenticate
{:reason (i18n/label :t/biometric-auth-confirm-message)
@@ -33,10 +30,8 @@
:shell? blur?
:content (fn []
[enter-password/view
{:button-label auth-button-label
:on-enter-password on-enter-password}])}]))})
{:on-enter-password on-enter-password}])}]))})
(do
(println "222222")
(reset-password)
(rf/dispatch [:show-bottom-sheet
{:on-close on-close
+1 -1
View File
@@ -74,7 +74,7 @@
(def default-multiaccount
{:preview-privacy? blank-preview?
:wallet-legacy/visible-tokens {:mainnet #{:SNT :ETH :DAI}}
:wallet-legacy/visible-tokens {:mainnet #{:SNT}}
:currency :usd
:appearance 0
:profile-pictures-show-to 2
@@ -35,25 +35,29 @@
(let [cleared (set (get-in db [:chat/link-previews :cleared]))]
(when (or (empty? urls)
(not= (set urls) cleared))
(let [cache (get-in db [:chat/link-previews :cache])
previews (urls->previews cache urls)
new-urls (->> previews
(filter :loading?)
(map :url))
(let [cache (get-in db [:chat/link-previews :cache])
previews (urls->previews cache urls)
new-urls (->> previews
(filter :loading?)
(map :url))
status-link-preview? #(string/includes? % "status.app")
status-link-urls (->> urls
(filter status-link-preview?))
;; `request-id` is a must because we need to process only the last
;; unfurling event, as well as avoid needlessly updating the app db
;; if the user changes the URLs in the input text when there are
;; in-flight RPC requests.
request-id (new-request-id)]
request-id
(new-request-id)]
(merge {:db (-> db
(assoc-in [:chat/link-previews :unfurled] previews)
(assoc-in [:chat/link-previews :request-id] request-id)
(update :chat/link-previews dissoc :cleared))}
(when (seq new-urls)
(when (or (seq status-link-urls) (seq new-urls))
(log/debug "Unfurling URLs" {:urls new-urls :request-id request-id})
{:json-rpc/call
[{:method "wakuext_unfurlURLs"
:params [new-urls]
:params [(concat new-urls status-link-urls)]
:on-success #(rf/dispatch [:link-preview/unfurl-parsed-urls-success request-id %])
:on-error #(rf/dispatch [:link-preview/unfurl-parsed-urls-error request-id
%])}]}))))))
@@ -82,17 +86,22 @@
(rf/defn unfurl-parsed-urls-success
{:events [:link-preview/unfurl-parsed-urls-success]}
[{:keys [db]} request-id {new-previews :linkPreviews}]
(when (= request-id (get-in db [:chat/link-previews :request-id]))
(let [new-previews (map data-store.messages/<-link-preview-rpc new-previews)
curr-previews (get-in db [:chat/link-previews :unfurled])
indexed-new-previews (utils.collection/index-by :url new-previews)]
[{:keys [db]} request-id {new-previews :linkPreviews status-link-previews :statusLinkPreviews}]
(when (or (seq status-link-previews) (= request-id (get-in db [:chat/link-previews :request-id])))
(let [new-previews (map data-store.messages/<-link-preview-rpc new-previews)
status-link-previews (map data-store.messages/<-status-link-previews-rpc
status-link-previews)
curr-previews (get-in db [:chat/link-previews :unfurled])
indexed-new-previews (utils.collection/index-by :url new-previews)
indexed-status-link-previews (utils.collection/index-by :url status-link-previews)]
(log/debug "URLs unfurled"
{:event :link-preview/unfurl-parsed-urls-success
:previews (map #(update % :thumbnail dissoc :data-uri) new-previews)
:request-id request-id})
{:db (-> db
(update-in [:chat/link-previews :unfurled] reconcile-unfurled indexed-new-previews)
(assoc-in [:chat/status-link-previews :unfurled]
status-link-previews)
(update-in [:chat/link-previews :cache]
merge
indexed-new-previews
@@ -130,3 +139,12 @@
{:db (-> db
(update :chat/link-previews dissoc :unfurled :request-id)
(assoc-in [:chat/link-previews :cleared] unfurled-urls))}))
(rf/defn clear-status-link-previews
{:events [:status-link-preview/clear]}
[{:keys [db]}]
(let [unfurled-urls (set (map :url (get-in db [:chat/status-link-previews :unfurled])))]
{:db (-> db
(update :chat/status-link-previews dissoc :unfurled)
(assoc-in [:chat/status-link-previews :cleared] unfurled-urls))}))
@@ -20,26 +20,37 @@
(defn f-view
[]
(let [previews (rf/sub [:chats/link-previews-unfurled])
height (use-animated-height (boolean (seq previews)))]
(let [previews (rf/sub [:chats/link-previews-unfurled])
status-link-previews (rf/sub [:chats/status-link-previews-unfurled])
height (use-animated-height (boolean (or (seq status-link-previews)
(seq previews))))]
[reanimated/view
{:style (reanimated/apply-animations-to-style {:height height} {:z-index 1})}
[quo/url-preview-list
{:key-fn :url
:preview-width (- (:width (rn/get-window))
(* 2 style/padding-horizontal))
:container-style (when (seq previews) style/preview-list)
:container-style (when (or (seq status-link-previews) (seq previews)) style/preview-list)
:container-style-item {:height style/preview-height}
:horizontal-spacing style/padding-horizontal
:loading-message (i18n/label :t/link-preview-loading-message)
:on-clear #(rf/dispatch [:link-preview/clear])
:data (map (fn [{:keys [title thumbnail hostname loading? url]}]
{:title title
:body hostname
:loading? loading?
:thumbnail (:data-uri thumbnail)
:url url})
previews)}]]))
:on-clear #(do
(rf/dispatch [:status-link-preview/clear])
(rf/dispatch [:link-preview/clear]))
:data (map (fn [{:keys [title thumbnail hostname loading? url community]}]
(if (seq community)
(let [{:keys [display-name banner]} community]
{:title display-name
:body "status.app"
:loading? loading?
:thumbnail (:data-uri banner)
:url url})
{:title title
:body hostname
:loading? loading?
:thumbnail (:data-uri thumbnail)
:url url}))
(set (concat previews status-link-previews)))}]]))
(defn view
[]
@@ -13,15 +13,32 @@
(defn view
[{:keys [chat-id message-id]}]
(let [previews (rf/sub [:chats/message-link-previews chat-id message-id])]
(when (seq previews)
(let [previews (rf/sub [:chats/message-link-previews chat-id message-id])
status-link-previews (rf/sub [:chats/message-status-link-previews chat-id message-id])]
(when (or (seq status-link-previews)
(seq previews))
[:<>
(for [{:keys [url title description thumbnail hostname]} previews]
(for [{:keys [url title description thumbnail hostname community]}
(concat status-link-previews previews)]
^{:key url}
[quo/link-preview
{:title title
:description description
:link hostname
:thumbnail (:url thumbnail)
:thumbnail-size (when (nearly-square? thumbnail) :large)
:container-style {:margin-top 8}}])])))
(if community
(let [{community-description :description
community-icon :icon
community-banner :banner
community-name :display-name
members-count :members-count} community]
[quo/status-link-preview-community
{:description community-description
:members-count members-count
:title community-name
:banner (:url community-banner)
:icon (:url community-icon)
:link url
:on-press #(rf/dispatch [:universal-links/handle-url url])}])
[quo/link-preview
{:title title
:description description
:link hostname
:thumbnail (:url thumbnail)
:thumbnail-size (when (nearly-square? thumbnail) :large)
:container-style {:margin-top 8}}]))])))
@@ -242,7 +242,6 @@
(defn- internal-discover-view
[params]
(rf/dispatch [:fetch-contract-communities])
[:f> f-view-internal params])
(def view (quo.theme/with-theme internal-discover-view))
@@ -366,9 +366,11 @@
(defn community-card-page-view
[id]
(let [{:keys [id]
(let [{:keys [id joined]
:as community} (rf/sub [:communities/community id])
pending? (rf/sub [:communities/my-pending-request-to-join id])]
(when joined
(rf/dispatch [:activity-center.notifications/dismiss-community-overview id]))
[community-scroll-page community pending?]))
(defn overview
@@ -119,6 +119,7 @@
(cond-> {:wallet-legacy/initialize-transactions-management-enabled nil
:wallet-legacy/initialize-wallet
[network-id
current-network-config
(fn [accounts tokens custom-tokens favourites]
(re-frame/dispatch [:wallet-legacy/initialize-wallet
accounts tokens custom-tokens favourites]))]
@@ -14,7 +14,6 @@
:on-success #(log/debug "sent contact update")}]}))
(rf/defn profile-update
{:events [:profile.settings/profile-update]}
[{:keys [db] :as cofx}
setting setting-value
{:keys [dont-sync? on-success] :or {on-success #()}}]
@@ -57,10 +56,6 @@
{:profile.settings/webview-debug-changed value}
(profile-update :webview-debug (boolean value) {})))
(rf/reg-event-fx :profile.settings/change-test-networks-enabled
(fn [_ [value]]
{:fx [[:dispatch [:profile.settings/profile-update :test-networks-enabled? (boolean value) {}]]]}))
(rf/defn change-preview-privacy-flag
{:events [:profile.settings/change-preview-privacy]}
[{:keys [db] :as cofx} private?]
@@ -0,0 +1,9 @@
(ns status-im2.contexts.quo-preview.ios.drawer-bar
(:require
[quo.core :as quo]
[status-im2.contexts.quo-preview.preview :as preview]))
(defn view
[]
[preview/preview-container {}
[quo/drawer-bar]])
@@ -9,8 +9,10 @@
:type :select
:options [{:key :default} {:key :balance-positive} {:key :balance-neutral} {:key :balance-negative}
{:key :tag} {:key :action}]}
{:key :selectable? :type :boolean}
{:key :title-icon? :type :boolean}
{:key :state
:type :select
:options [{:key :active} {:key :selected}]}
{:key :emoji
:type :text}
(preview/customization-color-option {:key :account-color})
@@ -20,8 +22,8 @@
(defn view
[]
(let [state (reagent/atom {:type :default
:selectable? false
:title-icon? false
:state :default
:customization-color :blue
:account-color :purple
:emoji "🍑"
+12 -2
View File
@@ -78,6 +78,7 @@
recovery-phrase-input]
[status-im2.contexts.quo-preview.inputs.search-input :as search-input]
[status-im2.contexts.quo-preview.inputs.title-input :as title-input]
[status-im2.contexts.quo-preview.ios.drawer-bar :as drawer-bar]
[status-im2.contexts.quo-preview.keycard.keycard :as keycard]
[status-im2.contexts.quo-preview.links.link-preview :as link-preview]
[status-im2.contexts.quo-preview.links.url-preview :as url-preview]
@@ -144,6 +145,7 @@
[status-im2.contexts.quo-preview.settings.settings-item :as settings-item]
[status-im2.contexts.quo-preview.share.qr-code :as qr-code]
[status-im2.contexts.quo-preview.share.share-qr-code :as share-qr-code]
[status-im2.contexts.quo-preview.status-link-preview.community :as status-preview-community]
[status-im2.contexts.quo-preview.style :as style]
[status-im2.contexts.quo-preview.switcher.group-messaging-card :as group-messaging-card]
[status-im2.contexts.quo-preview.switcher.switcher-cards :as switcher-cards]
@@ -164,6 +166,7 @@
channel-name]
[status-im2.contexts.quo-preview.text-combinations.preview :as
text-combinations]
[status-im2.contexts.quo-preview.text-combinations.standard-title :as standard-title]
[status-im2.contexts.quo-preview.wallet.account-card :as account-card]
[status-im2.contexts.quo-preview.wallet.account-origin :as account-origin]
[status-im2.contexts.quo-preview.wallet.account-overview :as
@@ -308,6 +311,8 @@
:component search-input/view}
{:name :title-input
:component title-input/view}]
:ios [{:name :drawer-bar
:component drawer-bar/view}]
:numbered-keyboard [{:name :keyboard-key
:component keyboard-key/view}
{:name :numbered-keyboard
@@ -320,7 +325,10 @@
:component url-preview-list/view}
{:name :link-preview
:options {:insets {:top? true}}
:component link-preview/view}]
:component link-preview/view}
{:name :status-preview-community
:options {:insets {:top true}}
:component status-preview-community/view}]
:list-items [{:name :account
:component account-item/view}
{:name :account-list-card
@@ -453,7 +461,9 @@
:text-combinations [{:name :text-combinations
:component text-combinations/view}
{:name :channel-name
:component channel-name/view}]
:component channel-name/view}
{:name :standard-title
:component standard-title/view}]
:wallet [{:name :account-card :component account-card/view}
{:name :account-origin :component account-origin/view}
{:name :account-overview
@@ -0,0 +1,37 @@
(ns status-im2.contexts.quo-preview.status-link-preview.community
(:require
[quo.core :as quo]
[reagent.core :as reagent]
[status-im2.common.resources :as resources]
[status-im2.contexts.quo-preview.preview :as preview]))
(def descriptor
[{:type :text :key :title}
{:type :text :key :description}
{:type :boolean :key :loading?}
{:type :text :key :members-count}
{:type :text :key :active-members-count}])
(defn view
[]
(let [state (reagent/atom
{:title "Doodles"
:description "Coloring the world with joy • ᴗ •"
:members-count 24
:active-members-count 12
:link "https://status.app/community-link"
:loading? false})]
(fn []
[preview/preview-container
{:state state
:descriptor descriptor}
[quo/status-link-preview-community
{:title (:title @state)
:description (:description @state)
:icon (resources/get-mock-image :status-logo)
:banner (resources/get-mock-image :status-logo)
:loading? (:loading? @state)
:members-count (int (:members-count @state))
:loading-message (:loading-message @state)
:active-members-count (int (:active-members-count @state))
:on-clear #(js/alert "Clear button pressed")}]])))
@@ -0,0 +1,66 @@
(ns status-im2.contexts.quo-preview.text-combinations.standard-title
(:require [quo.core :as quo]
[reagent.core :as reagent]
[status-im2.contexts.quo-preview.preview :as preview]))
(def descriptor
[{:key :title :type :text}
{:key :right
:type :select
:options [{:key nil
:value "Nothing (nil)"}
{:key :counter}
{:key :action}
{:key :tag}]}
{:key :blur? :type :boolean}])
(def counter-descriptor
[{:key :counter-left
:type :select
:options (mapv (fn [n] {:key n})
(range 0 101 25))}
{:key :counter-right
:type :select
:options (mapv (fn [n] {:key n})
(range 0 101 25))}])
(def action-descriptor
[(preview/customization-color-option)
{:key :icon
:type :select
:options [{:key :i/placeholder}
{:key :i/info}
{:key :i/key}]}])
(def tag-descriptor
[{:key :icon
:type :select
:options [{:key :i/placeholder}
{:key :i/info}
{:key :i/key}]}
{:key :label
:type :text}])
(defn view
[]
(let [state (reagent/atom {:title "Title"
:blur? true
:right :counter
:counter-left 50
:counter-right 100
:on-press #(js/alert "Button clicked!")
:customization-color :army
:icon :i/placeholder
:label ""})]
(fn []
(let [typed-descriptor (case (:right @state)
:counter counter-descriptor
:action action-descriptor
:tag tag-descriptor
nil)]
[preview/preview-container
{:state state
:descriptor (concat descriptor typed-descriptor)
:show-blur-background? true
:blur? (:blur? @state)}
[quo/standard-title @state]]))))
@@ -202,6 +202,12 @@
:utils/dispatch-later [{:dispatch [:activity-center.notifications/mark-all-as-read]
:ms undo-time-limit-ms}]}))
(re-frame/reg-event-fx :activity-center.notifications/dismiss-community-overview
(fn [_ [community-id]]
{:json-rpc/call [{:method "wakuext_dismissActivityCenterNotificationsByCommunity"
:params [{:communityId community-id}]
:on-success [:activity-center.notifications/fetch-unread-count]}]}))
(rf/defn accept-notification
{:events [:activity-center.notifications/accept]}
[{:keys [db]} notification-id]
@@ -1,6 +1,7 @@
(ns status-im2.contexts.shell.activity-center.notification.community-kicked.view
(:require
[quo.core :as quo]
[react-native.gesture :as gesture]
[status-im2.contexts.shell.activity-center.notification.common.style :as common-style]
[status-im2.contexts.shell.activity-center.notification.common.view :as common]
[utils.datetime :as datetime]
@@ -26,18 +27,22 @@
community-name (:name community)
community-image (get-in community [:images :thumbnail :uri])]
[swipeable props
[quo/activity-log
{:title (i18n/label :t/community-kicked-heading)
:customization-color customization-color
:icon :i/placeholder
:on-layout set-swipeable-height
:timestamp (datetime/timestamp->relative timestamp)
:unread? (not read)
:context [[quo/text {:style common-style/user-avatar-tag-text}
(i18n/label :t/community-kicked-body)]
[quo/context-tag
{:type :community
:size 24
:blur? true
:community-logo community-image
:community-name community-name}]]}]]))
[gesture/touchable-without-feedback
{:on-press (fn []
(rf/dispatch [:navigate-back])
(rf/dispatch [:activity-center.notifications/mark-as-read (:id notification)]))}
[quo/activity-log
{:title (i18n/label :t/community-kicked-heading)
:customization-color customization-color
:icon :i/placeholder
:on-layout set-swipeable-height
:timestamp (datetime/timestamp->relative timestamp)
:unread? (not read)
:context [[quo/text {:style common-style/user-avatar-tag-text}
(i18n/label :t/community-kicked-body)]
[quo/context-tag
{:type :community
:size 24
:blur? true
:community-logo community-image
:community-name community-name}]]}]]]))
@@ -1,6 +1,7 @@
(ns status-im2.contexts.shell.activity-center.notification.community-request.view
(:require
[quo.core :as quo]
[react-native.gesture :as gesture]
[status-im2.constants :as constants]
[status-im2.contexts.shell.activity-center.notification.common.style :as common-style]
[status-im2.contexts.shell.activity-center.notification.common.view :as common]
@@ -67,11 +68,15 @@
{:keys [header-text context]} (get-header-text-and-context community
membership-status)]
[swipeable props
[quo/activity-log
{:title header-text
:customization-color customization-color
:icon :i/communities
:on-layout set-swipeable-height
:timestamp (datetime/timestamp->relative timestamp)
:unread? (not read)
:context context}]]))
[gesture/touchable-without-feedback
{:on-press (fn []
(rf/dispatch [:navigate-back])
(rf/dispatch [:navigate-to :community-overview community-id]))}
[quo/activity-log
{:title header-text
:customization-color customization-color
:icon :i/communities
:on-layout set-swipeable-height
:timestamp (datetime/timestamp->relative timestamp)
:unread? (not read)
:context context}]]]))
@@ -2,8 +2,8 @@
(:require
[quo.core :as quo]
[react-native.core :as rn]
[status-im2.contexts.profile.utils :as profile.utils]
[status-im2.contexts.wallet.account.tabs.about.style :as style]
[status-im2.contexts.wallet.common.temp :as temp]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@@ -34,9 +34,10 @@
(defn view
[]
(let [{:keys [type address]} (rf/sub [:wallet/current-viewing-account])
networks (rf/sub [:wallet/network-details])
watch-only? (= type :watch)]
(let [{:keys [customization-color] :as profile} (rf/sub [:profile/profile-with-image])
{:keys [type address path]} (rf/sub [:wallet/current-viewing-account])
networks (rf/sub [:wallet/network-details])
watch-only? (= type :watch)]
[rn/view {:style style/about-tab}
[quo/data-item
{:description :default
@@ -53,4 +54,12 @@
:format :long}])
:container-style {:margin-bottom 12}
:on-press #(rf/dispatch [:show-bottom-sheet {:content about-options}])}]
(when (not watch-only?) [quo/account-origin temp/account-origin-state])]))
(when (not watch-only?)
[quo/account-origin
{:type :default-keypair
:stored :on-device
:profile-picture (profile.utils/photo profile)
:customization-color customization-color
:derivation-path path
:user-name (profile.utils/displayed-name profile)
:on-press #(js/alert "To be implemented")}])]))
@@ -9,6 +9,7 @@
networks (rf/sub [:wallet/network-details])]
[quo/page-nav
{:icon-name :i/close
:background :blur
:on-press on-press
:accessibility-label accessibility-label
:networks networks
@@ -16,7 +17,6 @@
: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}])
{:content account-options/view
:hide-handle? true}])
:emoji emoji}}]))
@@ -4,3 +4,33 @@
{:padding-horizontal 20
:padding-top 12
:padding-bottom 8})
(def options-container
{:position :absolute
:top 0
:left 0
:right 0
:z-index 1
:overflow :hidden})
(defn blur-container
[height]
{:height height
:position :absolute
:top 0
:left 0
:right 0})
(def gradient-container
{:position :absolute
:top 0
:left 0
:right 0})
(def divider-label
{:margin-top 8})
(defn list-container
[padding-top]
{:padding-top padding-top
:margin-horizontal 8})
@@ -1,18 +1,46 @@
(ns status-im2.contexts.wallet.common.sheets.account-options.view
(:require [quo.core :as quo]
(:require [oops.core :as oops]
[quo.core :as quo]
[quo.foundations.colors :as colors]
quo.theme
[react-native.blur :as blur]
[react-native.clipboard :as clipboard]
[react-native.core :as rn]
[react-native.gesture :as gesture]
[react-native.platform :as platform]
[reagent.core :as reagent]
[status-im2.contexts.wallet.common.sheets.account-options.style :as style]
[status-im2.contexts.wallet.common.temp :as temp]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn- view-internal
[{:keys [theme]}]
(defn- render-account-item
[{:keys [color address] :as account}]
[quo/account-item
{:account-props (assoc account :customization-color color)
:on-press (fn []
(rf/dispatch [:wallet/switch-current-viewing-account address])
(rf/dispatch [:hide-bottom-sheet]))}])
(defn- options
[{:keys [theme show-account-selector? options-height]}]
(let [{:keys [name color emoji address]} (rf/sub [:wallet/current-viewing-account])]
[:<>
[rn/view
{:on-layout #(reset! options-height (oops/oget % "nativeEvent.layout.height"))
:style (when show-account-selector? style/options-container)}
(when show-account-selector?
[blur/view
{:style (style/blur-container @options-height)
:blur-radius (if platform/android? 20 10)
:blur-amount (if platform/ios? 20 10)
:blur-type (quo.theme/theme-value (if platform/ios? :light :xlight) :dark theme)
:overlay-color (quo.theme/theme-value colors/white-70-blur
colors/neutral-95-opa-70-blur
theme)}])
[rn/view {:style style/gradient-container}
[quo/gradient-cover
{:customization-color color
:opacity 0.4}]]
[quo/drawer-bar]
[quo/drawer-top
{:title name
:type :account
@@ -39,17 +67,34 @@
{:icon :i/share
:accessibility-label :share-account
:label (i18n/label :t/share-account)}
{:icon :i/delete
{:add-divider? (not show-account-selector?)
:icon :i/delete
:accessibility-label :remove-account
:label (i18n/label :t/remove-account)
:danger? true}]]]
[quo/divider-line {:container-style {:margin-top 8}}]
[quo/section-label
{:section (i18n/label :t/select-another-account)
:container-style style/drawer-section-label}]
[rn/flat-list
{:data temp/other-accounts
:render-fn (fn [account] [quo/account-item {:account-props account}])
:style {:margin-horizontal 8}}]]))
(when show-account-selector?
[:<>
[quo/divider-line {:container-style style/divider-label}]
[quo/section-label
{:section (i18n/label :t/select-another-account)
:container-style style/drawer-section-label}]])]))
(defn- view-internal
[]
(let [options-height (reagent/atom 0)]
(fn [{:keys [theme]}]
(let [accounts (rf/sub [:wallet/accounts-without-current-viewing-account])
show-account-selector? (pos? (count accounts))]
[:<>
(when show-account-selector?
[gesture/flat-list
{:data accounts
:render-fn render-account-item
:content-container-style (style/list-container @options-height)
:shows-vertical-scroll-indicator false}])
[options
{:show-account-selector? show-account-selector?
:theme theme
:options-height options-height}]]))))
(def view (quo.theme/with-theme view-internal))
@@ -1,10 +1,8 @@
(ns status-im2.contexts.wallet.common.temp
(:require
[clojure.string :as string]
[quo.foundations.resources :as quo.resources]
[react-native.core :as rn]
[status-im2.common.resources :as status.resources]
[status-im2.constants :as constants]
[utils.i18n :as i18n]))
(defn wallet-overview-state
@@ -48,112 +46,6 @@
(def address "0x39cf6E0Ba4C4530735616e1Ee7ff5FbCB726fBd4")
(def data-item-state
{:description :default
:icon-right? true
:right-icon :i/options
:card? true
:label :none
:status :default
:size :default
:title "Address"
:customization-color :yellow})
(def account-origin-state
{:type :default-keypair
:stored :on-keycard
:profile-picture (status.resources/get-mock-image :user-picture-male5)
:derivation-path (string/replace constants/path-default-wallet #"/" " / ")
:user-name "Alisher Yakupov"
:on-press #(js/alert "pressed")})
(defn dapps-list
[{:keys [on-press-icon]}]
[{:dapp {:avatar (quo.resources/get-dapp :coingecko)
:name "Coingecko"
:value "coingecko.com"}
:state :default
:action :icon
:on-press-icon on-press-icon}
{:dapp {:avatar (quo.resources/get-dapp :uniswap)
:name "Uniswap"
:value "uniswap.org"}
:state :default
:action :icon
:on-press-icon on-press-icon}])
(def other-accounts
[{:customization-color :flamingo
:emoji "🍿"
:name "New House"
:address "0x21af6E0Ba4C4530735616e1Ee7ff5FbCB726f493"
:networks [{:network-name :ethereum :short-name "eth"}
{:network-name :optimism :short-name "opt"}]}
{:customization-color :blue
:emoji "🎮"
:name "My savings"
:address "0x43cf6E0Ba4C4530735616e1Ee7ff5FbCB726f98d"
:networks [{:network-name :ethereum :short-name "eth"}]}])
(def asset-snt
{:size 24
:type :token
:token-name "SNT"
:amount 1500
:token-logo (quo.resources/get-token :snt)})
(def piggy-bank
{:size 24
:type :account
:account-name "Piggy bank"
:emoji "🐷"})
(def aretha-gosling
{:size 24
:type :default
:full-name "Aretha Gosling"
:profile-picture (status.resources/mock-images :user-picture-female2)})
(def mainnet
{:size 24
:type :network
:network-logo (quo.resources/get-network :ethereum)
:network-name "Mainnet"})
(def activity-list
[{:date "Today"
:transaction :send
:timestamp "Today 22:20"
:status :pending
:counter 1
:first-tag asset-snt
:second-tag-prefix :t/from
:second-tag piggy-bank
:third-tag-prefix :t/to
:third-tag aretha-gosling
:fourth-tag-prefix :t/via
:fourth-tag mainnet
:blur? false}
{:date "Yesterday"
:transaction :receive
:timestamp "Yesterday 22:20"
:status :pending
:counter 1
:first-tag asset-snt
:second-tag-prefix :t/from
:second-tag piggy-bank
:third-tag-prefix :t/to
:third-tag aretha-gosling
:fourth-tag-prefix :t/via
:fourth-tag mainnet
:blur? false}])
(def collectible-list
[(status.resources/get-mock-image :collectible1)
(status.resources/get-mock-image :collectible2)
(status.resources/get-mock-image :collectible3)
(status.resources/get-mock-image :collectible4)])
(def buy-tokens-list
[{:title "Ramp"
:description :text
@@ -36,15 +36,12 @@
(map #(calculate-raw-balance (:raw-balance %) decimals))
(reduce +)))
(defn calculate-balance-for-token
[token]
(* (total-token-value-in-all-chains token)
(-> token :market-values-per-currency :usd :price)))
(defn calculate-balance
[tokens-in-account]
(->> tokens-in-account
(map #(calculate-balance-for-token %))
(map (fn [token]
(* (total-token-value-in-all-chains token)
(-> token :market-values-per-currency :usd :price))))
(reduce +)))
(defn network-list
+20 -133
View File
@@ -9,10 +9,8 @@
[status-im2.common.data-store.wallet :as data-store]
[status-im2.contexts.wallet.temp :as temp]
[taoensso.timbre :as log]
[utils.datetime :as datetime]
[utils.ethereum.chain :as chain]
[utils.i18n :as i18n]
[utils.money :as money]
[utils.number]
[utils.re-frame :as rf]
[utils.security.core :as security]
@@ -31,12 +29,25 @@
(rf/reg-event-fx :wallet/navigate-to-account
(fn [{:keys [db]} [address]]
(let [new-account? (get-in db [:wallet :new-account?])]
(cond-> {:db (assoc-in db [:wallet :current-viewing-account-address] address)
:fx [[:dispatch [:navigate-to :wallet-accounts address]]]}
{:db (assoc-in db [:wallet :current-viewing-account-address] address)
:fx [[:dispatch [:navigate-to :wallet-accounts address]]]}))
new-account?
(update :fx conj [:dispatch [:wallet/show-account-created-toast address]])))))
(rf/reg-event-fx :wallet/navigate-to-new-account
(fn [{:keys [db]} [address]]
{:db (assoc-in db [:wallet :current-viewing-account-address] address)
:fx [[:dispatch [:hide-bottom-sheet]]
[:dispatch-later
[{:dispatch [:navigate-back]
:ms 100}
{:dispatch [:navigate-back]
:ms 100}
{:dispatch [:navigate-to :wallet-accounts address]
:ms 300}]]
[:dispatch [:wallet/show-account-created-toast address]]]}))
(rf/reg-event-fx :wallet/switch-current-viewing-account
(fn [{:keys [db]} [address]]
{:db (assoc-in db [:wallet :current-viewing-account-address] address)}))
(rf/reg-event-fx :wallet/close-account-page
(fn [{:keys [db]}]
@@ -127,7 +138,7 @@
(rf/defn clean-scanned-address
{:events [:wallet/clean-scanned-address]}
[{:keys [db]}]
{:db (update-in db [:wallet :ui :send] dissoc :to-address)})
{:db (dissoc db :wallet/scanned-address :wallet/send-address)})
(rf/reg-event-fx :wallet/create-derived-addresses
(fn [{:keys [db]} [password {:keys [path]} on-success]]
@@ -355,7 +366,7 @@
(rf/reg-event-fx :wallet/select-send-address
(fn [{:keys [db]} [address]]
{:db (assoc-in db [:wallet :ui :send :to-address] address)}))
{:db (assoc db :wallet/send-address address)}))
(rf/reg-event-fx :wallet/get-address-details-success
(fn [{:keys [db]} [{:keys [hasActivity]}]]
@@ -377,127 +388,3 @@
:on-error #(log/info "failed to get address details"
{:error %
:event :wallet/get-address-details})}]]]}))
(rf/reg-event-fx :wallet/send-select-token
(fn [{:keys [db]} [token stack-id]]
{:db (assoc-in db [:wallet :ui :send :token] token)
:fx [[:navigate-to-within-stack [:wallet-send-input-amount stack-id]]]}))
(rf/reg-event-fx :wallet/send-select-amount
(fn [{:keys [db]} [amount stack-id]]
{:db (assoc-in db [:wallet :ui :send :amount] amount)
:fx [[:navigate-to-within-stack [:wallet-transaction-confirmation stack-id]]]}))
(rf/reg-event-fx :wallet/suggested-routes-success
(fn [{:keys [db]} [suggested-routes timestamp]]
(when (= (get-in db [:wallet :ui :send :suggested-routes-call-timestamp]) timestamp)
{:db (-> db
(assoc-in [:wallet :ui :send :suggested-routes] suggested-routes)
(assoc-in [:wallet :ui :send :route] (first (:Best suggested-routes)))
(assoc-in [:wallet :ui :send :loading-suggested-routes?] false))})))
(rf/reg-event-fx :wallet/suggested-routes-error
(fn [{:keys [db]} [_error]]
{:db (-> db
(update-in [:wallet :ui :send] dissoc :suggested-routes)
(update-in [:wallet :ui :send] dissoc :route)
(assoc-in [:wallet :ui :send :loading-suggested-routes?] false))}))
(rf/reg-event-fx :wallet/clean-suggested-routes
(fn [{:keys [db]}]
{:db (-> db
(update-in [:wallet :ui :send] dissoc :suggested-routes)
(update-in [:wallet :ui :send] dissoc :route)
(update-in [:wallet :ui :send] dissoc :loading-suggested-routes?))}))
(rf/reg-event-fx :wallet/get-suggested-routes
(fn [{:keys [db]} [amount]]
(let [wallet-address (get-in db [:wallet :current-viewing-account-address])
token (get-in db [:wallet :ui :send :token])
to-address (get-in db [:wallet :ui :send :to-address])
token-decimal 18
token-id (:symbol token)
value_ (js/parseFloat amount)
network-preferences [1]
gas-rates 0 ;low
amount-in (money/mul (money/bignumber value_)
(money/from-decimal token-decimal))
from-address wallet-address
request-params [0
from-address
to-address
(money/to-hex amount-in)
token-id
[]
[]
network-preferences
gas-rates
{}]
timestamp (datetime/timestamp)]
(prn "=====" request-params)
{:db (-> db
(assoc-in [:wallet :ui :send :loading-suggested-routes?] true)
(assoc-in [:wallet :ui :send :suggested-routes-call-timestamp]
timestamp))
:json-rpc/call [{:method "wallet_getSuggestedRoutes"
:params request-params
:on-success (fn [suggested-routes]
(rf/dispatch [:wallet/suggested-routes-success suggested-routes
timestamp]))
:on-error (fn [error]
(rf/dispatch [:wallet/suggested-routes-error error])
(log/error "failed to get suggested routes"
{:event :wallet/get-suggested-routes
:error error
:params request-params}))}]})))
(rf/reg-event-fx :wallet/send-transaction
(fn [{:keys [db]} [password]]
(let [route (get-in db [:wallet :ui :send :route])
from-address (get-in db [:wallet :current-viewing-account-address])
to-address (get-in db [:wallet :ui :send :to-address])
from (:From route)
token (get-in db [:wallet :ui :send :token])
token-id (:symbol token)
from-asset token-id
to-asset token-id
bridge-name (:BridgeName route)
chain-id (:chainId from)
multi-transaction-command {:fromAddress from-address
:toAddress to-address
:fromAsset from-asset
:toAsset to-asset
:fromAmount (:AmountOut route)
:type 0}
transaction-bridge
[{:BridgeName bridge-name
:ChainID chain-id
:TransferTx {:From from-address
:To to-address
:Gas (money/to-hex (:GasAmount route))
:GasPrice (money/to-hex (money/->wei :gwei
(:gasPrice (:GasFees route))))
:Value (:AmountOut route)
:Nonce nil
:MaxFeePerGas (money/to-hex
(money/->wei :gwei
(:maxFeePerGasMedium (:GasFees route))))
:MaxPriorityFeePerGas (money/to-hex (money/->wei :gwei
(:maxPriorityFeePerGas
(:GasFees
route))))
:Input ""
:Data "0x"}}]
sha3-pwd (native-module/sha3 (str (security/safe-unmask-data password)))
request-params [multi-transaction-command transaction-bridge sha3-pwd]]
(prn "=====" request-params)
{:json-rpc/call [{:method "wallet_createMultiTransaction"
:params request-params
:on-success (fn [response]
(prn response "======+++++++++========++++++++")
(rf/dispatch [:dismiss-modal :wallet-select-address]))
:on-error (fn [error]
(log/error "failed to send transaction"
{:event :wallet/send-transaction
:error error
:params request-params}))}]})))
@@ -7,7 +7,6 @@
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im2.contexts.wallet.send.input-amount.style :as style]
[utils.debounce :as debounce]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@@ -48,88 +47,71 @@
current))
(defn- f-view-internal
[{:keys [rate]}]
(let [bottom (safe-area/get-bottom)
{:keys [currency]} (rf/sub [:profile/profile])
networks (rf/sub [:wallet/network-details])
wallet-send (get-in (rf/sub [:wallet]) [:ui :send])
token (:token wallet-send)
token-symbol (:symbol token)
limit-crypto (:total-balance token)
limit-fiat (:total-balance-fiat token)
conversion-rate (or rate 10)
input-value (reagent/atom "")
current-limit (reagent/atom {:amount limit-crypto
:currency token-symbol})
loading-suggested-routes? (:loading-suggested-routes? wallet-send)
handle-swap (fn [crypto?]
(let [num-value (parse-double @input-value)]
(reset! current-limit (if crypto?
{:amount limit-crypto
:currency token-symbol}
{: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 (or (parse-double new-value) 0)]
(when (and (not loading-suggested-routes?)
(<= num-value (:amount @current-limit)))
(reset! input-value new-value)
(reagent/flush))))
handle-delete (fn [_]
(when-not loading-suggested-routes?
(swap! input-value #(subs % 0 (dec (count %))))
(reagent/flush)))
handle-on-change (fn [v]
(when (valid-input? @input-value v)
(let [num-value (or (parse-double v) 0)
current-limit-amount (:amount @current-limit)]
(if (> num-value current-limit-amount)
(reset! input-value (str current-limit-amount))
(reset! input-value v))
(reagent/flush))))]
[{:keys [token limit rate]}]
(let [bottom (safe-area/get-bottom)
{:keys [currency]} (rf/sub [:profile/profile])
networks (rf/sub [:wallet/network-details])
;; Temporary values
token (or token :eth)
conversion-rate (or rate 10)
limit-crypto (or limit 2860000.32)
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 (or (parse-double new-value) 0)]
(when (<= num-value (:amount @current-limit))
(reset! input-value new-value)
(reagent/flush))))
handle-delete (fn [_]
(swap! input-value #(subs % 0 (dec (count %))))
(reagent/flush))
handle-on-change (fn [v]
(when (valid-input? @input-value v)
(let [num-value (or (parse-double v) 0)
current-limit-amount (:amount @current-limit)]
(if (> num-value current-limit-amount)
(reset! input-value (str current-limit-amount))
(reset! input-value v))
(reagent/flush))))]
(fn [{:keys [on-confirm]
:or {on-confirm #(rf/dispatch [:wallet/send-select-amount @input-value
:wallet-send-input-amount])}}]
(let [limit-label (make-limit-label @current-limit)
input-num-value (parse-double @input-value)
route (get-in (rf/sub [:wallet]) [:ui :send :route])
loading-suggested-routes? (get-in (rf/sub [:wallet]) [:ui :send :loading-suggested-routes?])
confirm-disabled? (or
(nil? route)
(empty? @input-value)
(<= input-num-value 0)
(> input-num-value (:amount @current-limit)))]
:or {on-confirm #(js/alert "Confirmed")}}]
(let [limit-label (make-limit-label @current-limit)
input-num-value (parse-double @input-value)
confirm-disabled? (or
(empty? @input-value)
(<= input-num-value 0)
(> input-num-value (:amount @current-limit)))]
(rn/use-effect
(fn []
(let [dismiss-keyboard-fn #(when (= % "active") (rn/dismiss-keyboard!))
app-keyboard-listener (.addEventListener rn/app-state "change" dismiss-keyboard-fn)]
#(.remove app-keyboard-listener))))
(rn/use-effect (fn []
(rf/dispatch [:wallet/clean-suggested-routes])
(when-not (or
(empty? @input-value)
(<= input-num-value 0)
(> input-num-value (:amount @current-limit)))
(debounce/debounce-and-dispatch [:wallet/get-suggested-routes @input-value]
100)))
[@input-value])
[rn/view
{:style style/screen}
[quo/page-nav
{:background :blur
:icon-name :i/arrow-left
:on-press #(rf/dispatch [:navigate-back-within-stack :wallet-send-input-amount])
: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-symbol
:token token
:currency currency
:networks networks
:title (i18n/label :t/send-limit {:limit limit-label})
@@ -140,16 +122,7 @@
:on-change-text (fn [text]
(handle-on-change text))}]
;; Network routing content to be added
[rn/scroll-view
{:content-container-style {:flex-grow 1
:align-items :center
:justify-content :center}}
(cond loading-suggested-routes?
[quo/text "Loading routes"]
(and (not loading-suggested-routes?) route)
[quo/text "Route found"]
(and (not loading-suggested-routes?) (nil? route))
[quo/text "Route not found"])]
[rn/scroll-view]
[quo/bottom-actions
{:actions :1-action
:button-one-label (i18n/label :t/confirm)
@@ -48,7 +48,7 @@
[input-value input-focused?]
(fn []
(let [scanned-address (rf/sub [:wallet/scanned-address])
send-address (get-in (rf/sub [:wallet]) [:ui :send :to-address])
send-address (rf/sub [:wallet/send-address])
valid-ens-or-address? (rf/sub [:wallet/valid-ens-or-address?])]
[quo/address-input
{:on-focus (fn []
@@ -18,13 +18,10 @@
(defn- asset-component
[]
(fn [token _ _ _]
(let [on-press
#(if (= (:symbol token) "ETH")
(rf/dispatch [:wallet/send-select-token token :wallet-select-asset])
(js/alert "Only ETH transfers are allowed."))
(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 "$"]
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)
@@ -1,41 +0,0 @@
(ns status-im2.contexts.wallet.send.transaction-confirmation.style
(:require [quo.foundations.colors :as colors]))
(defn container
[margin-top]
{:position :absolute
:top margin-top
:right 0
:left 0
:bottom 0})
(def content-container
{:padding-top 12
:padding-horizontal 20
:padding-bottom 32})
(def title-container
{:margin-right 4})
(defn details-container
[theme]
{:flex-direction :row
:justify-content :space-between
:height 52
:padding-horizontal 12
:padding-top 7
:padding-bottom 8
:border-radius 16
:border-width 1
:border-color (colors/theme-colors colors/neutral-10 colors/neutral-90 theme)})
(def slide-button-container
{:position :absolute
:right 20
:left 20
:bottom 20})
(defn section-label
[theme]
{:margin-bottom 8
:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)})
@@ -1,202 +0,0 @@
(ns status-im2.contexts.wallet.send.transaction-confirmation.view
(:require
[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]
[status-im.utils.utils :as utils]
[status-im2.common.resources :as resources]
[status-im2.common.standard-authentication.core :as standard-auth]
[status-im2.contexts.wallet.send.transaction-confirmation.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn- transaction-title
[token amount account to-address]
[rn/view {:style style/content-container}
[rn/view {:style {:flex-direction :row}}
[quo/text
{:size :heading-1
:weight :semi-bold
:style style/title-container
:accessibility-label :send-label}
(i18n/label :t/send)]
[quo/summary-tag
{:label (str amount " " (:symbol token))
:type :token
:image-source (quo.resources/get-token :eth)}]]
[rn/view
{:style {:flex-direction :row
:margin-top 4}}
[quo/text
{:size :heading-1
:weight :semi-bold
:style style/title-container
:accessibility-label :send-label}
(i18n/label :t/from)]
[quo/summary-tag
{:label (:name account)
:type :account
:emoji (:emoji account)
:customization-color (:color account)}]]
[rn/view
{:style {:flex-direction :row
:margin-top 4}}
[quo/text
{:size :heading-1
:weight :semi-bold
:style style/title-container
:accessibility-label :send-label}
(i18n/label :t/to)]
[quo/summary-tag
{:type :address
:label (utils/get-shortened-address to-address)}]]])
(defn- transaction-from
[amount account-props theme]
[rn/view
{:style {:padding-horizontal 20
:padding-bottom 16}}
[quo/text
{:size :paragraph-2
:weight :medium
:style (style/section-label theme)
:accessibility-label :summary-from-label}
(i18n/label :t/from-capitalized)]
[quo/summary-info
{:type :status-account
:networks? true
:values {:ethereum amount
:optimism 0
:arbitrum 0}
:account-props account-props}]])
(defn- transaction-to
[amount user-props theme]
[rn/view
{:style {:padding-horizontal 20
:padding-bottom 16}}
[quo/text
{:size :paragraph-2
:weight :medium
:style (style/section-label theme)
:accessibility-label :summary-from-label}
(i18n/label :t/to-capitalized)]
[quo/summary-info
{:type :user
:networks? true
:values {:ethereum amount
:optimism 0
:arbitrum 0}
:account-props user-props}]])
(defn- transaction-details
[estimated-time-min max-fees-eth token amount to-address theme]
[rn/view
{:style {:padding-horizontal 20
:padding-bottom 16}}
[quo/text
{:size :paragraph-2
:weight :medium
:style (style/section-label theme)
:accessibility-label :summary-from-label}
(i18n/label :t/details)]
[rn/view
{:style (style/details-container theme)}
[quo/data-item
{:container-style {:flex 1
:height 36}
:blur? false
:description :default
:icon-right? false
:card? false
:label :none
:status :default
:size :small
:title (i18n/label :t/est-time)
:subtitle (str estimated-time-min " min")}]
[quo/data-item
{:container-style {:flex 1
:height 36}
:blur? false
:description :default
:icon-right? false
:card? false
:label :none
:status :default
:size :small
:title (i18n/label :t/max-fees)
:subtitle (str "$" max-fees-eth)}]
[quo/data-item
{:container-style {:flex 1
:height 36}
:blur? false
:description :default
:icon-right? false
:card? false
:label :none
:status :default
:size :small
:title (i18n/label :t/user-gets {:name (utils/get-shortened-address to-address)})
:subtitle (str amount " " (:symbol token))}]]])
(defn- f-view-internal
[_]
(let [margin-top (safe-area/get-top)
biometric-auth? false
on-close #(rf/dispatch [:navigate-back-within-stack :wallet-select-asset])
send-transaction-data (get-in (rf/sub [:wallet]) [:ui :send])
token (:token send-transaction-data)
amount (:amount send-transaction-data)
route (:route send-transaction-data)
estimated-time-min (:EstimatedTime route)
max-fees-eth 5.28 ; calculate gas price in fiat
to-address (:to-address send-transaction-data)
account (rf/sub [:wallet/current-viewing-account])
account-props {:customization-color (:color account)
:size 32
:emoji (:emoji account)
:type :default
:name (:name account)
:address (utils/get-shortened-address (:address account))}
user-props {:full-name "M L"
:status-indicator? false
:size :small
:ring-background (resources/get-mock-image :ring)
:customization-color :blue
:name "Mark Libot"
:address "0x0ah...78b"
:status-account (merge account-props
{:size 16
:name "New house"
:emoji "🍔"})}]
(fn [{:keys [theme]}]
[rn/view {:style {:flex 1}}
[quo/gradient-cover {:customization-color (:color account)}]
[rn/view {:style (style/container margin-top)}
[quo/page-nav
{:icon-name :i/arrow-left
:on-press on-close
:accessibility-label :top-bar
:right-side [{:icon-name :i/advanced
:on-press (fn callback [] nil)
:accessibility-label "Advanced"}]}]
[transaction-title token amount account to-address]
[transaction-from amount account-props theme]
[transaction-to amount user-props theme]
[transaction-details estimated-time-min max-fees-eth token amount to-address theme]
[rn/view {:style style/slide-button-container}
[standard-auth/slide-button
{:size :size-40
:track-text (i18n/label :t/slide-to-send)
:customization-color (:color account)
:on-enter-password #(rf/dispatch [:wallet/send-transaction %])
:biometric-auth? biometric-auth?
:auth-button-label (i18n/label :t/confirm)}]]]])))
(defn view-internal
[props]
[:f> f-view-internal props])
(def view (quo.theme/with-theme view-internal))
-39
View File
@@ -1,39 +0,0 @@
{:send-push-notifications? true
:send-status-updates? true
:key-uid "0x2a2d3b6722dcbcabaeae48adc0f4147bcb3d94b3cc9606da1a080b765ec5d9b1"
:backup-enabled? true
:address "0x88e052c915950060e6a51438a0524ca76b50d8f4"
:preview-privacy? true
:use-mailservers? true
:signing-phrase "beef flax tram"
:url-unfurling-mode 1
:profile-pictures-visibility 2
:messages-from-contacts-only false
:eip1581-address "0x56b5eb0c8d257a249eb1d6f5838cc356bfa9cbe7"
:name "Red Mediumslateblue Otter"
:latest-derived-path 0
:wallet-root-address "0xd00fc8f05dcf8f2676b066d9fb0e67db794eeb69"
:last-backup 1700127251
:networks/networks []
:gifs/api-key ""
:currency "usd"
:gifs/favorite-gifs nil
:default-sync-period 777600
:photo-path ""
:compressedKey "zQ3sha1FRZXLtZ5aG43vRhGbm1W16crtPMQ1CSbyyqSZXB7Bw"
:current-user-status {:statusType 1 :clock 1700127405 :text ""}
:dapps-address "0x5ffa75ce51c3a7ebe23bde37b5e3a0143dfbcee0"
:display-name "A1234"
:test-networks-enabled? true
:gifs/recent-gifs nil
:appearance 0
:emojiHash ["🫒" "👨🏽‍🏫" "🥄" "👦🏽" "👭" "🚣‍♂️" "🧓🏽" "👩🏿" "👨🏽‍⚖️" "👵🏿" "🕴🏻" "😦" "🙅"
"👩🏻‍🚀"]
:link-preview-request-enabled true
:profile-pictures-show-to 2
:device-name ""
:networks/current-network "mainnet_rpc"
:mutual-contact-enabled? false
:public-key
"0x04bb2024ce5d72e45d4a4f8589ae657ef9745855006996115a23a1af88d536cf02c0524a585fce7bfa79d6a9669af735eda6205d6c7e5b3cdc2b8ff7b2fa1f0b56"
:installation-id "38ff0c3e-58cf-41b3-bc01-48869af9776f"}
-125
View File
@@ -1,125 +0,0 @@
{:Best
[
{:From {:isTest true
:tokenOverrides nil
:rpcUrl "https://goerli-archival.gateway.pokt.network/v1/lb/3ef2018191814b7e1009b8d9"
:chainColor "#939BA1"
:chainName "Ethereum Mainnet"
:nativeCurrencyName "Ether"
:nativeCurrencyDecimals 18
:blockExplorerUrl "https://goerli.etherscan.io/"
:relatedChainId 1
:shortName "goEth"
:layer 1
:chainId 5
:originalFallbackURL "https://goerli.infura.io/v3/"
:iconUrl "network/Network=Testnet"
:originalRpcUrl "https://goerli-archival.gateway.pokt.network/v1/lb/3ef2018191814b7e1009b8d9"
:enabled true
:nativeCurrencySymbol "ETH"
:fallbackURL "https://goerli.infura.io/v3/"}
:AmountInLocked false
:AmountIn "0x16345785d8a0000"
:MaxAmountIn "0x362680d85001805"
:GasFees {:gasPrice "1.3e-08"
:baseFee "1"
:maxPriorityFeePerGas "2e-09"
:maxFeePerGasLow "9e-09"
:maxFeePerGasMedium "1"
:maxFeePerGasHigh "2"
:eip1559Enabled true}
:BridgeName "Transfer"
:AmountOut "0x16345785d8a0000" ;no bridge amount in === amount out, otherwise different
:ApprovalContractAddress nil
:ApprovalRequired false ; always fast - when using bridge
:EstimatedTime 3 ; an enum - see status go
:ApprovalGasFees "0"
:To {:isTest true
:tokenOverrides nil
:rpcUrl "https://goerli-archival.gateway.pokt.network/v1/lb/3ef2018191814b7e1009b8d9"
:chainColor "#939BA1"
:chainName "Ethereum Mainnet"
:nativeCurrencyName "Ether"
:nativeCurrencyDecimals 18
:blockExplorerUrl "https://goerli.etherscan.io/"
:relatedChainId 1
:shortName "goEth"
:layer 1
:chainId 5
:originalFallbackURL "https://goerli.infura.io/v3/"
:iconUrl "network/Network=Testnet"
:originalRpcUrl "https://goerli-archival.gateway.pokt.network/v1/lb/3ef2018191814b7e1009b8d9"
:enabled true
:nativeCurrencySymbol "ETH"
:fallbackURL "https://goerli.infura.io/v3/"}
:BonderFees "0x0"
:ApprovalAmountRequired nil
:Cost "4.3119595404000002308e-10"
:TokenFees "0"
:GasAmount 23487}]
:Candidates
[{:From {:isTest true
:tokenOverrides nil
:rpcUrl "https://goerli-archival.gateway.pokt.network/v1/lb/3ef2018191814b7e1009b8d9"
:chainColor "#939BA1"
:chainName "Ethereum Mainnet"
:nativeCurrencyName "Ether"
:nativeCurrencyDecimals 18
:blockExplorerUrl "https://goerli.etherscan.io/"
:relatedChainId 1
:shortName "goEth"
:layer 1
:chainId 5
:originalFallbackURL "https://goerli.infura.io/v3/"
:iconUrl "network/Network=Testnet"
:originalRpcUrl "https://goerli-archival.gateway.pokt.network/v1/lb/3ef2018191814b7e1009b8d9"
:enabled true
:nativeCurrencySymbol "ETH"
:fallbackURL "https://goerli.infura.io/v3/"}
:AmountInLocked false
:AmountIn "0x16345785d8a0000"
:MaxAmountIn "0x362680d85001805"
:GasFees {:gasPrice "1.3e-08"
:baseFee "1"
:maxPriorityFeePerGas "2e-09"
:maxFeePerGasLow "9e-09"
:maxFeePerGasMedium "1"
:maxFeePerGasHigh "2"
:eip1559Enabled true}
:BridgeName "Transfer"
:AmountOut "0x16345785d8a0000"
:ApprovalContractAddress nil
:ApprovalRequired false
:EstimatedTime 3
:ApprovalGasFees "0"
:To {:isTest true
:tokenOverrides nil
:rpcUrl "https://goerli-archival.gateway.pokt.network/v1/lb/3ef2018191814b7e1009b8d9"
:chainColor "#939BA1"
:chainName "Ethereum Mainnet"
:nativeCurrencyName "Ether"
:nativeCurrencyDecimals 18
:blockExplorerUrl "https://goerli.etherscan.io/"
:relatedChainId 1
:shortName "goEth"
:layer 1
:chainId 5
:originalFallbackURL "https://goerli.infura.io/v3/"
:iconUrl "network/Network=Testnet"
:originalRpcUrl "https://goerli-archival.gateway.pokt.network/v1/lb/3ef2018191814b7e1009b8d9"
:enabled true
:nativeCurrencySymbol "ETH"
:fallbackURL "https://goerli.infura.io/v3/"}
:BonderFees "0x0"
:ApprovalAmountRequired nil
:Cost "4.3119595404000002308e-10" ; "USD" or local currency
:TokenFees "0"
:GasAmount 23487}]
:TokenPrice 2039.88
:NativeChainTokenPrice 2039.88}
-5
View File
@@ -54,7 +54,6 @@
[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.contexts.wallet.send.transaction-confirmation.view :as wallet-transaction-confirmation]
[status-im2.navigation.options :as options]
[status-im2.navigation.transitions :as transitions]))
@@ -312,10 +311,6 @@
:options {:insets {:top? true}}
:component wallet-select-asset/view}
{:name :wallet-transaction-confirmation
:options {:insets {:bottom? true}}
:component wallet-transaction-confirmation/view}
{:name :scan-address
:options (merge
options/dark-screen
+10 -2
View File
@@ -442,11 +442,19 @@
(fn [previews]
(get previews :unfurled)))
(re-frame/reg-sub
:chats/status-link-previews-unfurled
:<- [:chat/status-link-previews]
(fn [previews]
(get previews :unfurled)))
(re-frame/reg-sub
:chats/link-previews?
:<- [:chats/link-previews-unfurled]
(fn [previews]
(boolean (seq previews))))
:<- [:chats/status-link-previews-unfurled]
(fn [previews status-link-previews]
(or (boolean (seq status-link-previews))
(boolean (seq previews)))))
(re-frame/reg-sub
:chat/check-channel-muted?
+6
View File
@@ -152,6 +152,12 @@
(fn [messages [_ chat-id message-id]]
(get-in messages [chat-id message-id :link-previews])))
(re-frame/reg-sub
:chats/message-status-link-previews
:<- [:messages/messages]
(fn [messages [_ chat-id message-id]]
(get-in messages [chat-id message-id :status-link-previews])))
(re-frame/reg-sub
:chats/pinned
:<- [:messages/pin-messages]
+1
View File
@@ -156,6 +156,7 @@
(reg-root-key-sub :wallet/scanned-address :wallet/scanned-address)
(reg-root-key-sub :wallet/local-suggestions :wallet/local-suggestions)
(reg-root-key-sub :wallet/valid-ens-or-address? :wallet/valid-ens-or-address?)
(reg-root-key-sub :wallet/send-address :wallet/send-address)
;;debug
(when js/goog.DEBUG
+14 -2
View File
@@ -48,7 +48,7 @@
:<- [:wallet/balances]
:<- [:wallet/tokens-loading?]
(fn [[accounts balances tokens-loading?]]
(mapv (fn [{:keys [color address] :as account}]
(mapv (fn [{:keys [color address type] :as account}]
(assoc account
:customization-color color
:type (if (= type :watch) :watch-only :empty)
@@ -75,7 +75,7 @@
(assoc token
:networks (utils/network-list token networks)
:total-balance (utils/total-token-value-in-all-chains token)
:total-balance-fiat (utils/calculate-balance-for-token token)))
:total-balance-fiat (utils/calculate-balance token)))
(:tokens account))
sorted-tokens
@@ -87,3 +87,15 @@
(string/lower-case query)))
sorted-tokens)]
filtered-tokens)))
(rf/reg-sub
:wallet/current-viewing-account-address
:<- [:wallet]
:-> :current-viewing-account-address)
(rf/reg-sub
:wallet/accounts-without-current-viewing-account
:<- [:wallet/accounts]
:<- [:wallet/current-viewing-account-address]
(fn [[accounts current-viewing-account-address]]
(remove #(= (:address %) current-viewing-account-address) accounts)))
@@ -193,3 +193,40 @@
(testing "watch address activity state with has-activity value"
(swap! rf-db/app-db #(assoc-in % [:wallet :ui :watch-address-activity-state] :has-activity))
(is (= :has-activity (rf/sub [sub-name])))))
(h/deftest-sub :wallet/current-viewing-account-address
[sub-name]
(testing "returns the address of the current viewing account"
(swap! rf-db/app-db #(assoc-in % [:wallet :current-viewing-account-address] "0x1"))
(is (= "0x1" (rf/sub [sub-name])))))
(h/deftest-sub :wallet/accounts-without-current-viewing-account
[sub-name]
(testing "returns the accounts list without the current viewing account in it"
(swap! rf-db/app-db
#(-> %
(assoc-in [:wallet :accounts] accounts)
(assoc-in [:wallet :current-viewing-account-address] "0x2")))
(is
(= (list
{:path "m/44'/60'/0'/0/0"
:emoji "😃"
:key-uid "0x2f5ea39"
:address "0x1"
:wallet false
:name "Account One"
:type :generated
:chat false
:test-preferred-chain-ids #{5 420 421613}
:color :blue
:hidden false
:prod-preferred-chain-ids #{1 10 42161}
:position 0
:clock 1698945829328
:created-at 1698928839000
:operable "fully"
:mixedcase-address "0x7bcDfc75c431"
:public-key "0x04371e2d9d66b82f056bc128064"
:removed false
:tokens tokens-0x1})
(rf/sub [sub-name])))))
+2 -6
View File
@@ -152,7 +152,7 @@
;; E.g. for Ether, it's smallest part is wei or 10^(-18) of 1 ether
;; for arbitrary ERC20 token the smallest part is 10^(-decimals) of 1 token
;;
;; Different tokens can have different number of allowed decimals, so it's necessary to include the
;; Different tokens can have different number of allowed decimals, so it's neccessary to include the
;; decimals parameter
;; to get the amount scale right.
@@ -205,14 +205,10 @@
(with-precision 2)
str))
(defn- add*
(defn add
[bn1 n2]
(.add ^js bn1 n2))
(def add
"Add with defaults, this version is able to receive `nil` and takes them as 0."
(fnil add* (bignumber 0) (bignumber 0)))
(defn mul
[bn1 bn2]
(.mul ^js bn1 bn2))
+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.25",
"commit-sha1": "8206ffc736cdf054f0699b98c3cb52ce6bd6ed96",
"src-sha256": "12lfn5xlg9n1fgk9zbi92kmzsqz7wv9zm84xsiisl495w4y8dvsl"
"version": "status-mobile-17116",
"commit-sha1": "cfd85f8b2c5f0c094ea7451acd4b2ed3232cb97e",
"src-sha256": "15x8ynbqx2sk19hkyy8x45hglf99c0x7vm3lpik0aw5d8i5zcgvm"
}
+1 -5
View File
@@ -2398,9 +2398,5 @@
"send-limit": "Max: {{limit}}",
"searching-for-activity": "Searching for activity...",
"this-address-has-no-activity": "This address has no activity",
"this-address-has-activity": "This address has activity",
"details": "Details",
"est-time": "Est. time",
"user-gets": "{{name}} gets",
"slide-to-send": "Slide to send"
"this-address-has-activity": "This address has activity"
}