Remove unused subs (#19530)

* Remove unused subs

* lint fix
This commit is contained in:
Volodymyr Kozieiev 2024-04-10 16:25:41 +01:00 committed by GitHub
parent f6a433c818
commit 8b417524fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 0 additions and 659 deletions

View File

@ -1,210 +1,17 @@
(ns legacy.status-im.subs.keycard (ns legacy.status-im.subs.keycard
(:require (:require
[clojure.string :as string]
[legacy.status-im.keycard.common :as common] [legacy.status-im.keycard.common :as common]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[utils.address :as address]
[utils.datetime :as datetime])) [utils.datetime :as datetime]))
(re-frame/reg-sub
:keycard/nfc-enabled?
(fn [db]
(get-in db [:keycard :nfc-enabled?])))
(re-frame/reg-sub
:keycard/card-read-in-progress?
(fn [db]
(get-in db [:keycard :card-read-in-progress?] false)))
(re-frame/reg-sub
:keycard-setup-step
(fn [db]
(get-in db [:keycard :setup-step])))
(re-frame/reg-sub
:keycard-card-state
(fn [db]
(get-in db [:keycard :card-state])))
(re-frame/reg-sub
:keycard-flow
(fn [db]
(get-in db [:keycard :flow])))
(re-frame/reg-sub
:keycard-flow-steps
(fn [db]
(case (get-in db [:keycard :flow])
:recovery "2"
"3")))
(re-frame/reg-sub
:keycard-pair-code
(fn [db]
(get-in db [:keycard :secrets :password])))
(re-frame/reg-sub
:keycard-recovery-phrase-word
(fn [db]
(get-in db
[:keycard
:recovery-phrase
(get-in db [:keycard :recovery-phrase :step])])))
(re-frame/reg-sub
:keycard-recovery-phrase-input-word
(fn [db]
(get-in db [:keycard :recovery-phrase :input-word])))
(re-frame/reg-sub
:keycard-recovery-phrase-confirm-error
(fn [db]
(get-in db [:keycard :recovery-phrase :confirm-error])))
(re-frame/reg-sub
:keycard-recovery-phrase-step
(fn [db]
(get-in db [:keycard :recovery-phrase :step])))
(re-frame/reg-sub
:keycard-secrets
(fn [db]
(get-in db [:keycard :secrets])))
(re-frame/reg-sub
:keycard-puk-code
(fn [db]
(->> (get-in db [:keycard :secrets :puk])
(partition 4)
(map string/join)
(string/join " "))))
(re-frame/reg-sub
:keycard-setup-error
(fn [db]
(get-in db [:keycard :setup-error])))
(re-frame/reg-sub
:keycard-mnemonic
(fn [db]
(map-indexed vector
(partition 3
(map-indexed vector
(string/split
(get-in db [:keycard :secrets :mnemonic])
#" "))))))
(re-frame/reg-sub
:keycard-application-info
(fn [db]
(get-in db [:keycard :application-info])))
(re-frame/reg-sub
:keycard-application-info-error
(fn [db]
(get-in db [:keycard :application-info-error])))
(re-frame/reg-sub
:keycard-multiaccount
(fn [db]
(get-in db [:keycard :profile/profile])))
(re-frame/reg-sub
:keycard-multiaccount-wallet-address
(fn [db]
(str "0x" (get-in db [:keycard :multiaccount-wallet-address]))))
(re-frame/reg-sub
:keycard-multiaccount-whisper-public-key
(fn [db]
(address/normalized-hex (get-in db [:keycard :multiaccount-whisper-public-key]))))
(re-frame/reg-sub (re-frame/reg-sub
:keycard-paired-on :keycard-paired-on
(fn [db] (fn [db]
(some-> (get-in db [:profile/profile :keycard-paired-on]) (some-> (get-in db [:profile/profile :keycard-paired-on])
(datetime/timestamp->year-month-day-date)))) (datetime/timestamp->year-month-day-date))))
(re-frame/reg-sub
:keycard-multiaccount-pairing
(fn [db]
(get-in db [:profile/profile :keycard-pairing])))
(re-frame/reg-sub
:keycard/pin-retry-counter
(fn [db]
(get-in db [:keycard :application-info :pin-retry-counter])))
(re-frame/reg-sub
:keycard/puk-retry-counter
(fn [db]
(get-in db [:keycard :application-info :puk-retry-counter])))
(re-frame/reg-sub
:keycard/retry-counter
:<- [:keycard/pin-retry-counter]
:<- [:keycard/puk-retry-counter]
(fn [[pin puk]]
(if (zero? pin) puk pin)))
(re-frame/reg-sub
:keycard-reset-card-disabled?
(fn [db]
(get-in db [:keycard :reset-card :disabled?] false)))
(re-frame/reg-sub (re-frame/reg-sub
:keycard-multiaccount? :keycard-multiaccount?
common/keycard-multiaccount?) common/keycard-multiaccount?)
(re-frame/reg-sub
:keycard/original-pin
(fn [db]
(get-in db [:keycard :pin :original])))
(re-frame/reg-sub
:keycard/login-pin
(fn [db]
(get-in db [:keycard :pin :login])))
(re-frame/reg-sub
:keycard/pin-confirmation
(fn [db]
(get-in db [:keycard :pin :confirmation])))
(re-frame/reg-sub
:keycard/pin-enter-step
(fn [db]
(get-in db [:keycard :pin :enter-step])))
(re-frame/reg-sub
:keycard/pin-operation
(fn [db]
(get-in db [:keycard :pin :operation])))
(re-frame/reg-sub
:keycard/pin-data
(fn [db]
(get-in db [:keycard :pin])))
(re-frame/reg-sub
:keycard/pin
:<- [:keycard/pin-data]
:<- [:keycard/pin-enter-step]
(fn [[pin-data step]]
(get pin-data step)))
(re-frame/reg-sub
:keycard/pin-status
(fn [db]
(get-in db [:keycard :pin :status])))
(re-frame/reg-sub
:keycard/pin-error-label
(fn [db]
(get-in db [:keycard :pin :error-label])))
(re-frame/reg-sub
:keycard/frozen-card?
(fn [db]
(and (common/keycard-multiaccount? db)
(zero? (get-in db [:keycard :application-info :pin-retry-counter])))))

View File

@ -1,7 +1,6 @@
(ns legacy.status-im.subs.mailservers (ns legacy.status-im.subs.mailservers
(:require (:require
[legacy.status-im.fleet.core :as fleet] [legacy.status-im.fleet.core :as fleet]
[legacy.status-im.mailserver.core :as mailserver]
[re-frame.core :as re-frame])) [re-frame.core :as re-frame]))
(re-frame/reg-sub (re-frame/reg-sub
@ -24,12 +23,6 @@
(fn [state] (fn [state]
(#{:error :disconnected} state))) (#{:error :disconnected} state)))
(re-frame/reg-sub
:chats/fetching-gap-in-progress?
:<- [:mailserver/fetching-gaps-in-progress]
(fn [gaps [_ ids _]]
(seq (select-keys gaps ids))))
(re-frame/reg-sub (re-frame/reg-sub
:mailserver/fetching? :mailserver/fetching?
:<- [:mailserver/state] :<- [:mailserver/state]
@ -58,11 +51,6 @@
(= (get-in mailserver [:id :value]) (= (get-in mailserver [:id :value])
current-mailserver-id))) current-mailserver-id)))
(re-frame/reg-sub
:mailserver/use-status-nodes?
(fn [db _]
(boolean (mailserver/fetch-use-mailservers? db))))
(re-frame/reg-sub (re-frame/reg-sub
:mailserver.edit/validation-errors :mailserver.edit/validation-errors
:<- [:mailserver.edit/mailserver] :<- [:mailserver.edit/mailserver]
@ -72,15 +60,6 @@
(when error k)) (when error k))
mailserver)))) mailserver))))
(re-frame/reg-sub
:mailserver/connected?
:<- [:mailserver/state]
:<- [:disconnected?]
(fn [[mail-state disconnected?]]
(let [mailserver-connected? (= :connected mail-state)]
(and mailserver-connected?
(not disconnected?)))))
(re-frame/reg-sub (re-frame/reg-sub
:mailserver/preferred-id :mailserver/preferred-id
:<- [:profile/profile] :<- [:profile/profile]

View File

@ -3,12 +3,6 @@
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.constants :as constants])) [status-im.constants :as constants]))
(re-frame/reg-sub
:stickers/installed-packs
:<- [:stickers/packs]
(fn [packs]
(filter #(= (:status %) constants/sticker-pack-status-installed) (vals packs))))
(re-frame/reg-sub (re-frame/reg-sub
:stickers/all-packs :stickers/all-packs
:<- [:stickers/packs] :<- [:stickers/packs]

View File

@ -1,12 +1,10 @@
(ns status-im.subs.chats (ns status-im.subs.chats
(:require (:require
[clojure.string :as string] [clojure.string :as string]
[legacy.status-im.group-chats.core :as group-chat]
[legacy.status-im.group-chats.db :as group-chats.db] [legacy.status-im.group-chats.db :as group-chats.db]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.constants :as constants] [status-im.constants :as constants]
[status-im.contexts.chat.events :as chat.events] [status-im.contexts.chat.events :as chat.events]
[status-im.contexts.chat.messenger.composer.constants :as composer.constants]
[status-im.contexts.profile.utils :as profile.utils])) [status-im.contexts.profile.utils :as profile.utils]))
(def memo-chats-stack-items (atom nil)) (def memo-chats-stack-items (atom nil))
@ -47,36 +45,6 @@
chat))) chat)))
(sort-by :timestamp >)))) (sort-by :timestamp >))))
(re-frame/reg-sub
:chats/with-empty-category-by-community-id
(fn [[_ community-id]]
[(re-frame/subscribe [:chats/by-community-id community-id])
(re-frame/subscribe [:communities/community-chats community-id])])
(fn [[chats comm-chats] [_ community-id]]
(filter #(string/blank? (get-in comm-chats
[(string/replace (:chat-id %) community-id "") :categoryID]))
chats)))
(re-frame/reg-sub
:chats/sorted-categories-by-community-id
(fn [[_ community-id]]
[(re-frame/subscribe [:chats/by-community-id community-id])
(re-frame/subscribe [:communities/community-chats community-id])])
(fn [[chats comm-chats] [_ community-id]]
(let [chat-cat (into {}
(map (fn [{:keys [id categoryID position]}]
{(str community-id id) {:categoryID categoryID
:position position}})
(vals comm-chats)))]
(group-by :categoryID (sort-by :position (map #(merge % (chat-cat (:chat-id %))) chats))))))
(re-frame/reg-sub
:chats/category-by-chat-id
(fn [[_ community-id _]]
[(re-frame/subscribe [:communities/community community-id])])
(fn [[{:keys [chats categories]}] [_ community-id chat-id]]
(get categories (get-in chats [(string/replace chat-id community-id "") :categoryID]))))
(re-frame/reg-sub (re-frame/reg-sub
:chats/community-chat-by-id :chats/community-chat-by-id
(fn [[_ community-id _]] (fn [[_ community-id _]]
@ -134,24 +102,6 @@
(fn [[chat-id inputs]] (fn [[chat-id inputs]]
(get inputs chat-id))) (get inputs chat-id)))
(re-frame/reg-sub
:chats/composer-height
:<- [:chats/current-chat-input]
:<- [:chats/link-previews-unfurled]
(fn [[{:keys [input-content-height metadata]} link-previews]]
(let [{:keys [responding-to-message editing-message sending-image]} metadata]
(+ (max composer.constants/input-height input-content-height)
(when responding-to-message
composer.constants/reply-container-height)
(when editing-message
composer.constants/edit-container-height)
(when (seq sending-image)
composer.constants/images-container-height)
(when (seq link-previews)
composer.constants/links-container-height)
composer.constants/bar-container-height
composer.constants/actions-container-height))))
(re-frame/reg-sub (re-frame/reg-sub
:chats/sending-image :chats/sending-image
:<- [:chats/current-chat-id] :<- [:chats/current-chat-id]
@ -159,12 +109,6 @@
(fn [[chat-id inputs]] (fn [[chat-id inputs]]
(get-in inputs [chat-id :metadata :sending-image]))) (get-in inputs [chat-id :metadata :sending-image])))
(re-frame/reg-sub
:chats/timeline-chat-input-text
:<- [:chats/timeline-chat-input]
(fn [input]
(:input-text input)))
(re-frame/reg-sub (re-frame/reg-sub
:chats/current-chat-membership :chats/current-chat-membership
:<- [:chats/current-chat-id] :<- [:chats/current-chat-id]
@ -289,28 +233,6 @@
:message-pin-enabled message-pin-enabled :message-pin-enabled message-pin-enabled
:can-delete-message-for-everyone? can-delete-message-for-everyone?}))) :can-delete-message-for-everyone? can-delete-message-for-everyone?})))
(re-frame/reg-sub
:current-chat/metadata
:<- [:chats/current-raw-chat]
(fn [current-chat]
(select-keys current-chat
[:community-id
:contacts
:public?
:group-chat
:chat-type
:chat-id
:chat-name
:color
:invitation-admin])))
(re-frame/reg-sub
:current-chat/one-to-one-chat?
:<- [:chats/current-raw-chat]
(fn [current-chat]
(not (or (chat.events/group-chat? current-chat)
(chat.events/public-chat? current-chat)))))
(re-frame/reg-sub (re-frame/reg-sub
:chats/photo-path :chats/photo-path
:<- [:contacts/contacts] :<- [:contacts/contacts]
@ -319,28 +241,6 @@
(let [contact (or (when (= id public-key) multiaccount) (get contacts id))] (let [contact (or (when (= id public-key) multiaccount) (get contacts id))]
(profile.utils/photo contact)))) (profile.utils/photo contact))))
(re-frame/reg-sub
:chats/unread-messages-number
:<- [:chats/home-list-chats]
(fn [chats _]
(reduce (fn [{:keys [public other]} {:keys [unviewed-messages-count public?] :as chat}]
(if (or public? (chat.events/community-chat? chat))
{:public (+ public unviewed-messages-count)
:other other}
{:other (+ other unviewed-messages-count)
:public public}))
{:public 0
:other 0}
chats)))
(re-frame/reg-sub
:chats/current-chat-cooldown-enabled?
:<- [:chats/current-chat]
:<- [:chats/cooldown-enabled?]
(fn [[{:keys [public?]} cooldown-enabled?]]
(and public?
cooldown-enabled?)))
(re-frame/reg-sub (re-frame/reg-sub
:chats/reply-message :chats/reply-message
:<- [:chats/current-chat-input] :<- [:chats/current-chat-input]
@ -360,12 +260,6 @@
(fn [[chat-id inputs]] (fn [[chat-id inputs]]
(get-in inputs [chat-id :audio]))) (get-in inputs [chat-id :audio])))
(re-frame/reg-sub
:chats/timeline-sending-image
:<- [:chats/timeline-chat-input]
(fn [{:keys [metadata]}]
(:sending-image metadata)))
(defn filter-selected-contacts (defn filter-selected-contacts
[selected-contacts contacts] [selected-contacts contacts]
(filter #(:added? (contacts %)) selected-contacts)) (filter #(:added? (contacts %)) selected-contacts))
@ -394,15 +288,6 @@
(fn [[selected-contacts active-contacts]] (fn [[selected-contacts active-contacts]]
(filter-contacts selected-contacts active-contacts))) (filter-contacts selected-contacts active-contacts)))
(re-frame/reg-sub
:group-chat/inviter-info
(fn [[_ chat-id] _]
[(re-frame/subscribe [:chats/chat-by-id chat-id])
(re-frame/subscribe [:multiaccount/public-key])])
(fn [[chat my-public-key]]
{:member? (group-chats.db/member? my-public-key chat)
:inviter-pk (group-chats.db/get-inviter-pk my-public-key chat)}))
(re-frame/reg-sub (re-frame/reg-sub
:group-chat/invitations-by-chat-id :group-chat/invitations-by-chat-id
:<- [:group-chat/invitations] :<- [:group-chat/invitations]
@ -416,13 +301,6 @@
(fn [[invitations]] (fn [[invitations]]
(filter #(= constants/invitation-state-requested (:state %)) invitations))) (filter #(= constants/invitation-state-requested (:state %)) invitations)))
(re-frame/reg-sub
:group-chat/removed-from-current-chat?
:<- [:chats/current-raw-chat]
:<- [:multiaccount/public-key]
(fn [[current-chat pk]]
(group-chat/member-removed? current-chat pk)))
(re-frame/reg-sub (re-frame/reg-sub
:chat/mention-suggestions :chat/mention-suggestions
:<- [:chats/current-chat-id] :<- [:chats/current-chat-id]
@ -461,13 +339,6 @@
(fn [status-link-previews] (fn [status-link-previews]
(boolean (seq status-link-previews)))) (boolean (seq status-link-previews))))
(re-frame/reg-sub
:chat/check-channel-muted?
(fn [[_ community-id channel-id]]
[(re-frame/subscribe [:chats/chat (str community-id channel-id)])])
(fn [[chat]]
(:muted? chat)))
(re-frame/reg-sub (re-frame/reg-sub
:camera-roll/total-photos-count-android :camera-roll/total-photos-count-android
(fn [{:keys [camera-roll/albums]}] (fn [{:keys [camera-roll/albums]}]

View File

@ -14,30 +14,12 @@
(fn [info [_ id]] (fn [info [_ id]]
(get info id))) (get info id)))
(re-frame/reg-sub
:communities/section-list
:<- [:communities]
(fn [communities]
(->> (vals communities)
(group-by (comp (fnil string/upper-case "") first :name))
(sort-by (fn [[title]] title))
(map (fn [[title data]]
{:title title
:data data})))))
(re-frame/reg-sub (re-frame/reg-sub
:communities/community :communities/community
:<- [:communities] :<- [:communities]
(fn [communities [_ id]] (fn [communities [_ id]]
(get communities id))) (get communities id)))
(re-frame/reg-sub
:communities/community-chats
(fn [[_ community-id]]
[(re-frame/subscribe [:communities/community community-id])])
(fn [[{:keys [chats]}] _]
chats))
(re-frame/reg-sub (re-frame/reg-sub
:communities/community-color :communities/community-color
(fn [[_ community-id]] (fn [[_ community-id]]
@ -135,12 +117,6 @@
(fn [contract-communities] (fn [contract-communities]
(sort-by :name (vals (:other contract-communities))))) (sort-by :name (vals (:other contract-communities)))))
(re-frame/reg-sub
:communities/community-ids
:<- [:communities]
(fn [communities]
(map :id (vals communities))))
(def memo-communities-stack-items (atom nil)) (def memo-communities-stack-items (atom nil))
(defn- merge-opened-communities (defn- merge-opened-communities
@ -230,16 +206,6 @@
(fn [[communities {:keys [community-id]}]] (fn [[communities {:keys [community-id]}]]
(get communities community-id))) (get communities community-id)))
(re-frame/reg-sub
:communities/unviewed-count
(fn [[_ community-id]]
[(re-frame/subscribe [:chats/by-community-id community-id])])
(fn [[chats]]
(reduce (fn [acc {:keys [unviewed-messages-count]}]
(+ acc (or unviewed-messages-count 0)))
0
chats)))
(defn calculate-unviewed-counts (defn calculate-unviewed-counts
[chats] [chats]
(reduce (fn [acc {:keys [unviewed-mentions-count unviewed-messages-count muted]}] (reduce (fn [acc {:keys [unviewed-mentions-count unviewed-messages-count muted]}]
@ -269,22 +235,6 @@
(filter (fn [{:keys [state]}] (filter (fn [{:keys [state]}]
(= state constants/request-to-join-pending-state)))))) (= state constants/request-to-join-pending-state))))))
(re-frame/reg-sub
:community/categories
(fn [[_ community-id]]
[(re-frame/subscribe [:communities/community community-id])])
(fn [[{:keys [categories]}] _]
categories))
(re-frame/reg-sub
:communities/sorted-categories
:<- [:communities]
(fn [communities [_ id]]
(->> (get-in communities [id :categories])
(map #(assoc (get % 1) :community-id id))
(sort-by :position)
(into []))))
(defn- reduce-over-categories (defn- reduce-over-categories
[community-id [community-id
categories categories

View File

@ -21,37 +21,6 @@
raw-communities) raw-communities)
(is (match? raw-communities (rf/sub [sub-name])))))) (is (match? raw-communities (rf/sub [sub-name]))))))
(h/deftest-sub :communities/section-list
[sub-name]
(testing "builds sections using the first community name char (uppercased)"
(swap! rf-db/app-db assoc
:communities
{"0x1" {:name "civilized monkeys"}
"0x2" {:name "Civilized rats"}})
(is (match? [{:title "C"
:data [{:name "civilized monkeys"}
{:name "Civilized rats"}]}]
(rf/sub [sub-name]))))
(testing "sorts by section ascending"
(swap! rf-db/app-db assoc
:communities
{"0x3" {:name "Memorable"}
"0x1" {:name "Civilized monkeys"}})
(is (match? [{:title "C" :data [{:name "Civilized monkeys"}]}
{:title "M" :data [{:name "Memorable"}]}]
(rf/sub [sub-name]))))
(testing "builds default section for communities without a name"
(swap! rf-db/app-db assoc
:communities
{"0x2" {:id "0x2"}
"0x1" {:id "0x1"}})
(is (match? [{:title ""
:data [{:id "0x2"}
{:id "0x1"}]}]
(rf/sub [sub-name])))))
(h/deftest-sub :communities/unviewed-counts (h/deftest-sub :communities/unviewed-counts
[sub-name] [sub-name]
(testing "sums counts for a particular community" (testing "sums counts for a particular community"

View File

@ -179,26 +179,6 @@
(fn [blocked-contacts] (fn [blocked-contacts]
(count blocked-contacts))) (count blocked-contacts)))
(defn filter-recipient-contacts
[search-filter {:keys [primary-name secondary-name]}]
(or
(when primary-name
(string/includes? (string/lower-case (str primary-name)) search-filter))
(when secondary-name
(string/includes? (string/lower-case (str secondary-name)) search-filter))))
(re-frame/reg-sub
:contacts/active-with-ens-names
:<- [:contacts/active]
:<- [:wallet-legacy/search-recipient-filter]
(fn [[contacts search-filter]]
(let [contacts (filter :ens-verified contacts)]
(if (string/blank? search-filter)
contacts
(filter (partial filter-recipient-contacts
(string/lower-case search-filter))
contacts)))))
(defn- enrich-contact (defn- enrich-contact
[_ contact-identity ens-name port font-file] [_ contact-identity ens-name port font-file]
(let [contact (contact.db/enrich-contact (let [contact (contact.db/enrich-contact
@ -224,20 +204,6 @@
(fn [contacts [_ contact-identity]] (fn [contacts [_ contact-identity]]
(get contacts contact-identity {:public-key contact-identity}))) (get contacts contact-identity {:public-key contact-identity})))
(re-frame/reg-sub
:contacts/contact-added?
(fn [[_ contact-identity] _]
[(re-frame/subscribe [:contacts/contact-by-identity contact-identity])])
(fn [[contact] _]
(:added? contact)))
(re-frame/reg-sub
:contacts/contact-blocked?
(fn [[_ contact-identity] _]
[(re-frame/subscribe [:contacts/contact-by-identity contact-identity])])
(fn [[contact] _]
(:blocked contact)))
(re-frame/reg-sub (re-frame/reg-sub
:contacts/contact-two-names-by-identity :contacts/contact-two-names-by-identity
(fn [[_ contact-identity] _] (fn [[_ contact-identity] _]
@ -287,17 +253,6 @@
multiaccount multiaccount
(contact.db/find-contact-by-address contacts address)))) (contact.db/find-contact-by-address contacts address))))
(re-frame/reg-sub
:contacts/contacts-by-address
:<- [:contacts/contacts]
(fn [contacts]
(reduce (fn [acc [_ {:keys [address] :as contact}]]
(if address
(assoc acc address contact)
acc))
{}
contacts)))
(re-frame/reg-sub (re-frame/reg-sub
:contacts/filtered-active-sections :contacts/filtered-active-sections
:<- [:contacts/active-sections] :<- [:contacts/active-sections]

View File

@ -1,7 +1,6 @@
(ns status-im.subs.general (ns status-im.subs.general
(:require (:require
[clojure.string :as string] [clojure.string :as string]
[legacy.status-im.ethereum.tokens :as tokens]
[legacy.status-im.multiaccounts.model :as multiaccounts.model] [legacy.status-im.multiaccounts.model :as multiaccounts.model]
[legacy.status-im.utils.build :as build] [legacy.status-im.utils.build :as build]
[legacy.status-im.utils.mobile-sync :as mobile-network-utils] [legacy.status-im.utils.mobile-sync :as mobile-network-utils]
@ -47,12 +46,6 @@
(when-let [network (get networks current-network)] (when-let [network (get networks current-network)]
(assoc network :rpc-network? (get-in network [:config :UpstreamConfig :Enabled]))))) (assoc network :rpc-network? (get-in network [:config :UpstreamConfig :Enabled])))))
(re-frame/reg-sub
:custom-rpc-node
:<- [:current-network]
(fn [{:keys [id]}]
(= 45 (count id))))
(re-frame/reg-sub (re-frame/reg-sub
:chain-keyword :chain-keyword
:<- [:current-network] :<- [:current-network]
@ -77,12 +70,6 @@
(fn [chain-id] (fn [chain-id]
(= 1 chain-id))) (= 1 chain-id)))
(re-frame/reg-sub
:ethereum-network?
:<- [:chain-id]
(fn [chain-id]
(< chain-id 6)))
(re-frame/reg-sub (re-frame/reg-sub
:network-name :network-name
:<- [:current-network] :<- [:current-network]
@ -100,16 +87,6 @@
;; Otherwise use peers-count fetched from "discovery.summary" signal ;; Otherwise use peers-count fetched from "discovery.summary" signal
(if wakuv2-flag (not (:isOnline peer-stats)) (zero? peers-count)))) (if wakuv2-flag (not (:isOnline peer-stats)) (zero? peers-count))))
(re-frame/reg-sub
:offline?
:<- [:network-status]
:<- [:sync-state]
:<- [:disconnected?]
(fn [[network-status sync-state disconnected?]]
(or disconnected?
(= network-status :offline)
(= sync-state :offline))))
(re-frame/reg-sub (re-frame/reg-sub
:syncing? :syncing?
:<- [:sync-state] :<- [:sync-state]
@ -126,12 +103,6 @@
:<- [:dimensions/window] :<- [:dimensions/window]
:-> :height) :-> :height)
(re-frame/reg-sub
:dimensions/small-screen?
:<- [:dimensions/window-height]
(fn [height]
(< height 550)))
(re-frame/reg-sub (re-frame/reg-sub
:get-screen-params :get-screen-params
:<- [:screen-params] :<- [:screen-params]
@ -139,34 +110,16 @@
(fn [[params view-id-db] [_ view-id]] (fn [[params view-id-db] [_ view-id]]
(get params (or view-id view-id-db)))) (get params (or view-id view-id-db))))
(re-frame/reg-sub
:delete-swipe-position
:<- [:animations]
(fn [animations [_ type item-id]]
(get-in animations [type item-id :delete-swiped])))
(re-frame/reg-sub (re-frame/reg-sub
:wallet-legacy/search-recipient-filter :wallet-legacy/search-recipient-filter
:<- [:ui/search] :<- [:ui/search]
(fn [search] (fn [search]
(get search :recipient-filter))) (get search :recipient-filter)))
(re-frame/reg-sub
:search/currency-filter
:<- [:ui/search]
(fn [search]
(get search :currency-filter)))
(defn- node-version (defn- node-version
[web3-node-version] [web3-node-version]
(or web3-node-version "N/A")) (or web3-node-version "N/A"))
(re-frame/reg-sub
:get-app-version
:<- [:web3-node-version]
(fn [web3-node-version]
(str build/app-short-version "; " (node-version web3-node-version))))
(re-frame/reg-sub (re-frame/reg-sub
:get-app-short-version :get-app-short-version
(fn [_] build/app-short-version)) (fn [_] build/app-short-version))
@ -216,12 +169,6 @@
(fn [network] (fn [network]
(chain/network->chain-keyword network))) (chain/network->chain-keyword network)))
(re-frame/reg-sub
:ethereum/native-currency
:<- [:current-network]
(fn [network]
(tokens/native-currency network)))
(re-frame/reg-sub (re-frame/reg-sub
:connectivity/state :connectivity/state
:<- [:network-status] :<- [:network-status]
@ -264,22 +211,6 @@
(fn [{:keys [mnemonic]}] (fn [{:keys [mnemonic]}]
mnemonic)) mnemonic))
(re-frame/reg-sub
:get-profile-unread-messages-number
:<- [:profile/profile]
(fn [{:keys [mnemonic]}]
(if mnemonic 1 0)))
(re-frame/reg-sub
:mobile-network/syncing-allowed?
:<- [:network/type]
:<- [:profile/profile]
(fn [[network-type {:keys [syncing-on-mobile-network?]}]]
(or (= network-type "wifi")
(and
(= network-type "cellular")
syncing-on-mobile-network?))))
(re-frame/reg-sub (re-frame/reg-sub
:toasts/toast :toasts/toast
:<- [:toasts] :<- [:toasts]

View File

@ -180,12 +180,6 @@
(fn [pinned-messages _] (fn [pinned-messages _]
(count pinned-messages))) (count pinned-messages)))
(re-frame/reg-sub
:chats/pin-modal
:<- [:messages/pin-modal]
(fn [pin-modal [_ chat-id]]
(get pin-modal chat-id)))
(re-frame/reg-sub (re-frame/reg-sub
:chats/message-reactions :chats/message-reactions
:<- [:multiaccount/public-key] :<- [:multiaccount/public-key]

View File

@ -23,11 +23,6 @@
:<- [:profile/profile] :<- [:profile/profile]
(fn [multiaccount] (:installation-id multiaccount))) (fn [multiaccount] (:installation-id multiaccount)))
(re-frame/reg-sub
:pairing/installation-name
:<- [:profile/profile]
(fn [multiaccount] (:installation-name multiaccount)))
(re-frame/reg-sub (re-frame/reg-sub
:pairing/pairing-status :pairing/pairing-status
:<- [:syncing] :<- [:syncing]

View File

@ -10,7 +10,6 @@
[status-im.common.pixel-ratio :as pixel-ratio] [status-im.common.pixel-ratio :as pixel-ratio]
[status-im.constants :as constants] [status-im.constants :as constants]
[status-im.contexts.profile.utils :as profile.utils] [status-im.contexts.profile.utils :as profile.utils]
[utils.address :as address]
[utils.image-server :as image-server] [utils.image-server :as image-server]
[utils.security.core :as security])) [utils.security.core :as security]))
@ -33,28 +32,6 @@
(-> (get currency/currencies currency-id) (-> (get currency/currencies currency-id)
:symbol))) :symbol)))
(re-frame/reg-sub
:profile/onboarding-placeholder-avatar
:<- [:mediaserver/port]
:<- [:initials-avatar-font-file]
(fn [[port font-file] [_ profile-pic]]
{:fn
(if profile-pic
(image-server/get-account-image-uri-fn {:port port
:ratio pixel-ratio/ratio
:image-name profile-pic
:override-ring? false
:uppercase-ratio (:uppercase-ratio
constants/initials-avatar-font-conf)
:theme (theme/get-theme)})
(image-server/get-initials-avatar-uri-fn {:port port
:ratio pixel-ratio/ratio
:theme (theme/get-theme)
:override-ring? false
:uppercase-ratio (:uppercase-ratio
constants/initials-avatar-font-conf)
:font-file font-file}))}))
(re-frame/reg-sub (re-frame/reg-sub
:profile/login-profiles-picture :profile/login-profiles-picture
:<- [:profile/profiles-overview] :<- [:profile/profiles-overview]
@ -157,12 +134,6 @@
(fn [accounts] (fn [accounts]
(first accounts))) (first accounts)))
(re-frame/reg-sub
:multiaccount/visible-accounts
:<- [:profile/wallet-accounts]
(fn [accounts]
(remove :hidden accounts)))
(re-frame/reg-sub (re-frame/reg-sub
:sign-in-enabled? :sign-in-enabled?
:<- [:profile/login] :<- [:profile/login]
@ -207,16 +178,6 @@
(fn [[accounts address]] (fn [[accounts address]]
(some #(when (= (:address %) address) %) accounts))) (some #(when (= (:address %) address) %) accounts)))
(re-frame/reg-sub
:multiaccount/current-account
:<- [:profile/wallet-accounts]
:<- [:get-screen-params :wallet-account]
(fn [[accounts acc]]
(some #(when (= (string/lower-case (:address %))
(string/lower-case (:address acc)))
%)
accounts)))
(re-frame/reg-sub (re-frame/reg-sub
:account-by-address :account-by-address
:<- [:profile/wallet-accounts] :<- [:profile/wallet-accounts]
@ -227,20 +188,6 @@
%) %)
accounts)))) accounts))))
;; NOTE: this subscription only works on login
(re-frame/reg-sub
:multiaccounts.login/keycard-account?
:<- [:profile/profiles-overview]
:<- [:profile/login]
(fn [[multiaccounts {:keys [key-uid]}]]
(get-in multiaccounts [key-uid :keycard-pairing])))
(re-frame/reg-sub
:multiaccounts/keycard-account?
:<- [:profile/profile]
(fn [multiaccount]
(:keycard-pairing multiaccount)))
(re-frame/reg-sub (re-frame/reg-sub
:accounts-without-watch-only :accounts-without-watch-only
:<- [:profile/wallet-accounts] :<- [:profile/wallet-accounts]
@ -253,41 +200,6 @@
(fn [accounts] (fn [accounts]
(remove :hidden (filter #(not= (:type %) :watch) accounts)))) (remove :hidden (filter #(not= (:type %) :watch) accounts))))
(defn filter-recipient-accounts
[search-filter {:keys [name]}]
(string/includes? (string/lower-case (str name)) search-filter))
(re-frame/reg-sub
:accounts-for-recipient
:<- [:multiaccount/visible-accounts]
:<- [:wallet-legacy/prepare-transaction]
:<- [:wallet-legacy/search-recipient-filter]
(fn [[accounts {:keys [from]} search-filter]]
(let [accounts (remove #(= (:address %) (:address from)) accounts)]
(if (string/blank? search-filter)
accounts
(filter (partial filter-recipient-accounts
(string/lower-case search-filter))
accounts)))))
(re-frame/reg-sub
:add-account-disabled?
:<- [:profile/wallet-accounts]
:<- [:add-account]
(fn [[accounts {:keys [address type account seed private-key]}]]
(or (string/blank? (:name account))
(case type
:generate
false
:watch
(or (not (address/address? address))
(some #(when (= (:address %) address) %) accounts))
:key
(string/blank? (security/safe-unmask-data private-key))
:seed
(string/blank? (security/safe-unmask-data seed))
false))))
(re-frame/reg-sub (re-frame/reg-sub
:multiaccount/current-user-visibility-status :multiaccount/current-user-visibility-status
:<- [:profile/profile] :<- [:profile/profile]
@ -379,12 +291,6 @@
(fn [{:keys [processing]}] (fn [{:keys [processing]}]
processing)) processing))
(re-frame/reg-sub
:profile/login-password
:<- [:profile/login]
(fn [{:keys [password]}]
password))
;; LINK PREVIEW ;; LINK PREVIEW
;; ======================================================================================================== ;; ========================================================================================================

View File

@ -95,11 +95,6 @@
:<- [:wallet/wallet-send] :<- [:wallet/wallet-send]
:-> :token) :-> :token)
(rf/reg-sub
:wallet/wallet-send-amount
:<- [:wallet/wallet-send]
:-> :amount)
(rf/reg-sub (rf/reg-sub
:wallet/wallet-send-loading-suggested-routes? :wallet/wallet-send-loading-suggested-routes?
:<- [:wallet/wallet-send] :<- [:wallet/wallet-send]
@ -110,11 +105,6 @@
:<- [:wallet/wallet-send] :<- [:wallet/wallet-send]
:-> :suggested-routes) :-> :suggested-routes)
(rf/reg-sub
:wallet/wallet-bridge-to-chain-id
:<- [:wallet/wallet-send]
:-> :bridge-to-chain-id)
(rf/reg-sub (rf/reg-sub
:wallet/keypairs :wallet/keypairs
:<- [:wallet] :<- [:wallet]