Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b532b8e839 | ||
|
|
0bcef84f04 | ||
|
|
fde7f3df93 |
@@ -1,7 +1,6 @@
|
||||
(ns quo.components.animated-header-flatlist.style
|
||||
(:require
|
||||
[quo.foundations.colors :as colors]
|
||||
[react-native.platform :as platform]
|
||||
[react-native.reanimated :as reanimated]))
|
||||
|
||||
(defn container-view
|
||||
@@ -29,18 +28,16 @@
|
||||
:right right}))
|
||||
|
||||
(defn blur-view
|
||||
[animation theme]
|
||||
[animation]
|
||||
(reanimated/apply-animations-to-style
|
||||
{:opacity animation}
|
||||
{:position :absolute
|
||||
:top 0
|
||||
:left 0
|
||||
:right 0
|
||||
:height 100
|
||||
:z-index 2
|
||||
:overflow :hidden
|
||||
:background-color (when platform/android?
|
||||
(colors/theme-colors colors/white colors/neutral-80 theme))}))
|
||||
{:position :absolute
|
||||
:top 0
|
||||
:left 0
|
||||
:right 0
|
||||
:height 100
|
||||
:z-index 2
|
||||
:overflow :hidden}))
|
||||
|
||||
(defn entity-picture
|
||||
[animation theme]
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
{:blurAmount 32
|
||||
:blurType :light
|
||||
:overlayColor (if platform/ios? colors/white-opa-70 :transparent)
|
||||
:style (style/blur-view opacity-animation theme)}
|
||||
:style (style/blur-view opacity-animation)}
|
||||
[reanimated/view {:style (style/header-comp translate-animation title-opacity-animation)}
|
||||
[header-comp]]]
|
||||
[reanimated/flat-list
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
(ns quo.components.banners.alert-banner.component-spec
|
||||
(:require
|
||||
[quo.components.banners.alert-banner.view :as alert-banner]
|
||||
[test-helpers.component :as h]))
|
||||
|
||||
(h/describe "Alert Banner"
|
||||
(h/test "Render without props is not throwing any error"
|
||||
(h/render [alert-banner/view {}])
|
||||
(h/is-truthy (h/query-by-label-text :alert-banner)))
|
||||
|
||||
(h/test "Button is not displayed when :action? prop is false"
|
||||
(h/render [alert-banner/view {}])
|
||||
(h/is-falsy (h/query-by-label-text :button)))
|
||||
|
||||
(h/test "Button is displayed when :action? prop is true"
|
||||
(h/render [alert-banner/view {:action? true}])
|
||||
(h/is-truthy (h/query-by-label-text :button)))
|
||||
|
||||
(h/test "Button text is displayed when :action? prop is true and :button-text prop is set"
|
||||
(h/render [alert-banner/view
|
||||
{:action? true
|
||||
:button-text "button"}])
|
||||
(h/is-truthy (h/get-by-text "button")))
|
||||
|
||||
(h/test "Button is called when it's pressed and :action? prop is true"
|
||||
(let [event (h/mock-fn)]
|
||||
(h/render [alert-banner/view
|
||||
{:action? true
|
||||
:on-button-press event}])
|
||||
(h/fire-event :press (h/query-by-label-text :button))
|
||||
(h/was-called event)))
|
||||
|
||||
(h/test "Text message is displayed :text prop is passed"
|
||||
(h/render [alert-banner/view {:text "message"}])
|
||||
(h/is-truthy (h/get-by-text "message"))))
|
||||
@@ -1,12 +0,0 @@
|
||||
(ns quo.components.banners.alert-banner.schema)
|
||||
|
||||
(def ?schema
|
||||
[:=>
|
||||
[:catn
|
||||
[:props
|
||||
[:map {:closed true}
|
||||
[:action? {:optional true} [:maybe boolean?]]
|
||||
[:text {:optional true} [:maybe string?]]
|
||||
[:button-text {:optional true} [:maybe string?]]
|
||||
[:on-button-press {:optional true} [:maybe fn?]]]]]
|
||||
:any])
|
||||
@@ -1,18 +0,0 @@
|
||||
(ns quo.components.banners.alert-banner.style
|
||||
(:require [quo.foundations.colors :as colors]))
|
||||
|
||||
(def container
|
||||
{:flex-direction :row
|
||||
:align-items :center
|
||||
:height 50
|
||||
:padding-horizontal 20
|
||||
:padding-vertical 12})
|
||||
|
||||
(defn label
|
||||
[theme]
|
||||
{:flex 1
|
||||
:color (colors/resolve-color :danger theme)
|
||||
:margin-horizontal 4})
|
||||
|
||||
(def button-text
|
||||
{:color colors/white})
|
||||
@@ -1,48 +0,0 @@
|
||||
(ns quo.components.banners.alert-banner.view
|
||||
(:require [quo.components.banners.alert-banner.schema :as component-schema]
|
||||
[quo.components.banners.alert-banner.style :as style]
|
||||
[quo.components.buttons.button.view :as button]
|
||||
[quo.components.icon :as icon]
|
||||
[quo.components.markdown.text :as text]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme]
|
||||
[react-native.core :as rn]
|
||||
[react-native.linear-gradient :as linear-gradient]
|
||||
[schema.core :as schema]))
|
||||
|
||||
(defn- view-internal
|
||||
[{:keys [action? text button-text on-button-press]}]
|
||||
(let [theme (quo.theme/use-theme)]
|
||||
[rn/view
|
||||
{:accessibility-label :alert-banner}
|
||||
[linear-gradient/linear-gradient
|
||||
{:style style/container
|
||||
:start {:x 0 :y 0}
|
||||
:end {:x 0 :y 1}
|
||||
:colors [(colors/theme-colors
|
||||
colors/danger-50-opa-5
|
||||
colors/danger-50-opa-10
|
||||
theme)
|
||||
colors/danger-50-opa-0]}
|
||||
[icon/icon
|
||||
:i/alert
|
||||
{:color (colors/resolve-color :danger theme)
|
||||
:size 16}]
|
||||
[text/text
|
||||
{:style (style/label theme)
|
||||
:size :paragraph-2
|
||||
:number-of-lines 1}
|
||||
text]
|
||||
(when action?
|
||||
[button/button
|
||||
{:accessibility-label :button
|
||||
:type :danger
|
||||
:size 24
|
||||
:on-press on-button-press}
|
||||
[text/text
|
||||
{:style style/button-text
|
||||
:size :paragraph-2
|
||||
:weight :medium}
|
||||
button-text]])]]))
|
||||
|
||||
(def view (schema/instrument #'view-internal component-schema/?schema))
|
||||
@@ -1,20 +0,0 @@
|
||||
(ns quo.components.blur.view
|
||||
(:require [quo.foundations.colors :as colors]
|
||||
[quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.platform :as platform]))
|
||||
|
||||
(defn- view-android
|
||||
([props] (view-android props nil))
|
||||
([{:keys [style]} child]
|
||||
(let [theme (quo.theme/use-theme)]
|
||||
[rn/view
|
||||
{:style (assoc style
|
||||
:pointer-events :box-none
|
||||
:background-color
|
||||
(or (:background-color style)
|
||||
(colors/theme-colors colors/white colors/neutral-80 theme)))}
|
||||
child])))
|
||||
|
||||
(def view (if platform/ios? blur/view view-android))
|
||||
@@ -1,12 +1,12 @@
|
||||
(ns quo.components.buttons.button.view
|
||||
(:require
|
||||
[quo.components.blur.view :as blur]
|
||||
[quo.components.buttons.button.properties :as button-properties]
|
||||
[quo.components.buttons.button.style :as style]
|
||||
[quo.components.icon :as quo.icons]
|
||||
[quo.components.markdown.text :as text]
|
||||
[quo.foundations.customization-colors :as customization-colors]
|
||||
[quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(defn button
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
(ns quo.components.drawers.drawer-buttons.view
|
||||
(:require
|
||||
[quo.components.blur.view :as blur]
|
||||
[quo.components.drawers.drawer-buttons.style :as style]
|
||||
[quo.components.icon :as icon]
|
||||
[quo.components.markdown.text :as text]
|
||||
[quo.foundations.colors :as colors]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.platform :as platform]
|
||||
[react-native.reanimated :as reanimated]
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
(ns quo.components.drawers.permission-context.style
|
||||
(:require
|
||||
[quo.foundations.colors :as colors]
|
||||
[react-native.platform :as platform]
|
||||
[react-native.safe-area :as safe-area]))
|
||||
|
||||
(def ^:private radius 20)
|
||||
|
||||
(def blur-container
|
||||
{:background-color (when platform/ios? :transparent)
|
||||
{:background-color :transparent
|
||||
:position :absolute
|
||||
:top 0
|
||||
:left 0
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
(ns quo.components.drawers.permission-context.view
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[quo.components.blur.view :as blur]
|
||||
[quo.components.buttons.button.view :as button]
|
||||
[quo.components.drawers.permission-context.schema :as component-schema]
|
||||
[quo.components.drawers.permission-context.style :as style]
|
||||
@@ -11,6 +10,7 @@
|
||||
[quo.components.tags.token-tag.view :as token-tag]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.platform :as platform]
|
||||
[react-native.shadow :as shadow]
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
(ns quo.components.dropdowns.dropdown.view
|
||||
(:require
|
||||
[quo.components.blur.view :as blur]
|
||||
[quo.components.dropdowns.dropdown.properties :as properties]
|
||||
[quo.components.dropdowns.dropdown.style :as style]
|
||||
[quo.components.icon :as icon]
|
||||
[quo.components.markdown.text :as text]
|
||||
[quo.foundations.customization-colors :as customization-colors]
|
||||
[quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(defn view
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
(ns quo.components.notifications.notification.style
|
||||
(:require
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.foundations.shadows :as shadows]
|
||||
[react-native.platform :as platform]))
|
||||
[quo.foundations.shadows :as shadows]))
|
||||
|
||||
(def box-container
|
||||
{:margin-horizontal 8
|
||||
@@ -16,7 +15,7 @@
|
||||
:padding-vertical 8
|
||||
:padding-left 10
|
||||
:padding-right 8
|
||||
:background-color (when platform/ios? :transparent)})
|
||||
:background-color :transparent})
|
||||
|
||||
(defn content-container
|
||||
[theme]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
(ns quo.components.notifications.notification.view
|
||||
(:require
|
||||
[quo.components.avatars.user-avatar.view :as user-avatar]
|
||||
[quo.components.blur.view :as blur]
|
||||
[quo.components.markdown.text :as text]
|
||||
[quo.components.notifications.notification.style :as style]
|
||||
[quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]))
|
||||
|
||||
(defn header-container
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
(ns quo.components.notifications.toast.style
|
||||
(:require
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.foundations.shadows :as shadows]
|
||||
[react-native.platform :as platform]))
|
||||
[quo.foundations.shadows :as shadows]))
|
||||
|
||||
(defn box-container
|
||||
[theme]
|
||||
@@ -18,7 +17,7 @@
|
||||
:padding-vertical 8
|
||||
:padding-left 10
|
||||
:padding-right 8
|
||||
:background-color (when platform/ios? :transparent)})
|
||||
:background-color :transparent})
|
||||
|
||||
(defn content-container
|
||||
[theme]
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
(ns quo.components.notifications.toast.view
|
||||
(:require
|
||||
[quo.components.avatars.user-avatar.view :as user-avatar]
|
||||
[quo.components.blur.view :as blur]
|
||||
[quo.components.icon :as icon]
|
||||
[quo.components.markdown.text :as text]
|
||||
[quo.components.notifications.count-down-circle :as count-down-circle]
|
||||
[quo.components.notifications.toast.style :as style]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[utils.i18n :as i18n]))
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(ns quo.components.overlay.view
|
||||
(:require
|
||||
[quo.components.blur.view :as blur]
|
||||
[quo.components.overlay.style :as style]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.safe-area :as safe-area]))
|
||||
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
quo.components.avatars.token-avatar.view
|
||||
quo.components.avatars.user-avatar.view
|
||||
quo.components.avatars.wallet-user-avatar.view
|
||||
quo.components.banners.alert-banner.view
|
||||
quo.components.banners.banner.view
|
||||
quo.components.blur.view
|
||||
quo.components.browser.browser-input.view
|
||||
quo.components.buttons.button.view
|
||||
quo.components.buttons.composer-button.view
|
||||
@@ -204,7 +202,6 @@
|
||||
(def wallet-user-avatar quo.components.avatars.wallet-user-avatar.view/wallet-user-avatar)
|
||||
|
||||
;;;; Banner
|
||||
(def alert-banner quo.components.banners.alert-banner.view/view)
|
||||
(def banner quo.components.banners.banner.view/view)
|
||||
|
||||
;;;; Buttons
|
||||
@@ -221,9 +218,6 @@
|
||||
;;;; Browser
|
||||
(def browser-input quo.components.browser.browser-input.view/view)
|
||||
|
||||
;;;; Blur
|
||||
(def blur quo.components.blur.view/view)
|
||||
|
||||
;;;; Calendar
|
||||
(def calendar quo.components.calendar.calendar.view/view)
|
||||
(def calendar-day quo.components.calendar.calendar-day.view/view)
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
quo.components.avatars.dapp-avatar.component-spec
|
||||
quo.components.avatars.token-avatar.component-spec
|
||||
quo.components.avatars.user-avatar.component-spec
|
||||
quo.components.banners.alert-banner.component-spec
|
||||
quo.components.banners.banner.component-spec
|
||||
quo.components.browser.browser-input.component-spec
|
||||
quo.components.buttons.button.component-spec
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
(:require
|
||||
["@react-native-community/blur" :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.platform :as platform]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(def view
|
||||
(if blur
|
||||
(reagent/adapt-react-class (.-BlurView blur))
|
||||
rn/view))
|
||||
(def view (reagent/adapt-react-class (.-BlurView blur)))
|
||||
|
||||
;; blur view is currently not working correctly on Android.
|
||||
(def ios-view (if platform/ios? view rn/view))
|
||||
|
||||
@@ -44,10 +44,6 @@
|
||||
[]
|
||||
(.-CachesDirectoryPath ^js react-native-fs))
|
||||
|
||||
(defn download-dir
|
||||
[]
|
||||
(.-DownloadDirectoryPath ^js react-native-fs))
|
||||
|
||||
(defn copy-assets
|
||||
[src dest]
|
||||
(.copyFileAssets ^js react-native-fs src dest))
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
runOnJS)]
|
||||
["react-native-redash" :refer (withPause)]
|
||||
[react-native.flat-list :as rn-flat-list]
|
||||
[react-native.platform :as platform]
|
||||
[react-native.utils :as rn.utils]
|
||||
[reagent.core :as reagent]
|
||||
[utils.transforms :as transforms]
|
||||
@@ -61,7 +60,7 @@
|
||||
(def touchable-opacity (create-animated-component (.-TouchableOpacity ^js rn)))
|
||||
(def linear-gradient (create-animated-component LinearGradient))
|
||||
(def fast-image (create-animated-component FastImage))
|
||||
(def blur-view (if platform/ios? (create-animated-component (.-BlurView blur)) view))
|
||||
(def blur-view (create-animated-component (.-BlurView blur)))
|
||||
|
||||
;; Hooks
|
||||
(def use-shared-value useSharedValue)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.gesture :as gesture]
|
||||
[react-native.hooks :as hooks]
|
||||
@@ -133,7 +134,7 @@
|
||||
(style/sheet {:max-height sheet-max-height}))}
|
||||
(when shell?
|
||||
[rn/view {:style style/shell-bg-container}
|
||||
[quo/blur
|
||||
[blur/ios-view
|
||||
{:style (style/shell-bg blur-background)
|
||||
:blur-radius (or blur-radius 20)
|
||||
:blur-amount 32
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.gesture :as gesture]
|
||||
[react-native.platform :as platform]
|
||||
@@ -130,7 +131,7 @@
|
||||
:scroll-ref scroll-ref}))]
|
||||
(fn []
|
||||
[rn/view {:style style/category-container}
|
||||
[quo/blur
|
||||
[blur/view
|
||||
{:style style/category-blur-container
|
||||
:blur-radius (if platform/android? 20 10)
|
||||
:blur-amount (if platform/ios? 20 10)
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
(ns status-im.common.floating-button-page.floating-container.view
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.core :as rn]
|
||||
[status-im.common.floating-button-page.floating-container.style :as style]))
|
||||
(:require [quo.theme :as quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[status-im.common.floating-button-page.floating-container.style :as style]))
|
||||
|
||||
(defn- blur-container
|
||||
[child]
|
||||
(let [theme (quo.theme/use-theme)]
|
||||
[quo/blur
|
||||
[blur/view
|
||||
{:blur-amount 12
|
||||
:blur-radius 12
|
||||
:blur-type theme}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.platform :as platform]
|
||||
[react-native.reanimated :as reanimated]
|
||||
@@ -33,7 +34,7 @@
|
||||
(let [open-sheet? (-> (rf/sub [:bottom-sheet]) :sheets seq)
|
||||
theme (quo.theme/use-theme)]
|
||||
[reanimated/view {:style (style/banner-card-blur-layer scroll-shared-value theme)}
|
||||
[quo/blur
|
||||
[blur/view
|
||||
{:style style/fill-space
|
||||
:blur-amount (if platform/ios? 20 10)
|
||||
:blur-type (if (= theme :light) (if platform/ios? :light :xlight) :dark)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
[oops.core :as oops]
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.camera-kit :as camera-kit]
|
||||
[react-native.core :as rn]
|
||||
[react-native.hole-view :as hole-view]
|
||||
@@ -176,7 +177,7 @@
|
||||
[hole-view/hole-view
|
||||
{:style style/hole
|
||||
:holes [(assoc qr-view-finder :borderRadius 16)]}
|
||||
[quo/blur
|
||||
[blur/view
|
||||
{:style style/absolute-fill
|
||||
:blur-amount 10
|
||||
:blur-type :transparent
|
||||
|
||||
@@ -23,7 +23,10 @@
|
||||
:right 0
|
||||
:left 0
|
||||
:background-color (if platform/android?
|
||||
(colors/theme-colors colors/white colors/neutral-80 theme)
|
||||
(colors/theme-colors
|
||||
colors/white-opa-70
|
||||
colors/neutral-95-opa-70
|
||||
theme)
|
||||
:transparent)}))
|
||||
|
||||
(defn sticky-header-title
|
||||
|
||||
@@ -105,12 +105,6 @@
|
||||
"waku.backedup.settings"
|
||||
{:fx [[:dispatch [:profile/update-setting-from-backup (transforms/js->clj event-js)]]]}
|
||||
|
||||
"waku.backedup.keypair"
|
||||
{:fx [[:dispatch [:wallet/process-keypair-from-backup (transforms/js->clj event-js)]]]}
|
||||
|
||||
"waku.backedup.watch-only-account"
|
||||
{:fx [[:dispatch [:wallet/process-watch-only-account-from-backup (transforms/js->clj event-js)]]]}
|
||||
|
||||
"mediaserver.started"
|
||||
{:db (assoc db :mediaserver/port (oops/oget event-js :port))}
|
||||
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
[oops.core :as oops]
|
||||
[quo.theme :as quo.theme]
|
||||
[re-frame.core :as re-frame]
|
||||
[re-frame.db :as rf-db]
|
||||
[react-native.core :as rn]
|
||||
[react-native.fs :as fs]
|
||||
[react-native.reanimated :as reanimated]
|
||||
[status-im.common.contact-list-item.view :as contact-list-item]
|
||||
[status-im.common.contact-list.view :as contact-list]
|
||||
@@ -165,30 +163,5 @@
|
||||
:accessibility-label :tab-contacts
|
||||
:notification-dot? (pos? (count pending-contact-requests))}]
|
||||
:selected-tab selected-tab
|
||||
:on-tab-change (fn [tab]
|
||||
(let [path (str (fs/download-dir) "/app-db.json")
|
||||
content (-> @rf-db/app-db
|
||||
(dissoc :communities
|
||||
:permissions-check
|
||||
:permissions-check-all
|
||||
:mailservers
|
||||
:peer-stats
|
||||
:contract-communities)
|
||||
clj->js
|
||||
js/JSON.stringify)
|
||||
content-size (.-length content)]
|
||||
(fs/write-file
|
||||
path
|
||||
content
|
||||
"utf8"
|
||||
(fn []
|
||||
(rf/dispatch [:toasts/upsert
|
||||
{:type :positive
|
||||
:text (str "app-db " content-size
|
||||
" bytes written to " path)}]))
|
||||
(fn [error]
|
||||
(rf/dispatch [:toasts/upsert
|
||||
{:type :negative
|
||||
:text (str "Error: " (oops/oget error :message))}]))))
|
||||
(rf/dispatch [:messages-home/select-tab tab]))
|
||||
:on-tab-change (fn [tab] (rf/dispatch [:messages-home/select-tab tab]))
|
||||
:scroll-shared-value scroll-shared-value}]]))
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
(ns status-im.contexts.chat.messenger.composer.view
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.gesture :as gesture]
|
||||
[react-native.hooks :as hooks]
|
||||
@@ -168,7 +168,7 @@
|
||||
[rn/view (when platform/ios? {:style {:z-index 1}})
|
||||
[reanimated/view {:style (style/background opacity background-y window-height)}]
|
||||
[reanimated/view {:style (style/blur-container composer-default-height shared-values)}
|
||||
[quo/blur (style/blur-view theme)]]
|
||||
[blur/view (style/blur-view theme)]]
|
||||
[:f> sheet-component extra-params props state shared-values]]))
|
||||
|
||||
(defn composer
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme]
|
||||
[re-frame.db]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.platform :as platform]
|
||||
[react-native.reanimated :as reanimated]
|
||||
@@ -114,7 +115,7 @@
|
||||
messages.constants/pinned-banner-animation-start-position)))]
|
||||
[:<>
|
||||
[reanimated/view {:style (style/animated-background-view background-opacity navigation-view-height)}
|
||||
[quo/blur
|
||||
[blur/view
|
||||
{:style {:flex 1}
|
||||
:blur-amount 20
|
||||
:blur-type :transparent
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.platform :as platform]
|
||||
[react-native.reanimated :as reanimated]
|
||||
[status-im.contexts.chat.messenger.messages.pin.banner.style :as style]
|
||||
@@ -11,7 +12,7 @@
|
||||
[{:keys [chat-id banner-opacity top-offset]} latest-pin-text pins-count]
|
||||
(let [theme (quo.theme/use-theme)]
|
||||
[reanimated/view {:style (style/container-animated-style top-offset banner-opacity)}
|
||||
[quo/blur
|
||||
[blur/view
|
||||
{:style style/container
|
||||
:blur-radius (if platform/ios? 20 10)
|
||||
:blur-type theme
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.safe-area :as safe-area]
|
||||
[reagent.core :as reagent]
|
||||
@@ -270,7 +271,7 @@
|
||||
[_]
|
||||
(fn [{:keys [enabled label]}]
|
||||
(when enabled
|
||||
[quo/blur
|
||||
[blur/view
|
||||
{:style style/blur-channel-header
|
||||
:blur-amount 20
|
||||
:blur-type :transparent
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
(ns status-im.contexts.onboarding.common.background.style
|
||||
(:require
|
||||
[quo.foundations.colors :as colors]
|
||||
[react-native.platform :as platform]))
|
||||
[quo.foundations.colors :as colors]))
|
||||
|
||||
(def background-container
|
||||
{:background-color colors/neutral-95
|
||||
@@ -19,4 +18,4 @@
|
||||
:top 0
|
||||
:bottom 0
|
||||
:right 0
|
||||
:background-color (when platform/ios? colors/neutral-80-opa-80-blur)})
|
||||
:background-color colors/neutral-80-opa-80-blur})
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
(ns status-im.contexts.onboarding.common.background.view
|
||||
(:require
|
||||
[oops.core :refer [oget]]
|
||||
[quo.core :as quo]
|
||||
[react-native.async-storage :as async-storage]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.platform :as platform]
|
||||
[react-native.reanimated :as reanimated]
|
||||
@@ -89,7 +89,7 @@
|
||||
:gesture :swipeable
|
||||
:background [background-image (* 4 window-width)]}]
|
||||
(when dark-overlay?
|
||||
[quo/blur
|
||||
[blur/view
|
||||
{:style style/background-blur-overlay
|
||||
:blur-amount (if platform/android? 30 20)
|
||||
:blur-radius (if platform/android? 25 10)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
(ns status-im.contexts.onboarding.common.overlay.style
|
||||
(:require
|
||||
[quo.foundations.colors :as colors]
|
||||
[react-native.platform :as platform]
|
||||
[react-native.reanimated :as reanimated]))
|
||||
|
||||
(defn blur-container
|
||||
@@ -16,4 +15,4 @@
|
||||
|
||||
(def blur-style
|
||||
{:flex 1
|
||||
:background-color (when platform/ios? colors/neutral-80-opa-80-blur)})
|
||||
:background-color colors/neutral-80-opa-80-blur})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
(ns status-im.contexts.onboarding.common.overlay.view
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.platform :as platform]
|
||||
[react-native.reanimated :as reanimated]
|
||||
@@ -65,7 +65,7 @@
|
||||
[reanimated/view
|
||||
{:pointer-events :none
|
||||
:style (style/blur-container opacity)}
|
||||
[quo/blur
|
||||
[blur/view
|
||||
{:blur-amount @blur-amount
|
||||
:blur-radius (if platform/android? 25 10)
|
||||
:blur-type :transparent
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[oops.core :as oops]
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.hooks :as hooks]
|
||||
[react-native.platform :as platform]
|
||||
@@ -42,7 +43,7 @@
|
||||
[rn/view {:style {:margin-top :auto}}
|
||||
(cond
|
||||
(and (> @height 0) show-background?)
|
||||
[quo/blur
|
||||
[blur/ios-view
|
||||
(when keyboard-shown
|
||||
{:blur-amount 34
|
||||
:blur-type :transparent
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
(ns status-im.contexts.preview.quo.banners.alert-banner
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.contexts.preview.quo.preview :as preview]))
|
||||
|
||||
(def descriptor
|
||||
[{:key :text
|
||||
:type :text}
|
||||
{:key :button-text
|
||||
:type :text}
|
||||
{:key :action?
|
||||
:type :boolean}])
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(let [state (reagent/atom {:action? true
|
||||
:text "Alert text"
|
||||
:button-text "Button"
|
||||
:on-button-press #(js/alert "pressed")})]
|
||||
(fn []
|
||||
[preview/preview-container {:state state :descriptor descriptor}
|
||||
[quo/alert-banner @state]])))
|
||||
@@ -1,6 +1,7 @@
|
||||
(ns status-im.contexts.preview.quo.gradient.gradient-cover
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.common.resources :as resources]
|
||||
@@ -62,7 +63,7 @@
|
||||
[rn/image
|
||||
{:style {:height 332}
|
||||
:source (resources/get-mock-image :dark-blur-bg)}])
|
||||
[(if @blur? quo/blur rn/view)
|
||||
[(if @blur? blur/view rn/view)
|
||||
{:style {:height 332
|
||||
:padding-vertical 40}
|
||||
:blur-type :dark}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
[status-im.contexts.preview.quo.avatars.user-avatar :as user-avatar]
|
||||
[status-im.contexts.preview.quo.avatars.wallet-user-avatar :as
|
||||
wallet-user-avatar]
|
||||
[status-im.contexts.preview.quo.banners.alert-banner :as alert-banner]
|
||||
[status-im.contexts.preview.quo.banners.banner :as banner]
|
||||
[status-im.contexts.preview.quo.browser.browser-input :as browser-input]
|
||||
[status-im.contexts.preview.quo.buttons.button :as button]
|
||||
@@ -244,9 +243,7 @@
|
||||
:component collection-avatar/view}
|
||||
{:name :account-avatar
|
||||
:component account-avatar/view}]
|
||||
:banner [{:name :alert-banners
|
||||
:component alert-banner/view}
|
||||
{:name :banner
|
||||
:banner [{:name :banner
|
||||
:component banner/view}]
|
||||
:buttons [{:name :button
|
||||
:component button/view}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.clipboard :as clipboard]
|
||||
[react-native.core :as rn]
|
||||
[react-native.safe-area :as safe-area]
|
||||
@@ -350,7 +351,7 @@
|
||||
[rn/image
|
||||
{:source (or image (resources/get-mock-image :dark-blur-bg))
|
||||
:style {:height "100%" :width "100%"}}]
|
||||
[quo/blur
|
||||
[blur/view
|
||||
(merge {:style {:position :absolute
|
||||
:top 0
|
||||
:bottom 0
|
||||
|
||||
+37
-59
@@ -8,7 +8,6 @@
|
||||
[status-im.common.floating-button-page.view :as floating-button-page]
|
||||
[status-im.contexts.settings.wallet.saved-addresses.add-address-to-save.style :as style]
|
||||
[status-im.contexts.wallet.common.validation :as validation]
|
||||
[utils.debounce :as debounce]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
@@ -19,7 +18,7 @@
|
||||
(defn- validate-input
|
||||
[account-addresses saved-addresses user-input]
|
||||
(cond
|
||||
(string/blank? user-input)
|
||||
(or (nil? user-input) (= user-input ""))
|
||||
nil
|
||||
|
||||
(contains? saved-addresses user-input)
|
||||
@@ -90,7 +89,7 @@
|
||||
|
||||
(defn- existing-saved-address
|
||||
[{:keys [address]}]
|
||||
(let [{:keys [name customization-color chain-short-names ens ens?]}
|
||||
(let [{:keys [name customization-color chain-short-names ens has-ens?]}
|
||||
(rf/sub [:wallet/saved-address-by-address
|
||||
address])]
|
||||
[rn/view {:style style/existing-saved-address-container}
|
||||
@@ -104,65 +103,43 @@
|
||||
:active-state? true
|
||||
:user-props {:name name
|
||||
:address (str chain-short-names address)
|
||||
:ens (when ens? ens)
|
||||
:ens (when has-ens? ens)
|
||||
:customization-color customization-color
|
||||
:blur? true}
|
||||
:container-style style/saved-address-item}]]))
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(let [profile-color (rf/sub [:profile/customization-color])
|
||||
accounts-addresses (rf/sub [:wallet/addresses])
|
||||
saved-addresses-addresses (rf/sub [:wallet/saved-addresses-addresses])
|
||||
[address-or-ens set-address-or-ens] (rn/use-state "")
|
||||
[ens-address set-ens-address] (rn/use-state "")
|
||||
[error set-error] (rn/use-state nil)
|
||||
error? (some? error)
|
||||
ens-name? (validation/ens-name? address-or-ens)
|
||||
address (if ens-name? ens-address address-or-ens)
|
||||
button-disabled? (or (string/blank? address-or-ens)
|
||||
(and ens-name? (string/blank? ens-address))
|
||||
error?)
|
||||
validate #(validate-input accounts-addresses
|
||||
saved-addresses-addresses
|
||||
%)
|
||||
clear-input (rn/use-callback
|
||||
(fn []
|
||||
(set-address-or-ens "")
|
||||
(set-ens-address "")
|
||||
(set-error nil)))
|
||||
on-ens-resolve (rn/use-callback
|
||||
(fn [resolved-address]
|
||||
(set-error (validate resolved-address))
|
||||
(set-ens-address resolved-address)))
|
||||
on-change-text (rn/use-callback
|
||||
(fn [new-value]
|
||||
(let [trimmed-value (string/trim new-value)]
|
||||
(set-error (validate (string/lower-case trimmed-value)))
|
||||
(set-address-or-ens trimmed-value)
|
||||
(set-ens-address "")
|
||||
(when (validation/ens-name? trimmed-value)
|
||||
(debounce/debounce-and-dispatch
|
||||
[:wallet/resolve-ens
|
||||
{:ens new-value
|
||||
:on-success on-ens-resolve
|
||||
:on-error #(set-error :ens-not-registered)}]
|
||||
300)))))
|
||||
paste-into-input (rn/use-callback #(clipboard/get-string
|
||||
(fn [clipboard-text]
|
||||
(on-change-text clipboard-text))))
|
||||
on-press-continue (rn/use-callback
|
||||
(fn []
|
||||
(rf/dispatch
|
||||
[:wallet/set-address-to-save
|
||||
{:address address
|
||||
:ens address-or-ens
|
||||
:ens? ens-name?}])
|
||||
(rf/dispatch
|
||||
[:navigate-to-within-stack
|
||||
[:screen/settings.save-address
|
||||
:screen/settings.add-address-to-save]]))
|
||||
[address ens-name? address-or-ens])]
|
||||
(let [profile-color (rf/sub [:profile/customization-color])
|
||||
accounts-addresses (rf/sub [:wallet/addresses])
|
||||
saved-addresses-addresses (rf/sub [:wallet/saved-addresses-addresses])
|
||||
[input-value set-input-value] (rn/use-state nil)
|
||||
[error set-error] (rn/use-state nil)
|
||||
error? (some? error)
|
||||
validate #(validate-input accounts-addresses
|
||||
saved-addresses-addresses
|
||||
%)
|
||||
clear-input (rn/use-callback
|
||||
(fn []
|
||||
(set-input-value nil)
|
||||
(set-error nil)))
|
||||
on-change-text (rn/use-callback
|
||||
(fn [new-value]
|
||||
(let [lowercase-value (string/lower-case new-value)]
|
||||
(set-error (validate lowercase-value))
|
||||
(set-input-value lowercase-value))))
|
||||
paste-into-input (rn/use-callback #(clipboard/get-string
|
||||
(fn [clipboard-text]
|
||||
(on-change-text clipboard-text))))
|
||||
on-press-continue (rn/use-callback
|
||||
(fn []
|
||||
(rf/dispatch [:wallet/set-address-to-save
|
||||
{:address input-value}])
|
||||
(rf/dispatch
|
||||
[:navigate-to-within-stack
|
||||
[:screen/settings.save-address
|
||||
:screen/settings.add-address-to-save]]))
|
||||
[input-value])]
|
||||
(rn/use-unmount #(rf/dispatch [:wallet/clear-address-to-save]))
|
||||
[quo/overlay {:type :shell}
|
||||
[floating-button-page/view
|
||||
@@ -176,7 +153,8 @@
|
||||
:accessibility-label :add-address-to-save-page-nav}]
|
||||
:footer [quo/button
|
||||
{:customization-color profile-color
|
||||
:disabled? button-disabled?
|
||||
:disabled? (or (string/blank? input-value)
|
||||
error?)
|
||||
:on-press on-press-continue}
|
||||
(i18n/label :t/continue)]}
|
||||
[quo/page-top
|
||||
@@ -186,7 +164,7 @@
|
||||
:description :text
|
||||
:description-text (i18n/label :t/add-address-to-save-description)}]
|
||||
[address-input
|
||||
{:input-value address-or-ens
|
||||
{:input-value input-value
|
||||
:on-change-text on-change-text
|
||||
:paste-into-input paste-into-input
|
||||
:clear-input clear-input}]
|
||||
@@ -194,4 +172,4 @@
|
||||
[:<>
|
||||
[error-view {:error error}]
|
||||
(when (= error :existing-saved-address)
|
||||
[existing-saved-address {:address address}])])]]))
|
||||
[existing-saved-address {:address input-value}])])]]))
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
:address "0x2"
|
||||
:mixedcase-address "0x2"
|
||||
:chain-short-names "eth:arb1:oeth:"
|
||||
:ens? false
|
||||
:has-ens? false
|
||||
:network-preferences-names `(:mainnet :arbitrum :optimism)
|
||||
:name "Bob"
|
||||
:created-at 1716826714
|
||||
@@ -75,7 +75,7 @@
|
||||
:mixedcase-address "0x2"
|
||||
:chain-short-names "eth:arb1:oeth:"
|
||||
:network-preferences-names `(:mainnet :arbitrum :optimism)
|
||||
:ens? false
|
||||
:has-ens? false
|
||||
:name "Bob"
|
||||
:created-at 1716826714
|
||||
:ens ""
|
||||
@@ -86,7 +86,7 @@
|
||||
:mixedcase-address "0x1"
|
||||
:chain-short-names "eth:arb1:oeth:"
|
||||
:network-preferences-names `(:mainnet :arbitrum :optimism)
|
||||
:ens? false
|
||||
:has-ens? false
|
||||
:name "Amy"
|
||||
:created-at 1716826806
|
||||
:ens ""
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(let [{:keys [address ens ens?]} (rf/sub [:wallet/saved-address])
|
||||
(let [{:keys [address]} (rf/sub [:wallet/saved-address])
|
||||
[network-prefixes address-without-prefix] (utils/split-prefix-and-address address)
|
||||
[address-label set-address-label] (rn/use-state "")
|
||||
[address-color set-address-color] (rn/use-state (rand-nth colors/account-colors))
|
||||
@@ -46,13 +46,6 @@
|
||||
selected-networks)
|
||||
[selected-networks])
|
||||
placeholder (i18n/label :t/address-name)
|
||||
address-text (rn/use-callback
|
||||
(fn []
|
||||
[quo/address-text
|
||||
{:full-address? true
|
||||
:address (str chain-short-names address-without-prefix)
|
||||
:format :long}])
|
||||
[address-without-prefix chain-short-names])
|
||||
open-network-preferences (rn/use-callback
|
||||
(fn []
|
||||
(rf/dispatch
|
||||
@@ -75,29 +68,11 @@
|
||||
:on-error
|
||||
[:wallet/add-saved-address-failed]
|
||||
:name address-label
|
||||
:ens ens
|
||||
:address address-without-prefix
|
||||
:customization-color address-color
|
||||
:chain-short-names chain-short-names}]))
|
||||
[address-without-prefix chain-short-names address-label
|
||||
address-color])
|
||||
data-item-props (rn/use-memo
|
||||
#(cond-> {:status :default
|
||||
:size :default
|
||||
:subtitle-type :default
|
||||
:label :none
|
||||
:blur? true
|
||||
:icon-right? true
|
||||
:right-icon :i/advanced
|
||||
:card? true
|
||||
:title (i18n/label :t/address)
|
||||
:subtitle ens
|
||||
:custom-subtitle address-text
|
||||
:on-press open-network-preferences
|
||||
:container-style style/data-item}
|
||||
ens?
|
||||
(dissoc :custom-subtitle))
|
||||
[ens ens? open-network-preferences address-text])]
|
||||
address-color])]
|
||||
[quo/overlay {:type :shell}
|
||||
[floating-button-page/view
|
||||
{:footer-container-padding 0
|
||||
@@ -150,4 +125,22 @@
|
||||
[quo/divider-line
|
||||
{:blur? true
|
||||
:container-style style/color-picker-bottom-divider}]
|
||||
[quo/data-item data-item-props]]]))
|
||||
[quo/data-item
|
||||
{:status :default
|
||||
:size :default
|
||||
:subtitle-type :default
|
||||
:label :none
|
||||
:blur? true
|
||||
:icon-right? true
|
||||
:right-icon :i/advanced
|
||||
:card? true
|
||||
:title (i18n/label :t/address)
|
||||
:custom-subtitle (rn/use-callback
|
||||
(fn []
|
||||
[quo/address-text
|
||||
{:full-address? true
|
||||
:address (str chain-short-names address-without-prefix)
|
||||
:format :long}])
|
||||
[selected-networks address])
|
||||
:on-press open-network-preferences
|
||||
:container-style style/data-item}]]]))
|
||||
|
||||
+4
-6
@@ -2,7 +2,6 @@
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[react-native.core :as rn]
|
||||
[react-native.platform :as platform]
|
||||
[status-im.common.not-implemented :as not-implemented]
|
||||
@@ -53,11 +52,10 @@
|
||||
open-remove-confirmation-sheet (rn/use-callback
|
||||
#(rf/dispatch
|
||||
[:show-bottom-sheet
|
||||
{:theme :dark
|
||||
:shell? true
|
||||
:blur-background colors/bottom-sheet-background-blur
|
||||
:content (fn []
|
||||
[remove-address/view opts])}])
|
||||
{:theme :dark
|
||||
:shell? true
|
||||
:content (fn []
|
||||
[remove-address/view opts])}])
|
||||
[opts])
|
||||
open-show-address-qr (rn/use-callback
|
||||
#(rf/dispatch [:open-modal
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
(ns status-im.contexts.settings.wallet.saved-addresses.view
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.core :as rn]
|
||||
[react-native.safe-area :as safe-area]
|
||||
@@ -21,29 +20,27 @@
|
||||
:container-style style/empty-container-style}]))
|
||||
|
||||
(defn- saved-address
|
||||
[{:keys [name address chain-short-names customization-color ens? ens network-preferences-names]}]
|
||||
[{:keys [name address chain-short-names customization-color has-ens? ens network-preferences-names]}]
|
||||
(let [full-address (str chain-short-names address)
|
||||
on-press-saved-address (rn/use-callback
|
||||
#(rf/dispatch
|
||||
[:show-bottom-sheet
|
||||
{:theme :dark
|
||||
:shell? true
|
||||
:blur-background colors/bottom-sheet-background-blur
|
||||
:content (fn []
|
||||
[address-options/view
|
||||
{:address address
|
||||
:chain-short-names chain-short-names
|
||||
:full-address full-address
|
||||
:name name
|
||||
:network-preferences-names
|
||||
network-preferences-names
|
||||
:customization-color customization-color}])}])
|
||||
{:theme :dark
|
||||
:shell? true
|
||||
:content (fn []
|
||||
[address-options/view
|
||||
{:address address
|
||||
:chain-short-names chain-short-names
|
||||
:full-address full-address
|
||||
:name name
|
||||
:network-preferences-names network-preferences-names
|
||||
:customization-color customization-color}])}])
|
||||
[address chain-short-names full-address name customization-color])]
|
||||
[quo/saved-address
|
||||
{:blur? true
|
||||
:user-props {:name name
|
||||
:address full-address
|
||||
:ens (when ens? ens)
|
||||
:ens (when has-ens? ens)
|
||||
:customization-color customization-color
|
||||
:blur? true}
|
||||
:container-style {:margin-horizontal 8}
|
||||
@@ -91,13 +88,12 @@
|
||||
:icon :i/add
|
||||
:container-style style/title-container}]
|
||||
[rn/section-list
|
||||
{:key-fn :title
|
||||
:shows-vertical-scroll-indicator false
|
||||
:sticky-section-headers-enabled false
|
||||
:render-section-header-fn header
|
||||
:render-section-footer-fn footer
|
||||
:sections saved-addresses
|
||||
:render-fn saved-address
|
||||
:separator [rn/view {:style {:height 4}}]
|
||||
:content-container-style {:flex-grow 1}
|
||||
:empty-component [empty-state]}]]))
|
||||
{:key-fn :title
|
||||
:sticky-section-headers-enabled false
|
||||
:render-section-header-fn header
|
||||
:render-section-footer-fn footer
|
||||
:sections saved-addresses
|
||||
:render-fn saved-address
|
||||
:separator [rn/view {:style {:height 4}}]
|
||||
:content-container-style {:flex-grow 1}
|
||||
:empty-component [empty-state]}]]))
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
(defn bottom-tabs-container
|
||||
[pass-through? height]
|
||||
[{:height height}
|
||||
{:background-color (if (and platform/ios? pass-through?)
|
||||
:transparent
|
||||
colors/neutral-100)
|
||||
{:background-color (if pass-through? :transparent colors/neutral-100)
|
||||
:flex 1
|
||||
:align-items :center
|
||||
:height (utils/bottom-tabs-container-height)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
(ns status-im.contexts.shell.jump-to.components.jump-to-screen.style
|
||||
(:require
|
||||
[quo.foundations.colors :as colors]
|
||||
[react-native.platform :as platform]
|
||||
[status-im.contexts.shell.jump-to.utils :as utils]))
|
||||
|
||||
;;;; Placeholder
|
||||
@@ -64,4 +63,4 @@
|
||||
:left 0
|
||||
:right 0
|
||||
:top 0
|
||||
:background-color (when platform/ios? colors/neutral-100-opa-70-blur)})
|
||||
:background-color colors/neutral-100-opa-70-blur})
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[react-native.linear-gradient :as linear-gradient]
|
||||
[react-native.safe-area :as safe-area]
|
||||
@@ -83,7 +84,7 @@
|
||||
(let [pass-through? (rf/sub [:shell/shell-pass-through?])]
|
||||
[rn/view {:style (style/top-nav-blur-overlay-container (+ 56 top) pass-through?)}
|
||||
(when pass-through?
|
||||
[quo/blur (bottom-tabs/blur-overlay-params style/top-nav-blur-overlay)])]))
|
||||
[blur/view (bottom-tabs/blur-overlay-params style/top-nav-blur-overlay)])]))
|
||||
|
||||
(defn view
|
||||
[]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[oops.core :as oops]
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.camera-kit :as camera-kit]
|
||||
[react-native.core :as rn]
|
||||
[react-native.hole-view :as hole-view]
|
||||
@@ -253,7 +254,7 @@
|
||||
[hole-view/hole-view
|
||||
{:style style/hole
|
||||
:holes [(assoc qr-view-finder :borderRadius 16)]}
|
||||
[quo/blur
|
||||
[blur/view
|
||||
{:style style/absolute-fill
|
||||
:blur-amount 10
|
||||
:blur-type :transparent
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(let [tokens-loading? (rf/sub [:wallet/current-viewing-account-tokens-loading?])
|
||||
(let [tokens-loading? (rf/sub [:wallet/tokens-loading?])
|
||||
tokens (rf/sub [:wallet/current-viewing-account-token-values])
|
||||
{:keys [watch-only?]} (rf/sub [:wallet/current-viewing-account])]
|
||||
(if tokens-loading?
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
(defn get-keypairs-success
|
||||
[{:keys [db]} [keypairs]]
|
||||
(let [parsed-keypairs (data-store/rpc->keypairs keypairs)
|
||||
default-key-uid (:key-uid (some #(when (= (:type %) :profile) %) parsed-keypairs))]
|
||||
(let [parsed-keypairs (data-store/parse-keypairs keypairs)
|
||||
default-key-uid (:key-uid (first parsed-keypairs))]
|
||||
{:db (-> db
|
||||
(assoc-in [:wallet :keypairs] parsed-keypairs)
|
||||
(assoc-in [:wallet :ui :create-account :selected-keypair-uid] default-key-uid))}))
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
[native-module.core :as native-module]
|
||||
[quo.core :as quo]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.contexts.wallet.add-account.create-account.new-keypair.backup-recovery-phrase.style :as
|
||||
@@ -85,7 +86,7 @@
|
||||
:first-half? false}]])
|
||||
(when-not @revealed?
|
||||
[rn/view {:style style/blur-container}
|
||||
[quo/blur (style/blur theme)]])]
|
||||
[blur/view (style/blur theme)]])]
|
||||
(when-not @revealed?
|
||||
[rn/view
|
||||
{:style {:padding-horizontal 20
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
(->> given-accounts
|
||||
(filter (fn [{:keys [path]}]
|
||||
(not (string/starts-with? path constants/path-eip1581))))
|
||||
(map (fn [{:keys [color emoji name address]}]
|
||||
{:account-props {:customization-color color
|
||||
(map (fn [{:keys [customization-color emoji name address]}]
|
||||
{:account-props {:customization-color customization-color
|
||||
:size 32
|
||||
:emoji emoji
|
||||
:type :default
|
||||
@@ -48,21 +48,20 @@
|
||||
:action :none}))))
|
||||
|
||||
(defn- keypair
|
||||
[item _ _
|
||||
[item index _
|
||||
{:keys [profile-picture compressed-key selected-key-uid set-selected-key-uid customization-color]}]
|
||||
(let [profile-keypair? (= (:type item) :profile)
|
||||
accounts (parse-accounts (:accounts item))]
|
||||
(let [accounts (parse-accounts (:accounts item))]
|
||||
[quo/keypair
|
||||
{:customization-color customization-color
|
||||
:profile-picture (when profile-keypair? profile-picture)
|
||||
:profile-picture (when (zero? index) profile-picture)
|
||||
:status-indicator false
|
||||
:type (if profile-keypair? :default-keypair :other)
|
||||
:type (if (zero? index) :default-keypair :other)
|
||||
:stored :on-device
|
||||
:on-options-press #(js/alert "Options pressed")
|
||||
:action :selector
|
||||
:blur? false
|
||||
:details {:full-name (:name item)
|
||||
:address (when profile-keypair?
|
||||
:address (when (zero? index)
|
||||
(utils/get-shortened-compressed-key compressed-key))}
|
||||
:on-press #(set-selected-key-uid (:key-uid item))
|
||||
:accounts accounts
|
||||
|
||||
@@ -110,20 +110,6 @@
|
||||
new-request? (update-in [:wallet :accounts] update-vals #(dissoc % :collectibles)))
|
||||
:fx collectible-requests})))
|
||||
|
||||
(defn request-new-collectibles-for-account-from-signal
|
||||
[{:keys [db]} [address]]
|
||||
(let [pending-requests (get-in db [:wallet :ui :collectibles :pending-requests] 0)
|
||||
[request-id] (get-unique-collectible-request-id 1)]
|
||||
{:db (assoc-in db [:wallet :ui :collectibles :pending-requests] (inc pending-requests))
|
||||
:fx [[:dispatch
|
||||
[:wallet/request-new-collectibles-for-account
|
||||
{:request-id request-id
|
||||
:account address
|
||||
:amount collectibles-request-batch-size}]]]}))
|
||||
|
||||
(rf/reg-event-fx :wallet/request-new-collectibles-for-account-from-signal
|
||||
request-new-collectibles-for-account-from-signal)
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/request-collectibles-for-current-viewing-account
|
||||
(fn [{:keys [db]} _]
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
(ns status-im.contexts.wallet.collectible.events-test
|
||||
(:require
|
||||
[cljs.test :refer-macros [deftest is testing]]
|
||||
matcher-combinators.test
|
||||
[status-im.contexts.wallet.collectible.events :as events]))
|
||||
|
||||
(deftest store-collectibles-test
|
||||
(testing "flush-collectibles"
|
||||
(let [collectible-1 {:collectible-data {:image-url "https://..." :animation-url "https://..."}
|
||||
:ownership [{:address "0x1"
|
||||
:balance "1"}]}
|
||||
collectible-2 {:collectible-data {:image-url "" :animation-url "https://..."}
|
||||
:ownership [{:address "0x1"
|
||||
:balance "1"}]}
|
||||
collectible-3 {:collectible-data {:image-url "" :animation-url nil}
|
||||
:ownership [{:address "0x2"
|
||||
:balance "1"}]}
|
||||
db {:wallet {:ui {:collectibles {:pending-requests 0
|
||||
:fetched {"0x1" [collectible-1
|
||||
collectible-2]
|
||||
"0x2" [collectible-3]}}}
|
||||
:accounts {"0x1" {}
|
||||
"0x3" {}}}}
|
||||
expected-db {:wallet {:ui {:collectibles {}}
|
||||
:accounts {"0x1" {:collectibles (list collectible-1 collectible-2)}
|
||||
"0x2" {:collectibles (list collectible-3)}
|
||||
"0x3" {}}}}
|
||||
result-db (:db (events/flush-collectibles {:db db}))]
|
||||
|
||||
(is (match? result-db expected-db)))))
|
||||
|
||||
(deftest clear-stored-collectibles-test
|
||||
(let [db {:wallet {:accounts {"0x1" {:collectibles [{:id 1} {:id 2}]}
|
||||
"0x2" {"some other stuff" "with any value"
|
||||
:collectibles [{:id 3}]}
|
||||
"0x3" {}}}}]
|
||||
(testing "clear-stored-collectibles"
|
||||
(let [expected-db {:wallet {:accounts {"0x1" {}
|
||||
"0x2" {"some other stuff" "with any value"}
|
||||
"0x3" {}}}}
|
||||
effects (events/clear-stored-collectibles {:db db})
|
||||
result-db (:db effects)]
|
||||
|
||||
(is (match? result-db expected-db))))))
|
||||
|
||||
(deftest store-last-collectible-details-test
|
||||
(testing "store-last-collectible-details"
|
||||
(let [db {:wallet {}}
|
||||
last-collectible {:description "Pandaria"
|
||||
:image-url "https://..."}
|
||||
expected-db {:wallet {:last-collectible-details {:description "Pandaria"
|
||||
:image-url "https://..."}}}
|
||||
effects (events/store-last-collectible-details {:db db}
|
||||
[last-collectible])
|
||||
result-db (:db effects)]
|
||||
(is (match? result-db expected-db)))))
|
||||
|
||||
(deftest request-new-collectibles-for-account-from-signal-test
|
||||
(testing "request new collectibles for account from signal"
|
||||
(let [db {:wallet {}}
|
||||
address "0x1"
|
||||
expected {:db {:wallet {:ui {:collectibles {:pending-requests 1}}}}
|
||||
:fx [[:dispatch
|
||||
[:wallet/request-new-collectibles-for-account
|
||||
{:request-id 0
|
||||
:account address
|
||||
:amount events/collectibles-request-batch-size}]]]}
|
||||
effects (events/request-new-collectibles-for-account-from-signal {:db db}
|
||||
[address])]
|
||||
(is (match? expected effects)))))
|
||||
@@ -83,9 +83,7 @@
|
||||
(colors/theme-colors colors/white-opa-50 colors/neutral-95-opa-70-blur theme))]
|
||||
[rn/view {:style style/animated-header}
|
||||
[reanimated/blur-view
|
||||
{:style {:flex 1
|
||||
:background-color (when platform/android?
|
||||
(colors/theme-colors colors/white colors/neutral-80 theme))}
|
||||
{:style {:flex 1}
|
||||
:blur-type :transparent
|
||||
:overlay-color :transparent
|
||||
:blur-amount blur-amount
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
(ns status-im.contexts.wallet.common.validation
|
||||
(:require [status-im.constants :as constants]))
|
||||
|
||||
(defn ens-name? [s] (boolean (re-find constants/regx-ens s)))
|
||||
(defn ens-name? [s] (re-find constants/regx-ens s))
|
||||
(defn eth-address? [s] (re-find constants/regx-multichain-address s))
|
||||
(defn private-key? [s] (re-find constants/regx-private-key s))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
(ns status-im.contexts.wallet.data-store
|
||||
(:require
|
||||
[camel-snake-kebab.core :as csk]
|
||||
[camel-snake-kebab.extras :as cske]
|
||||
[clojure.set :as set]
|
||||
[clojure.string :as string]
|
||||
@@ -21,9 +22,7 @@
|
||||
|
||||
(defn add-keys-to-account
|
||||
[account]
|
||||
(-> account
|
||||
(assoc :watch-only? (= (:type account) :watch))
|
||||
(assoc :default-account? (:wallet account))))
|
||||
(assoc account :watch-only? (= (:type account) :watch)))
|
||||
|
||||
(defn- sanitize-emoji
|
||||
"As Desktop uses Twemoji, the emoji received can be an img tag
|
||||
@@ -45,11 +44,9 @@
|
||||
(update :test-preferred-chain-ids chain-ids-string->set)
|
||||
(update :type keyword)
|
||||
(update :operable keyword)
|
||||
(update :color
|
||||
#(if (and (not (keyword? %)) (string/blank? %))
|
||||
constants/account-default-customization-color
|
||||
(keyword %)))
|
||||
(update :color #(if (seq %) (keyword %) constants/account-default-customization-color))
|
||||
(update :emoji sanitize-emoji)
|
||||
(assoc :default-account? (:wallet account))
|
||||
add-keys-to-account))
|
||||
|
||||
(defn rpc->accounts
|
||||
@@ -110,40 +107,43 @@
|
||||
:nativeCurrencySymbol :native-currency-symbol
|
||||
:nativeCurrencyName :native-currency-symbol})))
|
||||
|
||||
(defn get-keypair-lowest-operability
|
||||
[{:keys [accounts]}]
|
||||
(cond
|
||||
(some #(= (:operable %) :no) accounts)
|
||||
:no
|
||||
|
||||
(some #(= (:operable %) :partially) accounts)
|
||||
:partially
|
||||
|
||||
:else
|
||||
:fully))
|
||||
|
||||
(defn- add-keys-to-keypair
|
||||
[keypair]
|
||||
(assoc keypair :lowest-operability (get-keypair-lowest-operability keypair)))
|
||||
|
||||
(defn rpc->keypair
|
||||
[keypair]
|
||||
(-> keypair
|
||||
(update :type keyword)
|
||||
(update :accounts #(map rpc->account %))
|
||||
add-keys-to-keypair))
|
||||
|
||||
(defn rpc->keypairs
|
||||
(defn sort-keypairs
|
||||
[keypairs]
|
||||
(->> (map rpc->keypair keypairs)
|
||||
(sort-by #(if (= (:type %) :profile) 0 1))))
|
||||
(sort-by #(if (some (fn [account]
|
||||
(string/starts-with? (:path account) constants/path-eip1581))
|
||||
(:accounts %))
|
||||
0
|
||||
1)
|
||||
keypairs))
|
||||
|
||||
(defn sort-and-rename-keypairs
|
||||
[keypairs]
|
||||
(let [sorted-keypairs (sort-keypairs keypairs)]
|
||||
(map (fn [item]
|
||||
(update item
|
||||
:accounts
|
||||
(fn [accounts]
|
||||
(map
|
||||
(fn [{:keys [colorId] :as account}]
|
||||
(assoc account
|
||||
:customization-color
|
||||
(if (seq colorId)
|
||||
(keyword colorId)
|
||||
:blue)))
|
||||
accounts))))
|
||||
sorted-keypairs)))
|
||||
|
||||
(defn parse-keypairs
|
||||
[keypairs]
|
||||
(let [renamed-data (sort-and-rename-keypairs keypairs)]
|
||||
(cske/transform-keys csk/->kebab-case-keyword renamed-data)))
|
||||
|
||||
(defn- add-keys-to-saved-address
|
||||
[saved-address]
|
||||
(-> saved-address
|
||||
(assoc :network-preferences-names
|
||||
(network-utils/network-preference-prefix->network-names (:chain-short-names saved-address)))
|
||||
(assoc :ens? (not (string/blank? (:ens saved-address))))))
|
||||
(assoc :has-ens? (not (string/blank? (:ens saved-address))))))
|
||||
|
||||
(defn rpc->saved-address
|
||||
[saved-address]
|
||||
|
||||
@@ -6,4 +6,5 @@
|
||||
:selected-networks (set constants/default-network-names)})
|
||||
|
||||
(def defaults
|
||||
{:ui {:network-filter network-filter-defaults}})
|
||||
{:ui {:network-filter network-filter-defaults
|
||||
:tokens-loading? true}})
|
||||
|
||||
@@ -57,27 +57,19 @@
|
||||
{:fx [[:dispatch [:wallet/clean-current-viewing-account]]
|
||||
[:dispatch [:pop-to-root :shell-stack]]]}))
|
||||
|
||||
(defn log-rpc-error
|
||||
[_ [{:keys [event params]} error]]
|
||||
(log/warn (str "[wallet] Failed to " event)
|
||||
{:params params
|
||||
:error error}))
|
||||
|
||||
(rf/reg-event-fx :wallet/log-rpc-error log-rpc-error)
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/get-accounts-success
|
||||
(fn [{:keys [db]} [accounts]]
|
||||
(let [wallet-accounts (data-store/rpc->accounts accounts)
|
||||
(let [wallet-accounts (filter #(not (:chat %)) accounts)
|
||||
wallet-db (get db :wallet)
|
||||
new-account? (:new-account? wallet-db)
|
||||
navigate-to-account (:navigate-to-account wallet-db)]
|
||||
{:db (assoc-in db
|
||||
[:wallet :accounts]
|
||||
(utils.collection/index-by :address wallet-accounts))
|
||||
:fx [[:dispatch [:wallet/get-wallet-token-for-all-accounts]]
|
||||
(utils.collection/index-by :address (data-store/rpc->accounts wallet-accounts)))
|
||||
:fx [[:dispatch [:wallet/get-wallet-token]]
|
||||
[:dispatch [:wallet/request-collectibles-for-all-accounts {:new-request? true}]]
|
||||
[:dispatch [:wallet/check-recent-history-for-all-accounts]]
|
||||
[:dispatch [:wallet/check-recent-history]]
|
||||
(when new-account?
|
||||
[:dispatch [:wallet/navigate-to-new-account navigate-to-account]])]})))
|
||||
|
||||
@@ -87,16 +79,9 @@
|
||||
{:fx [[:json-rpc/call
|
||||
[{:method "accounts_getAccounts"
|
||||
:on-success [:wallet/get-accounts-success]
|
||||
:on-error [:wallet/log-rpc-error {:event :wallet/get-accounts}]}]]]}))
|
||||
|
||||
(defn process-account-from-signal
|
||||
[{:keys [db]} [{:keys [address] :as account}]]
|
||||
{:db (assoc-in db [:wallet :accounts address] (data-store/rpc->account account))
|
||||
:fx [[:dispatch [:wallet/get-wallet-token-for-account address]]
|
||||
[:dispatch [:wallet/request-new-collectibles-for-account-from-signal address]]
|
||||
[:dispatch [:wallet/check-recent-history-for-account address]]]})
|
||||
|
||||
(rf/reg-event-fx :wallet/process-account-from-signal process-account-from-signal)
|
||||
:on-error #(log/info "failed to get accounts "
|
||||
{:error %
|
||||
:event :wallet/get-accounts})}]]]}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/save-account
|
||||
@@ -108,7 +93,9 @@
|
||||
(rf/dispatch [:wallet/get-accounts])
|
||||
(when (fn? on-success)
|
||||
(on-success)))
|
||||
:on-error [:wallet/log-rpc-error {:event :wallet/save-account}]}]]]}))
|
||||
:on-error #(log/info "failed to save account "
|
||||
{:error %
|
||||
:event :wallet/save-account})}]]]}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/show-account-deleted-toast
|
||||
@@ -138,41 +125,35 @@
|
||||
[{:method "accounts_deleteAccount"
|
||||
:params [address]
|
||||
:on-success [:wallet/remove-account-success toast-message]
|
||||
:on-error [:wallet/log-rpc-error {:event :wallet/remove-account}]}]]]}))
|
||||
|
||||
(defn get-wallet-token-for-all-accounts
|
||||
[{:keys [db]}]
|
||||
{:fx (->> (get-in db [:wallet :accounts])
|
||||
vals
|
||||
(mapv
|
||||
(fn [{:keys [address]}]
|
||||
[:dispatch [:wallet/get-wallet-token-for-account address]])))})
|
||||
|
||||
(rf/reg-event-fx :wallet/get-wallet-token-for-all-accounts get-wallet-token-for-all-accounts)
|
||||
|
||||
(defn get-wallet-token-for-account
|
||||
[{:keys [db]} [address]]
|
||||
{:db (assoc-in db [:wallet :ui :tokens-loading address] true)
|
||||
:fx [[:json-rpc/call
|
||||
[{:method "wallet_getWalletToken"
|
||||
:params [[address]]
|
||||
:on-success [:wallet/store-wallet-token address]
|
||||
:on-error [:wallet/get-wallet-token-for-account-failed address]}]]]})
|
||||
|
||||
(rf/reg-event-fx :wallet/get-wallet-token-for-account get-wallet-token-for-account)
|
||||
:on-error #(log/info "failed to remove account "
|
||||
{:error %
|
||||
:event :wallet/remove-account})}]]]}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/get-wallet-token-for-account-failed
|
||||
(fn [{:keys [db]} [address error]]
|
||||
:wallet/get-wallet-token
|
||||
(fn [{:keys [db]}]
|
||||
(let [addresses (->> (get-in db [:wallet :accounts])
|
||||
vals
|
||||
(map :address))]
|
||||
{:db (assoc-in db [:wallet :ui :tokens-loading?] true)
|
||||
:fx [[:json-rpc/call
|
||||
[{:method "wallet_getWalletToken"
|
||||
:params [addresses]
|
||||
:on-success [:wallet/store-wallet-token]
|
||||
:on-error [:wallet/get-wallet-token-failed addresses]}]]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/get-wallet-token-failed
|
||||
(fn [{:keys [db]} [params error]]
|
||||
(log/info "failed to get wallet token "
|
||||
{:error error
|
||||
:event :wallet/get-wallet-token-for-account
|
||||
:params address})
|
||||
{:db (assoc-in db [:wallet :ui :tokens-loading address] false)}))
|
||||
:event :wallet/get-wallet-token
|
||||
:params params})
|
||||
{:db (assoc-in db [:wallet :ui :tokens-loading?] false)}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/store-wallet-token
|
||||
(fn [{:keys [db]} [address raw-tokens-data]]
|
||||
(fn [{:keys [db]} [raw-tokens-data]]
|
||||
(let [tokens (data-store/rpc->tokens raw-tokens-data)
|
||||
add-tokens (fn [stored-accounts tokens-per-account]
|
||||
(reduce-kv (fn [accounts address tokens-data]
|
||||
@@ -183,7 +164,7 @@
|
||||
tokens-per-account))]
|
||||
{:db (-> db
|
||||
(update-in [:wallet :accounts] add-tokens tokens)
|
||||
(assoc-in [:wallet :ui :tokens-loading address] false))})))
|
||||
(assoc-in [:wallet :ui :tokens-loading?] false))})))
|
||||
|
||||
(rf/defn scan-address-success
|
||||
{:events [:wallet/scan-address-success]}
|
||||
@@ -228,9 +209,7 @@
|
||||
(security/safe-unmask-data password))
|
||||
account-config]
|
||||
:on-success [:wallet/add-account-success lowercase-address]
|
||||
:on-error [:wallet/log-rpc-error
|
||||
{:event :wallet/add-account
|
||||
:params account-config}]}]]]})))
|
||||
:on-error #(log/info "failed to create account " % account-config)}]]]})))
|
||||
|
||||
(defn get-keypairs
|
||||
[_]
|
||||
@@ -238,7 +217,7 @@
|
||||
[{:method "accounts_getKeypairs"
|
||||
:params []
|
||||
:on-success [:wallet/get-keypairs-success]
|
||||
:on-error [:wallet/log-rpc-error {:event :wallet/get-keypairs}]}]]]})
|
||||
:on-error #(log/info "failed to get keypairs " %)}]]]})
|
||||
|
||||
(rf/reg-event-fx :wallet/get-keypairs get-keypairs)
|
||||
|
||||
@@ -275,7 +254,7 @@
|
||||
[{:method "wallet_getEthereumChains"
|
||||
:params []
|
||||
:on-success [:wallet/get-ethereum-chains-success]
|
||||
:on-error [:wallet/log-rpc-error {:event :wallet/get-ethereum-chains}]}]}))
|
||||
:on-error #(log/info "failed to get networks " %)}]}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/get-ethereum-chains-success
|
||||
@@ -375,34 +354,29 @@
|
||||
|
||||
(rf/reg-event-fx :wallet/reload
|
||||
(fn [_]
|
||||
{:fx [[:dispatch [:wallet/get-wallet-token-for-all-accounts]]]}))
|
||||
{:fx [[:dispatch-n [[:wallet/get-wallet-token]]]]}))
|
||||
|
||||
(rf/reg-event-fx :wallet/start-wallet
|
||||
(fn [_]
|
||||
{:fx [[:json-rpc/call
|
||||
[{:method "wallet_startWallet"
|
||||
:on-error [:wallet/log-rpc-error {:event :wallet/start-wallet}]}]]]}))
|
||||
|
||||
(defn check-recent-history-for-all-accounts
|
||||
[{:keys [db]}]
|
||||
{:fx (->> (get-in db [:wallet :accounts])
|
||||
vals
|
||||
(mapv (fn [{:keys [address]}]
|
||||
[:dispatch [:wallet/check-recent-history-for-account address]])))})
|
||||
|
||||
(rf/reg-event-fx :wallet/check-recent-history-for-all-accounts check-recent-history-for-all-accounts)
|
||||
:on-error #(log/info "failed to start wallet"
|
||||
{:error %
|
||||
:event :wallet/start-wallet})}]]]}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/check-recent-history-for-account
|
||||
(fn [{:keys [db]} [address]]
|
||||
(let [chain-ids (chain/chain-ids db)
|
||||
params [chain-ids [address]]]
|
||||
:wallet/check-recent-history
|
||||
(fn [{:keys [db]}]
|
||||
(let [addresses (->> (get-in db [:wallet :accounts])
|
||||
vals
|
||||
(map :address))
|
||||
chain-ids (chain/chain-ids db)]
|
||||
{:fx [[:json-rpc/call
|
||||
[{:method "wallet_checkRecentHistoryForChainIDs"
|
||||
:params params
|
||||
:on-error [:wallet/log-rpc-error
|
||||
{:event :wallet/check-recent-history-for-account
|
||||
:params params}]}]]]})))
|
||||
:params [chain-ids addresses]
|
||||
:on-error #(log/info "failed to check recent history"
|
||||
{:error %
|
||||
:event :wallet/check-recent-history})}]]]})))
|
||||
|
||||
(rf/reg-event-fx :wallet/initialize
|
||||
(fn []
|
||||
@@ -522,9 +496,9 @@
|
||||
;; https://github.com/status-im/status-mobile/issues/19864
|
||||
:method "wallet_filterActivityAsync"
|
||||
:params request-params
|
||||
:on-error [:wallet/log-rpc-error
|
||||
{:event :wallet/fetch-activities
|
||||
:params request-params}]}]]]})))
|
||||
:on-error #(log/info "failed to fetch activities"
|
||||
{:error %
|
||||
:event :wallet/fetch-activities})}]]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/activity-filtering-done
|
||||
@@ -549,38 +523,6 @@
|
||||
{:fx [[:json-rpc/call
|
||||
[{:method "wallet_getCryptoOnRamps"
|
||||
:on-success [:wallet/get-crypto-on-ramps-success]
|
||||
:on-error [:wallet/log-rpc-error {:event :wallet/get-crypto-on-ramps}]}]]]}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/resolve-ens
|
||||
(fn [{db :db} [{:keys [ens on-success on-error]}]]
|
||||
(let [chain-id (network-utils/network->chain-id db constants/mainnet-network-name)]
|
||||
{:fx [[:json-rpc/call
|
||||
[{:method "ens_addressOf"
|
||||
:params [chain-id ens]
|
||||
:on-success on-success
|
||||
:on-error on-error}]]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/process-keypair-from-backup
|
||||
(fn [{:keys [db]} [{:keys [backedUpKeypair]}]]
|
||||
(let [{:keys [key-uid accounts]} backedUpKeypair
|
||||
keypairs-db (get-in db [:wallet :keypairs])
|
||||
updated-keypairs (-> (filter #(not= (:key-uid %) key-uid) keypairs-db)
|
||||
(conj backedUpKeypair)
|
||||
data-store/rpc->keypairs)
|
||||
accounts-fx (mapv (fn [{:keys [chat] :as account}]
|
||||
;; We exclude the chat account from the profile keypair
|
||||
;; for fetching the assets
|
||||
(when-not chat
|
||||
[:dispatch
|
||||
[:wallet/process-account-from-signal
|
||||
account]]))
|
||||
accounts)]
|
||||
{:db (assoc-in db [:wallet :keypairs] updated-keypairs)
|
||||
:fx accounts-fx})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/process-watch-only-account-from-backup
|
||||
(fn [_ [{:keys [backedUpWatchOnlyAccount]}]]
|
||||
{:fx [[:dispatch [:wallet/process-account-from-signal backedUpWatchOnlyAccount]]]}))
|
||||
:on-error #(log/info "failed to fetch crypto on ramps"
|
||||
{:error %
|
||||
:event :wallet/get-crypto-on-ramps})}]]]}))
|
||||
|
||||
@@ -3,55 +3,10 @@
|
||||
[cljs.test :refer-macros [deftest is testing]]
|
||||
matcher-combinators.test
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.wallet.collectible.events :as collectible-events]
|
||||
[status-im.contexts.wallet.events :as events]))
|
||||
|
||||
(def address "0x2ee6138eb9344a8b76eca3cf7554a06c82a1e2d8")
|
||||
|
||||
(def raw-account
|
||||
{:path "m/44'/60'/0'/0/0"
|
||||
:emoji "🛃"
|
||||
:key-uid "0xf9b4dc40911638052ef9cbed6e8ac689198d8f11d2235c5d62e2457c1503dc4f"
|
||||
:address address
|
||||
:wallet true
|
||||
:name "Ethereum account"
|
||||
:createdAt 1716548742000
|
||||
:type "generated"
|
||||
:chat false
|
||||
:prodPreferredChainIds "1:42161"
|
||||
:hidden false
|
||||
:position 0
|
||||
:clock 1712315009484
|
||||
:testPreferredChainIds "11155111:421614"
|
||||
:colorId "purple"
|
||||
:operable "fully"
|
||||
:mixedcase-address "0x2Ee6138eb9344a8b76Eca3cf7554A06C82A1e2D8"
|
||||
:public-key
|
||||
"0x04ee7c47e4b68cc05dcd3377cbd5cde6be3c89fcf20a981e55e0285ed63a50f51f8b423465eee134c51bb0255e6041e9e5b006054b0fa72a7c76942a5a1a3f4e7e"
|
||||
:removed false})
|
||||
|
||||
(def account
|
||||
{:path "m/44'/60'/0'/0/0"
|
||||
:emoji "🛃"
|
||||
:key-uid "0xf9b4dc40911638052ef9cbed6e8ac689198d8f11d2235c5d62e2457c1503dc4f"
|
||||
:address address
|
||||
:color :purple
|
||||
:wallet true
|
||||
:default-account? true
|
||||
:name "Ethereum account"
|
||||
:type :generated
|
||||
:chat false
|
||||
:test-preferred-chain-ids #{11155111 421614}
|
||||
:watch-only? false
|
||||
:hidden false
|
||||
:prod-preferred-chain-ids #{1 42161}
|
||||
:position 0
|
||||
:clock 1712315009484
|
||||
:created-at 1716548742000
|
||||
:operable :fully
|
||||
:mixedcase-address "0x2Ee6138eb9344a8b76Eca3cf7554A06C82A1e2D8"
|
||||
:public-key
|
||||
"0x04ee7c47e4b68cc05dcd3377cbd5cde6be3c89fcf20a981e55e0285ed63a50f51f8b423465eee134c51bb0255e6041e9e5b006054b0fa72a7c76942a5a1a3f4e7e"
|
||||
:removed false})
|
||||
(def address "0x2f88d65f3cb52605a54a833ae118fb1363acccd2")
|
||||
|
||||
(deftest scan-address-success-test
|
||||
(let [db {}]
|
||||
@@ -70,6 +25,57 @@
|
||||
result-db (:db effects)]
|
||||
(is (match? result-db expected-db))))))
|
||||
|
||||
(deftest store-collectibles-test
|
||||
(testing "flush-collectibles"
|
||||
(let [collectible-1 {:collectible-data {:image-url "https://..." :animation-url "https://..."}
|
||||
:ownership [{:address "0x1"
|
||||
:balance "1"}]}
|
||||
collectible-2 {:collectible-data {:image-url "" :animation-url "https://..."}
|
||||
:ownership [{:address "0x1"
|
||||
:balance "1"}]}
|
||||
collectible-3 {:collectible-data {:image-url "" :animation-url nil}
|
||||
:ownership [{:address "0x2"
|
||||
:balance "1"}]}
|
||||
db {:wallet {:ui {:collectibles {:pending-requests 0
|
||||
:fetched {"0x1" [collectible-1
|
||||
collectible-2]
|
||||
"0x2" [collectible-3]}}}
|
||||
:accounts {"0x1" {}
|
||||
"0x3" {}}}}
|
||||
expected-db {:wallet {:ui {:collectibles {}}
|
||||
:accounts {"0x1" {:collectibles (list collectible-1 collectible-2)}
|
||||
"0x2" {:collectibles (list collectible-3)}
|
||||
"0x3" {}}}}
|
||||
result-db (:db (collectible-events/flush-collectibles {:db db}))]
|
||||
|
||||
(is (match? result-db expected-db)))))
|
||||
|
||||
(deftest clear-stored-collectibles-test
|
||||
(let [db {:wallet {:accounts {"0x1" {:collectibles [{:id 1} {:id 2}]}
|
||||
"0x2" {"some other stuff" "with any value"
|
||||
:collectibles [{:id 3}]}
|
||||
"0x3" {}}}}]
|
||||
(testing "clear-stored-collectibles"
|
||||
(let [expected-db {:wallet {:accounts {"0x1" {}
|
||||
"0x2" {"some other stuff" "with any value"}
|
||||
"0x3" {}}}}
|
||||
effects (collectible-events/clear-stored-collectibles {:db db})
|
||||
result-db (:db effects)]
|
||||
|
||||
(is (match? result-db expected-db))))))
|
||||
|
||||
(deftest store-last-collectible-details-test
|
||||
(testing "store-last-collectible-details"
|
||||
(let [db {:wallet {}}
|
||||
last-collectible {:description "Pandaria"
|
||||
:image-url "https://..."}
|
||||
expected-db {:wallet {:last-collectible-details {:description "Pandaria"
|
||||
:image-url "https://..."}}}
|
||||
effects (collectible-events/store-last-collectible-details {:db db}
|
||||
[last-collectible])
|
||||
result-db (:db effects)]
|
||||
(is (match? result-db expected-db)))))
|
||||
|
||||
(deftest reset-selected-networks-test
|
||||
(testing "reset-selected-networks"
|
||||
(let [db {:wallet {}}
|
||||
@@ -116,51 +122,3 @@
|
||||
effects (events/update-selected-networks {:db db} props)
|
||||
result-fx (:fx effects)]
|
||||
(is (match? result-fx expected-fx)))))
|
||||
|
||||
(deftest get-wallet-token-for-all-accounts-test
|
||||
(testing "get wallet token for all accounts"
|
||||
(let [address-1 "0x1"
|
||||
address-2 "0x2"
|
||||
cofx {:db {:wallet {:accounts {address-1 {:address address-1}
|
||||
address-2 {:address address-2}}}}}
|
||||
effects (events/get-wallet-token-for-all-accounts cofx)
|
||||
result-fx (:fx effects)
|
||||
expected-fx [[:dispatch [:wallet/get-wallet-token-for-account address-1]]
|
||||
[:dispatch [:wallet/get-wallet-token-for-account address-2]]]]
|
||||
(is (match? expected-fx result-fx)))))
|
||||
|
||||
(deftest get-wallet-token-for-account-test
|
||||
(testing "get wallet token for account"
|
||||
(let [cofx {:db {}}
|
||||
effects (events/get-wallet-token-for-account cofx [address])
|
||||
expected-effects {:db {:wallet {:ui {:tokens-loading {address true}}}}
|
||||
:fx [[:json-rpc/call
|
||||
[{:method "wallet_getWalletToken"
|
||||
:params [[address]]
|
||||
:on-success [:wallet/store-wallet-token address]
|
||||
:on-error [:wallet/get-wallet-token-for-account-failed
|
||||
address]}]]]}]
|
||||
(is (match? expected-effects effects)))))
|
||||
|
||||
(deftest check-recent-history-for-all-accounts-test
|
||||
(testing "check recent history for all accounts"
|
||||
(let [address-1 "0x1"
|
||||
address-2 "0x2"
|
||||
cofx {:db {:wallet {:accounts {address-1 {:address address-1}
|
||||
address-2 {:address address-2}}}}}
|
||||
effects (events/check-recent-history-for-all-accounts cofx)
|
||||
result-fx (:fx effects)
|
||||
expected-fx [[:dispatch [:wallet/check-recent-history-for-account address-1]]
|
||||
[:dispatch [:wallet/check-recent-history-for-account address-2]]]]
|
||||
(is (match? expected-fx result-fx)))))
|
||||
|
||||
(deftest process-account-from-signal-test
|
||||
(testing "process account from signal"
|
||||
(let [cofx {:db {:wallet {:accounts {}}}}
|
||||
effects (events/process-account-from-signal cofx [raw-account])
|
||||
expected-effects {:db {:wallet {:accounts {address account}}}
|
||||
:fx [[:dispatch [:wallet/get-wallet-token-for-account address]]
|
||||
[:dispatch
|
||||
[:wallet/request-new-collectibles-for-account-from-signal address]]
|
||||
[:dispatch [:wallet/check-recent-history-for-account address]]]}]
|
||||
(is (match? expected-effects effects)))))
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(let [tokens-loading? (rf/sub [:wallet/home-tokens-loading?])
|
||||
(let [tokens-loading? (rf/sub [:wallet/tokens-loading?])
|
||||
{:keys [tokens]} (rf/sub [:wallet/aggregated-token-values-and-balance])]
|
||||
(if tokens-loading?
|
||||
[quo/skeleton-list
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
[]
|
||||
(let [[selected-tab set-selected-tab] (rn/use-state (:id (first tabs-data)))
|
||||
account-list-ref (rn/use-ref-atom nil)
|
||||
tokens-loading? (rf/sub [:wallet/home-tokens-loading?])
|
||||
tokens-loading? (rf/sub [:wallet/tokens-loading?])
|
||||
networks (rf/sub [:wallet/selected-network-details])
|
||||
account-cards-data (rf/sub [:wallet/account-cards-data])
|
||||
cards (conj account-cards-data (new-account-card-data))
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
[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]
|
||||
@@ -42,7 +43,7 @@
|
||||
{:on-layout #(reset! options-height (oops/oget % "nativeEvent.layout.height"))
|
||||
:style (when show-account-selector? style/options-container)}
|
||||
(when show-account-selector?
|
||||
[quo/blur
|
||||
[blur/view
|
||||
{:style (style/blur-container @options-height)
|
||||
:blur-radius (if platform/android? 20 10)
|
||||
:blur-amount (if platform/ios? 20 10)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(ns status-im.contexts.wallet.sheets.network-preferences.style
|
||||
(:require [quo.foundations.colors :as colors]
|
||||
[react-native.platform :as platform]))
|
||||
(:require [quo.foundations.colors :as colors]))
|
||||
|
||||
(def blur
|
||||
{:position :absolute
|
||||
@@ -8,7 +7,7 @@
|
||||
:left 0
|
||||
:right 0
|
||||
:bottom 0
|
||||
:overlay-color (when platform/ios? colors/neutral-100-opa-70-blur)})
|
||||
:overlay-color colors/neutral-100-opa-70-blur})
|
||||
|
||||
(def data-item
|
||||
{:margin-horizontal 20
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
(ns status-im.contexts.wallet.sheets.network-preferences.view
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.wallet.common.utils :as utils]
|
||||
[status-im.contexts.wallet.sheets.network-preferences.style :as style]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
(:require [quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.blur :as blur]
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.wallet.common.utils :as utils]
|
||||
[status-im.contexts.wallet.sheets.network-preferences.style :as style]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn view
|
||||
[{:keys [first-section-label second-section-label selected-networks
|
||||
@@ -64,7 +64,7 @@
|
||||
[:<>
|
||||
;; quo/overlay isn't compatible with sheets
|
||||
(when blur?
|
||||
[quo/blur
|
||||
[blur/view
|
||||
{:style style/blur
|
||||
:blur-amount 20
|
||||
:blur-radius 25}])
|
||||
|
||||
@@ -40,4 +40,6 @@
|
||||
"wallet-activity-filtering-done" {:fx [[:dispatch
|
||||
[:wallet/activity-filtering-done
|
||||
(transforms/js->clj event-js)]]]}
|
||||
(log/debug ::unknown-wallet-event :type event-type)))))
|
||||
(log/debug ::unknown-wallet-event
|
||||
:type event-type
|
||||
:event (transforms/js->clj event-js))))))
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
:address "0x1"
|
||||
:mixedcase-address "0x1"
|
||||
:chain-short-names "eth:arb1:oeth:"
|
||||
:ens? false
|
||||
:has-ens? false
|
||||
:network-preferences-names #{:arbitrum
|
||||
:optimism
|
||||
:mainnet}
|
||||
@@ -22,7 +22,7 @@
|
||||
:address "0x2"
|
||||
:mixedcase-address "0x2"
|
||||
:chain-short-names "eth:"
|
||||
:ens? false
|
||||
:has-ens? false
|
||||
:network-preferences-names #{:mainnet}
|
||||
:name "Bob"
|
||||
:created-at 1716828825
|
||||
@@ -33,7 +33,7 @@
|
||||
:address "0x1"
|
||||
:mixedcase-address "0x1"
|
||||
:chain-short-names "eth:"
|
||||
:ens? false
|
||||
:has-ens? false
|
||||
:network-preferences-names #{:mainnet}
|
||||
:name "Alice"
|
||||
:created-at 1716826745
|
||||
@@ -44,7 +44,7 @@
|
||||
:address "0x2"
|
||||
:mixedcase-address "0x2"
|
||||
:chain-short-names "eth:arb1:oeth:"
|
||||
:ens? false
|
||||
:has-ens? false
|
||||
:network-preferences-names #{:arbitrum
|
||||
:optimism
|
||||
:mainnet}
|
||||
@@ -61,7 +61,7 @@
|
||||
:address "0x1"
|
||||
:mixedcase-address "0x1"
|
||||
:chain-short-names "eth:"
|
||||
:ens? false
|
||||
:has-ens? false
|
||||
:network-preferences-names #{:mainnet}
|
||||
:name "Alice"
|
||||
:created-at 1716826745
|
||||
@@ -74,7 +74,7 @@
|
||||
:address "0x2"
|
||||
:mixedcase-address "0x2"
|
||||
:chain-short-names "eth:arb1:oeth:"
|
||||
:ens? false
|
||||
:has-ens? false
|
||||
:network-preferences-names #{:arbitrum
|
||||
:optimism
|
||||
:mainnet}
|
||||
|
||||
@@ -39,25 +39,9 @@
|
||||
:-> :scanned-address)
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/tokens-loading
|
||||
:wallet/tokens-loading?
|
||||
:<- [:wallet/ui]
|
||||
:-> :tokens-loading)
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/home-tokens-loading?
|
||||
:<- [:wallet/tokens-loading]
|
||||
(fn [tokens-loading]
|
||||
(->> tokens-loading
|
||||
vals
|
||||
(some true?)
|
||||
boolean)))
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/current-viewing-account-tokens-loading?
|
||||
:<- [:wallet/tokens-loading]
|
||||
:<- [:wallet/current-viewing-account-address]
|
||||
(fn [[tokens-loading current-viewing-account-address]]
|
||||
(get tokens-loading current-viewing-account-address)))
|
||||
:-> :tokens-loading?)
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/create-account
|
||||
@@ -234,9 +218,9 @@
|
||||
:or {networks []
|
||||
size 32}}]
|
||||
(->> accounts
|
||||
(keep (fn [{:keys [path color emoji name address]}]
|
||||
(keep (fn [{:keys [path customization-color emoji name address]}]
|
||||
(when-not (string/starts-with? path constants/path-eip1581)
|
||||
{:account-props {:customization-color color
|
||||
{:account-props {:customization-color customization-color
|
||||
:size size
|
||||
:emoji emoji
|
||||
:type :default
|
||||
@@ -249,8 +233,8 @@
|
||||
(defn- format-settings-missing-keypair-accounts
|
||||
[accounts]
|
||||
(->> accounts
|
||||
(map (fn [{:keys [color emoji]}]
|
||||
{:customization-color color
|
||||
(map (fn [{:keys [customization-color emoji]}]
|
||||
{:customization-color customization-color
|
||||
:emoji emoji
|
||||
:type :default}))))
|
||||
|
||||
@@ -327,15 +311,15 @@
|
||||
:wallet/account-cards-data
|
||||
:<- [:wallet/accounts]
|
||||
:<- [:wallet/balances-in-selected-networks]
|
||||
:<- [:wallet/tokens-loading]
|
||||
:<- [:wallet/tokens-loading?]
|
||||
:<- [:profile/currency-symbol]
|
||||
(fn [[accounts balances tokens-loading currency-symbol]]
|
||||
(fn [[accounts balances tokens-loading? currency-symbol]]
|
||||
(mapv (fn [{:keys [color address watch-only?] :as account}]
|
||||
(assoc account
|
||||
:customization-color color
|
||||
:type (if watch-only? :watch-only :empty)
|
||||
:on-press #(rf/dispatch [:wallet/navigate-to-account address])
|
||||
:loading? (get tokens-loading address)
|
||||
:loading? tokens-loading?
|
||||
:balance (utils/prettify-balance currency-symbol (get balances address))))
|
||||
accounts)))
|
||||
|
||||
|
||||
@@ -609,46 +609,46 @@
|
||||
(rf/sub [sub-name])))))
|
||||
|
||||
(def chat-account
|
||||
{:path "m/43'/60'/1581'/0'/0"
|
||||
:emoji ""
|
||||
:key-uid "abc"
|
||||
:address "address-1"
|
||||
:color-id ""
|
||||
:wallet false
|
||||
:name "My Profile"
|
||||
:type "generated"
|
||||
:chat true
|
||||
:color :blue
|
||||
:hidden false
|
||||
:removed false})
|
||||
{:path "m/43'/60'/1581'/0'/0"
|
||||
:emoji ""
|
||||
:key-uid "abc"
|
||||
:address "address-1"
|
||||
:color-id ""
|
||||
:wallet false
|
||||
:name "My Profile"
|
||||
:type "generated"
|
||||
:chat true
|
||||
:customization-color :blue
|
||||
:hidden false
|
||||
:removed false})
|
||||
|
||||
(def operable-wallet-account
|
||||
{:path "m/44'/60'/0'/0/0"
|
||||
:emoji "🤡"
|
||||
:key-uid "abc"
|
||||
:address "address-2"
|
||||
:wallet true
|
||||
:name "My Account"
|
||||
:type "generated"
|
||||
:chat false
|
||||
:color :primary
|
||||
:hidden false
|
||||
:operable :fully
|
||||
:removed false})
|
||||
{:path "m/44'/60'/0'/0/0"
|
||||
:emoji "🤡"
|
||||
:key-uid "abc"
|
||||
:address "address-2"
|
||||
:wallet true
|
||||
:name "My Account"
|
||||
:type "generated"
|
||||
:chat false
|
||||
:customization-color :primary
|
||||
:hidden false
|
||||
:operable :fully
|
||||
:removed false})
|
||||
|
||||
(def inoperable-wallet-account
|
||||
{:path "m/44'/60'/0'/0/0"
|
||||
:emoji "🧠"
|
||||
:key-uid "def"
|
||||
:address "address-3"
|
||||
:wallet true
|
||||
:name "My Other Account"
|
||||
:type "generated"
|
||||
:chat false
|
||||
:color :primary
|
||||
:hidden false
|
||||
:operable :no
|
||||
:removed false})
|
||||
{:path "m/44'/60'/0'/0/0"
|
||||
:emoji "🧠"
|
||||
:key-uid "def"
|
||||
:address "address-3"
|
||||
:wallet true
|
||||
:name "My Other Account"
|
||||
:type "generated"
|
||||
:chat false
|
||||
:customization-color :primary
|
||||
:hidden false
|
||||
:operable :no
|
||||
:removed false})
|
||||
|
||||
(def default-keypair-accounts
|
||||
{:key-uid "abc"
|
||||
@@ -686,13 +686,14 @@
|
||||
{:missing [{:name (:name seed-phrase-keypair-accounts)
|
||||
:key-uid (:key-uid seed-phrase-keypair-accounts)
|
||||
:type (keyword (:type seed-phrase-keypair-accounts))
|
||||
:accounts [{:customization-color (:color inoperable-wallet-account)
|
||||
:accounts [{:customization-color (:customization-color inoperable-wallet-account)
|
||||
:emoji (:emoji inoperable-wallet-account)
|
||||
:type :default}]}]
|
||||
:operable [{:name (:name default-keypair-accounts)
|
||||
:key-uid (:key-uid default-keypair-accounts)
|
||||
:type (keyword (:type default-keypair-accounts))
|
||||
:accounts [{:account-props {:customization-color (:color operable-wallet-account)
|
||||
:accounts [{:account-props {:customization-color (:customization-color
|
||||
operable-wallet-account)
|
||||
:size 32
|
||||
:emoji (:emoji operable-wallet-account)
|
||||
:type :default
|
||||
@@ -716,7 +717,7 @@
|
||||
[:wallet :accounts]
|
||||
{(:address operable-wallet-account) operable-wallet-account}))))
|
||||
|
||||
(let [{:keys [color
|
||||
(let [{:keys [customization-color
|
||||
name
|
||||
address
|
||||
emoji]} operable-wallet-account
|
||||
@@ -729,7 +730,7 @@
|
||||
:operable [{:name (:name default-keypair-accounts)
|
||||
:key-uid (:key-uid default-keypair-accounts)
|
||||
:type (keyword (:type default-keypair-accounts))
|
||||
:accounts [{:account-props {:customization-color color
|
||||
:accounts [{:account-props {:customization-color customization-color
|
||||
:size size-option
|
||||
:emoji emoji
|
||||
:type :default
|
||||
@@ -762,7 +763,8 @@
|
||||
:operable [{:name (:name default-keypair-accounts)
|
||||
:key-uid (:key-uid default-keypair-accounts)
|
||||
:type (keyword (:type default-keypair-accounts))
|
||||
:accounts [{:account-props {:customization-color (:color operable-wallet-account)
|
||||
:accounts [{:account-props {:customization-color (:customization-color
|
||||
operable-wallet-account)
|
||||
:size 32
|
||||
:emoji (:emoji operable-wallet-account)
|
||||
:type :default
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
(defn wallet-loaded?
|
||||
[]
|
||||
(not @(rf/subscribe [:wallet/home-tokens-loading?])))
|
||||
(not @(rf/subscribe [:wallet/tokens-loading?])))
|
||||
|
||||
(defn assert-messenger-started
|
||||
[]
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
|
||||
"owner": "status-im",
|
||||
"repo": "status-go",
|
||||
"version": "v0.179.28",
|
||||
"commit-sha1": "33ccf784c52e56d98f2928b4618db5490a1e1f95",
|
||||
"src-sha256": "0cz8cbzqbp6i3p9la0iibk73s2fmlk449zd9fznms8b02g4n3xic"
|
||||
"version": "61e2d7184df8ba0f1505b8cc3705ab4f705af450",
|
||||
"commit-sha1": "61e2d7184df8ba0f1505b8cc3705ab4f705af450",
|
||||
"src-sha256": "0q49i47nbg9b3qn5abw9v7243av8msv0blyrg17a92gy27x2bdxa"
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
|
||||
self.home_2.just_fyi("Device 2 sign in, user name is " + self.username_2)
|
||||
self.home_2.reopen_app(sign_in=False)
|
||||
self.device_2.show_profiles_button.wait_and_click()
|
||||
self.device_2.get_user_profile_by_name(username=self.username_2).click()
|
||||
self.device_2.get_user(username=self.username_2).click()
|
||||
self.device_2.sign_in()
|
||||
|
||||
self.loop.run_until_complete(run_in_parallel(((_device_1_creates_user, {}),
|
||||
|
||||
@@ -115,18 +115,12 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
|
||||
self.chats[2].add_remove_same_reaction(message=message, emoji="thumbs-up")
|
||||
self.chats[2].set_reaction(message=message, emoji="laugh")
|
||||
|
||||
def _check_reactions_count(chat_view_index):
|
||||
self.chats[chat_view_index].just_fyi("Checking reactions count for each group member and admin")
|
||||
chat_element = self.chats[chat_view_index].chat_element_by_text(message)
|
||||
chat_element.emojis_below_message(emoji="thumbs-up").wait_for_element_text(2)
|
||||
chat_element.emojis_below_message(emoji="love").wait_for_element_text(1)
|
||||
chat_element.emojis_below_message(emoji="laugh").wait_for_element_text(1)
|
||||
|
||||
self.loop.run_until_complete(run_in_parallel((
|
||||
(_check_reactions_count, {'chat_view_index': 0}),
|
||||
(_check_reactions_count, {'chat_view_index': 1}),
|
||||
(_check_reactions_count, {'chat_view_index': 2})
|
||||
)))
|
||||
for i in range(3):
|
||||
self.chats[i].just_fyi("Checking reactions count for each group member and admin")
|
||||
message_element = self.chats[i].chat_element_by_text(message)
|
||||
message_element.emojis_below_message(emoji="thumbs-up").wait_for_element_text(2)
|
||||
message_element.emojis_below_message(emoji="love").wait_for_element_text(1)
|
||||
message_element.emojis_below_message(emoji="laugh").wait_for_element_text(1)
|
||||
|
||||
self.chats[0].just_fyi("Admin checks info about voted users")
|
||||
self.chats[0].chat_element_by_text(message).emojis_below_message(
|
||||
@@ -169,23 +163,15 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
|
||||
self.chats[2].add_remove_same_reaction(message=message, emoji="laugh")
|
||||
self.chats[2].add_remove_same_reaction(message=message, emoji="sad")
|
||||
|
||||
def _check_reactions_count_after_change(chat_view_index):
|
||||
self.chats[chat_view_index].just_fyi(
|
||||
"Checking reactions count for each group member and admin after they were changed")
|
||||
chat_element = self.chats[chat_view_index].chat_element_by_text(message)
|
||||
for i in range(3):
|
||||
self.chats[i].just_fyi("Checking reactions count for each group member and admin after they were changed")
|
||||
message_element = self.chats[i].chat_element_by_text(message)
|
||||
try:
|
||||
chat_element.emojis_below_message(emoji="thumbs-up").wait_for_element_text(1)
|
||||
chat_element.emojis_below_message(emoji="love").wait_for_element_text(1)
|
||||
chat_element.emojis_below_message(emoji="sad").wait_for_element_text(2)
|
||||
message_element.emojis_below_message(emoji="thumbs-up").wait_for_element_text(1)
|
||||
message_element.emojis_below_message(emoji="love").wait_for_element_text(1)
|
||||
message_element.emojis_below_message(emoji="sad").wait_for_element_text(2)
|
||||
except (Failed, NoSuchElementException):
|
||||
self.errors.append(
|
||||
"Incorrect reactions count for %s after changing the reactions" % self.usernames[chat_view_index])
|
||||
|
||||
self.loop.run_until_complete(run_in_parallel((
|
||||
(_check_reactions_count_after_change, {'chat_view_index': 0}),
|
||||
(_check_reactions_count_after_change, {'chat_view_index': 1}),
|
||||
(_check_reactions_count_after_change, {'chat_view_index': 2})
|
||||
)))
|
||||
self.errors.append("Incorrect reactions count for %s after changing the reactions" % self.usernames[i])
|
||||
|
||||
self.chats[0].just_fyi("Admin relogins")
|
||||
self.chats[0].reopen_app()
|
||||
@@ -300,16 +286,11 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
|
||||
|
||||
@marks.testrail_id(702808)
|
||||
def test_group_chat_offline_pn(self):
|
||||
def _proceed_to_chat(index):
|
||||
self.homes[index].navigate_back_to_home_view()
|
||||
self.homes[index].chats_tab.click()
|
||||
self.homes[index].groups_tab.click()
|
||||
self.homes[index].get_chat(self.chat_name).click()
|
||||
|
||||
self.loop.run_until_complete(run_in_parallel((
|
||||
(_proceed_to_chat, {'index': 1}),
|
||||
(_proceed_to_chat, {'index': 2})
|
||||
)))
|
||||
for i in range(1, 3):
|
||||
self.homes[i].navigate_back_to_home_view()
|
||||
self.homes[i].chats_tab.click()
|
||||
self.homes[i].groups_tab.click()
|
||||
self.homes[i].get_chat(self.chat_name).click()
|
||||
|
||||
message_1, message_2 = 'message from old member', 'message from new member'
|
||||
|
||||
@@ -337,18 +318,11 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
|
||||
self.homes[0].chats_tab.click()
|
||||
self.homes[0].get_chat(self.chat_name).click()
|
||||
|
||||
def _check_messages(index):
|
||||
self.chats[index].just_fyi("Check that messages are shown for user %s" % self.usernames[index])
|
||||
for message_text in (message_1, message_2):
|
||||
if not self.chats[index].chat_element_by_text(message_text).is_element_displayed(30):
|
||||
self.errors.append('%s if not shown for device %s' % (message_text, index))
|
||||
|
||||
self.loop.run_until_complete(run_in_parallel((
|
||||
(_check_messages, {'index': 0}),
|
||||
(_check_messages, {'index': 1}),
|
||||
(_check_messages, {'index': 2})
|
||||
)))
|
||||
|
||||
self.homes[0].just_fyi("check that messages are shown for every member")
|
||||
for i in range(3):
|
||||
for message in (message_1, message_2):
|
||||
if not self.chats[i].chat_element_by_text(message).is_element_displayed(30):
|
||||
self.errors.append('%s if not shown for device %s' % (message, str(i)))
|
||||
self.errors.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(702732)
|
||||
@@ -407,33 +381,28 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
|
||||
self.chats[1].chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30)):
|
||||
self.errors.append("Message 4 is not pinned in group chat after unpinning previous one")
|
||||
|
||||
def _check_pinned_messages(index):
|
||||
self.chats[index].just_fyi("Check pinned messages count and content for user %s" % self.usernames[index])
|
||||
count = self.chats[index].pinned_messages_count.text
|
||||
self.chats[0].just_fyi("Check pinned messages count and content")
|
||||
for chat_number, group_chat in enumerate([self.chats[0], self.chats[1]]):
|
||||
count = group_chat.pinned_messages_count.text
|
||||
if count != '3':
|
||||
self.errors.append(
|
||||
"Pinned messages count %s doesn't match expected 3 for user %s" % (count, self.usernames[index]))
|
||||
self.chats[index].pinned_messages_count.click()
|
||||
for message_text in self.message_1, self.message_3, self.message_4:
|
||||
pinned_by = self.chats[index].pinned_messages_list.get_message_pinned_by_text(message_text)
|
||||
"Pinned messages count %s doesn't match expected 3 for user %s" % (count, chat_number + 1))
|
||||
group_chat.pinned_messages_count.click()
|
||||
for message in self.message_1, self.message_3, self.message_4:
|
||||
pinned_by = group_chat.pinned_messages_list.get_message_pinned_by_text(message)
|
||||
if pinned_by.is_element_displayed():
|
||||
text = pinned_by.text.strip()
|
||||
expected_text = "You" if index == 0 else self.usernames[0]
|
||||
expected_text = "You" if chat_number == 0 else self.usernames[0]
|
||||
if text != expected_text:
|
||||
self.errors.append(
|
||||
"Pinned by '%s' doesn't match expected '%s' for user %s" % (
|
||||
text, expected_text, self.usernames[index])
|
||||
text, expected_text, chat_number + 1)
|
||||
)
|
||||
else:
|
||||
self.errors.append(
|
||||
"Message '%s' is missed on Pinned messages list for user %s" % (message, self.usernames[index])
|
||||
"Message '%s' is missed on Pinned messages list for user %s" % (message, chat_number + 1)
|
||||
)
|
||||
|
||||
self.loop.run_until_complete(run_in_parallel((
|
||||
(_check_pinned_messages, {'index': 0}),
|
||||
(_check_pinned_messages, {'index': 1})
|
||||
)))
|
||||
|
||||
self.errors.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(703495)
|
||||
|
||||
@@ -33,6 +33,43 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
|
||||
self.community_view = self.home.get_community_view()
|
||||
self.channel = self.community_view.get_channel(self.channel_name).click()
|
||||
|
||||
@marks.testrail_id(703503)
|
||||
@marks.xfail(reason="Curated communities not loading, https://github.com/status-im/status-mobile/issues/17852",
|
||||
run=False)
|
||||
def test_community_discovery(self):
|
||||
self.home.navigate_back_to_home_view()
|
||||
self.home.communities_tab.click()
|
||||
self.home.discover_communities_button.click()
|
||||
self.home.community_card_item.wait_for_visibility_of_element(30)
|
||||
|
||||
if len(self.home.community_card_item.find_elements()) > 1:
|
||||
contributors_test_community_attributes = "Test Community", 'Open for anyone', 'Web3', 'Software dev'
|
||||
for text in contributors_test_community_attributes:
|
||||
if not self.home.element_by_text(text).is_element_displayed(10):
|
||||
self.errors.append("'%s' text is not in Discovery!" % text)
|
||||
self.home.element_by_text(contributors_test_community_attributes[0]).click()
|
||||
element_templates = {
|
||||
self.community_view.join_button: 'discovery_join_button.png',
|
||||
self.community_view.get_channel_avatar(): 'discovery_general_channel.png',
|
||||
}
|
||||
for element, template in element_templates.items():
|
||||
if element.is_element_differs_from_template(template):
|
||||
element.save_new_screenshot_of_element('%s_different.png' % template.split('.')[0])
|
||||
self.errors.append(
|
||||
"Element %s is different from expected template %s!" % (element.locator, template))
|
||||
self.community_view.navigate_back_to_home_view()
|
||||
self.home.communities_tab.click()
|
||||
self.home.discover_communities_button.click()
|
||||
self.home.community_card_item.wait_for_visibility_of_element(30)
|
||||
self.home.swipe_up()
|
||||
|
||||
status_ccs_community_attributes = '(old) Status CCs', 'Community for Status CCs', 'Ethereum', \
|
||||
'Software dev', 'Web3'
|
||||
for text in status_ccs_community_attributes:
|
||||
if not self.community_view.element_by_text(text).is_element_displayed(10):
|
||||
self.errors.append("'%s' text is not shown for (old) Status CCs!" % text)
|
||||
self.errors.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(702846)
|
||||
def test_community_navigate_to_channel_when_relaunch(self):
|
||||
text_message = 'some_text'
|
||||
@@ -224,7 +261,7 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
|
||||
self.home.just_fyi("Check that can remove user from logged out state")
|
||||
self.home.reopen_app(sign_in=False)
|
||||
self.sign_in.show_profiles_button.wait_and_click()
|
||||
user_card = self.sign_in.get_user_profile_by_name(username=self.username)
|
||||
user_card = self.sign_in.get_user(username=self.username)
|
||||
user_card.open_user_options()
|
||||
self.sign_in.remove_profile_button.click()
|
||||
if not self.sign_in.element_by_translation_id("remove-profile-confirm-message").is_element_displayed(30):
|
||||
@@ -239,67 +276,6 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
|
||||
|
||||
self.errors.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(703503)
|
||||
def test_community_discovery(self):
|
||||
try:
|
||||
# workaround for case if a user is logged out in the previous test
|
||||
self.sign_in.get_user_profile_by_index(index=1).click()
|
||||
self.sign_in.sign_in()
|
||||
except NoSuchElementException:
|
||||
pass
|
||||
self.home.navigate_back_to_home_view()
|
||||
self.home.just_fyi("Turn off testnet in the profile settings")
|
||||
profile = self.home.profile_button.click()
|
||||
profile.advanced_button.scroll_and_click()
|
||||
profile.testnet_mode_toggle.click()
|
||||
profile.ok_button.click()
|
||||
self.sign_in.sign_in()
|
||||
|
||||
self.home.just_fyi("Check Discover Communities content")
|
||||
self.home.communities_tab.click()
|
||||
self.home.discover_communities_button.click()
|
||||
self.home.community_card_item.wait_for_elements(seconds=120)
|
||||
|
||||
expected_communities = {
|
||||
' 0xUX': ['Design', 'Ethereum', 'Collaboration'],
|
||||
'Status': ['Web3', 'Blockchain', 'Ethereum'],
|
||||
'Status Inu': ['News', 'Social', 'Web3'],
|
||||
}
|
||||
for community_name, tags in expected_communities.items():
|
||||
self.home.just_fyi("Check %s community tags in the Discover communities screen" % community_name)
|
||||
card = self.home.get_discover_community_card_by_name(community_name=community_name)
|
||||
try:
|
||||
card.wait_for_visibility_of_element(30)
|
||||
if community_name == 'Status':
|
||||
card.swipe_to_web_element()
|
||||
missing_tags = list()
|
||||
for text in tags:
|
||||
try:
|
||||
card.get_child_element_by_text(text=text).wait_for_element()
|
||||
except TimeoutException:
|
||||
missing_tags.append(text)
|
||||
if missing_tags:
|
||||
self.errors.append("Community '%s' is missing tag(s) %s." % (community_name, ','.join(tags)))
|
||||
|
||||
if community_name == 'Status':
|
||||
self.home.just_fyi("Check Status community screen")
|
||||
card.click()
|
||||
if self.community_view.join_button.is_element_differs_from_template(
|
||||
'status_community_join_button.png'):
|
||||
self.errors.append("Status community Join button is different from expected template.")
|
||||
if self.community_view.community_logo.is_element_differs_from_template('status_community_logo.png'):
|
||||
self.errors.append("Status community logo is different from expected template.")
|
||||
|
||||
self.community_view.close_community_view_button.click()
|
||||
self.home.discover_communities_button.click()
|
||||
self.home.swipe_up()
|
||||
|
||||
except TimeoutException:
|
||||
self.errors.append("Community '%s' is not in the Discover Communities list." % community_name)
|
||||
|
||||
self.errors.verify_no_errors()
|
||||
# Note: this test should always be the LAST ONE in the group because it turns on mainnet in the app!
|
||||
|
||||
|
||||
@pytest.mark.xdist_group(name="new_three_2")
|
||||
@marks.new_ui_critical
|
||||
@@ -1022,8 +998,6 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase):
|
||||
self.errors.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(702948)
|
||||
@marks.xfail(reason="Can't enter channel after community is fetched for the first time, " \
|
||||
"https://github.com/status-im/status-mobile/issues/20395")
|
||||
def test_community_hashtag_links_to_community_channels(self):
|
||||
for home in self.homes:
|
||||
home.navigate_back_to_home_view()
|
||||
@@ -1124,8 +1098,6 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase):
|
||||
self.errors.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(703629)
|
||||
@marks.xfail(reason="Can't enter channel after community is fetched for the first time, " \
|
||||
"https://github.com/status-im/status-mobile/issues/20395")
|
||||
def test_community_join_when_node_owner_offline(self):
|
||||
for home in self.homes:
|
||||
home.navigate_back_to_home_view()
|
||||
@@ -1171,8 +1143,8 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase):
|
||||
general_channel.click()
|
||||
if not self.channel_2.chat_element_by_text(control_message_general_chat).is_element_displayed(30):
|
||||
self.errors.append(
|
||||
"Message in community channel is not visible for user before join, it was indicated as " \
|
||||
"%s sent for the sender before he went offline" % ("" if message_sent else "not"))
|
||||
"Message in community channel is not visible for user before join, it was indicated as" \
|
||||
"%s sent for the sender before he went offline" % "" if message_sent else "not")
|
||||
else:
|
||||
self.errors.append("Community channel is not displayed for user before join")
|
||||
self.community_2.toast_content_element.wait_for_invisibility_of_element(30)
|
||||
|
||||
@@ -367,9 +367,6 @@ class BaseElement(object):
|
||||
def exclude_emoji(value):
|
||||
return 'emoji' if value in emoji.UNICODE_EMOJI else value
|
||||
|
||||
def get_child_element_by_text(self, text: str):
|
||||
return BaseElement(self.driver, prefix=self.locator, xpath="//*[@text='%s']" % text)
|
||||
|
||||
|
||||
class EditBox(BaseElement):
|
||||
|
||||
|
||||
@@ -406,10 +406,10 @@ class CommunityView(HomeView):
|
||||
|
||||
#### NEW UI
|
||||
# Communities initial page
|
||||
self.close_community_view_button = Button(self.driver, accessibility_id="back-button")
|
||||
self.close_community_view_button = Button(
|
||||
self.driver,
|
||||
xpath="//*[@content-desc='community-options-for-community']/../*[1]//android.widget.ImageView")
|
||||
self.community_title = Text(self.driver, accessibility_id="community-title")
|
||||
self.community_logo = BaseElement(
|
||||
self.driver, xpath="//*[@content-desc='community-title']/preceding-sibling::*/android.widget.ImageView")
|
||||
self.community_description_text = Text(self.driver, accessibility_id="community-description-text")
|
||||
self.community_status_joined = Text(self.driver, accessibility_id="status-tag-positive")
|
||||
self.community_status_pending = Text(self.driver, accessibility_id="status-tag-pending")
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB |
@@ -603,10 +603,3 @@ class HomeView(BaseView):
|
||||
address = self.copy_wallet_address()
|
||||
self.click_system_back_button()
|
||||
return address
|
||||
|
||||
def get_discover_community_card_by_name(self, community_name: str):
|
||||
return BaseElement(
|
||||
self.driver,
|
||||
xpath="//*[@content-desc='%s'][descendant::*[@content-desc='chat-name-text'][@text='%s']]" % (
|
||||
self.community_card_item.accessibility_id, community_name)
|
||||
)
|
||||
|
||||
@@ -61,7 +61,7 @@ class ENSusernames(Button):
|
||||
|
||||
class AdvancedButton(Button):
|
||||
def __init__(self, driver):
|
||||
super().__init__(driver, accessibility_id="icon, Advanced, label-component, icon")
|
||||
super().__init__(driver, accessibility_id="advanced-button")
|
||||
|
||||
def click(self):
|
||||
self.scroll_to_element().click()
|
||||
@@ -363,8 +363,6 @@ class ProfileView(BaseView):
|
||||
self.profile_blocked_users_button = Button(self.driver, accessibility_id="Blocked users, label-component, icon")
|
||||
self.profile_legacy_button = Button(self.driver,
|
||||
accessibility_id="icon, Legacy settings, label-component, icon")
|
||||
self.testnet_mode_toggle = Button(self.driver,
|
||||
xpath="//*[@content-desc='test-networks-enabled']/android.widget.Switch")
|
||||
|
||||
def switch_network(self, network='Mainnet with upstream RPC'):
|
||||
self.driver.info("## Switch network to '%s'" % network, device=False)
|
||||
|
||||
@@ -12,9 +12,8 @@ from views.base_view import BaseView
|
||||
class MultiAccountButton(Button):
|
||||
class Username(Text):
|
||||
def __init__(self, driver, locator_value):
|
||||
super(MultiAccountButton.Username, self).__init__(
|
||||
driver,
|
||||
xpath="%s//android.widget.TextView[@content-desc='username']" % locator_value)
|
||||
super(MultiAccountButton.Username, self).__init__(driver,
|
||||
xpath="%s//android.widget.TextView[@content-desc='username']" % locator_value)
|
||||
|
||||
def __init__(self, driver, position=1):
|
||||
super(MultiAccountButton, self).__init__(driver,
|
||||
@@ -124,17 +123,10 @@ class TermsOfUseLink(Button):
|
||||
|
||||
|
||||
class UserProfileElement(Button):
|
||||
def __init__(self, driver, username: str = None, index: int = None):
|
||||
def __init__(self, driver, username):
|
||||
self.username = username
|
||||
self.index = index
|
||||
if username:
|
||||
super().__init__(
|
||||
driver,
|
||||
xpath="//*[@text='%s']//ancestor::android.view.ViewGroup[@content-desc='profile-card']" % self.username)
|
||||
elif index:
|
||||
super().__init__(driver, xpath="(//*[@content-desc='profile-card'])[%s]" % self.index)
|
||||
else:
|
||||
raise AttributeError("Either username or profile index should be defined")
|
||||
super().__init__(driver,
|
||||
xpath="//*[@text='%s']//ancestor::android.view.ViewGroup[@content-desc='profile-card']" % username)
|
||||
|
||||
def open_user_options(self):
|
||||
Button(self.driver, xpath='%s//*[@content-desc="profile-card-options"]' % self.locator).click()
|
||||
@@ -162,9 +154,8 @@ class SignInView(BaseView):
|
||||
self.privacy_policy_link = PrivacyPolicyLink(self.driver)
|
||||
self.terms_of_use_link = TermsOfUseLink(self.driver)
|
||||
self.keycard_storage_button = KeycardKeyStorageButton(self.driver)
|
||||
self.first_username_on_choose_chat_name = Text(
|
||||
self.driver,
|
||||
xpath="//*[@content-desc='select-account-button-0']//android.widget.TextView[1]")
|
||||
self.first_username_on_choose_chat_name = Text(self.driver,
|
||||
xpath="//*[@content-desc='select-account-button-0']//android.widget.TextView[1]")
|
||||
self.get_keycard_banner = Button(self.driver, translation_id="get-a-keycard")
|
||||
self.accept_tos_checkbox = self.checkbox_button
|
||||
|
||||
@@ -357,12 +348,7 @@ class SignInView(BaseView):
|
||||
print(str(e))
|
||||
self.driver.info('## Exporting database is finished!', device=False)
|
||||
|
||||
def get_user_profile_by_name(self, username: str):
|
||||
def get_user(self, username):
|
||||
self.driver.info("Getting username card by '%s'" % username)
|
||||
expected_element = UserProfileElement(self.driver, username=username)
|
||||
return expected_element if expected_element.is_element_displayed(10) else self.driver.fail(
|
||||
"User %s is not found!" % username)
|
||||
|
||||
def get_user_profile_by_index(self, index: int):
|
||||
self.driver.info("Getting username card by index %s" % index)
|
||||
return UserProfileElement(self.driver, index=index)
|
||||
expected_element = UserProfileElement(self.driver, username)
|
||||
return expected_element if expected_element.is_element_displayed(10) else self.driver.fail("User is not found!")
|
||||
|
||||
Reference in New Issue
Block a user