diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 5acb02d858..ad3d71b565 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -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 diff --git a/src/status_im/integration_test.cljs b/src/status_im/integration_test.cljs index 7a92e91de0..9de8598056 100644 --- a/src/status_im/integration_test.cljs +++ b/src/status_im/integration_test.cljs @@ -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])) diff --git a/src/status_im/multiaccounts/core.cljs b/src/status_im/multiaccounts/core.cljs index 7b6bda0a43..d4d7fa483a 100644 --- a/src/status_im/multiaccounts/core.cljs +++ b/src/status_im/multiaccounts/core.cljs @@ -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] diff --git a/src/status_im/search/core_test.cljs b/src/status_im/search/core_test.cljs index f0ef9ce155..7a6410f84a 100644 --- a/src/status_im/search/core_test.cljs +++ b/src/status_im/search/core_test.cljs @@ -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] diff --git a/src/status_im2/subs/bootnodes.cljs b/src/status_im/subs/bootnodes.cljs similarity index 96% rename from src/status_im2/subs/bootnodes.cljs rename to src/status_im/subs/bootnodes.cljs index 8bbf30d947..14a75ae160 100644 --- a/src/status_im2/subs/bootnodes.cljs +++ b/src/status_im/subs/bootnodes.cljs @@ -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 diff --git a/src/status_im2/subs/browser.cljs b/src/status_im/subs/browser.cljs similarity index 96% rename from src/status_im2/subs/browser.cljs rename to src/status_im/subs/browser.cljs index 60e99effe3..269fa49232 100644 --- a/src/status_im2/subs/browser.cljs +++ b/src/status_im/subs/browser.cljs @@ -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])) diff --git a/src/status_im2/subs/ens.cljs b/src/status_im/subs/ens.cljs similarity index 99% rename from src/status_im2/subs/ens.cljs rename to src/status_im/subs/ens.cljs index f369a3892d..9240a359d5 100644 --- a/src/status_im2/subs/ens.cljs +++ b/src/status_im/subs/ens.cljs @@ -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] diff --git a/src/status_im2/subs/keycard.cljs b/src/status_im/subs/keycard.cljs similarity index 99% rename from src/status_im2/subs/keycard.cljs rename to src/status_im/subs/keycard.cljs index 1fab38fd11..57b9b1c72f 100644 --- a/src/status_im2/subs/keycard.cljs +++ b/src/status_im/subs/keycard.cljs @@ -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] diff --git a/src/status_im2/subs/mailservers.cljs b/src/status_im/subs/mailservers.cljs similarity index 98% rename from src/status_im2/subs/mailservers.cljs rename to src/status_im/subs/mailservers.cljs index 6b4fb1ffa3..a1e4f58c0d 100644 --- a/src/status_im2/subs/mailservers.cljs +++ b/src/status_im/subs/mailservers.cljs @@ -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])) diff --git a/src/status_im2/subs/networks.cljs b/src/status_im/subs/networks.cljs similarity index 97% rename from src/status_im2/subs/networks.cljs rename to src/status_im/subs/networks.cljs index 2b5894239a..dfd9b90872 100644 --- a/src/status_im2/subs/networks.cljs +++ b/src/status_im/subs/networks.cljs @@ -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])) diff --git a/src/status_im/subs/root.cljs b/src/status_im/subs/root.cljs new file mode 100644 index 0000000000..66f3d5fba7 --- /dev/null +++ b/src/status_im/subs/root.cljs @@ -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) diff --git a/src/status_im2/subs/stickers.cljs b/src/status_im/subs/stickers.cljs similarity index 96% rename from src/status_im2/subs/stickers.cljs rename to src/status_im/subs/stickers.cljs index b2baf8fc41..8f70b10c6d 100644 --- a/src/status_im2/subs/stickers.cljs +++ b/src/status_im/subs/stickers.cljs @@ -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])) diff --git a/src/status_im2/subs/search.cljs b/src/status_im/subs/wallet/search.cljs similarity index 97% rename from src/status_im2/subs/search.cljs rename to src/status_im/subs/wallet/search.cljs index 808569f12f..c1d876cfd5 100644 --- a/src/status_im2/subs/search.cljs +++ b/src/status_im/subs/wallet/search.cljs @@ -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])) diff --git a/src/status_im2/subs/wallet/signing.cljs b/src/status_im/subs/wallet/signing.cljs similarity index 99% rename from src/status_im2/subs/wallet/signing.cljs rename to src/status_im/subs/wallet/signing.cljs index ee0c1ded34..0583b3e450 100644 --- a/src/status_im2/subs/wallet/signing.cljs +++ b/src/status_im/subs/wallet/signing.cljs @@ -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] diff --git a/src/status_im2/subs/wallet/transactions.cljs b/src/status_im/subs/wallet/transactions.cljs similarity index 99% rename from src/status_im2/subs/wallet/transactions.cljs rename to src/status_im/subs/wallet/transactions.cljs index bda2d0d6ce..5121963f9f 100644 --- a/src/status_im2/subs/wallet/transactions.cljs +++ b/src/status_im/subs/wallet/transactions.cljs @@ -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] diff --git a/src/status_im2/subs/wallet/wallet.cljs b/src/status_im/subs/wallet/wallet.cljs similarity index 99% rename from src/status_im2/subs/wallet/wallet.cljs rename to src/status_im/subs/wallet/wallet.cljs index 2ff5383b8a..b66e9a98bb 100644 --- a/src/status_im2/subs/wallet/wallet.cljs +++ b/src/status_im/subs/wallet/wallet.cljs @@ -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] diff --git a/src/status_im2/subs/wallet/wallet_test.cljs b/src/status_im/subs/wallet/wallet_test.cljs similarity index 84% rename from src/status_im2/subs/wallet/wallet_test.cljs rename to src/status_im/subs/wallet/wallet_test.cljs index 67b6368ef8..9435eb1500 100644 --- a/src/status_im2/subs/wallet/wallet_test.cljs +++ b/src/status_im/subs/wallet/wallet_test.cljs @@ -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)))) diff --git a/src/status_im2/core.cljs b/src/status_im2/core.cljs index 9c38b0d2ba..52c44bb3a6 100644 --- a/src/status_im2/core.cljs +++ b/src/status_im2/core.cljs @@ -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 diff --git a/src/status_im2/subs/chat/chats.cljs b/src/status_im2/subs/chats.cljs similarity index 96% rename from src/status_im2/subs/chat/chats.cljs rename to src/status_im2/subs/chats.cljs index fadd7065c7..34f147e870 100644 --- a/src/status_im2/subs/chat/chats.cljs +++ b/src/status_im2/subs/chats.cljs @@ -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] diff --git a/src/status_im2/subs/chat/chats_test.cljs b/src/status_im2/subs/chats_test.cljs similarity index 99% rename from src/status_im2/subs/chat/chats_test.cljs rename to src/status_im2/subs/chats_test.cljs index a33f71a597..2e1660e8dd 100644 --- a/src/status_im2/subs/chat/chats_test.cljs +++ b/src/status_im2/subs/chats_test.cljs @@ -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] diff --git a/src/status_im2/subs/general.cljs b/src/status_im2/subs/general.cljs index 2ef813e860..7d1c3685e2 100644 --- a/src/status_im2/subs/general.cljs +++ b/src/status_im2/subs/general.cljs @@ -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)))) diff --git a/src/status_im2/subs/home.cljs b/src/status_im2/subs/home.cljs deleted file mode 100644 index aab2b9f1bb..0000000000 --- a/src/status_im2/subs/home.cljs +++ /dev/null @@ -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))) diff --git a/src/status_im2/subs/chat/messages.cljs b/src/status_im2/subs/messages.cljs similarity index 99% rename from src/status_im2/subs/chat/messages.cljs rename to src/status_im2/subs/messages.cljs index 08aa1f718a..fc8fe2a7d1 100644 --- a/src/status_im2/subs/chat/messages.cljs +++ b/src/status_im2/subs/messages.cljs @@ -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] diff --git a/src/status_im2/subs/chat/messages_test.cljs b/src/status_im2/subs/messages_test.cljs similarity index 98% rename from src/status_im2/subs/chat/messages_test.cljs rename to src/status_im2/subs/messages_test.cljs index 8385c3ce0c..66a69d7525 100644 --- a/src/status_im2/subs/chat/messages_test.cljs +++ b/src/status_im2/subs/messages_test.cljs @@ -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])) diff --git a/src/status_im2/subs/root.cljs b/src/status_im2/subs/root.cljs index 0f7e2a44e1..0041fe4afc 100644 --- a/src/status_im2/subs/root.cljs +++ b/src/status_im2/subs/root.cljs @@ -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) diff --git a/src/status_im2/subs/subs_test.cljs b/src/status_im2/subs/subs_test.cljs deleted file mode 100644 index 69afaff14f..0000000000 --- a/src/status_im2/subs/subs_test.cljs +++ /dev/null @@ -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)))) diff --git a/src/status_im2/subs/toasts.cljs b/src/status_im2/subs/toasts.cljs deleted file mode 100644 index d4a4795fce..0000000000 --- a/src/status_im2/subs/toasts.cljs +++ /dev/null @@ -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))))