Compare commits

..
Author SHA1 Message Date
Ibrkhalil 9890836457 Rebase go 2023-12-12 10:25:48 +02:00
Ibrkhalil 964a610d25 Share community URL 2023-12-12 10:05:35 +02:00
63 changed files with 432 additions and 678 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 675 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -155,7 +155,7 @@
;; setupFilesAfterEnv.
status-im2.setup.schema-preload
;;quo.core-spec
quo.core-spec
status-im2.core-spec]
:ns-regexp "component-spec$"
:output-dir "component-spec"
@@ -7,7 +7,6 @@
(h/test "Token label renders"
(h/render [token-value/view
{:token :snt
:token-name "Status"
:state :default
:status :empty
:customization-color :blue
@@ -21,7 +20,6 @@
(h/test "Status change"
(h/render [token-value/view
{:token :snt
:token-name "Status"
:state :default
:status :positive
:customization-color :blue
@@ -6,6 +6,7 @@
[quo.components.markdown.text :as text]
[quo.components.utilities.token.view :as token]
[quo.foundations.colors :as colors]
[quo.foundations.common :as common]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[reagent.core :as reagent]))
@@ -13,8 +14,7 @@
(defn- internal-view
[]
(let [state (reagent/atom :default)]
(fn [{:keys [theme customization-color status token metrics? values on-press on-long-press
token-name]}]
(fn [{:keys [theme customization-color status token metrics? values on-press on-long-press]}]
(let [bg-opacity (case @state
:active 10
:pressed 5
@@ -36,7 +36,7 @@
:flex 1}}
[token/view {:token token :size :size-32}]
[rn/view {:style {:margin-left 8}}
[text/text {:weight :semi-bold} token-name]
[text/text {:weight :semi-bold} (common/token-label token)]
[text/text
{:size :paragraph-2
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}}
+7 -24
View File
@@ -1,11 +1,8 @@
(ns quo.components.utilities.token.view
(:require
[clojure.string :as string]
[quo.components.markdown.text :as quo]
[quo.components.utilities.token.loader :as token-loader]
[react-native.core :as rn]
[schema.core :as schema]
[utils.number]))
(:require [quo.components.utilities.token.loader :as token-loader]
[react-native.core :as rn]
[schema.core :as schema]
[utils.number]))
(def ?schema
[:=>
@@ -36,18 +33,6 @@
(def ^:private b64-png-image-prefix "data:image/png;base64,")
(defn temp-empty-symbol
[token size]
[rn/view
{:style (token-style {:justify-content :center
:align-items :center
:border-radius 20
:border-width 1
:border-color :grey}
size)}
[quo/text {:style {:color :grey}}
(string/capitalize (first (name token)))]])
(defn view-internal
"Render a token image.
Props:
@@ -66,10 +51,8 @@
(str b64-png-image-prefix image-source)
image-source)
source (or b64-string (token-loader/get-token-image token))]
(if source
[rn/image
{:style (token-style style size)
:source source}]
[temp-empty-symbol token size])))
[rn/image
{:style (token-style style size)
:source source}]))
(def view (schema/instrument #'view-internal ?schema))
+5
View File
@@ -3,3 +3,8 @@
(def currency-label
{:eur "€"
:usd "$"})
(def token-label
{:eth "Ethereum"
:snt "Status"
:dai "Dai"})
@@ -19,8 +19,7 @@
transactions-management-enabled?
wakuv2-flag
current-fleet
webview-debug
test-networks-enabled?]}]
webview-debug]}]
(keep
identity
[{:size :small
@@ -101,14 +100,6 @@
[:profile.settings/change-webview-debug (not webview-debug)])
:accessory :switch
:active webview-debug}
{:size :small
:title "Testnet mode"
:accessibility-label :test-networks-enabled
:container-margin-bottom 8
:on-press
#(re-frame/dispatch [:profile.settings/toggle-test-networks])
:accessory :switch
:active test-networks-enabled?}
{:size :small
:title (i18n/label :t/waku-bloom-filter-mode)
:accessibility-label :waku-bloom-filter-mode-settings-switch
@@ -137,8 +128,7 @@
(views/defview advanced-settings
[]
(views/letsubs [{:keys [webview-debug
test-networks-enabled?]} [:profile/profile]
(views/letsubs [{:keys [webview-debug]} [:profile/profile]
network-name [:network-name]
waku-bloom-filter-mode [:waku/bloom-filter-mode]
wakuv2-flag [:waku/v2-flag]
@@ -154,7 +144,6 @@
:dev-mode? false
:wakuv2-flag wakuv2-flag
:waku-bloom-filter-mode waku-bloom-filter-mode
:webview-debug webview-debug
:test-networks-enabled? test-networks-enabled?})
:webview-debug webview-debug})
:key-fn (fn [_ i] (str i))
:render-fn render-item}]))
+1 -4
View File
@@ -18,8 +18,6 @@
constants/local-pairing-event-connection-success)
(= action
constants/local-pairing-action-connect))
connection-error? (and (= type
constants/local-pairing-event-connection-error))
error-on-pairing? (contains? constants/local-pairing-event-errors type)
completed-pairing? (and (= type
constants/local-pairing-event-transfer-success)
@@ -32,9 +30,8 @@
(and (some? account) (some? password)))
multiaccount-data (when received-account?
(merge account {:password password}))
navigate-to-syncing-devices? (and (or connection-success? connection-error?) receiver?)
navigate-to-syncing-devices? (and (or connection-success? error-on-pairing?) receiver?)
user-in-syncing-devices-screen? (or (= (:view-id db) :syncing-progress)
(= (:view-id db) :profiles)
(= (:view-id db) :syncing-progress-intro))
user-in-sign-in-intro-screen? (= (:view-id db) :sign-in-intro)]
(merge {:db (cond-> db
+1 -6
View File
@@ -47,7 +47,6 @@
:no-contacts-to-invite-dark (js/require "../resources/images/ui2/no-contacts-to-invite-dark.png")
:no-notifications-light (js/require "../resources/images/ui2/no-notifications-light.png")
:no-notifications-dark (js/require "../resources/images/ui2/no-notifications-dark.png")
:notifications (js/require "../resources/images/ui2/notifications.png")
:welcome-illustration (js/require "../resources/images/ui2/welcome_illustration.png")})
(def ui-themed
@@ -139,11 +138,7 @@
(js/require "../resources/videos2/biometrics_04.mp4")]
:generate-keys [(js/require "../resources/videos2/generating_keys_01.mp4")
(js/require "../resources/videos2/generating_keys_02.mp4")
(js/require "../resources/videos2/generating_keys_03.mp4")]
:notifications [(js/require "../resources/videos2/notifications_01.mp4")
(js/require "../resources/videos2/notifications_02.mp4")
(js/require "../resources/videos2/notifications_03.mp4")
(js/require "../resources/videos2/notifications_04.mp4")]})
(js/require "../resources/videos2/generating_keys_03.mp4")]})
(def services
{:latamex (js/require "../resources/images/services/Latamex.png")
+2
View File
@@ -157,4 +157,6 @@
(def default-kdf-iterations 3200)
(def shell-navigation-disabled? false)
(def community-accounts-selection-enabled? false)
@@ -4,6 +4,7 @@
[react-native.blur :as blur]
[react-native.core :as rn]
[react-native.reanimated :as reanimated]
[status-im2.config :as config]
[status-im2.contexts.chat.composer.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@@ -39,6 +40,8 @@
[quo/floating-shell-button
{:jump-to
{:on-press (fn []
(when config/shell-navigation-disabled?
(rf/dispatch [:chat/close true]))
(rf/dispatch [:shell/navigate-to-jump-to]))
:customization-color customization-color
:label (i18n/label :t/jump-to)
+12 -3
View File
@@ -7,6 +7,7 @@
[status-im.chat.models.loading :as loading]
[status-im.data-store.chats :as chats-store]
[status-im2.common.muting.helpers :refer [format-mute-till]]
[status-im2.config :as config]
[status-im2.constants :as constants]
[status-im2.contexts.chat.composer.link-preview.events :as link-preview]
status-im2.contexts.chat.effects
@@ -167,7 +168,7 @@
(rf/defn close-chat
{:events [:chat/close]}
[{:keys [db] :as cofx}]
[{:keys [db] :as cofx} navigate-to-shell?]
(when-let [chat-id (:current-chat-id db)]
(chat.state/reset-visible-item)
(rf/merge cofx
@@ -176,7 +177,15 @@
(dissoc :current-chat-id)
(assoc-in [:chat/inputs chat-id :focused?] false))
:effects.async-storage/set {:chat-id nil
:key-uid nil}})
:key-uid nil}}
(let [community-id (get-in db [:chats chat-id :community-id])]
;; When navigating back from community chat to community, update switcher card
;; A close chat event is also called while opening any chat.
;; That might lead to duplicate :dispatch keys in fx/merge, that's why dispatch-n
;; is used here.
(when (and community-id config/shell-navigation-disabled? (not navigate-to-shell?))
{:dispatch-n [[:shell/add-switcher-card
:community-overview community-id]]})))
(link-preview/reset-all)
(delete-for-me/sync-all)
(delete-message/send-all)
@@ -210,7 +219,7 @@
{:dispatch [(if animation :shell/navigate-to :navigate-to) :chat chat-id animation]}
(when-not (#{:community :community-overview :shell} (:view-id db))
(navigation/pop-to-root :shell-stack))
(close-chat)
(close-chat false)
(force-close-chat chat-id)
(fn [{:keys [db]}]
{:db (assoc db :current-chat-id chat-id)})
@@ -2,6 +2,7 @@
(:require
[quo.core :as quo]
[react-native.core :as rn]
[status-im2.config :as config]
[status-im2.constants :as constants]
[status-im2.contexts.shell.jump-to.constants :as jump-to.constants]
[utils.i18n :as i18n]
@@ -39,6 +40,8 @@
[quo/floating-shell-button
{:jump-to
{:on-press (fn []
(when config/shell-navigation-disabled?
(rf/dispatch [:chat/close true]))
(rf/dispatch [:shell/navigate-to-jump-to]))
:customization-color customization-color
:label (i18n/label :t/jump-to)}}
@@ -1,14 +1,19 @@
(ns status-im2.contexts.chat.messages.list.style
(:require
[quo.foundations.colors :as colors]
[react-native.reanimated :as reanimated]))
[react-native.reanimated :as reanimated]
[status-im2.config :as config]))
(defonce ^:const cover-height 168)
(defonce ^:const overscroll-cover-height 2000)
(defonce ^:const header-avatar-top-offset -36)
(def keyboard-avoiding-container
{:flex 1})
(defn keyboard-avoiding-container
[{:keys [top]}]
{:position :relative
:flex 1
:top (if config/shell-navigation-disabled? (- top) 0)
:margin-bottom (if config/shell-navigation-disabled? (- top) 0)})
(def list-container
{:padding-vertical 16})
@@ -9,6 +9,7 @@
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[status-im2.common.home.actions.view :as actions]
[status-im2.config :as config]
[status-im2.contexts.chat.messages.list.view :refer [topbar-invisible-scroll-y-value]]
[status-im2.contexts.chat.messages.navigation.style :as style]
[status-im2.contexts.chat.messages.pin.banner.view :as pin.banner]
@@ -115,7 +116,10 @@
:background :blur
:size 32
:accessibility-label :back-button
:on-press #(rf/dispatch [:navigate-back])}
:on-press #(do
(when config/shell-navigation-disabled?
(rf/dispatch [:chat/close]))
(rf/dispatch [:navigate-back]))}
back-icon]
[reanimated/view
{:style (style/animated-header all-loaded? translate-animation title-opacity-animation)}
@@ -49,7 +49,7 @@
;; Note - Don't pass `behavior :height` to keyboard avoiding view,. It breaks composer -
;; https://github.com/status-im/status-mobile/issues/16595
[rn/keyboard-avoiding-view
{:style style/keyboard-avoiding-container
{:style (style/keyboard-avoiding-container insets)
:keyboard-vertical-offset (- (:bottom insets))}
[list.view/message-list-content-view
@@ -242,7 +242,6 @@
(defn- internal-discover-view
[params]
(rf/dispatch [:fetch-contract-communities])
[:f> f-view-internal params])
(def view (quo.theme/with-theme internal-discover-view))
@@ -1,19 +1,22 @@
(ns status-im2.contexts.onboarding.enable-notifications.style)
(ns status-im2.contexts.onboarding.enable-notifications.style
(:require
[quo.foundations.colors :as colors]))
(def default-margin 20)
(defn page-container
[insets]
{:flex 1
:justify-content :space-between
:padding-top (:top insets)})
{:flex 1
:padding-top (:top insets)})
(defn page-illustration
[width]
{:flex 1
:width width})
(def page-heading {:z-index 1})
(def page-illustration
{:flex 1
:background-color colors/danger-50
:align-items :center
:margin-horizontal default-margin
:border-radius 20
:margin-top default-margin
:justify-content :center})
(defn buttons
[insets]
@@ -4,9 +4,6 @@
[react-native.core :as rn]
[react-native.platform :as platform]
[react-native.safe-area :as safe-area]
[status-im2.common.parallax.view :as parallax]
[status-im2.common.parallax.whitelist :as whitelist]
[status-im2.common.resources :as resources]
[status-im2.contexts.onboarding.enable-notifications.style :as style]
[status-im2.contexts.shell.jump-to.utils :as shell.utils]
[taoensso.timbre :as log]
@@ -38,7 +35,7 @@
(rf/dispatch [:navigate-to-within-stack
[:welcome :enable-notifications]]))
:type :primary
:icon-left :i/notifications
:before :i/notifications
:accessibility-label :enable-notifications-button
:customization-color profile-color}
(i18n/label :t/intro-wizard-title6)]
@@ -53,36 +50,16 @@
:container-style {:margin-top 12}}
(i18n/label :t/maybe-later)]]))
(defn enable-notifications-parallax
[]
(let [stretch (if rn/small-screen? -40 -25)]
[parallax/video
{:layers (:notifications resources/parallax-video)
:stretch stretch}]))
(defn enable-notifications-simple
[]
(let [width (:width (rn/get-window))]
[rn/image
{:resize-mode :contain
:style (style/page-illustration width)
:source (resources/get-image :notifications)}]))
(defn f-enable-notifications
(defn enable-notifications
[]
(let [insets (safe-area/get-insets)]
[rn/view {:style (style/page-container insets)}
[rn/view {:style style/page-heading}
[quo/page-nav
{:background :blur
:icon-name :i/arrow-left
:on-press #(rf/dispatch [:navigate-back-within-stack :enable-biometrics])}]
[page-title]]
(if whitelist/whitelisted?
[enable-notifications-parallax]
[enable-notifications-simple])
[quo/page-nav
{:background :blur
:icon-name :i/arrow-left
:on-press #(rf/dispatch [:navigate-back-within-stack :enable-biometrics])}]
[page-title]
[rn/view {:style style/page-illustration}
[quo/text
"Illustration here"]]
[enable-notification-buttons {:insets insets}]]))
(defn view
[]
[:f> f-enable-notifications])
@@ -4,7 +4,6 @@
[react-native.core :as rn]
[status-im2.contexts.onboarding.common.background.view :as background]
[status-im2.contexts.onboarding.syncing.progress.style :as style]
[utils.debounce :as debounce]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@@ -26,17 +25,12 @@
:description-accessibility-label :progress-screen-sub-title}])
(defn try-again-button
[profile-color in-onboarding? logged-in?]
[profile-color in-onboarding?]
[quo/button
{:on-press (fn []
(rf/dispatch [:syncing/clear-states])
(cond
logged-in? (rf/dispatch [:navigate-back])
in-onboarding? (rf/dispatch [:navigate-back-to :sign-in-intro])
:else (do
(rf/dispatch [:navigate-back])
(debounce/dispatch-and-chill [:open-modal :sign-in]
1000))))
(rf/dispatch [:navigate-back-to
(if in-onboarding? :sign-in-intro :sign-in)]))
:accessibility-label :try-again-later-button
:customization-color profile-color
:container-style style/try-again-button}
@@ -45,8 +39,7 @@
(defn view
[in-onboarding?]
(let [pairing-status (rf/sub [:pairing/pairing-status])
profile-color (:color (rf/sub [:onboarding/profile]))
logged-in? (rf/sub [:multiaccount/logged-in?])]
profile-color (:color (rf/sub [:onboarding/profile]))]
[rn/view {:style (style/page-container in-onboarding?)}
(when-not in-onboarding? [background/view true])
[quo/page-nav {:type :no-title :background :blur}]
@@ -57,7 +50,7 @@
[rn/view {:style style/page-illustration}
[quo/text "[Error here]"]])
(when-not (pairing-progress pairing-status)
[try-again-button profile-color in-onboarding? logged-in?])]))
[try-again-button profile-color in-onboarding?])]))
(defn view-onboarding
[]
@@ -4,7 +4,6 @@
[status-im2.constants :as constants]
status-im2.contexts.profile.settings.effects
[taoensso.timbre :as log]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(rf/defn send-contact-update
@@ -15,7 +14,6 @@
:on-success #(log/debug "sent contact update")}]}))
(rf/defn profile-update
{:events [:profile.settings/profile-update]}
[{:keys [db] :as cofx}
setting setting-value
{:keys [dont-sync? on-success] :or {on-success #()}}]
@@ -58,18 +56,6 @@
{:profile.settings/webview-debug-changed value}
(profile-update :webview-debug (boolean value) {})))
(rf/reg-event-fx :profile.settings/toggle-test-networks
(fn [{:keys [db]}]
(let [value (get-in db [:profile/profile :test-networks-enabled?])
on-success #(rf/dispatch [:logout])]
{:fx [[:ui/show-confirmation
{:title (i18n/label :t/testnet-mode-prompt-title)
:content (i18n/label :t/testnet-mode-prompt-content)
:on-accept #(rf/dispatch [:profile.settings/profile-update :test-networks-enabled?
(not value)
{:on-success on-success}])
:on-cancel nil}]]})))
(rf/defn change-preview-privacy-flag
{:events [:profile.settings/change-preview-privacy]}
[{:keys [db] :as cofx} private?]
@@ -20,7 +20,6 @@
(defn view
[]
(let [state (reagent/atom {:token :snt
:token-name "Status"
:state :default
:status :empty
:customization-color :blue
@@ -5,6 +5,7 @@
[quo.foundations.colors :as colors]
[react-native.core :as rn]
[react-native.fast-image :as fast-image]
[status-im2.config :as config]
[status-im2.constants :as constants]
[status-im2.contexts.chat.messages.resolver.message-resolver :as resolver]
[status-im2.contexts.shell.jump-to.animation :as animation]
@@ -197,7 +198,13 @@
(rf/dispatch [:chat/navigate-to-chat id])
(= card-type shell.constants/community-channel-card)
(rf/dispatch [:chat/navigate-to-chat channel-id])
(if config/shell-navigation-disabled?
(do
(rf/dispatch [:navigate-to :community-overview id])
(js/setTimeout
#(rf/dispatch [:chat/navigate-to-chat channel-id])
100))
(rf/dispatch [:chat/navigate-to-chat channel-id]))
(= card-type shell.constants/community-card)
(rf/dispatch [:navigate-to :community-overview id])))
@@ -1,5 +1,6 @@
(ns status-im2.contexts.shell.jump-to.effects
(:require
[status-im2.config :as config]
[status-im2.contexts.shell.jump-to.animation :as animation]
[status-im2.contexts.shell.jump-to.constants :as shell.constants]
[status-im2.contexts.shell.jump-to.state :as state]
@@ -14,8 +15,9 @@
(rf/reg-fx :effects.shell/navigate-to-jump-to
(fn []
(animation/close-home-stack false)
(some-> ^js @state/jump-to-list-ref
(.scrollToOffset #js {:y 0 :animated false}))))
(when-not config/shell-navigation-disabled?
(some-> ^js @state/jump-to-list-ref
(.scrollToOffset #js {:y 0 :animated false})))))
;; Note - pop-to-root resets currently opened screens to `close-screen-without-animation`.
;; This might take some time. So don't directly merge the effect of `pop-to-root` and
@@ -2,6 +2,7 @@
(:require
[status-im.data-store.switcher-cards :as switcher-cards-store]
[status-im.utils.core :as utils]
[status-im2.config :as config]
[status-im2.constants :as constants]
[status-im2.contexts.shell.jump-to.constants :as shell.constants]
status-im2.contexts.shell.jump-to.effects
@@ -65,10 +66,19 @@
(when card-data
(rf/merge
cofx
{:db (assoc-in
db
[:shell/switcher-cards (:card-id card-data)]
switcher-card)}
(merge
{:db (assoc-in
db
[:shell/switcher-cards (:card-id card-data)]
switcher-card)}
(when config/shell-navigation-disabled?
{:effects.shell/change-tab (cond
(#{shell.constants/one-to-one-chat-card
shell.constants/private-group-chat-card}
card-type)
:chats-stack
:else :communities-stack)}))
(switcher-cards-store/upsert-switcher-card-rpc switcher-card)))))
(rf/defn close-switcher-card
@@ -84,29 +94,32 @@
{:events [:shell/navigate-to-jump-to]}
[{:keys [db]}]
(let [open-floating-screens (shell.utils/open-floating-screens)]
{:db
(cond-> db
(merge
(if config/shell-navigation-disabled?
{:pop-to-root-fx :shell-stack}
{:db
(cond-> db
(get open-floating-screens shell.constants/chat-screen)
(assoc-in [:shell/floating-screens shell.constants/chat-screen :animation]
shell.constants/close-screen-with-shell-animation)
(get open-floating-screens shell.constants/chat-screen)
(assoc-in [:shell/floating-screens shell.constants/chat-screen :animation]
shell.constants/close-screen-with-shell-animation)
(and (get open-floating-screens shell.constants/chat-screen)
(get open-floating-screens shell.constants/community-screen))
(assoc-in [:shell/floating-screens shell.constants/community-screen :animation]
shell.constants/close-screen-without-animation)
(and (get open-floating-screens shell.constants/chat-screen)
(get open-floating-screens shell.constants/community-screen))
(assoc-in [:shell/floating-screens shell.constants/community-screen :animation]
shell.constants/close-screen-without-animation)
(and (not (get open-floating-screens shell.constants/chat-screen))
(get open-floating-screens shell.constants/community-screen))
(assoc-in [:shell/floating-screens shell.constants/community-screen :animation]
shell.constants/close-screen-with-shell-animation)
(and (not (get open-floating-screens shell.constants/chat-screen))
(get open-floating-screens shell.constants/community-screen))
(assoc-in [:shell/floating-screens shell.constants/community-screen :animation]
shell.constants/close-screen-with-shell-animation)
(get open-floating-screens shell.constants/discover-communities-screen)
(assoc-in [:shell/floating-screens shell.constants/discover-communities-screen :animation]
shell.constants/close-screen-without-animation))
(get open-floating-screens shell.constants/discover-communities-screen)
(assoc-in [:shell/floating-screens shell.constants/discover-communities-screen :animation]
shell.constants/close-screen-without-animation))
:dispatch [:set-view-id :shell]
:effects.shell/navigate-to-jump-to nil}))
:dispatch [:set-view-id :shell]})
{:effects.shell/navigate-to-jump-to nil})))
(rf/defn change-shell-status-bar-style
{:events [:change-shell-status-bar-style]}
@@ -149,8 +162,15 @@
(not hidden-screen?)
(:current-chat-id db))
(conj [:chat/close]))})
{:db (assoc db :view-id go-to-view-id)
:navigate-to go-to-view-id}))
(merge
{:db (assoc db :view-id go-to-view-id)
:navigate-to go-to-view-id}
(when (and config/shell-navigation-disabled?
(#{:chat :community-overview} go-to-view-id))
{:dispatch-later
;; 300 ms delay because, navigation is priority over shell card update
[{:dispatch [:shell/add-switcher-card go-to-view-id screen-params]
:ms 300}]}))))
(rf/defn shell-navigate-back
{:events [:shell/navigate-back]}
@@ -6,6 +6,7 @@
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[react-native.safe-area :as safe-area]
[status-im2.config :as config]
[status-im2.contexts.shell.jump-to.constants :as shell.constants]
[status-im2.contexts.shell.jump-to.state :as state]
[utils.re-frame :as rf]))
@@ -119,7 +120,8 @@
;;; Navigation
(defn shell-navigation?
[view-id]
(some #{view-id} shell.constants/floating-screens))
(when-not config/shell-navigation-disabled?
(some #{view-id} shell.constants/floating-screens)))
(defn calculate-view-id
[]
@@ -1,7 +1,9 @@
(ns status-im2.contexts.shell.jump-to.view
(:require
[quo.core :as quo]
re-frame.db
[react-native.core :as rn]
[status-im2.config :as config]
[status-im2.contexts.shell.jump-to.animation :as animation]
[status-im2.contexts.shell.jump-to.components.bottom-tabs.view :as bottom-tabs]
[status-im2.contexts.shell.jump-to.components.floating-screens.view :as floating-screens]
@@ -15,12 +17,18 @@
(defn navigate-back-handler
[]
(if (and (not @navigation.state/curr-modal)
(seq (utils/open-floating-screens)))
(do
(rf/dispatch [:navigate-back])
true)
false))
(let [chat-screen-open? (and config/shell-navigation-disabled?
(= (get @re-frame.db/app-db :view-id) :chat))
open-floating-screens (utils/open-floating-screens)]
(if (and (not @navigation.state/curr-modal)
(or
chat-screen-open?
(seq open-floating-screens)))
(do
(when chat-screen-open? (rf/dispatch [:chat/close]))
(rf/dispatch [:navigate-back])
true)
false)))
(defn floating-button
[shared-values]
@@ -45,7 +53,8 @@
[:f> bottom-tabs/f-bottom-tabs]
[:f> home-stack/f-home-stack]
[floating-button shared-values]
[floating-screens/view]]))
(when-not config/shell-navigation-disabled?
[floating-screens/view])]))
(defn shell-stack
[]
@@ -289,22 +289,14 @@
scan-code? (reagent/atom true)
set-rescan-timeout (fn []
(reset! scan-code? false)
(js/setTimeout (fn []
(reset! scan-code? true)
(reset! qr-code-succeed? false))
3000))]
(js/setTimeout #(reset! scan-code? true) 3000))]
(fn [{:keys [title show-bottom-view? background animated?]}]
(let [torch-mode (if @torch? :on :off)
flashlight-icon (if @torch? :i/flashlight-on :i/flashlight-off)
scan-qr-code-tab? (= @active-tab 1)
view-id (rf/sub [:view-id])
show-camera? (and scan-qr-code-tab?
@camera-permission-granted?
@preflight-check-passed?
(some #{view-id}
[:sign-in-intro
:sign-in
:scan-sync-code-page])
(boolean (not-empty @qr-view-finder)))
camera-ready-to-scan? (and (or (not animated?) @render-camera?)
show-camera?
@@ -320,7 +312,8 @@
:show-camera? show-camera?
:content-opacity content-opacity
:subtitle-opacity subtitle-opacity
:title-opacity title-opacity})]
:title-opacity title-opacity})
view-id (rf/sub [:view-id])]
(rn/use-effect
#(set-listener-torch-off-on-app-inactive torch?))
@@ -355,9 +348,7 @@
{:torch-mode torch-mode
:qr-view-finder @qr-view-finder
:scan-code? @scan-code?
:set-qr-code-succeeded (fn []
(reset! qr-code-succeed? true)
(set-rescan-timeout))
:set-qr-code-succeeded #(reset! qr-code-succeed? true)
:set-rescan-timeout set-rescan-timeout}])
[rn/view {:style (style/root-container (:top insets))}
[:f> header
@@ -126,11 +126,9 @@
[quo/button
{:customization-color customization-color
:disabled? (or (string/blank? @input-value) (some? (validate @input-value)))
:on-press (fn []
(rf/dispatch [:navigate-to
:confirm-address-to-watch
{:address @input-value}])
(clear-input))
:on-press #(rf/dispatch [:navigate-to
:confirm-address-to-watch
{:address @input-value}])
:container-style {:z-index 2}}
(i18n/label :t/continue)]}
[quo/text-combinations
@@ -23,8 +23,7 @@
(defn- options
[{:keys [theme show-account-selector? options-height]}]
(let [{:keys [name color emoji address]} (rf/sub [:wallet/current-viewing-account])
network-preference-details (rf/sub [:wallet/network-preference-details])]
(let [{:keys [name color emoji address]} (rf/sub [:wallet/current-viewing-account])]
[rn/view
{:on-layout #(reset! options-height (oops/oget % "nativeEvent.layout.height"))
:style (when show-account-selector? style/options-container)}
@@ -45,7 +44,9 @@
[quo/drawer-top
{:title name
:type :account
:networks network-preference-details
:networks [{:network-name :ethereum :short-name "eth"}
{:network-name :optimism :short-name "opt"}
{:network-name :arbitrum :short-name "arb1"}]
:description address
:account-avatar-emoji emoji
:customization-color color}]
@@ -1,104 +1,70 @@
(ns status-im2.contexts.wallet.common.sheets.network-preferences.view
(:require [clojure.string :as string]
[quo.core :as quo]
(:require [quo.core :as quo]
[quo.foundations.colors :as colors]
[quo.foundations.resources :as resources]
[quo.theme :as quo.theme]
[reagent.core :as reagent]
[status-im2.contexts.wallet.common.sheets.network-preferences.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn- mainnet
[account-color]
[{:title "Mainnet"
:image :icon-avatar
:image-props {:icon (resources/get-network :ethereum)
:size :size-20}
:action :selector
:action-props {:type :checkbox
:customization-color account-color}}])
(defn- make-network-item
[{:keys [network-name] :as _network}
{:keys [title color on-change network-preferences state] :as _options}]
{:title (or title (string/capitalize (name network-name)))
:image :icon-avatar
:image-props {:icon (resources/get-network network-name)
:size :size-20}
:action :selector
:action-props {:type (if (= :default state)
:filled-checkbox
:checkbox)
:customization-color color
:checked? (contains? network-preferences network-name)
:on-change on-change}})
(defn- networks-list
[account-color]
[{:title "Optimism"
:image :icon-avatar
:image-props {:icon (resources/get-network :optimism)
:size :size-20}
:action :selector
:action-props {:type :checkbox
:customization-color account-color}}
{:title "Arbitrum"
:image :icon-avatar
:image-props {:icon (resources/get-network :arbitrum)
:size :size-20}
:action :selector
:action-props {:type :checkbox
:customization-color account-color}}])
(defn- view-internal
[]
(let [state (reagent/atom :default)
{:keys [color address
network-preferences-names]} (rf/sub [:wallet/current-viewing-account])
initial-network-preferences-names network-preferences-names
network-preferences-names-state (reagent/atom #{})
toggle-network (fn [network-name]
(reset! state :changed)
(if (contains? @network-preferences-names-state
network-name)
(swap! network-preferences-names-state disj
network-name)
(swap! network-preferences-names-state conj
network-name)))
get-current-preferences-names (fn []
(if (= @state :default)
initial-network-preferences-names
@network-preferences-names-state))]
(fn [{:keys [on-save theme]}]
(let [network-details (rf/sub [:wallet/network-details])
mainnet (first network-details)
layer-2-networks (rest network-details)
current-networks (filter (fn [network]
(contains? (get-current-preferences-names)
(:network-name network)))
network-details)]
[:<>
[quo/drawer-top
{:title (i18n/label :t/network-preferences)
:description (i18n/label :t/network-preferences-desc)}]
[quo/data-item
{:status :default
:size :default
:description :default
:label :none
:blur? false
:card? true
:title (i18n/label :t/address)
:custom-subtitle (fn []
[quo/address-text
{:networks current-networks
:address address
:format :long}])
:container-style (merge style/data-item
{:background-color (colors/theme-colors colors/neutral-2_5
colors/neutral-90
theme)})}]
[quo/category
{:list-type :settings
:data [(make-network-item mainnet
{:state @state
:title (i18n/label :t/mainnet)
:color color
:network-preferences (get-current-preferences-names)
:on-change #(toggle-network (:network-name
mainnet))})]}]
[quo/category
{:list-type :settings
:label (i18n/label :t/layer-2)
:data (mapv (fn [network]
(make-network-item network
{:state @state
:color color
:network-preferences (get-current-preferences-names)
:on-change #(toggle-network (:network-name
network))}))
layer-2-networks)}]
[quo/bottom-actions
{:button-one-label (i18n/label :t/confirm)
:button-one-props {:disabled? (= @state :default)
:on-press (fn []
(let [chain-ids (map :chain-id current-networks)]
(on-save chain-ids)))
:customization-color color}}]]))))
[{:keys [on-save theme]}]
(let [{:keys [color address]} (rf/sub [:wallet/current-viewing-account])]
[:<>
[quo/drawer-top
{:title (i18n/label :t/network-preferences)
:description (i18n/label :t/network-preferences-desc)}]
[quo/data-item
{:status :default
:size :default
:label :none
:blur? false
:card? true
:title (i18n/label :t/address)
:subtitle address
:subtitle-type :default
:container-style (merge style/data-item
{:background-color (colors/theme-colors colors/neutral-2_5
colors/neutral-90
theme)})}]
[quo/category
{:list-type :settings
:data (mainnet color)}]
[quo/category
{:list-type :settings
:label (i18n/label :t/layer-2)
:data (networks-list color)}]
[quo/bottom-actions
{:button-one-label (i18n/label :t/update)
:button-one-props {:disabled? true
:on-press on-save
:customization-color color}}]]))
(def view (quo.theme/with-theme view-internal))
@@ -19,7 +19,6 @@
(def tokens
[{:token :snt
:token-name "Status"
:state :default
:status :empty
:customization-color :blue
@@ -28,7 +27,6 @@
:percentage-change "0.00"
:fiat-change "€0.00"}}
{:token :eth
:token-name "Ether"
:state :default
:status :empty
:customization-color :blue
@@ -37,7 +35,6 @@
:percentage-change "0.00"
:fiat-change "€0.00"}}
{:token :dai
:token-name "Dai Stablecoin"
:state :default
:status :empty
:customization-color :blue
@@ -42,10 +42,6 @@
(total-raw-balance-in-all-chains)
(money/token->unit decimals)))
(defn get-account-by-address
[accounts address]
(some #(when (= (:address %) address) %) accounts))
(defn calculate-raw-balance
[raw-balance decimals]
(if-let [n (utils.number/parse-int raw-balance nil)]
@@ -15,10 +15,9 @@
(defn- show-save-account-toast
[updated-key theme]
(let [message (case updated-key
:name :t/edit-wallet-account-name-updated-message
:color :t/edit-wallet-account-colour-updated-message
:emoji :t/edit-wallet-account-emoji-updated-message
:prod-preferred-chain-ids :t/edit-wallet-network-preferences-updated-message
:name :t/edit-wallet-account-name-updated-message
:color :t/edit-wallet-account-colour-updated-message
:emoji :t/edit-wallet-account-emoji-updated-message
nil)]
(rf/dispatch [:toasts/upsert
{:id :edit-account
@@ -56,11 +55,10 @@
:new-value @edited-account-name
:theme theme}))]
(fn []
(let [{:keys [name emoji address color] :as account} (rf/sub [:wallet/current-viewing-account])
network-details (rf/sub [:wallet/network-preference-details])
account-name (or @edited-account-name name)
button-disabled? (or (nil? @edited-account-name)
(= name @edited-account-name))]
(let [{:keys [name emoji address color]
:as account} (rf/sub [:wallet/current-viewing-account])
account-name (or @edited-account-name name)
button-disabled? (or (nil? @edited-account-name) (= name @edited-account-name))]
[create-or-edit-account/view
{:page-nav-right-side [{:icon-name :i/delete
:on-press #(js/alert "Delete account: to be implemented")}]
@@ -88,22 +86,18 @@
:right-icon :i/advanced
:card? true
:title (i18n/label :t/address)
:custom-subtitle (fn [] [quo/address-text
{:networks network-details
:address address
:format :long}])
:custom-subtitle (fn []
[quo/address-text
{:networks [{:network-name :ethereum :short-name "eth"}
{:network-name :optimism :short-name "opt"}
{:network-name :arbitrum :short-name "arb1"}]
:address address
:format :long}])
:on-press (fn []
(rf/dispatch [:show-bottom-sheet
{:content
(fn []
[network-preferences/view
{:on-save (fn [chain-ids]
(rf/dispatch [:hide-bottom-sheet])
(save-account
{:account account
:updated-key :prod-preferred-chain-ids
:new-value chain-ids
:theme theme}))}])}]))
{:content (fn []
[network-preferences/view
{:on-save #(js/alert "calling on save")}])}]))
:container-style style/data-item}]]))))
(def view (quo.theme/with-theme view-internal))
@@ -1,12 +0,0 @@
(ns status-im2.contexts.wallet.send.events
(:require
[utils.number]
[utils.re-frame :as rf]))
(rf/reg-event-fx :wallet/select-address-tab
(fn [{:keys [db]} [tab]]
{:db (assoc-in db [:wallet :ui :send :select-address-tab] tab)}))
(rf/reg-event-fx :wallet/select-send-account-address
(fn [{:keys [db]} [address]]
{:db (assoc db [:wallet :ui :send :send-account-address] address)}))
@@ -15,6 +15,11 @@
{:padding-left 20
:padding-right 8})
(def empty-container-style
{:justify-content :center
:flex 1
:margin-bottom 44})
(def button
{:justify-self :flex-end
:margin-bottom 46
@@ -1,10 +0,0 @@
(ns status-im2.contexts.wallet.send.select-address.tabs.style)
(def empty-container-style
{:justify-content :center
:flex 1
:margin-bottom 44})
(def my-accounts-container
{:padding-left 8
:padding-right 8})
@@ -1,57 +0,0 @@
(ns status-im2.contexts.wallet.send.select-address.tabs.view
(:require
[quo.core :as quo]
[react-native.gesture :as gesture]
[status-im2.contexts.wallet.send.select-address.tabs.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn- render-account-item
[{:keys [color address] :as account}]
[quo/account-item
{:account-props (assoc account :customization-color color)
:on-press (fn []
(rf/dispatch [:wallet/select-send-account-address address])
(rf/dispatch [:navigate-to-within-stack
[:wallet-select-asset :wallet-select-address]]))}])
(def data
[{:id :tab/recent :label (i18n/label :t/recent) :accessibility-label :recent-tab}
{:id :tab/saved :label (i18n/label :t/saved) :accessibility-label :saved-tab}
{:id :tab/contacts :label (i18n/label :t/contacts) :accessibility-label :contacts-tab}
{:id :tab/my-accounts :label (i18n/label :t/my-accounts) :accessibility-label :my-accounts-tab}])
(defn my-accounts
[]
(let [other-accounts (rf/sub [:wallet/accounts-without-current-viewing-account])]
(if (zero? (count other-accounts))
[quo/empty-state
{:title (i18n/label :t/no-other-accounts)
:description (i18n/label :t/here-is-a-cat-in-a-box-instead)
:placeholder? true
:container-style style/empty-container-style}]
[gesture/flat-list
{:data other-accounts
:render-fn render-account-item
:content-container-style style/my-accounts-container
:shows-vertical-scroll-indicator false}])))
(defn view
[selected-tab]
(case selected-tab
:tab/recent [quo/empty-state
{:title (i18n/label :t/no-recent-transactions)
:description (i18n/label :t/make-one-it-is-easy-we-promise)
:placeholder? true
:container-style style/empty-container-style}]
:tab/saved [quo/empty-state
{:title (i18n/label :t/no-saved-addresses)
:description (i18n/label :t/you-like-to-type-43-characters)
:placeholder? true
:container-style style/empty-container-style}]
:tab/contacts [quo/empty-state
{:title (i18n/label :t/no-contacts)
:description (i18n/label :t/no-contacts-description)
:placeholder? true
:container-style style/empty-container-style}]
:tab/my-accounts [my-accounts]))
@@ -2,23 +2,47 @@
(: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-im2.constants :as constants]
[status-im2.contexts.wallet.common.account-switcher.view :as account-switcher]
[status-im2.contexts.wallet.item-types :as types]
[status-im2.contexts.wallet.send.select-address.style :as style]
[status-im2.contexts.wallet.send.select-address.tabs.view :as tabs]
[utils.debounce :as debounce]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(def ^:private tabs-data
(def tabs-data
[{:id :tab/recent :label (i18n/label :t/recent) :accessibility-label :recent-tab}
{:id :tab/saved :label (i18n/label :t/saved) :accessibility-label :saved-tab}
{:id :tab/contacts :label (i18n/label :t/contacts) :accessibility-label :contacts-tab}
{:id :tab/my-accounts :label (i18n/label :t/my-accounts) :accessibility-label :my-accounts-tab}])
(defn- tab-view
[selected-tab]
(case selected-tab
:tab/recent [quo/empty-state
{:title (i18n/label :t/no-recent-transactions)
:description (i18n/label :t/make-one-it-is-easy-we-promise)
:placeholder? true
:container-style style/empty-container-style}]
:tab/saved [quo/empty-state
{:title (i18n/label :t/no-saved-addresses)
:description (i18n/label :t/you-like-to-type-43-characters)
:placeholder? true
:container-style style/empty-container-style}]
:tab/contacts [quo/empty-state
{:title (i18n/label :t/no-contacts)
:description (i18n/label :t/no-contacts-description)
:placeholder? true
:container-style style/empty-container-style}]
:tab/my-accounts [quo/empty-state
{:title (i18n/label :t/no-other-accounts)
:description (i18n/label :t/here-is-a-cat-in-a-box-instead)
:placeholder? true
:container-style style/empty-container-style}]))
(defn- address-input
[input-value input-focused?]
(fn []
@@ -107,19 +131,18 @@
:keyboard-should-persist-taps :handled
:render-fn suggestion-component}]])))
(defn- f-view
(defn- f-view-internal
[]
(let [on-close (fn []
(let [selected-tab (reagent/atom (:id (first tabs-data)))
on-close (fn []
(rf/dispatch [:wallet/clean-scanned-address])
(rf/dispatch [:wallet/clean-local-suggestions])
(rf/dispatch [:wallet/select-address-tab nil])
(rf/dispatch [:navigate-back]))
on-change-tab #(rf/dispatch [:wallet/select-address-tab %])
on-change-tab #(reset! selected-tab %)
input-value (reagent/atom "")
input-focused? (reagent/atom false)]
(fn []
(let [selected-tab (or (rf/sub [:wallet/send-tab]) (:id (first tabs-data)))
valid-ens-or-address? (boolean (rf/sub [:wallet/valid-ens-or-address?]))]
(let [valid-ens-or-address? (boolean (rf/sub [:wallet/valid-ens-or-address?]))]
(rn/use-effect (fn []
(fn []
(rf/dispatch [:wallet/clean-scanned-address])
@@ -156,14 +179,15 @@
{:style style/tabs
:container-style style/tabs-content
:size 32
:default-active selected-tab
:default-active @selected-tab
:data tabs-data
:scrollable? true
:scroll-on-press? true
:on-change on-change-tab}]
[tabs/view selected-tab]])]))))
[tab-view @selected-tab]])]))))
(defn view
(defn- view-internal
[]
[:f> f-view])
[:f> f-view-internal])
(def view (quo.theme/with-theme view-internal))
-1
View File
@@ -22,7 +22,6 @@
status-im2.contexts.shell.share.events
status-im2.contexts.syncing.events
status-im2.contexts.wallet.events
status-im2.contexts.wallet.send.events
[status-im2.db :as db]
[utils.re-frame :as rf]))
+1 -1
View File
@@ -210,7 +210,7 @@
:animations (merge transitions/new-to-status-modal-animations
transitions/push-animations-for-transparent-background)
:modalPresentationStyle :overCurrentContext}
:component enable-notifications/view}
:component enable-notifications/enable-notifications}
{:name :identifiers
:component identifiers/view
+1 -1
View File
@@ -13,7 +13,6 @@
status-im2.subs.shell
status-im2.subs.wallet.collectibles
status-im2.subs.wallet.networks
status-im2.subs.wallet.send
status-im2.subs.wallet.wallet))
(defn reg-root-key-sub
@@ -154,6 +153,7 @@
(reg-root-key-sub :wallet/scanned-address :wallet/scanned-address)
(reg-root-key-sub :wallet/create-account :wallet/create-account)
(reg-root-key-sub :wallet/networks :wallet/networks)
(reg-root-key-sub :wallet/scanned-address :wallet/scanned-address)
(reg-root-key-sub :wallet/local-suggestions :wallet/local-suggestions)
(reg-root-key-sub :wallet/valid-ens-or-address? :wallet/valid-ens-or-address?)
(reg-root-key-sub :wallet/send-address :wallet/send-address)
+3 -1
View File
@@ -2,6 +2,7 @@
(:require
[re-frame.core :as re-frame]
[status-im2.common.resources :as resources]
[status-im2.config :as config]
[status-im2.constants :as constants]
[status-im2.contexts.shell.jump-to.constants :as shell.constants]
[utils.datetime :as datetime]
@@ -268,4 +269,5 @@
:shell/chat-screen-loaded?
:<- [:shell/loaded-screens]
(fn [screens]
(get screens shell.constants/chat-screen)))
(or config/shell-navigation-disabled?
(get screens shell.constants/chat-screen))))
+7 -9
View File
@@ -34,15 +34,13 @@
:wallet/network-details
:<- [:wallet/filtered-networks-by-mode false]
(fn [networks]
(->> networks
(keep
(fn [{:keys [chain-id related-chain-id layer test?]}]
(let [network-details (get network-list (if test? related-chain-id chain-id))]
(assoc network-details
:chain-id chain-id
:related-chain-id related-chain-id
:layer layer))))
(sort-by (juxt :layer :short-name)))))
(keep
(fn [{:keys [chain-id related-chain-id test?]}]
(let [network-details (get network-list (if test? related-chain-id chain-id))]
(assoc network-details
:chain-id chain-id
:related-chain-id related-chain-id)))
networks)))
(re-frame/reg-sub
:wallet/network-details-by-chain-id
+9 -18
View File
@@ -11,28 +11,22 @@
{:test [{:test? true
:short-name "eth"
:network-name :ethereum
:related-chain-id 1
:layer 1}
:related-chain-id 1}
{:test? true
:short-name "arb1"
:related-chain-id 42161
:layer 2}
:related-chain-id 42161}
{:test? true
:short-name "opt"
:related-chain-id 10
:layer 2}]
:related-chain-id 10}]
:prod [{:test? false
:short-name "eth"
:chain-id 1
:layer 1}
:chain-id 1}
{:test? false
:short-name "arb1"
:chain-id 42161
:layer 2}
:chain-id 42161}
{:test? false
:short-name "opt"
:chain-id 10
:layer 2}]})
:chain-id 10}]})
(h/deftest-sub :wallet/network-details
[sub-name]
@@ -40,14 +34,11 @@
(swap! rf-db/app-db assoc :wallet/networks network-data)
(is (= [{:network-name :ethereum
:short-name "eth"
:chain-id 1
:layer 1}
:chain-id 1}
{:network-name :arbitrum
:short-name "arb1"
:chain-id 42161
:layer 2}
:chain-id 42161}
{:network-name :optimism
:short-name "opt"
:chain-id 10
:layer 2}]
:chain-id 10}]
(map #(dissoc % :source :related-chain-id) (rf/sub [sub-name]))))))
-10
View File
@@ -1,10 +0,0 @@
(ns status-im2.subs.wallet.send
(:require
[re-frame.core :as rf]
[utils.number]))
(rf/reg-sub
:wallet/send-tab
:<- [:wallet/ui]
(fn [ui]
(get-in ui [:send :select-address-tab])))
-14
View File
@@ -1,14 +0,0 @@
(ns status-im2.subs.wallet.send-test
(:require
[cljs.test :refer [is testing]]
[re-frame.db :as rf-db]
status-im2.subs.root
status-im2.subs.wallet.send
[test-helpers.unit :as h]
[utils.re-frame :as rf]))
(h/deftest-sub :wallet/send-tab
[sub-name]
(testing "returns active tab for selecting address"
(swap! rf-db/app-db assoc-in [:wallet :ui :send :select-address-tab] :tabs/recent)
(is (= :tabs/recent (rf/sub [sub-name])))))
+15 -51
View File
@@ -4,25 +4,6 @@
[status-im2.contexts.wallet.common.utils :as utils]
[utils.number]))
(defn- filter-networks
[chain-ids network-details]
(filter (fn [{:keys [chain-id]}]
(contains? chain-ids chain-id))
network-details))
(defn- assoc-network-preferences-names
[network-details account testnet?]
(let [{:keys [prod-preferred-chain-ids
test-preferred-chain-ids]} account
current-chain-ids (if testnet?
test-preferred-chain-ids
prod-preferred-chain-ids)
network-preferences-names (->> network-details
(filter-networks current-chain-ids)
(map :network-name)
(set))]
(assoc account :network-preferences-names network-preferences-names)))
(rf/reg-sub
:wallet/ui
:<- [:wallet]
@@ -33,12 +14,6 @@
:<- [:wallet/ui]
:-> :tokens-loading?)
(rf/reg-sub
:wallet/current-viewing-account-address
:<- [:wallet]
:-> :current-viewing-account-address)
(rf/reg-sub
:wallet/watch-address-activity-state
:<- [:wallet/ui]
@@ -47,16 +22,10 @@
(rf/reg-sub
:wallet/accounts
:<- [:wallet]
:<- [:wallet/network-details]
(fn [[wallet network-details]]
;; TODO(@rende11): `testnet?` value would be relevant after this implementation,
;; https://github.com/status-im/status-mobile/issues/17826
(let [testnet? false]
(->> wallet
:accounts
vals
(map #(assoc-network-preferences-names network-details % testnet?))
(sort-by :position)))))
:-> #(->> %
:accounts
vals
(sort-by :position)))
(rf/reg-sub
:wallet/addresses
@@ -90,13 +59,12 @@
(rf/reg-sub
:wallet/current-viewing-account
:<- [:wallet/accounts]
:<- [:wallet/current-viewing-account-address]
:<- [:wallet]
:<- [:wallet/balances]
(fn [[accounts current-viewing-account-address balances]]
(let [current-viewing-account (utils/get-account-by-address accounts current-viewing-account-address)]
(-> current-viewing-account
(assoc :balance (get balances current-viewing-account-address))))))
(fn [[{:keys [current-viewing-account-address] :as wallet} balances]]
(-> wallet
(get-in [:accounts current-viewing-account-address])
(assoc :balance (get balances current-viewing-account-address)))))
(rf/reg-sub
:wallet/tokens-filtered
@@ -117,6 +85,11 @@
sorted-tokens)]
filtered-tokens)))
(rf/reg-sub
:wallet/current-viewing-account-address
:<- [:wallet]
:-> :current-viewing-account-address)
(rf/reg-sub
:wallet/accounts-without-current-viewing-account
:<- [:wallet/accounts]
@@ -130,9 +103,8 @@
market-values (:usd market-values-per-currency)
{:keys [price change-pct-24hour]} market-values
fiat-change (utils/calculate-fiat-change crypto-value change-pct-24hour)]
(when (and crypto-value (seq (:name item)))
(when crypto-value
{:token (keyword (string/lower-case (:symbol item)))
:token-name (:name item)
:state :default
:status (cond
(pos? change-pct-24hour) :positive
@@ -150,11 +122,3 @@
:<- [:chain-id]
(fn [[current-account chain-id]]
(mapv #(calc-token-value % chain-id) (:tokens current-account))))
(rf/reg-sub
:wallet/network-preference-details
:<- [:wallet/current-viewing-account]
:<- [:wallet/network-details]
(fn [[current-viewing-account network-details]]
(let [network-preferences-names (:network-preferences-names current-viewing-account)]
(filter #(contains? network-preferences-names (:network-name %)) network-details))))
+94 -154
View File
@@ -82,33 +82,6 @@
:removed false
:tokens tokens-0x2}})
(def network-data
{:test [{:test? true
:short-name "eth"
:network-name :ethereum
:related-chain-id 1
:layer 1}
{:test? true
:short-name "arb1"
:related-chain-id 42161
:layer 2}
{:test? true
:short-name "opt"
:related-chain-id 10
:layer 2}]
:prod [{:test? false
:short-name "eth"
:chain-id 1
:layer 1}
{:test? false
:short-name "arb1"
:chain-id 42161
:layer 2}
{:test? false
:short-name "opt"
:chain-id 10
:layer 2}]})
(h/deftest-sub :wallet/balances
[sub-name]
(testing "a map: address->balance"
@@ -123,60 +96,50 @@
(h/deftest-sub :wallet/accounts
[sub-name]
(testing "returns all accounts without balance"
(swap! rf-db/app-db
#(-> %
(assoc-in [:wallet :accounts] accounts)
(assoc :wallet/networks network-data)))
(is
(= (list {:path "m/44'/60'/0'/0/0"
:emoji "😃"
:key-uid "0x2f5ea39"
:address "0x1"
:wallet false
:name "Account One"
:type :generated
:chat false
:test-preferred-chain-ids #{5 420 421613}
:color :blue
:hidden false
:prod-preferred-chain-ids #{1 10 42161}
:network-preferences-names #{:ethereum :arbitrum :optimism}
:position 0
:clock 1698945829328
:created-at 1698928839000
:operable "fully"
:mixedcase-address "0x7bcDfc75c431"
:public-key "0x04371e2d9d66b82f056bc128064"
:removed false
:tokens tokens-0x1}
{:path "m/44'/60'/0'/0/1"
:emoji "💎"
:key-uid "0x2f5ea39"
:address "0x2"
:wallet false
:name "Account Two"
:type :generated
:chat false
:test-preferred-chain-ids #{5 420 421613}
:color :purple
:hidden false
:prod-preferred-chain-ids #{1 10 42161}
:network-preferences-names #{:ethereum :arbitrum :optimism}
:position 1
:clock 1698945829328
:created-at 1698928839000
:operable "fully"
:mixedcase-address "0x7bcDfc75c431"
:public-key "0x04371e2d9d66b82f056bc128064"
:removed false
:tokens tokens-0x2})
(rf/sub [sub-name])))))
(swap! rf-db/app-db #(assoc-in % [:wallet :accounts] accounts))
(h/deftest-sub :wallet/current-viewing-account-address
[sub-name]
(testing "returns current viewing account address"
(swap! rf-db/app-db #(assoc-in % [:wallet :current-viewing-account-address] "0x1"))
(is (= "0x1" (rf/sub [sub-name])))))
(is
(= (list {:path "m/44'/60'/0'/0/0"
:emoji "😃"
:key-uid "0x2f5ea39"
:address "0x1"
:wallet false
:name "Account One"
:type :generated
:chat false
:test-preferred-chain-ids #{5 420 421613}
:color :blue
:hidden false
:prod-preferred-chain-ids #{1 10 42161}
:position 0
:clock 1698945829328
:created-at 1698928839000
:operable "fully"
:mixedcase-address "0x7bcDfc75c431"
:public-key "0x04371e2d9d66b82f056bc128064"
:removed false
:tokens tokens-0x1}
{:path "m/44'/60'/0'/0/1"
:emoji "💎"
:key-uid "0x2f5ea39"
:address "0x2"
:wallet false
:name "Account Two"
:type :generated
:chat false
:test-preferred-chain-ids #{5 420 421613}
:color :purple
:hidden false
:prod-preferred-chain-ids #{1 10 42161}
:position 1
:clock 1698945829328
:created-at 1698928839000
:operable "fully"
:mixedcase-address "0x7bcDfc75c431"
:public-key "0x04371e2d9d66b82f056bc128064"
:removed false
:tokens tokens-0x2})
(rf/sub [sub-name])))))
(h/deftest-sub :wallet/current-viewing-account
[sub-name]
@@ -184,35 +147,35 @@
(swap! rf-db/app-db
#(-> %
(assoc-in [:wallet :accounts] accounts)
(assoc-in [:wallet :current-viewing-account-address] "0x1")
(assoc :wallet/networks network-data)))
(assoc-in [:wallet :current-viewing-account-address] "0x1")))
(let [result (rf/sub [sub-name])]
(is
(= {:path "m/44'/60'/0'/0/0"
:emoji "😃"
:key-uid "0x2f5ea39"
:address "0x1"
:wallet false
:name "Account One"
:type :generated
:chat false
:test-preferred-chain-ids #{5 420 421613}
:color :blue
:hidden false
:prod-preferred-chain-ids #{1 10 42161}
:network-preferences-names #{:ethereum :arbitrum :optimism}
:position 0
:clock 1698945829328
:created-at 1698928839000
:operable "fully"
:mixedcase-address "0x7bcDfc75c431"
:public-key "0x04371e2d9d66b82f056bc128064"
:removed false
:tokens tokens-0x1}
(= {:path "m/44'/60'/0'/0/0"
:emoji "😃"
:key-uid "0x2f5ea39"
:address "0x1"
:wallet false
:name "Account One"
:type :generated
:chat false
:test-preferred-chain-ids #{5 420 421613}
:color :blue
:hidden false
:prod-preferred-chain-ids #{1 10 42161}
:position 0
:clock 1698945829328
:created-at 1698928839000
:operable "fully"
:mixedcase-address "0x7bcDfc75c431"
:public-key "0x04371e2d9d66b82f056bc128064"
:removed false
:tokens tokens-0x1}
(dissoc result :balance)))
(is (money/equal-to (:balance result) (money/bignumber 3250))))))
(h/deftest-sub :wallet/addresses
[sub-name]
(testing "returns all addresses"
@@ -220,6 +183,7 @@
#(-> %
(assoc-in [:wallet :accounts] accounts)
(assoc-in [:wallet :current-viewing-account-address] "0x1")))
(is
(= (set ["0x1" "0x2"])
(rf/sub [sub-name])))))
@@ -237,63 +201,39 @@
(swap! rf-db/app-db #(assoc-in % [:wallet :ui :watch-address-activity-state] :has-activity))
(is (= :has-activity (rf/sub [sub-name])))))
(h/deftest-sub :wallet/current-viewing-account-address
[sub-name]
(testing "returns the address of the current viewing account"
(swap! rf-db/app-db #(assoc-in % [:wallet :current-viewing-account-address] "0x1"))
(is (= "0x1" (rf/sub [sub-name])))))
(h/deftest-sub :wallet/accounts-without-current-viewing-account
[sub-name]
(testing "returns the accounts list without the current viewing account in it"
(swap! rf-db/app-db
#(-> %
(assoc-in [:wallet :accounts] accounts)
(assoc-in [:wallet :current-viewing-account-address] "0x2")
(assoc :wallet/networks network-data)))
(assoc-in [:wallet :current-viewing-account-address] "0x2")))
(is
(= (list
{:path "m/44'/60'/0'/0/0"
:emoji "😃"
:key-uid "0x2f5ea39"
:address "0x1"
:wallet false
:name "Account One"
:type :generated
:chat false
:test-preferred-chain-ids #{5 420 421613}
:color :blue
:hidden false
:prod-preferred-chain-ids #{1 10 42161}
:network-preferences-names #{:ethereum :arbitrum :optimism}
:position 0
:clock 1698945829328
:created-at 1698928839000
:operable "fully"
:mixedcase-address "0x7bcDfc75c431"
:public-key "0x04371e2d9d66b82f056bc128064"
:removed false
:tokens tokens-0x1})
{:path "m/44'/60'/0'/0/0"
:emoji "😃"
:key-uid "0x2f5ea39"
:address "0x1"
:wallet false
:name "Account One"
:type :generated
:chat false
:test-preferred-chain-ids #{5 420 421613}
:color :blue
:hidden false
:prod-preferred-chain-ids #{1 10 42161}
:position 0
:clock 1698945829328
:created-at 1698928839000
:operable "fully"
:mixedcase-address "0x7bcDfc75c431"
:public-key "0x04371e2d9d66b82f056bc128064"
:removed false
:tokens tokens-0x1})
(rf/sub [sub-name])))))
(h/deftest-sub :wallet/network-preference-details
[sub-name]
(testing "returns current viewing account address"
(swap! rf-db/app-db
#(-> %
(assoc-in [:wallet :accounts] accounts)
(assoc-in [:wallet :current-viewing-account-address] "0x1")
(assoc :wallet/networks network-data)))
(is
(= [{:short-name "eth"
:network-name :ethereum
:chain-id 1
:related-chain-id nil
:layer 1}
{:short-name "arb1"
:network-name :arbitrum
:chain-id 42161
:related-chain-id nil
:layer 2}
{:short-name "opt"
:network-name :optimism
:chain-id 10
:related-chain-id nil
:layer 2}]
(->> (rf/sub [sub-name])
;; Removed `#js source` property for correct compare
(map #(dissoc % :source)))))))
+3 -3
View File
@@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "chore/storenode-requests-manager",
"commit-sha1": "43d7c93cb6c1aeb414adc3f3f6e6f6e173d98c7a",
"src-sha256": "03va3x6q50kzb2g0kvqyqh3zpix0nlz1v5089sz24hq4k7bidz36"
"version": "status-mobile-17116",
"commit-sha1": "a08e7df7ad5c3e9401b4860650467b03ce15aacd",
"src-sha256": "0rf90r9kx74mwicg8l64fwvsibnr47iga1wlrn61fl00q7s4da6p"
}
@@ -350,6 +350,12 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
if reply_element.is_element_displayed():
self.errors.append("Reply is still shown after removing from activity centre!")
self.home_1.just_fyi("Reset filter to show all AC notifications again")
self.home_1.reply_activity_tab_button.click()
self.home_1.mention_activity_tab_button.click()
self.home_1.all_activity_tab_button.click()
self.home_1.close_activity_centre.click()
self.errors.verify_no_errors()
@@ -668,9 +668,9 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase
self.home_2.just_fyi("Deleting chat via delete button and check it will not reappear after relaunching app")
self.home_2.delete_chat_long_press(username=self.username_1)
if self.home_2.get_chat_from_home_view(self.username_1).is_element_displayed():
self.errors.append("Deleted '%s' chat is shown, but the chat has been deleted" % self.username_1)
self.errors.append('Deleted %s chat is shown, but the chat has been deleted' % self.username_1)
self.home_2.reopen_app()
if self.home_2.get_chat_from_home_view(self.username_1).is_element_displayed(15):
self.errors.append(
"Deleted chat '%s' is shown after re-login, but the chat has been deleted" % self.username_1)
'Deleted chat %s is shown after re-login, but the chat has been deleted' % self.username_1)
self.errors.verify_no_errors()
@@ -71,6 +71,7 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(702846)
@marks.xfail(reason="Issue #18075", run=False)
def test_community_navigate_to_channel_when_relaunch(self):
text_message = 'some_text'
if not self.channel.chat_message_input.is_element_displayed():
@@ -92,7 +92,6 @@ class TestDeepLinksOneDevice(MultipleSharedDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(704614)
@marks.skip # ToDo: the feature is not ready yet
def test_links_open_universal_links_from_other_apps(self):
app_package = self.driver.current_package
self.home.just_fyi("Opening a profile URL from google search bar when user is still logged in")
+1 -2
View File
@@ -291,8 +291,7 @@ class ChatElementByText(Text):
try:
self.driver.info("Trying to access image inside message with text '%s'" % self.message_text)
ChatElementByText(self.driver, self.message_text).wait_for_sent_state(60)
return Button(self.driver,
xpath="%s//android.widget.ImageView[@content-desc='image-message']" % self.locator)
return Button(self.driver, xpath="%s//*[@content-desc='image-message']" % self.locator)
except NoSuchElementException:
self.driver.fail("No image is found in message!")
Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 KiB

After

Width:  |  Height:  |  Size: 250 KiB

+3 -4
View File
@@ -276,8 +276,7 @@ class HomeView(BaseView):
# Options on long tap
self.chats_menu_invite_friends_button = Button(self.driver, accessibility_id="chats-menu-invite-friends-button")
self.close_chat_button = Button(self.driver, accessibility_id="close-chat")
self.confirm_closing_chat_button = Button(self.driver, accessibility_id="Confirm")
self.delete_chat_button = Button(self.driver, translation_id="close-chat")
self.clear_history_button = Button(self.driver, accessibility_id="clear-history")
self.mute_chat_button = MuteButton(self.driver, accessibility_id="mute-chat")
self.mute_community_button = MuteButton(self.driver, accessibility_id="mute-community")
@@ -522,8 +521,8 @@ class HomeView(BaseView):
def delete_chat_long_press(self, username):
self.driver.info("Deleting chat '%s' by long press" % username)
self.get_chat(username).long_press_element()
self.close_chat_button.click()
self.confirm_closing_chat_button.click()
self.delete_chat_button.click()
self.delete_chat_button.click()
def leave_chat_long_press(self, username):
self.driver.info("Leaving chat '%s' by long press" % username)
+2 -5
View File
@@ -494,7 +494,7 @@
"empty-chat-description-community": "It's been quiet here for the last {{quiet-hours}}.",
"empty-chat-description-public-share-this": "share this chat.",
"enable": "Enable",
"enable-notifications-sub-title": "Receive notifications about your new messages or wallet transactions",
"enable-notifications-sub-title": "Receive notifications when somebody sends you a message or crypto to your wallet",
"encrypt-with-password": "Encrypt with password",
"ending-not-allowed": "{{ending}} ending is not allowed",
"ends-with-space": "Cannot end with space",
@@ -1407,8 +1407,6 @@
"try-keeping-the-card-still": "Try keeping the card still",
"turn-nfc-on": "Turn NFC on to continue",
"turn-nfc-description": "NFC is disabled on yor device. You can enable it in settings",
"testnet-mode-prompt-title": "Warning!",
"testnet-mode-prompt-content": "You are about to switch the network mode. This will log you out and you will have to login again.",
"keycard-init-title": "Looking for cards...",
"keycard-init-description": "Put the card to the back of your phone to continue",
"keycard-awaiting-title": "Still looking...",
@@ -2375,7 +2373,7 @@
"account-info": "Account info",
"account-name-input-placeholder": "Account name",
"network-preferences": "Network preferences",
"network-preferences-desc": "Select which networks to receive funds on",
"network-preferences-desc": "Select which network this address is happy to receive funds on",
"layer-2": "Layer 2",
"manage-tokens": "Manage tokens",
"edit-derivation-path": "Edit derivation path",
@@ -2389,7 +2387,6 @@
"edit-wallet-account-emoji-updated-message": "Account emoji has been updated",
"edit-wallet-account-name-updated-message": "Account name has been updated",
"edit-wallet-account-colour-updated-message": "Account colour has been updated",
"edit-wallet-network-preferences-updated-message": "Account network preferences has been updated",
"search-assets": "Search assets",
"address-activity": "This address has activity",
"keypairs": "Keypairs",