move legacy subs step 1 (#17648)

This commit is contained in:
flexsurfer 2023-10-16 15:47:20 +02:00 committed by GitHub
parent 18606c7329
commit b970b723a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 250 additions and 277 deletions

View File

@ -112,7 +112,7 @@
:optimizations :simple
:target :node-test
;; Uncomment line below to `make test-watch` a specific file
;; :ns-regexp "status-im2.subs.chat.messages-test$"
;; :ns-regexp "status-im2.subs.messages-test$"
:main
status-im.test-runner/main
;; set :ui-driven to true to let shadow-cljs inject node-repl

View File

@ -10,6 +10,7 @@
[status-im.utils.test :as utils.test]
status-im2.navigation.core
status-im2.subs.root ; so integration tests can run independently
status-im.subs.root ; so integration tests can run independently
[taoensso.timbre :as log]
[status-im2.constants :as constants]
[native-module.core :as native-module]))

View File

@ -77,14 +77,6 @@
true
{}))
(rf/defn confirm-home-tooltip
{:events [:multiaccounts.ui/hide-home-tooltip]}
[cofx]
(multiaccounts.update/multiaccount-update cofx
:hide-home-tooltip?
true
{}))
(rf/defn switch-webview-debug
{:events [:multiaccounts.ui/switch-webview-debug]}
[{:keys [db] :as cofx} value]

View File

@ -1,6 +1,6 @@
(ns status-im.search.core-test
(:require [cljs.test :refer-macros [deftest testing is]]
[status-im2.subs.search :as search.subs]))
[status-im.subs.wallet.search :as search.subs]))
(defn extract-chat-attributes
[chat]

View File

@ -1,4 +1,4 @@
(ns status-im2.subs.bootnodes
(ns status-im.subs.bootnodes
(:require [re-frame.core :as re-frame]))
(re-frame/reg-sub

View File

@ -1,4 +1,4 @@
(ns status-im2.subs.browser
(ns status-im.subs.browser
(:require [re-frame.core :as re-frame]
[status-im.browser.core :as browser]))

View File

@ -1,4 +1,4 @@
(ns status-im2.subs.ens
(ns status-im.subs.ens
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.ens.core :as ens]

View File

@ -1,4 +1,4 @@
(ns status-im2.subs.keycard
(ns status-im.subs.keycard
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.keycard.common :as common]

View File

@ -1,4 +1,4 @@
(ns status-im2.subs.mailservers
(ns status-im.subs.mailservers
(:require [re-frame.core :as re-frame]
[status-im.fleet.core :as fleet]
[status-im.mailserver.core :as mailserver]))

View File

@ -1,4 +1,4 @@
(ns status-im2.subs.networks
(ns status-im.subs.networks
(:require [re-frame.core :as re-frame]
[status-im2.config :as config]
[utils.ethereum.chain :as chain]))

View File

@ -0,0 +1,134 @@
(ns status-im.subs.root
(:require [re-frame.core :as re-frame]
status-im.subs.wallet.signing
status-im.subs.wallet.transactions
status-im.subs.wallet.wallet
status-im.subs.bootnodes
status-im.subs.browser
status-im.subs.ens
status-im.subs.keycard
status-im.subs.mailservers
status-im.subs.networks
status-im.subs.wallet.search
status-im.subs.stickers))
(defn reg-root-key-sub
[sub-name db-key]
(re-frame/reg-sub sub-name (fn [db] (get db db-key))))
;;general
(reg-root-key-sub :visibility-status-popover/popover :visibility-status-popover/popover)
(reg-root-key-sub :visibility-status-updates :visibility-status-updates)
(reg-root-key-sub :fleets/custom-fleets :custom-fleets)
(reg-root-key-sub :ui/search :ui/search)
(reg-root-key-sub :network/type :network/type)
(reg-root-key-sub :network-status :network-status)
(reg-root-key-sub :peers-count :peers-count)
(reg-root-key-sub :peers-summary :peers-summary)
(reg-root-key-sub :web3-node-version :web3-node-version)
;;keycard
(reg-root-key-sub :keycard :keycard)
(reg-root-key-sub :keycard/banner-hidden :keycard/banner-hidden)
;;bottom sheet old
(reg-root-key-sub :bottom-sheet/show? :bottom-sheet/show?)
(reg-root-key-sub :bottom-sheet/view :bottom-sheet/view)
(reg-root-key-sub :bottom-sheet/options :bottom-sheet/options)
;;browser
(reg-root-key-sub :browsers :browser/browsers)
(reg-root-key-sub :browser/options :browser/options)
(reg-root-key-sub :dapps/permissions :dapps/permissions)
(reg-root-key-sub :bookmarks :bookmarks/bookmarks)
(reg-root-key-sub :browser/screen-id :browser/screen-id)
;;stickers
(reg-root-key-sub :stickers/selected-pack :stickers/selected-pack)
(reg-root-key-sub :stickers/packs :stickers/packs)
(reg-root-key-sub :stickers/recent-stickers :stickers/recent-stickers)
;;mailserver
(reg-root-key-sub :mailserver/current-id :mailserver/current-id)
(reg-root-key-sub :mailserver/mailservers :mailserver/mailservers)
(reg-root-key-sub :mailserver.edit/mailserver :mailserver.edit/mailserver)
(reg-root-key-sub :mailserver/state :mailserver/state)
(reg-root-key-sub :mailserver/pending-requests :mailserver/pending-requests)
(reg-root-key-sub :mailserver/request-error? :mailserver/request-error)
(reg-root-key-sub :mailserver/fetching-gaps-in-progress :mailserver/fetching-gaps-in-progress)
;;contacts
(reg-root-key-sub :contacts/contacts-raw :contacts/contacts)
(reg-root-key-sub :contacts/current-contact-identity :contacts/identity)
(reg-root-key-sub :contacts/current-contact-ens-name :contacts/ens-name)
(reg-root-key-sub :contacts/new-identity :contacts/new-identity)
(reg-root-key-sub :group/selected-contacts :group/selected-contacts)
(reg-root-key-sub :contacts/search-query :contacts/search-query)
;;wallet
(reg-root-key-sub :wallet :wallet)
(reg-root-key-sub :prices :prices)
(reg-root-key-sub :prices-loading? :prices-loading?)
(reg-root-key-sub :wallet.transactions :wallet.transactions)
(reg-root-key-sub :wallet/custom-token-screen :wallet/custom-token-screen)
(reg-root-key-sub :wallet/prepare-transaction :wallet/prepare-transaction)
(reg-root-key-sub :wallet-service/manual-setting :wallet-service/manual-setting)
(reg-root-key-sub :wallet/recipient :wallet/recipient)
(reg-root-key-sub :wallet/favourites :wallet/favourites)
(reg-root-key-sub :wallet/refreshing-history? :wallet/refreshing-history?)
(reg-root-key-sub :wallet/fetching-error :wallet/fetching-error)
(reg-root-key-sub :wallet/non-archival-node :wallet/non-archival-node)
(reg-root-key-sub :wallet/current-base-fee :wallet/current-base-fee)
(reg-root-key-sub :wallet/slow-base-fee :wallet/slow-base-fee)
(reg-root-key-sub :wallet/normal-base-fee :wallet/normal-base-fee)
(reg-root-key-sub :wallet/fast-base-fee :wallet/fast-base-fee)
(reg-root-key-sub :wallet/current-priority-fee :wallet/current-priority-fee)
(reg-root-key-sub :wallet/transactions-management-enabled? :wallet/transactions-management-enabled?)
(reg-root-key-sub :wallet/all-tokens :wallet/all-tokens)
(reg-root-key-sub :wallet/collectible-collections :wallet/collectible-collections)
(reg-root-key-sub :wallet/fetching-collection-assets :wallet/fetching-collection-assets)
(reg-root-key-sub :wallet/collectible-assets :wallet/collectible-assets)
(reg-root-key-sub :wallet/selected-collectible :wallet/selected-collectible)
(reg-root-key-sub :wallet/modal-selecting-source-token? :wallet/modal-selecting-source-token?)
(reg-root-key-sub :wallet/swap-from-token :wallet/swap-from-token)
(reg-root-key-sub :wallet/swap-to-token :wallet/swap-to-token)
(reg-root-key-sub :wallet/swap-from-token-amount :wallet/swap-from-token-amount)
(reg-root-key-sub :wallet/swap-to-token-amount :wallet/swap-to-token-amount)
(reg-root-key-sub :wallet/swap-advanced-mode? :wallet/swap-advanced-mode?)
(reg-root-key-sub :add-account :add-account)
(reg-root-key-sub :buy-crypto/on-ramps :buy-crypto/on-ramps)
;;; Link previews
(reg-root-key-sub :link-previews-whitelist :link-previews-whitelist)
(reg-root-key-sub :chat/link-previews :chat/link-previews)
;;commands
(reg-root-key-sub :commands/select-account :commands/select-account)
;;ethereum
(reg-root-key-sub :ethereum/current-block :ethereum/current-block)
;;ens
(reg-root-key-sub :ens/registration :ens/registration)
(reg-root-key-sub :ens/registrations :ens/registrations)
(reg-root-key-sub :ens/names :ens/names)
;;signing
(reg-root-key-sub :signing/sign :signing/sign)
(reg-root-key-sub :signing/tx :signing/tx)
(reg-root-key-sub :signing/edit-fee :signing/edit-fee)
;; wallet connect
(reg-root-key-sub :wallet-connect/proposal-metadata :wallet-connect/proposal-metadata)
(reg-root-key-sub :wallet-connect/enabled? :wallet-connect/enabled?)
(reg-root-key-sub :wallet-connect/session-connected :wallet-connect/session-connected)
(reg-root-key-sub :wallet-connect/showing-app-management-sheet?
:wallet-connect/showing-app-management-sheet?)
(reg-root-key-sub :wallet-connect/sessions :wallet-connect/sessions)
(reg-root-key-sub :wallet-connect/session-managed :wallet-connect/session-managed)
(reg-root-key-sub :contact-requests/pending :contact-requests/pending)
(reg-root-key-sub :bug-report/description-error :bug-report/description-error)
(reg-root-key-sub :bug-report/details :bug-report/details)
(reg-root-key-sub :backup/performing-backup :backup/performing-backup)

View File

@ -1,4 +1,4 @@
(ns status-im2.subs.stickers
(ns status-im.subs.stickers
(:require [re-frame.core :as re-frame]
[status-im2.constants :as constants]))

View File

@ -1,5 +1,4 @@
(ns status-im2.subs.search
(:require [clojure.string :as string])
(ns status-im.subs.wallet.search
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.utils.currency :as currency]))

View File

@ -1,4 +1,4 @@
(ns status-im2.subs.wallet.signing
(ns status-im.subs.wallet.signing
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.ethereum.tokens :as tokens]

View File

@ -1,4 +1,4 @@
(ns status-im2.subs.wallet.transactions
(ns status-im.subs.wallet.transactions
(:require [re-frame.core :as re-frame]
[status-im.ethereum.transactions.core :as transactions]
[utils.i18n :as i18n]

View File

@ -1,4 +1,4 @@
(ns status-im2.subs.wallet.wallet
(ns status-im.subs.wallet.wallet
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.ethereum.tokens :as tokens]

View File

@ -1,10 +1,11 @@
(ns status-im2.subs.wallet.wallet-test
(ns status-im.subs.wallet.wallet-test
(:require [cljs.test :refer [deftest is testing]]
[re-frame.db :as rf-db]
[test-helpers.unit :as h]
[utils.money :as money]
[status-im2.subs.wallet.wallet :as wallet]
[utils.re-frame :as rf]))
[status-im.subs.wallet.wallet :as wallet]
[utils.re-frame :as rf]
[status-im.subs.wallet.transactions :as wallet.transactions]))
(def money-zero (money/bignumber 0))
(def money-eth (money/bignumber 8000000000000000000))
@ -127,3 +128,24 @@
:wallet wallet
:wallet/all-tokens tokens)
(is (= "10,275.38" (rf/sub [sub-name main-account-id])))))
(def transactions
[{:timestamp "1505912551000"}
{:timestamp "1505764322000"}
{:timestamp "1505750000000"}])
(def grouped-transactions
'({:title "20 Sep"
:key :20170920
:data
({:timestamp "1505912551000"})}
{:title "18 Sep"
:key :20170918
:data
({:timestamp "1505764322000"}
{:timestamp "1505750000000"})}))
(deftest group-transactions-by-date
(testing "Check if transactions are sorted by date"
(is (= (wallet.transactions/group-transactions-by-date transactions)
grouped-transactions))))

View File

@ -23,6 +23,7 @@
status-im2.events
status-im2.navigation.core
status-im2.subs.root
status-im.subs.root
[status-im2.contexts.push-notifications.events :as notifications]))
;;;; re-frame RN setup

View File

@ -1,4 +1,4 @@
(ns status-im2.subs.chat.chats
(ns status-im2.subs.chats
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.communities.core :as communities]
@ -9,6 +9,21 @@
[status-im2.contexts.chat.composer.constants :as composer.constants]
[status-im2.contexts.chat.events :as chat.events]))
(def memo-chats-stack-items (atom nil))
(re-frame/reg-sub
:chats-stack-items
:<- [:chats/home-list-chats]
:<- [:view-id]
:<- [:home-items-show-number]
(fn [[chats view-id home-items-show-number]]
(if (or (empty? @memo-chats-stack-items) (= view-id :chats-stack))
(let [res (take home-items-show-number chats)]
(reset! memo-chats-stack-items res)
res)
;;we want to keep data unchanged so react doesn't change component when we leave screen
@memo-chats-stack-items)))
(re-frame/reg-sub
:chats/chat
:<- [:chats/chats]

View File

@ -1,4 +1,4 @@
(ns status-im2.subs.chat.chats-test
(ns status-im2.subs.chats-test
(:require [cljs.test :refer [is testing]]
[re-frame.db :as rf-db]
[status-im2.constants :as constants]

View File

@ -285,3 +285,15 @@
(and
(= network-type "cellular")
syncing-on-mobile-network?))))
(re-frame/reg-sub
:toasts/toast
:<- [:toasts]
(fn [toasts [_ toast-id]]
(get-in toasts [:toasts toast-id])))
(re-frame/reg-sub
:toasts/toast-cursor
:<- [:toasts]
(fn [toasts [_ toast-id & cursor]]
(get-in toasts (into [:toasts toast-id] cursor))))

View File

@ -1,23 +0,0 @@
(ns status-im2.subs.home
(:require [re-frame.core :as re-frame]))
(def memo-chats-stack-items (atom nil))
(re-frame/reg-sub
:chats-stack-items
:<- [:chats/home-list-chats]
:<- [:view-id]
:<- [:home-items-show-number]
(fn [[chats view-id home-items-show-number]]
(if (or (empty? @memo-chats-stack-items) (= view-id :chats-stack))
(let [res (take home-items-show-number chats)]
(reset! memo-chats-stack-items res)
res)
;;we want to keep data unchanged so react doesn't change component when we leave screen
@memo-chats-stack-items)))
(re-frame/reg-sub
:hide-home-tooltip?
:<- [:profile/profile]
(fn [multiaccount]
(:hide-home-tooltip? multiaccount)))

View File

@ -1,4 +1,4 @@
(ns status-im2.subs.chat.messages
(ns status-im2.subs.messages
(:require [re-frame.core :as re-frame]
[status-im.chat.models.reactions :as models.reactions]
[status-im2.constants :as constants]

View File

@ -1,8 +1,8 @@
(ns status-im2.subs.chat.messages-test
(ns status-im2.subs.messages-test
(:require [cljs.test :refer [deftest is testing]]
[re-frame.db :as rf-db]
[status-im2.constants :as constants]
[status-im2.subs.chat.messages :as messages]
[status-im2.subs.messages :as messages]
[test-helpers.unit :as h]
[utils.re-frame :as rf]))

View File

@ -2,28 +2,15 @@
(:require
[re-frame.core :as re-frame]
status-im2.subs.activity-center
status-im2.subs.bootnodes
status-im2.subs.browser
status-im2.subs.chat.chats
status-im2.subs.chat.messages
status-im2.subs.chats
status-im2.subs.messages
status-im2.subs.communities
status-im2.subs.contact
status-im2.subs.ens
status-im2.subs.general
status-im2.subs.home
status-im2.subs.keycard
status-im2.subs.mailservers
status-im2.subs.networks
status-im2.subs.onboarding
status-im2.subs.pairing
status-im2.subs.profile
status-im2.subs.search
status-im2.subs.shell
status-im2.subs.stickers
status-im2.subs.toasts
status-im2.subs.wallet.signing
status-im2.subs.wallet.transactions
status-im2.subs.wallet.wallet))
status-im2.subs.shell))
(defn reg-root-key-sub
[sub-name db-key]
@ -34,27 +21,24 @@
(reg-root-key-sub :screen-params :navigation/screen-params)
(reg-root-key-sub :shared-element-id :shared-element-id)
;;bottom sheet old
(reg-root-key-sub :bottom-sheet/show? :bottom-sheet/show?)
(reg-root-key-sub :bottom-sheet/view :bottom-sheet/view)
(reg-root-key-sub :bottom-sheet/options :bottom-sheet/options)
;;bottom sheet
(reg-root-key-sub :bottom-sheet :bottom-sheet)
; media-server
(reg-root-key-sub :mediaserver/port :mediaserver/port)
;; push notifications
(reg-root-key-sub :push-notifications/preferences :push-notifications/preferences)
;;general
(reg-root-key-sub :messenger/started? :messenger/started?)
(reg-root-key-sub :animations :animations)
(reg-root-key-sub :toasts :toasts)
(reg-root-key-sub :popover/popover :popover/popover)
(reg-root-key-sub :auth-method :auth-method)
(reg-root-key-sub :syncing :syncing)
(reg-root-key-sub :sync-state :sync-state)
(reg-root-key-sub :network-status :network-status)
(reg-root-key-sub :peers-count :peers-count)
(reg-root-key-sub :about-app/node-info :node-info)
(reg-root-key-sub :peers-summary :peers-summary)
(reg-root-key-sub :dimensions/window :dimensions/window)
(reg-root-key-sub :fleets/custom-fleets :custom-fleets)
(reg-root-key-sub :animations :animations)
(reg-root-key-sub :ui/search :ui/search)
(reg-root-key-sub :web3-node-version :web3-node-version)
(reg-root-key-sub :sync-data :sync-data)
(reg-root-key-sub :mobile-network/remember-choice? :mobile-network/remember-choice?)
(reg-root-key-sub :qr-modal :qr-modal)
@ -70,20 +54,21 @@
(reg-root-key-sub :app-state :app-state)
(reg-root-key-sub :home-items-show-number :home-items-show-number)
(reg-root-key-sub :waku/v2-peer-stats :peer-stats)
(reg-root-key-sub :visibility-status-updates :visibility-status-updates)
(reg-root-key-sub :shell/switcher-cards :shell/switcher-cards)
(reg-root-key-sub :password-authentication :password-authentication)
(reg-root-key-sub :shell/floating-screens :shell/floating-screens)
(reg-root-key-sub :shell/loaded-screens :shell/loaded-screens)
(reg-root-key-sub :initials-avatar-font-file :initials-avatar-font-file)
;;NOTE this one is not related to ethereum network
;; it is about cellular network/ wifi network
(reg-root-key-sub :network/type :network/type)
;;onboarding
(reg-root-key-sub :onboarding-2/generated-keys? :onboarding-2/generated-keys?)
(reg-root-key-sub :onboarding-2/new-account? :onboarding-2/new-account?)
(reg-root-key-sub :onboarding-2/profile :onboarding-2/profile)
;;shell
(reg-root-key-sub :shell/switcher-cards :shell/switcher-cards)
(reg-root-key-sub :shell/floating-screens :shell/floating-screens)
(reg-root-key-sub :shell/loaded-screens :shell/loaded-screens)
;;my profile
(reg-root-key-sub :my-profile/seed :my-profile/seed)
;;profiles
(reg-root-key-sub :profile/profiles-overview :profile/profiles-overview)
(reg-root-key-sub :profile/login :profile/login)
@ -93,6 +78,9 @@
(reg-root-key-sub :multiaccount/reset-password-form-vals :multiaccount/reset-password-form-vals)
(reg-root-key-sub :multiaccount/reset-password-errors :multiaccount/reset-password-errors)
(reg-root-key-sub :multiaccount/resetting-password? :multiaccount/resetting-password?)
;; delete profile
(reg-root-key-sub :delete-profile/error :delete-profile/error)
(reg-root-key-sub :delete-profile/keep-keys-on-keycard? :delete-profile/keep-keys-on-keycard?)
;;chat
(reg-root-key-sub :chats/cooldown-enabled? :chat/cooldown-enabled?)
@ -101,18 +89,8 @@
(reg-root-key-sub :public-group-topic :public-group-topic)
(reg-root-key-sub :chats/loading? :chats/loading?)
(reg-root-key-sub :new-chat-name :new-chat-name)
(reg-root-key-sub :group-chat-profile/editing? :group-chat-profile/editing?)
(reg-root-key-sub :group-chat-profile/profile :group-chat-profile/profile)
(reg-root-key-sub :group-chat/selected-participants :group-chat/selected-participants)
(reg-root-key-sub :group-chat/deselected-members :group-chat/deselected-members)
(reg-root-key-sub :chat/inputs :chat/inputs)
(reg-root-key-sub :chat/memberships :chat/memberships)
(reg-root-key-sub :camera-roll/photos :camera-roll/photos)
(reg-root-key-sub :camera-roll/end-cursor :camera-roll/end-cursor)
(reg-root-key-sub :camera-roll/has-next-page :camera-roll/has-next-page)
(reg-root-key-sub :camera-roll/loading-more :camera-roll/loading-more)
(reg-root-key-sub :camera-roll/albums :camera-roll/albums)
(reg-root-key-sub :camera-roll/selected-album :camera-roll/selected-album)
(reg-root-key-sub :group-chat/invitations :group-chat/invitations)
(reg-root-key-sub :chats/mention-suggestions :chats/mention-suggestions)
(reg-root-key-sub :chat/inputs-with-mentions :chat/inputs-with-mentions)
@ -120,12 +98,26 @@
(reg-root-key-sub :chats/recording? :chats/recording?)
(reg-root-key-sub :chat/reactions-authors :chat/reactions-authors)
;;lightbox
;;chat images lightbox
(reg-root-key-sub :lightbox/exit-signal :lightbox/exit-signal)
(reg-root-key-sub :lightbox/zoom-out-signal :lightbox/zoom-out-signal)
(reg-root-key-sub :lightbox/orientation :lightbox/orientation)
(reg-root-key-sub :lightbox/scale :lightbox/scale)
;;chat images camera roll
(reg-root-key-sub :camera-roll/photos :camera-roll/photos)
(reg-root-key-sub :camera-roll/end-cursor :camera-roll/end-cursor)
(reg-root-key-sub :camera-roll/has-next-page :camera-roll/has-next-page)
(reg-root-key-sub :camera-roll/loading-more :camera-roll/loading-more)
(reg-root-key-sub :camera-roll/albums :camera-roll/albums)
(reg-root-key-sub :camera-roll/selected-album :camera-roll/selected-album)
;;group chat
(reg-root-key-sub :group-chat-profile/editing? :group-chat-profile/editing?)
(reg-root-key-sub :group-chat-profile/profile :group-chat-profile/profile)
(reg-root-key-sub :group-chat/selected-participants :group-chat/selected-participants)
(reg-root-key-sub :group-chat/deselected-members :group-chat/deselected-members)
;;messages
(reg-root-key-sub :messages/messages :messages)
(reg-root-key-sub :messages/reactions :reactions)
@ -135,113 +127,10 @@
(reg-root-key-sub :messages/pin-messages :pin-messages)
(reg-root-key-sub :messages/pin-modal :pin-modal)
;;browser
(reg-root-key-sub :browsers :browser/browsers)
(reg-root-key-sub :browser/options :browser/options)
(reg-root-key-sub :dapps/permissions :dapps/permissions)
(reg-root-key-sub :bookmarks :bookmarks/bookmarks)
(reg-root-key-sub :browser/screen-id :browser/screen-id)
;;stickers
(reg-root-key-sub :stickers/selected-pack :stickers/selected-pack)
(reg-root-key-sub :stickers/packs :stickers/packs)
(reg-root-key-sub :stickers/recent-stickers :stickers/recent-stickers)
;;mailserver
(reg-root-key-sub :mailserver/current-id :mailserver/current-id)
(reg-root-key-sub :mailserver/mailservers :mailserver/mailservers)
(reg-root-key-sub :mailserver.edit/mailserver :mailserver.edit/mailserver)
(reg-root-key-sub :mailserver/state :mailserver/state)
(reg-root-key-sub :mailserver/pending-requests :mailserver/pending-requests)
(reg-root-key-sub :mailserver/request-error? :mailserver/request-error)
(reg-root-key-sub :mailserver/fetching-gaps-in-progress :mailserver/fetching-gaps-in-progress)
;;contacts
(reg-root-key-sub :contacts/contacts-raw :contacts/contacts)
(reg-root-key-sub :contacts/current-contact-identity :contacts/identity)
(reg-root-key-sub :contacts/current-contact-ens-name :contacts/ens-name)
(reg-root-key-sub :contacts/new-identity :contacts/new-identity)
(reg-root-key-sub :group/selected-contacts :group/selected-contacts)
(reg-root-key-sub :contacts/search-query :contacts/search-query)
;;wallet
(reg-root-key-sub :wallet :wallet)
(reg-root-key-sub :prices :prices)
(reg-root-key-sub :prices-loading? :prices-loading?)
(reg-root-key-sub :wallet.transactions :wallet.transactions)
(reg-root-key-sub :wallet/custom-token-screen :wallet/custom-token-screen)
(reg-root-key-sub :wallet/prepare-transaction :wallet/prepare-transaction)
(reg-root-key-sub :wallet-service/manual-setting :wallet-service/manual-setting)
(reg-root-key-sub :wallet/recipient :wallet/recipient)
(reg-root-key-sub :wallet/favourites :wallet/favourites)
(reg-root-key-sub :wallet/refreshing-history? :wallet/refreshing-history?)
(reg-root-key-sub :wallet/fetching-error :wallet/fetching-error)
(reg-root-key-sub :wallet/non-archival-node :wallet/non-archival-node)
(reg-root-key-sub :wallet/current-base-fee :wallet/current-base-fee)
(reg-root-key-sub :wallet/slow-base-fee :wallet/slow-base-fee)
(reg-root-key-sub :wallet/normal-base-fee :wallet/normal-base-fee)
(reg-root-key-sub :wallet/fast-base-fee :wallet/fast-base-fee)
(reg-root-key-sub :wallet/current-priority-fee :wallet/current-priority-fee)
(reg-root-key-sub :wallet/transactions-management-enabled? :wallet/transactions-management-enabled?)
(reg-root-key-sub :wallet/all-tokens :wallet/all-tokens)
(reg-root-key-sub :wallet/collectible-collections :wallet/collectible-collections)
(reg-root-key-sub :wallet/fetching-collection-assets :wallet/fetching-collection-assets)
(reg-root-key-sub :wallet/collectible-assets :wallet/collectible-assets)
(reg-root-key-sub :wallet/selected-collectible :wallet/selected-collectible)
(reg-root-key-sub :wallet/modal-selecting-source-token? :wallet/modal-selecting-source-token?)
(reg-root-key-sub :wallet/swap-from-token :wallet/swap-from-token)
(reg-root-key-sub :wallet/swap-to-token :wallet/swap-to-token)
(reg-root-key-sub :wallet/swap-from-token-amount :wallet/swap-from-token-amount)
(reg-root-key-sub :wallet/swap-to-token-amount :wallet/swap-to-token-amount)
(reg-root-key-sub :wallet/swap-advanced-mode? :wallet/swap-advanced-mode?)
;;; Link previews
(reg-root-key-sub :link-previews-whitelist :link-previews-whitelist)
(reg-root-key-sub :chat/link-previews :chat/link-previews)
;;commands
(reg-root-key-sub :commands/select-account :commands/select-account)
;;ethereum
(reg-root-key-sub :ethereum/current-block :ethereum/current-block)
;;ens
(reg-root-key-sub :ens/registration :ens/registration)
(reg-root-key-sub :ens/registrations :ens/registrations)
(reg-root-key-sub :ens/names :ens/names)
;;signing
(reg-root-key-sub :signing/sign :signing/sign)
(reg-root-key-sub :signing/tx :signing/tx)
(reg-root-key-sub :signing/edit-fee :signing/edit-fee)
;;intro-wizard
(reg-root-key-sub :intro-wizard-state :intro-wizard)
(reg-root-key-sub :toasts :toasts)
(reg-root-key-sub :popover/popover :popover/popover)
(reg-root-key-sub :visibility-status-popover/popover :visibility-status-popover/popover)
(reg-root-key-sub :add-account :add-account)
(reg-root-key-sub :keycard :keycard)
(reg-root-key-sub :auth-method :auth-method)
;; keycard
(reg-root-key-sub :keycard/banner-hidden :keycard/banner-hidden)
;; delete profile
(reg-root-key-sub :delete-profile/error :delete-profile/error)
(reg-root-key-sub :delete-profile/keep-keys-on-keycard? :delete-profile/keep-keys-on-keycard?)
;; push notifications
(reg-root-key-sub :push-notifications/preferences :push-notifications/preferences)
(reg-root-key-sub :buy-crypto/on-ramps :buy-crypto/on-ramps)
; Messages home view -> tabs
(reg-root-key-sub :messages-home/selected-tab :messages-home/selected-tab)
;; communities
(reg-root-key-sub :communities :communities)
(reg-root-key-sub :communities/create :communities/create)
(reg-root-key-sub :communities/create-channel :communities/create-channel)
@ -251,38 +140,7 @@
(reg-root-key-sub :communities/my-pending-requests-to-join :communities/my-pending-requests-to-join)
(reg-root-key-sub :communities/collapsed-categories :communities/collapsed-categories)
(reg-root-key-sub :communities/selected-tab :communities/selected-tab)
(reg-root-key-sub :contract-communities :contract-communities)
;; activity center
(reg-root-key-sub :activity-center :activity-center)
(reg-root-key-sub :bug-report/description-error :bug-report/description-error)
(reg-root-key-sub :bug-report/details :bug-report/details)
(reg-root-key-sub :backup/performing-backup :backup/performing-backup)
;; wallet connect
(reg-root-key-sub :wallet-connect/proposal-metadata :wallet-connect/proposal-metadata)
(reg-root-key-sub :wallet-connect/enabled? :wallet-connect/enabled?)
(reg-root-key-sub :wallet-connect/session-connected :wallet-connect/session-connected)
(reg-root-key-sub :wallet-connect/showing-app-management-sheet?
:wallet-connect/showing-app-management-sheet?)
(reg-root-key-sub :wallet-connect/sessions :wallet-connect/sessions)
(reg-root-key-sub :wallet-connect/session-managed :wallet-connect/session-managed)
(reg-root-key-sub :contact-requests/pending :contact-requests/pending)
; media-server
(reg-root-key-sub :mediaserver/port :mediaserver/port)
; onboarding
(reg-root-key-sub :onboarding-2/generated-keys? :onboarding-2/generated-keys?)
(reg-root-key-sub :onboarding-2/new-account? :onboarding-2/new-account?)
(reg-root-key-sub :onboarding-2/profile :onboarding-2/profile)
; Testing
(reg-root-key-sub :messenger/started? :messenger/started?)
; Messages home view -> tabs
(reg-root-key-sub :messages-home/selected-tab :messages-home/selected-tab)

View File

@ -1,24 +0,0 @@
(ns status-im2.subs.subs-test
(:require [cljs.test :refer [deftest is testing]]
[status-im2.subs.wallet.transactions :as wallet.transactions]))
(def transactions
[{:timestamp "1505912551000"}
{:timestamp "1505764322000"}
{:timestamp "1505750000000"}])
(def grouped-transactions
'({:title "20 Sep"
:key :20170920
:data
({:timestamp "1505912551000"})}
{:title "18 Sep"
:key :20170918
:data
({:timestamp "1505764322000"}
{:timestamp "1505750000000"})}))
(deftest group-transactions-by-date
(testing "Check if transactions are sorted by date"
(is (= (wallet.transactions/group-transactions-by-date transactions)
grouped-transactions))))

View File

@ -1,14 +0,0 @@
(ns status-im2.subs.toasts
(:require [re-frame.core :as re-frame]))
(re-frame/reg-sub
:toasts/toast
:<- [:toasts]
(fn [toasts [_ toast-id]]
(get-in toasts [:toasts toast-id])))
(re-frame/reg-sub
:toasts/toast-cursor
:<- [:toasts]
(fn [toasts [_ toast-id & cursor]]
(get-in toasts (into [:toasts toast-id] cursor))))