refactor: go through clj-kondo warnings (#13929)
This commit is contained in:
parent
1a3e89ea7a
commit
ccd26dcfd0
|
@ -91,7 +91,8 @@
|
|||
:source-map false
|
||||
;; needed because we use deref in tests
|
||||
:static-fns false
|
||||
:optimizations :simple}}
|
||||
:optimizations :simple
|
||||
:infer-externs true}}
|
||||
|
||||
;; mock.js-dependencies is mocking the react-native libraries
|
||||
;; we build it as a node library so that it can be required by
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(ns quo.react
|
||||
(:refer-clojure :exclude [ref])
|
||||
(:require [oops.core :refer [oget oset!]]
|
||||
["react" :as react])
|
||||
(:require ["react" :as react]
|
||||
[oops.core :refer [oget oset!]])
|
||||
(:require-macros [quo.react :refer [with-deps-check
|
||||
maybe-js-deps]]))
|
||||
|
||||
|
@ -25,21 +25,21 @@
|
|||
(-hash [o] (goog/getUid o))
|
||||
|
||||
cljs.core/IDeref
|
||||
(-deref [o]
|
||||
(-deref [_o]
|
||||
value)
|
||||
|
||||
cljs.core/IReset
|
||||
(-reset! [o new-value]
|
||||
(-reset! [_o new-value]
|
||||
(set-value new-value))
|
||||
|
||||
cljs.core/ISwap
|
||||
(-swap! [o f]
|
||||
(-swap! [_o f]
|
||||
(set-value f))
|
||||
(-swap! [o f a]
|
||||
(-swap! [_o f a]
|
||||
(set-value #(f % a)))
|
||||
(-swap! [o f a b]
|
||||
(-swap! [_o f a b]
|
||||
(set-value #(f % a b)))
|
||||
(-swap! [o f a b xs]
|
||||
(-swap! [_o f a b xs]
|
||||
(set-value #(apply f % a b xs))))
|
||||
|
||||
(defn state [value]
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
(ns status-im.core
|
||||
(:require status-im.utils.db
|
||||
status-im.events
|
||||
status-im.subs
|
||||
status-im.navigation.core
|
||||
(:require ["react-native" :refer (DevSettings LogBox)]
|
||||
["react-native-languages" :default react-native-languages]
|
||||
["react-native-shake" :as react-native-shake]
|
||||
[re-frame.core :as re-frame]
|
||||
[re-frame.interop :as interop]
|
||||
[reagent.impl.batching :as batching]
|
||||
[status-im.notifications.local :as notifications]
|
||||
[status-im.async-storage.core :as async-storage]
|
||||
status-im.events
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.native-module.core :as status]
|
||||
status-im.navigation.core
|
||||
[status-im.notifications.local :as notifications]
|
||||
status-im.subs
|
||||
[status-im.ui.components.react :as react]
|
||||
[status-im.utils.config :as config]
|
||||
status-im.utils.db
|
||||
[status-im.utils.error-handler :as error-handler]
|
||||
[status-im.utils.logging.core :as utils.logs]
|
||||
[status-im.utils.platform :as platform]
|
||||
[status-im.utils.snoopy :as snoopy]
|
||||
[status-im.utils.config :as config]
|
||||
[status-im.utils.universal-links.core :as utils.universal-links]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.ui.components.react :as react]
|
||||
[status-im.async-storage.core :as async-storage]
|
||||
["react-native" :refer (DevSettings LogBox)]
|
||||
["react-native-languages" :default react-native-languages]
|
||||
["react-native-shake" :as react-native-shake]))
|
||||
[status-im.utils.universal-links.core :as utils.universal-links]))
|
||||
|
||||
(set! interop/next-tick js/setTimeout)
|
||||
(set! batching/fake-raf #(js/setTimeout % 0))
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
(ns status-im.ethereum.abi-spec
|
||||
(:require [cljs.spec.alpha :as spec]
|
||||
(:require ["web3-utils" :as utils]
|
||||
[cljs.spec.alpha :as spec]
|
||||
[clojure.string :as string]
|
||||
[status-im.ethereum.core :as ethereum]
|
||||
["web3-utils" :as utils]))
|
||||
[status-im.ethereum.core :as ethereum]))
|
||||
|
||||
;; Utility functions for encoding
|
||||
|
||||
|
@ -213,15 +213,15 @@
|
|||
(spec/def ::string string?)
|
||||
|
||||
(defn- single-char [code]
|
||||
(if-let [m (#{\, \[ \] \x} (first code))]
|
||||
(when-let [m (#{\, \[ \] \x} (first code))]
|
||||
[1 m]))
|
||||
|
||||
(defn- number [code]
|
||||
(if-let [m (re-find #"^[0-9]+" code)]
|
||||
(when-let [m (re-find #"^[0-9]+" code)]
|
||||
[(count m) (js/parseInt m)]))
|
||||
|
||||
(defn- string [s]
|
||||
(if-let [m (re-find #"^[a-z]+" s)]
|
||||
(when-let [m (re-find #"^[a-z]+" s)]
|
||||
[(count m) m]))
|
||||
|
||||
(defn tokenise [code]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(ns status-im.ethereum.core
|
||||
(:require [clojure.string :as string]
|
||||
["web3-utils" :as utils]
|
||||
(:require ["web3-utils" :as utils]
|
||||
[clojure.string :as string]
|
||||
[status-im.ethereum.eip55 :as eip55]))
|
||||
|
||||
(defn sha3 [s]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(ns status-im.ethereum.eip681-test
|
||||
(:require [cljs.test :refer-macros [deftest is]]
|
||||
(:require [cljs.test :refer-macros [deftest is] :as test]
|
||||
[status-im.ethereum.eip681 :as eip681]
|
||||
[status-im.utils.money :as money]))
|
||||
|
||||
|
@ -139,10 +139,10 @@
|
|||
(is (.equals (money/ether->wei (money/bignumber 1)) value))
|
||||
(is (= :ETH symbol))
|
||||
(is (= "0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7" address)))
|
||||
(is (= (eip681/extract-request-details {:address "0x744d70fdbe2ba4cf95131626614a1763df805b9e" :chain-id 1 :function-name "unknown"}
|
||||
{:address "0x744d70fdbe2ba4cf95131626614a1763df805b9e" :chain-id 1 :function-name "unknown"})))
|
||||
(let [{:keys [value symbol address]} (eip681/extract-request-details {:address "0x744d70fdbe2ba4cf95131626614a1763df805b9e" :chain-id 1
|
||||
:function-name "transfer" :function-arguments {:uint256 1000 :address "0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7"}}
|
||||
(is (= (eip681/extract-request-details {:address "0x744d70fdbe2ba4cf95131626614a1763df805b9e" :chain-id 1 :function-name "unknown"} {})
|
||||
{:address "0x744d70fdbe2ba4cf95131626614a1763df805b9e" :chain-id 1 :function-name "unknown"}))
|
||||
(let [{:keys [value symbol address]} (eip681/extract-request-details {:address "0x744d70fdbe2ba4cf95131626614a1763df805b9e" :chain-id 1
|
||||
:function-name "transfer" :function-arguments {:uint256 1000 :address "0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7"}}
|
||||
{"0x744d70fdbe2ba4cf95131626614a1763df805b9e" {:address "0x744d70fdbe2ba4cf95131626614a1763df805b9e"
|
||||
:name "Status Network Token"
|
||||
:symbol :SNT
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
(ns status-im.keycard.real-keycard
|
||||
(:require ["react-native-status-keycard" :default status-keycard]
|
||||
["react-native" :as rn]
|
||||
[status-im.utils.types :as types]
|
||||
[status-im.native-module.core :as status]
|
||||
(:require ["react-native" :as rn]
|
||||
["react-native-status-keycard" :default status-keycard]
|
||||
[status-im.ethereum.core :as ethereum]
|
||||
[status-im.keycard.keycard :as keycard]
|
||||
[taoensso.timbre :as log]
|
||||
[status-im.utils.platform :as platform]))
|
||||
[status-im.native-module.core :as status]
|
||||
[status-im.utils.platform :as platform]
|
||||
[status-im.utils.types :as types]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(defonce event-emitter (if platform/ios?
|
||||
(new (.-NativeEventEmitter rn) status-keycard)
|
||||
|
@ -199,7 +199,7 @@
|
|||
|
||||
(defn unpair
|
||||
[{:keys [pin on-success on-failure]}]
|
||||
(when (and pin)
|
||||
(when pin
|
||||
(.. status-keycard
|
||||
(unpair pin)
|
||||
(then on-success)
|
||||
|
@ -298,79 +298,79 @@
|
|||
|
||||
(defrecord RealKeycard []
|
||||
keycard/Keycard
|
||||
(keycard/start-nfc [this args]
|
||||
(keycard/start-nfc [_this args]
|
||||
(start-nfc args))
|
||||
(keycard/stop-nfc [this args]
|
||||
(keycard/stop-nfc [_this args]
|
||||
(stop-nfc args))
|
||||
(keycard/set-nfc-message [this args]
|
||||
(keycard/set-nfc-message [_this args]
|
||||
(set-nfc-message args))
|
||||
(keycard/check-nfc-support [this args]
|
||||
(keycard/check-nfc-support [_this args]
|
||||
(check-nfc-support args))
|
||||
(keycard/check-nfc-enabled [this args]
|
||||
(keycard/check-nfc-enabled [_this args]
|
||||
(check-nfc-enabled args))
|
||||
(keycard/open-nfc-settings [this]
|
||||
(keycard/open-nfc-settings [_this]
|
||||
(open-nfc-settings))
|
||||
(keycard/register-card-events [this args]
|
||||
(keycard/register-card-events [_this args]
|
||||
(register-card-events args))
|
||||
(keycard/on-card-connected [this callback]
|
||||
(keycard/on-card-connected [_this callback]
|
||||
(on-card-connected callback))
|
||||
(keycard/on-card-disconnected [this callback]
|
||||
(keycard/on-card-disconnected [_this callback]
|
||||
(on-card-disconnected callback))
|
||||
(keycard/remove-event-listener [this event]
|
||||
(keycard/remove-event-listener [_this event]
|
||||
(remove-event-listener event))
|
||||
(keycard/remove-event-listeners [this]
|
||||
(keycard/remove-event-listeners [_this]
|
||||
(remove-event-listeners))
|
||||
(keycard/set-pairings [this args]
|
||||
(keycard/set-pairings [_this args]
|
||||
(set-pairings args))
|
||||
(keycard/get-application-info [this args]
|
||||
(keycard/get-application-info [_this args]
|
||||
(get-application-info args))
|
||||
(keycard/factory-reset [this args]
|
||||
(keycard/factory-reset [_this args]
|
||||
(factory-reset args))
|
||||
(keycard/install-applet [this args]
|
||||
(keycard/install-applet [_this args]
|
||||
(install-applet args))
|
||||
(keycard/install-cash-applet [this args]
|
||||
(keycard/install-cash-applet [_this args]
|
||||
(install-cash-applet args))
|
||||
(keycard/init-card [this args]
|
||||
(keycard/init-card [_this args]
|
||||
(init-card args))
|
||||
(keycard/install-applet-and-init-card [this args]
|
||||
(keycard/install-applet-and-init-card [_this args]
|
||||
(install-applet-and-init-card args))
|
||||
(keycard/pair [this args]
|
||||
(keycard/pair [_this args]
|
||||
(pair args))
|
||||
(keycard/generate-and-load-key [this args]
|
||||
(keycard/generate-and-load-key [_this args]
|
||||
(generate-and-load-key args))
|
||||
(keycard/unblock-pin [this args]
|
||||
(keycard/unblock-pin [_this args]
|
||||
(unblock-pin args))
|
||||
(keycard/verify-pin [this args]
|
||||
(keycard/verify-pin [_this args]
|
||||
(verify-pin args))
|
||||
(keycard/change-pin [this args]
|
||||
(keycard/change-pin [_this args]
|
||||
(change-pin args))
|
||||
(keycard/change-puk [this args]
|
||||
(keycard/change-puk [_this args]
|
||||
(change-puk args))
|
||||
(keycard/change-pairing [this args]
|
||||
(keycard/change-pairing [_this args]
|
||||
(change-pairing args))
|
||||
(keycard/unpair [this args]
|
||||
(keycard/unpair [_this args]
|
||||
(unpair args))
|
||||
(keycard/delete [this args]
|
||||
(keycard/delete [_this args]
|
||||
(delete args))
|
||||
(keycard/remove-key [this args]
|
||||
(keycard/remove-key [_this args]
|
||||
(remove-key args))
|
||||
(keycard/remove-key-with-unpair [this args]
|
||||
(keycard/remove-key-with-unpair [_this args]
|
||||
(remove-key-with-unpair args))
|
||||
(keycard/export-key [this args]
|
||||
(keycard/export-key [_this args]
|
||||
(export-key args))
|
||||
(keycard/unpair-and-delete [this args]
|
||||
(keycard/unpair-and-delete [_this args]
|
||||
(unpair-and-delete args))
|
||||
(keycard/import-keys [this args]
|
||||
(keycard/import-keys [_this args]
|
||||
(import-keys args))
|
||||
(keycard/get-keys [this args]
|
||||
(keycard/get-keys [_this args]
|
||||
(get-keys args))
|
||||
(keycard/sign [this args]
|
||||
(keycard/sign [_this args]
|
||||
(sign args))
|
||||
(keycard/sign-typed-data [this args]
|
||||
(keycard/sign-typed-data [_this args]
|
||||
(sign-typed-data args))
|
||||
(keycard/save-multiaccount-and-login [this args]
|
||||
(keycard/save-multiaccount-and-login [_this args]
|
||||
(save-multiaccount-and-login args))
|
||||
(keycard/login [this args]
|
||||
(keycard/login [_this args]
|
||||
(login args))
|
||||
(keycard/send-transaction-with-signature [this args]
|
||||
(keycard/send-transaction-with-signature [_this args]
|
||||
(send-transaction-with-signature args)))
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
(ns status-im.keycard.simulated-keycard
|
||||
(:require [re-frame.core :as re-frame]
|
||||
(:require [clojure.string :as string]
|
||||
[re-frame.core :as re-frame]
|
||||
[re-frame.db :as re-frame.db]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.ethereum.core :as ethereum]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.keycard.keycard :as keycard]
|
||||
[status-im.multiaccounts.create.core :as multiaccounts.create]
|
||||
[status-im.native-module.core :as status]
|
||||
[status-im.node.core :as node]
|
||||
[status-im.utils.types :as types]
|
||||
[status-im.utils.utils :as utils]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[clojure.string :as string]
|
||||
[taoensso.timbre :as log]
|
||||
[status-im.multiaccounts.create.core :as multiaccounts.create]
|
||||
[status-im.node.core :as node]))
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(def kk1-password "000000")
|
||||
(def default-pin "111111")
|
||||
|
@ -243,9 +243,8 @@
|
|||
{:root-key root-data
|
||||
:derived derived-data-extended})))))))))))
|
||||
(when (= password (get @state :password))
|
||||
(do
|
||||
(swap! state assoc-in [:application-info :paired?] true)
|
||||
(later #(on-success (str (rand-int 10000000)))))))
|
||||
(swap! state assoc-in [:application-info :paired?] true)
|
||||
(later #(on-success (str (rand-int 10000000))))))
|
||||
|
||||
(defn generate-and-load-key
|
||||
[{:keys [pin on-success]}]
|
||||
|
@ -441,111 +440,111 @@
|
|||
|
||||
(defrecord SimulatedKeycard []
|
||||
keycard/Keycard
|
||||
(keycard/start-nfc [this args]
|
||||
(keycard/start-nfc [_this args]
|
||||
(log/debug "simulated card start-nfc")
|
||||
(start-nfc args))
|
||||
(keycard/stop-nfc [this args]
|
||||
(keycard/stop-nfc [_this args]
|
||||
(log/debug "simulated card stop-nfc")
|
||||
(stop-nfc args))
|
||||
(keycard/set-nfc-message [this args]
|
||||
(keycard/set-nfc-message [_this args]
|
||||
(log/debug "simulated card set-nfc-message")
|
||||
(set-nfc-message args))
|
||||
(keycard/check-nfc-support [this args]
|
||||
(keycard/check-nfc-support [_this args]
|
||||
(log/debug "simulated card check-nfc-support")
|
||||
(check-nfc-support args))
|
||||
(keycard/check-nfc-enabled [this args]
|
||||
(keycard/check-nfc-enabled [_this args]
|
||||
(log/debug "simulated card check-nfc-enabled")
|
||||
(check-nfc-enabled args))
|
||||
(keycard/open-nfc-settings [this]
|
||||
(keycard/open-nfc-settings [_this]
|
||||
(log/debug "simulated card open-nfc-setting")
|
||||
(open-nfc-settings))
|
||||
(keycard/register-card-events [this args]
|
||||
(keycard/register-card-events [_this args]
|
||||
(log/debug "simulated card register-card-event")
|
||||
(register-card-events args))
|
||||
(keycard/set-pairings [this args]
|
||||
(keycard/set-pairings [_this args]
|
||||
(log/debug "simulated card set-pairings")
|
||||
(set-pairings args))
|
||||
(keycard/on-card-connected [this callback]
|
||||
(keycard/on-card-connected [_this callback]
|
||||
(log/debug "simulated card on-card-connected")
|
||||
(on-card-connected callback))
|
||||
(keycard/on-card-disconnected [this callback]
|
||||
(keycard/on-card-disconnected [_this callback]
|
||||
(log/debug "simulated card on-card-disconnected")
|
||||
(on-card-disconnected callback))
|
||||
(keycard/remove-event-listener [this event]
|
||||
(keycard/remove-event-listener [_this event]
|
||||
(log/debug "simulated card remove-event-listener")
|
||||
(remove-event-listener event))
|
||||
(keycard/remove-event-listeners [this]
|
||||
(keycard/remove-event-listeners [_this]
|
||||
(log/debug "simulated card remove-event-listener")
|
||||
(remove-event-listeners))
|
||||
(keycard/get-application-info [this args]
|
||||
(keycard/get-application-info [_this args]
|
||||
(log/debug "simulated card get-application-info")
|
||||
(get-application-info args))
|
||||
(keycard/factory-reset [this args]
|
||||
(keycard/factory-reset [_this args]
|
||||
(log/debug "simulated card factory-reset")
|
||||
(factory-reset args))
|
||||
(keycard/install-applet [this args]
|
||||
(keycard/install-applet [_this args]
|
||||
(log/debug "simulated card install-applet")
|
||||
(install-applet args))
|
||||
(keycard/init-card [this args]
|
||||
(keycard/init-card [_this args]
|
||||
(log/debug "simulated card init-card")
|
||||
(init-card args))
|
||||
(keycard/install-applet-and-init-card [this args]
|
||||
(keycard/install-applet-and-init-card [_this args]
|
||||
(log/debug "simulated card install-applet-and-init-card")
|
||||
(install-applet-and-init-card args))
|
||||
(keycard/pair [this args]
|
||||
(keycard/pair [_this args]
|
||||
(log/debug "simulated card pair")
|
||||
(pair args))
|
||||
(keycard/generate-and-load-key [this args]
|
||||
(keycard/generate-and-load-key [_this args]
|
||||
(log/debug "simulated card generate-and-load-key")
|
||||
(generate-and-load-key args))
|
||||
(keycard/unblock-pin [this args]
|
||||
(keycard/unblock-pin [_this args]
|
||||
(log/debug "simulated card unblock-pin")
|
||||
(unblock-pin args))
|
||||
(keycard/verify-pin [this args]
|
||||
(keycard/verify-pin [_this args]
|
||||
(log/debug "simulated card verify-pin")
|
||||
(verify-pin args))
|
||||
(keycard/change-pin [this args]
|
||||
(keycard/change-pin [_this args]
|
||||
(log/debug "simulated card change-pin")
|
||||
(change-pin args))
|
||||
(keycard/change-puk [this args]
|
||||
(keycard/change-puk [_this args]
|
||||
(log/debug "simulated card change-puk")
|
||||
(change-puk args))
|
||||
(keycard/change-pairing [this args]
|
||||
(keycard/change-pairing [_this args]
|
||||
(log/debug "simulated card change-pairing")
|
||||
(change-pairing args))
|
||||
(keycard/unpair [this args]
|
||||
(keycard/unpair [_this args]
|
||||
(log/debug "simulated card unpair")
|
||||
(unpair args))
|
||||
(keycard/delete [this args]
|
||||
(keycard/delete [_this args]
|
||||
(log/debug "simulated card delete")
|
||||
(delete args))
|
||||
(keycard/remove-key [this args]
|
||||
(keycard/remove-key [_this args]
|
||||
(log/debug "simulated card remove-key")
|
||||
(remove-key args))
|
||||
(keycard/remove-key-with-unpair [this args]
|
||||
(keycard/remove-key-with-unpair [_this args]
|
||||
(log/debug "simulated card remove-key-with-unpair")
|
||||
(remove-key-with-unpair args))
|
||||
(keycard/export-key [this args]
|
||||
(keycard/export-key [_this args]
|
||||
(log/debug "simulated card export-key")
|
||||
(export-key args))
|
||||
(keycard/unpair-and-delete [this args]
|
||||
(keycard/unpair-and-delete [_this args]
|
||||
(log/debug "simulated card unpair-and-delete")
|
||||
(unpair-and-delete args))
|
||||
(keycard/import-keys [this args]
|
||||
(keycard/import-keys [_this args]
|
||||
(log/debug "simulated card import-keys")
|
||||
(import-keys args))
|
||||
(keycard/get-keys [this args]
|
||||
(keycard/get-keys [_this args]
|
||||
(log/debug "simulated card get-keys")
|
||||
(get-keys args))
|
||||
(keycard/sign [this args]
|
||||
(keycard/sign [_this args]
|
||||
(log/debug "simulated card sign")
|
||||
(sign args))
|
||||
(keycard/save-multiaccount-and-login [this args]
|
||||
(keycard/save-multiaccount-and-login [_this args]
|
||||
(log/debug "simulated card save-multiaccount-and-login")
|
||||
(save-multiaccount-and-login args))
|
||||
(keycard/login [this args]
|
||||
(keycard/login [_this args]
|
||||
(log/debug "simulated card login")
|
||||
(login args))
|
||||
(keycard/send-transaction-with-signature [this args]
|
||||
(keycard/send-transaction-with-signature [_this args]
|
||||
(log/debug "simulated card send-transaction-with-signature")
|
||||
(send-transaction-with-signature args)))
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
(ns status-im.multiaccounts.login.core-test
|
||||
(:require [cljs.test :as test]
|
||||
[status-im.multiaccounts.login.core :as login]
|
||||
[status-im.multiaccounts.biometric.core :as biometric]
|
||||
[status-im.utils.keychain.core :as keychain]
|
||||
[status-im.utils.fx :as fx]))
|
||||
[status-im.multiaccounts.login.core :as login]
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im.utils.keychain.core :as keychain]))
|
||||
|
||||
(test/deftest save-password-test
|
||||
(test/testing "check save password, biometric unavailable"
|
||||
|
@ -59,4 +59,4 @@
|
|||
(test/testing "disable biometric"
|
||||
(let [{:keys [db]} (biometric/disable {:db db})]
|
||||
(test/is (= false (get-in db [:multiaccounts/login :save-password?])))
|
||||
(test/is (= keychain/auth-method-none) (:auth-method db)))))))
|
||||
(test/is (= keychain/auth-method-none (:auth-method db))))))))
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
(ns status-im.router.core
|
||||
(:require [re-frame.core :as re-frame]
|
||||
(:require [bidi.bidi :as bidi]
|
||||
[cljs.spec.alpha :as spec]
|
||||
[clojure.string :as string]
|
||||
[bidi.bidi :as bidi]
|
||||
[taoensso.timbre :as log]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.add-new.db :as public-chat.db]
|
||||
[status-im.utils.security :as security]
|
||||
[status-im.chat.models :as chat.models]
|
||||
[status-im.ethereum.core :as ethereum]
|
||||
[status-im.ethereum.eip681 :as eip681]
|
||||
[status-im.ethereum.ens :as ens]
|
||||
[cljs.spec.alpha :as spec]
|
||||
[status-im.ethereum.core :as ethereum]
|
||||
[status-im.ethereum.stateofus :as stateofus]
|
||||
[status-im.utils.db :as utils.db]
|
||||
[status-im.utils.http :as http]
|
||||
[status-im.chat.models :as chat.models]
|
||||
[status-im.ethereum.stateofus :as stateofus]
|
||||
[status-im.utils.wallet-connect :as wallet-connect]))
|
||||
[status-im.utils.security :as security]
|
||||
[status-im.utils.wallet-connect :as wallet-connect]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(def ethereum-scheme "ethereum:")
|
||||
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
(ns status-im.subs
|
||||
(:require [cljs.spec.alpha :as spec]
|
||||
[clojure.set :as clojure.set]
|
||||
[clojure.string :as string]
|
||||
[quo.design-system.colors :as colors]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.add-new.db :as db]
|
||||
[status-im.browser.core :as browser]
|
||||
[status-im.chat.db :as chat.db]
|
||||
[status-im.chat.models :as chat.models]
|
||||
[status-im.chat.models.mentions :as mentions]
|
||||
[status-im.chat.models.message-list :as models.message-list]
|
||||
[status-im.chat.models.reactions :as models.reactions]
|
||||
[status-im.communities.core :as communities]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contact.db :as contact.db]
|
||||
[status-im.ens.core :as ens]
|
||||
|
@ -13,35 +19,29 @@
|
|||
[status-im.ethereum.tokens :as tokens]
|
||||
[status-im.ethereum.transactions.core :as transactions]
|
||||
[status-im.fleet.core :as fleet]
|
||||
[status-im.mailserver.core :as mailserver]
|
||||
[status-im.group-chats.db :as group-chats.db]
|
||||
[status-im.communities.core :as communities]
|
||||
[status-im.group-chats.core :as group-chat]
|
||||
[status-im.group-chats.db :as group-chats.db]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.mailserver.core :as mailserver]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.multiaccounts.db :as multiaccounts.db]
|
||||
[status-im.multiaccounts.model :as multiaccounts.model]
|
||||
[status-im.multiaccounts.recover.core :as recover]
|
||||
[status-im.chat.models.reactions :as models.reactions]
|
||||
[status-im.notifications.core :as notifications]
|
||||
[status-im.pairing.core :as pairing]
|
||||
[status-im.signing.gas :as signing.gas]
|
||||
[status-im.add-new.db :as db]
|
||||
[status-im.utils.mobile-sync :as mobile-network-utils]
|
||||
status-im.ui.screens.keycard.subs
|
||||
[status-im.ui.screens.profile.visibility-status.utils :as visibility-status-utils]
|
||||
[status-im.utils.build :as build]
|
||||
[status-im.utils.config :as config]
|
||||
[status-im.utils.currency :as currency]
|
||||
[status-im.utils.datetime :as datetime]
|
||||
[status-im.utils.gfycat.core :as gfycat]
|
||||
[status-im.utils.mobile-sync :as mobile-network-utils]
|
||||
[status-im.utils.money :as money]
|
||||
[status-im.utils.security :as security]
|
||||
[status-im.wallet.db :as wallet.db]
|
||||
[status-im.wallet.utils :as wallet.utils]
|
||||
status-im.ui.screens.keycard.subs
|
||||
[status-im.chat.models.mentions :as mentions]
|
||||
[status-im.notifications.core :as notifications]
|
||||
[status-im.utils.currency :as currency]
|
||||
[clojure.set :as clojure.set]
|
||||
[quo.design-system.colors :as colors]
|
||||
[status-im.ui.screens.profile.visibility-status.utils :as visibility-status-utils]))
|
||||
[status-im.wallet.utils :as wallet.utils]))
|
||||
|
||||
;; TOP LEVEL ===========================================================================================================
|
||||
|
||||
|
@ -267,10 +267,8 @@
|
|||
(reg-root-key-sub :wallet-connect/session-managed :wallet-connect/session-managed)
|
||||
(reg-root-key-sub :contact-requests/pending :contact-requests/pending)
|
||||
|
||||
|
||||
; Testing
|
||||
|
||||
|
||||
(reg-root-key-sub :messenger/started? :messenger/started?)
|
||||
|
||||
(reg-root-key-sub :information-box-states :information-box-states)
|
||||
|
@ -874,7 +872,7 @@
|
|||
(fn [chats [_ community-id]]
|
||||
(->> chats
|
||||
(keep (fn [[_ chat]]
|
||||
(when (and (= (:community-id chat) community-id))
|
||||
(when (= (:community-id chat) community-id)
|
||||
chat)))
|
||||
(sort-by :timestamp >))))
|
||||
|
||||
|
@ -3004,7 +3002,6 @@
|
|||
|
||||
;; NAVIGATION2
|
||||
|
||||
|
||||
(re-frame/reg-sub
|
||||
:navigation2/switcher-cards
|
||||
:<- [:navigation2/navigation2-stacks]
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
(ns status-im.switcher.switcher-container
|
||||
(:require [quo.react-native :as rn]
|
||||
status-im.switcher.cards.messaging-card
|
||||
[status-im.switcher.cards.messaging-card :as messaging-card]
|
||||
[status-im.switcher.styles :as styles]
|
||||
[status-im.utils.handlers :refer [<sub]]
|
||||
[status-im.switcher.cards.messaging-card :as messaging-card]))
|
||||
[status-im.utils.handlers :refer [<sub]]))
|
||||
|
||||
;; TODO - use something like this to avoid multiple renders etc.
|
||||
;; (defn switch-screen [toggle-switcher-screen]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
(ns status-im.ui.screens.chat.message.link-preview
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[clojure.string :as string]
|
||||
[status-im.ui.components.react :as react]
|
||||
(:require [clojure.string :as string]
|
||||
[quo.core :as quo]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.ui.components.react :as react]
|
||||
[status-im.utils.security :as security]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.ui.screens.chat.message.styles :as styles]
|
||||
|
@ -82,7 +82,7 @@
|
|||
(when-not error
|
||||
[react/touchable-highlight
|
||||
{:style (when-not (is-gif? thumbnailUrl) {:align-self :stretch})
|
||||
:on-press #(when (and (security/safe-link? link))
|
||||
:on-press #(when (security/safe-link? link)
|
||||
(re-frame/dispatch
|
||||
[:browser.ui/message-link-pressed link]))}
|
||||
[react/view (styles/link-preview-wrapper outgoing timeline)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(ns status-im.utils.money
|
||||
(:require [clojure.string :as string]
|
||||
["bignumber.js" :as BigNumber]))
|
||||
(:require ["bignumber.js" :as BigNumber]
|
||||
[clojure.string :as string]))
|
||||
|
||||
;; The BigNumber version included in web3 sometimes hangs when dividing large
|
||||
;; numbers Hence we want to use these functions instead of fromWei etc, which
|
||||
|
|
|
@ -9,15 +9,16 @@
|
|||
(deftype PersistentPriorityMap [priority->set-of-items item->priority meta keyfn ^:mutable __hash]
|
||||
IPrintWithWriter
|
||||
(-pr-writer [coll writer opts]
|
||||
(let [pr-pair (fn [keyval] (pr-sequential-writer writer pr-writer "" " " "" opts keyval))]
|
||||
(let [pr-pair (fn [keyval]
|
||||
(pr-sequential-writer writer #'cljs.core/pr-writer "" " " "" opts keyval))]
|
||||
(pr-sequential-writer writer pr-pair "#status-im.utils.priority-map {" ", " "}" opts coll)))
|
||||
|
||||
IWithMeta
|
||||
(-with-meta [this meta]
|
||||
(-with-meta [_this meta]
|
||||
(PersistentPriorityMap. priority->set-of-items item->priority meta keyfn __hash))
|
||||
|
||||
IMeta
|
||||
(-meta [this] meta)
|
||||
(-meta [_this] meta)
|
||||
|
||||
ICollection
|
||||
(-conj [this entry]
|
||||
|
@ -26,12 +27,13 @@
|
|||
(reduce -conj this entry)))
|
||||
|
||||
IEmptyableCollection
|
||||
(-empty [this] (with-meta
|
||||
status-im.utils.priority-map.PersistentPriorityMap.EMPTY
|
||||
meta))
|
||||
(-empty [_this] #_{:clj-kondo/ignore [:unresolved-symbol]}
|
||||
(with-meta
|
||||
status-im.utils.priority-map.PersistentPriorityMap.EMPTY
|
||||
meta))
|
||||
|
||||
IEquiv
|
||||
(-equiv [this other]
|
||||
(-equiv [_this other]
|
||||
(-equiv item->priority other))
|
||||
|
||||
IHash
|
||||
|
@ -39,7 +41,7 @@
|
|||
(coreclj/caching-hash this core/hash-unordered-coll __hash))
|
||||
|
||||
ISeqable
|
||||
(-seq [this]
|
||||
(-seq [_this]
|
||||
(if keyfn
|
||||
(seq (for [[_ item-set] priority->set-of-items, item item-set]
|
||||
(MapEntry. item (item->priority item) nil)))
|
||||
|
@ -47,7 +49,7 @@
|
|||
(MapEntry. item priority nil)))))
|
||||
|
||||
IReversible
|
||||
(-rseq [coll]
|
||||
(-rseq [_coll]
|
||||
(if keyfn
|
||||
(seq (for [[_ item-set] (rseq priority->set-of-items), item item-set]
|
||||
(MapEntry. item (item->priority item) nil)))
|
||||
|
@ -55,24 +57,24 @@
|
|||
(MapEntry. item priority nil)))))
|
||||
|
||||
ICounted
|
||||
(-count [this]
|
||||
(-count [_this]
|
||||
(count item->priority))
|
||||
|
||||
ILookup
|
||||
(-lookup [this item]
|
||||
(-lookup [_this item]
|
||||
(get item->priority item))
|
||||
(-lookup [coll item not-found]
|
||||
(-lookup [_coll item not-found]
|
||||
(get item->priority item not-found))
|
||||
|
||||
IStack
|
||||
(-peek [this]
|
||||
(-peek [_this]
|
||||
(when-not (zero? (count item->priority))
|
||||
(let [f (first priority->set-of-items)
|
||||
item (first (val f))]
|
||||
(if keyfn
|
||||
[item (item->priority item)]
|
||||
[item (key f)]))))
|
||||
(-pop [this]
|
||||
(-pop [_this]
|
||||
(if (zero? (count item->priority))
|
||||
(throw (js/Error. "Can't pop empty priority map"))
|
||||
(let [f (first priority->set-of-items)
|
||||
|
@ -126,7 +128,7 @@
|
|||
keyfn
|
||||
nil))))
|
||||
|
||||
(-contains-key? [this item]
|
||||
(-contains-key? [_this item]
|
||||
(contains? item->priority item))
|
||||
|
||||
IMap
|
||||
|
@ -153,7 +155,7 @@
|
|||
ISorted
|
||||
(-sorted-seq [this ascending?]
|
||||
((if ascending? seq rseq) this))
|
||||
(-sorted-seq-from [this k ascending?]
|
||||
(-sorted-seq-from [_this k ascending?]
|
||||
(let [sets (if ascending?
|
||||
(subseq priority->set-of-items >= k)
|
||||
(rsubseq priority->set-of-items <= k))]
|
||||
|
@ -162,9 +164,9 @@
|
|||
[item (item->priority item)]))
|
||||
(seq (for [[priority item-set] sets, item item-set]
|
||||
[item priority])))))
|
||||
(-entry-key [this entry]
|
||||
(-entry-key [_this entry]
|
||||
(keyfn (val entry)))
|
||||
(-comparator [this] compare)
|
||||
(-comparator [_this] compare)
|
||||
|
||||
IFn
|
||||
(-invoke [this item]
|
||||
|
@ -172,6 +174,7 @@
|
|||
(-invoke [this item not-found]
|
||||
(-lookup this item not-found)))
|
||||
|
||||
#_{:clj-kondo/ignore [:unresolved-symbol]}
|
||||
(set! status-im.utils.priority-map.PersistentPriorityMap.EMPTY
|
||||
(PersistentPriorityMap. (sorted-map) {} {} identity nil))
|
||||
|
||||
|
@ -193,6 +196,7 @@
|
|||
"keyval => key val
|
||||
Returns a new priority map with supplied mappings."
|
||||
([& keyvals]
|
||||
#_{:clj-kondo/ignore [:unresolved-symbol]}
|
||||
(loop [in (seq keyvals) out status-im.utils.priority-map.PersistentPriorityMap.EMPTY]
|
||||
(if in
|
||||
(recur (nnext in) (assoc out (first in) (second in)))
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
(ns status-im.utils.signing-phrase.core-test
|
||||
(:require [cljs.test :refer-macros [deftest is]]
|
||||
[status-im.utils.signing-phrase.core :refer [generate]]
|
||||
[clojure.string :as string]))
|
||||
[clojure.string :as string]
|
||||
[status-im.utils.signing-phrase.core :refer [generate]]))
|
||||
|
||||
(deftest test-generate
|
||||
(doseq [_ (range 30)]
|
||||
(let [result (generate)]
|
||||
(is (not (string/starts-with? result " ")))
|
||||
(is (not (string/ends-with? result " ")))
|
||||
(is (= (get (frequencies result) " ")) 2))))
|
||||
(is (= (get (frequencies result) " ") 2)))))
|
||||
|
|
Loading…
Reference in New Issue