diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn index 39d16e9e6e..242c95e261 100644 --- a/.clj-kondo/config.edn +++ b/.clj-kondo/config.edn @@ -3,7 +3,8 @@ status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all quo.previews.preview/list-comp clojure.core/for status-im.utils.styles/def clojure.core/def - status-im.utils.styles/defn clojure.core/defn} + status-im.utils.styles/defn clojure.core/defn + taoensso.tufte/defnp clojure.core/defn} :linters {:invalid-arity {:skip-args [status-im.utils.fx/defn]} ;;TODO remove number when this is fixed ;;https://github.com/borkdude/clj-kondo/issues/867 diff --git a/Makefile b/Makefile index b25e65c7d4..9ac027a69a 100644 --- a/Makefile +++ b/Makefile @@ -275,6 +275,7 @@ endif lint: export TARGET := clojure lint: ##@test Run code style checks + yarn clj-kondo --confg .clj-kondo/config.edn --lint src && \ clojure -Sdeps '{:deps {cljfmt {:mvn/version "0.6.7"}}}' \ -m cljfmt.main check src \ --indents indentation.edn @@ -391,4 +392,4 @@ repl-ios: ##@repl-ios start repl for ios project repl-android: export TARGET := clojure repl-android: ##@repl-android start repl for android project - yarn shadow-cljs cljs-repl android \ No newline at end of file + yarn shadow-cljs cljs-repl android diff --git a/mobile/js_files/package.json b/mobile/js_files/package.json index 60205e05b7..b9198167f7 100644 --- a/mobile/js_files/package.json +++ b/mobile/js_files/package.json @@ -14,7 +14,7 @@ "@react-native-community/masked-view": "^0.1.6", "@react-native-community/netinfo": "^4.4.0", "@react-navigation/bottom-tabs": "^5.1.1", - "@react-navigation/native": "^5.0.9", + "@react-navigation/native": "^5.2.3", "@react-navigation/stack": "^5.1.1", "bignumber.js": "git+https://github.com/status-im/bignumber.js.git#v4.0.2-status", "buffer": "^5.4.2", diff --git a/mobile/js_files/yarn.lock b/mobile/js_files/yarn.lock index de9d4377a6..bc9376639f 100644 --- a/mobile/js_files/yarn.lock +++ b/mobile/js_files/yarn.lock @@ -1327,29 +1327,29 @@ color "^3.1.2" react-native-iphone-x-helper "^1.2.1" -"@react-navigation/core@^5.3.4": - version "5.3.4" - resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-5.3.4.tgz#272eb48381c4db251f4dc5cd044db1606a551551" - integrity sha512-ul8J7oHC1/k/qWORr7uI710nKofbcD2clYI0bK0Bix+xgAoiFPgrwRDrQcjWw4YQViYlR8CGF/DhnKK+BFA+Yw== +"@react-navigation/core@^5.4.0": + version "5.4.0" + resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-5.4.0.tgz#6b4973d48396d28ed3efee582b28807682a5865d" + integrity sha512-tDmfw7nzbJg186cXHUPl/VYEGSepzBXNiHRv4GTxLQ+S9cnZgPyrGv56kiSvHhxCzyNGN0nHscCY9IUv08KL6Q== dependencies: - "@react-navigation/routers" "^5.4.0" + "@react-navigation/routers" "^5.4.2" escape-string-regexp "^2.0.0" nanoid "^3.0.2" query-string "^6.12.0" react-is "^16.13.0" use-subscription "^1.4.0" -"@react-navigation/native@^5.0.9": - version "5.1.6" - resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-5.1.6.tgz#932ff1b5b8b9f051d8e5cd3b016d05badaa01898" - integrity sha512-DLLSnh29AndrGjPrHJoAgObeO9TiyrGtrASl+SA3B4ksmz4dUV2t6vaRwHogn1kejvRd+1T8VD923d3K1rjy7w== +"@react-navigation/native@^5.2.3": + version "5.2.3" + resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-5.2.3.tgz#2e2ec88396d2be96d11f9430b4af6dcea34029b0" + integrity sha512-fQfW506n9eTwBGiUbuxSvI7DTBXwR3IqAlooBCUHRJC0WiuSUm3aGg6eESJc8nW1A64hu33i/ITf10mn3Ec6Tg== dependencies: - "@react-navigation/core" "^5.3.4" + "@react-navigation/core" "^5.4.0" -"@react-navigation/routers@^5.4.0": - version "5.4.0" - resolved "https://registry.yarnpkg.com/@react-navigation/routers/-/routers-5.4.0.tgz#2fce2a3880e84a110d4eaea317bb7dadee27d57c" - integrity sha512-Z5mQF/oQH9CRLilNm1H7h0wjY3dKomWOhuuDehW8UKuLiFp2mWJI1P5N9qwaSraxhcoiVfb9QXwKZru/wBzWMQ== +"@react-navigation/routers@^5.4.2": + version "5.4.2" + resolved "https://registry.yarnpkg.com/@react-navigation/routers/-/routers-5.4.2.tgz#10c1f32b0ddde935d1fc9123fb1683472bf31815" + integrity sha512-YjGv4H0LXD2YnDjSBAJzIKzlZehFRqWfR2IJtZor/mfLkOi6qDl8yJeqZKbLEeQsu6o6493QdxM81tqX293kyQ== dependencies: nanoid "^3.0.2" diff --git a/src/quo/components/header.cljs b/src/quo/components/header.cljs index afd4f0a05a..4a8f14e5a4 100644 --- a/src/quo/components/header.cljs +++ b/src/quo/components/header.cljs @@ -4,7 +4,6 @@ [quo.components.text :as text] [quo.design-system.colors :as colors] [quo.design-system.spacing :as spacing] - [quo.react :as react] [quo.react-native :as rn] [reagent.core :as reagent] [status-im.ui.components.icons.vector-icons :as icons])) diff --git a/src/quo/components/tooltip.cljs b/src/quo/components/tooltip.cljs index 7cc758dfbf..947bc9b53c 100644 --- a/src/quo/components/tooltip.cljs +++ b/src/quo/components/tooltip.cljs @@ -2,7 +2,6 @@ (:require [reagent.core :as reagent] [oops.core :refer [oget]] [quo.animated :as animated] - [quo.react :as react] [quo.react-native :as rn] [quo.design-system.colors :as colors] [quo.design-system.spacing :as spacing] diff --git a/src/quo/design_system/typography.cljs b/src/quo/design_system/typography.cljs index cc400f57bc..e37f71eaff 100644 --- a/src/quo/design_system/typography.cljs +++ b/src/quo/design_system/typography.cljs @@ -1,5 +1,4 @@ -(ns quo.design-system.typography - (:require [quo.platform :as platform])) +(ns quo.design-system.typography) (def tiny {:font-size 10 :line-height 14}) diff --git a/src/quo/gesture_handler.cljs b/src/quo/gesture_handler.cljs index 28d81c5c7f..89a8bdda2f 100644 --- a/src/quo/gesture_handler.cljs +++ b/src/quo/gesture_handler.cljs @@ -4,7 +4,8 @@ [reagent.core :as reagent] ["react-native-gesture-handler" :refer (TapGestureHandler PanGestureHandler LongPressGestureHandler - PureNativeButton TouchableWithoutFeedback createNativeWrapper State)])) + PureNativeButton TouchableWithoutFeedback + createNativeWrapper State)])) (def tap-gesture-handler (reagent/adapt-react-class TapGestureHandler)) @@ -19,8 +20,6 @@ (def touchable-without-feedback-class TouchableWithoutFeedback) -(def createNativeWrapper createNativeWrapper) - (def touchable-without-feedback (reagent/adapt-react-class touchable-without-feedback-class)) diff --git a/src/quo/previews/main.cljs b/src/quo/previews/main.cljs index 3f35ea5034..78a93ef36e 100644 --- a/src/quo/previews/main.cljs +++ b/src/quo/previews/main.cljs @@ -1,6 +1,5 @@ (ns quo.previews.main - (:require [oops.core :refer [ocall]] - [quo.previews.header :as header] + (:require [quo.previews.header :as header] [quo.previews.text :as text] [quo.previews.text-input :as text-input] [quo.previews.tooltip :as tooltip] diff --git a/src/shadow/cljs/devtools/client/react_native.cljs b/src/shadow/cljs/devtools/client/react_native.cljs index d40732f1cb..b18200de6e 100644 --- a/src/shadow/cljs/devtools/client/react_native.cljs +++ b/src/shadow/cljs/devtools/client/react_native.cljs @@ -1,11 +1,9 @@ (ns shadow.cljs.devtools.client.react-native - (:require - [clojure.string :as str] - [cljs.reader :as reader] - [goog.object :as gobj] - [goog.net.XhrIo :as xhr] - [shadow.cljs.devtools.client.env :as env] - [status-im.reloader :as reloader])) + (:require [cljs.reader :as reader] + [clojure.string :as str] + [goog.net.XhrIo :as xhr] + [shadow.cljs.devtools.client.env :as env] + [status-im.reloader :as reloader])) (defonce repl-ns-ref (atom nil)) @@ -51,7 +49,7 @@ (callback []) (xhr/send (env/files-url) - (fn [res] + (fn [_] (this-as ^goog req (let [content (-> req @@ -64,10 +62,10 @@ :sources (into [] (map :resource-id) sources)}) #js {"content-type" "application/edn; charset=utf-8"}))) -(defn noop [& args]) +(defn noop [& _]) (defn handle-build-complete [{:keys [info reload-info] :as msg}] - (let [{:keys [sources compiled]} + (let [{:keys [sources]} info warnings @@ -97,7 +95,7 @@ (assoc :id id) (ws-msg)))) -(defn repl-require [{:keys [id sources reload-namespaces js-requires] :as msg} done] +(defn repl-require [{:keys [id sources reload-namespaces]} done] (let [sources-to-load (->> sources (remove (fn [{:keys [provides] :as src}] @@ -188,7 +186,7 @@ (env/process-ws-msg (. e -data) handle-message))) (set! (.-onopen socket) - (fn [e] + (fn [_] ;; :module-format :js already patches provide (when (= "goog" env/module-format) ;; patch away the already declared exception @@ -199,7 +197,7 @@ (devtools-msg "WebSocket connected!"))) (set! (.-onclose socket) - (fn [e] + (fn [_] ;; not a big fan of reconnecting automatically since a disconnect ;; may signal a change of config, safer to just reload the page (devtools-msg "WebSocket disconnected!") @@ -216,7 +214,7 @@ ;; pretty much only for me while working on this file (when-let [s @socket-ref] (devtools-msg "connection reset!") - (set! (.-onclose s) (fn [e])) + (set! (.-onclose s) (fn [_])) (.close s) (vreset! socket-ref nil)) diff --git a/src/status_im/bootnodes/core.cljs b/src/status_im/bootnodes/core.cljs index c43727e269..d8571fd1e4 100644 --- a/src/status_im/bootnodes/core.cljs +++ b/src/status_im/bootnodes/core.cljs @@ -1,9 +1,8 @@ (ns status-im.bootnodes.core (:require [clojure.string :as string] [re-frame.core :as re-frame] - [status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.i18n :as i18n] - + [status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.navigation :as navigation] [status-im.utils.fx :as fx])) @@ -46,7 +45,8 @@ (set-input :name (str name)))] (assoc fxs :dispatch [:navigate-to :edit-bootnode]))) -(defn custom-bootnodes-in-use? [{:keys [db] :as cofx}] +(defn custom-bootnodes-in-use? + [{:keys [db]}] (let [network (:networks/current-network db)] (get-in db [:multiaccount :custom-bootnodes-enabled? network]))) diff --git a/src/status_im/browser/permissions.cljs b/src/status_im/browser/permissions.cljs index b9d0670376..38b052f87e 100644 --- a/src/status_im/browser/permissions.cljs +++ b/src/status_im/browser/permissions.cljs @@ -2,10 +2,9 @@ (:require [status-im.constants :as constants] [status-im.ethereum.json-rpc :as json-rpc] [status-im.i18n :as i18n] - [status-im.qr-scanner.core :as qr-scanner] [status-im.navigation :as navigation] - [status-im.utils.fx :as fx] - [status-im.browser.webview-ref :as webview-ref])) + [status-im.qr-scanner.core :as qr-scanner] + [status-im.utils.fx :as fx])) (declare process-next-permission) (declare send-response-to-bridge) diff --git a/src/status_im/chat/db.cljs b/src/status_im/chat/db.cljs index 36c920da4f..1dbb80732f 100644 --- a/src/status_im/chat/db.cljs +++ b/src/status_im/chat/db.cljs @@ -1,9 +1,10 @@ (ns status-im.chat.db (:require [clojure.set :as clojure.set] - [status-im.multiaccounts.core :as multiaccounts] + [clojure.string :as clojure.string] [status-im.contact.db :as contact.db] [status-im.group-chats.db :as group-chats.db] [status-im.mailserver.constants :as mailserver.constants] + [status-im.multiaccounts.core :as multiaccounts] [status-im.utils.gfycat.core :as gfycat])) (defn group-chat-name @@ -11,7 +12,7 @@ (str (when public? "#") name)) (defn enrich-active-chat - [contacts {:keys [chat-id public? group-chat name] :as chat} current-public-key] + [contacts {:keys [chat-id group-chat] :as chat} current-public-key] (if group-chat (let [pending-invite-inviter-name (group-chats.db/get-pending-invite-inviter-name contacts diff --git a/src/status_im/chat/db_test.cljs b/src/status_im/chat/db_test.cljs index a7cdedc4bd..d5a1f9cc38 100644 --- a/src/status_im/chat/db_test.cljs +++ b/src/status_im/chat/db_test.cljs @@ -29,7 +29,7 @@ message-3 message-2 message-1] - [m1 d1 m2 m3 m4 d2 :as ms] (db/add-datemarks ordered-messages)] + [m1 d1 m2 m3 m4 d2] (db/add-datemarks ordered-messages)] (is (= "Jan 1, 2000" (:datemark m1))) (is (= {:type :datemark diff --git a/src/status_im/chat/models.cljs b/src/status_im/chat/models.cljs index 0162b06a9c..32f15e6e0d 100644 --- a/src/status_im/chat/models.cljs +++ b/src/status_im/chat/models.cljs @@ -288,9 +288,10 @@ (i18n/label :cooldown/warning-message) #()))) -(defn set-dock-badge-label [label] +(defn set-dock-badge-label "Sets dock badge label (OSX only for now). Label must be a string. Pass nil or empty string to clear the label." + [label] (.setDockBadgeLabel ^js react/desktop-notification label)) (re-frame/reg-fx diff --git a/src/status_im/chat/models/input.cljs b/src/status_im/chat/models/input.cljs index 8ae98ccf7b..e9d919d40b 100644 --- a/src/status_im/chat/models/input.cljs +++ b/src/status_im/chat/models/input.cljs @@ -4,8 +4,8 @@ [re-frame.core :as re-frame] [status-im.chat.constants :as chat.constants] [status-im.chat.models :as chat] - [status-im.chat.models.message-content :as message-content] [status-im.chat.models.message :as chat.message] + [status-im.chat.models.message-content :as message-content] [status-im.constants :as constants] [status-im.utils.datetime :as datetime] [status-im.utils.fx :as fx] @@ -140,7 +140,7 @@ (fn [^js ref] (try (.focus ref) - (catch :default e + (catch :default _ (log/debug "Cannot focus the reference"))))) (re-frame/reg-fx @@ -148,5 +148,5 @@ (fn [ref] (try (.clear ref) - (catch :default e + (catch :default _ (log/debug "Cannot clear the reference"))))) diff --git a/src/status_im/chat/models/input_test.cljs b/src/status_im/chat/models/input_test.cljs index 68dd1581e8..da94b77012 100644 --- a/src/status_im/chat/models/input_test.cljs +++ b/src/status_im/chat/models/input_test.cljs @@ -1,9 +1,8 @@ (ns status-im.chat.models.input-test (:require [cljs.test :refer-macros [deftest is testing]] [status-im.chat.constants :as constants] - [status-im.utils.config :as config] - [status-im.utils.datetime :as datetime] - [status-im.chat.models.input :as input])) + [status-im.chat.models.input :as input] + [status-im.utils.datetime :as datetime])) (deftest text->emoji (is (nil? (input/text->emoji nil))) diff --git a/src/status_im/chat/models/message.cljs b/src/status_im/chat/models/message.cljs index 12c4e166b1..91d40b27a2 100644 --- a/src/status_im/chat/models/message.cljs +++ b/src/status_im/chat/models/message.cljs @@ -1,24 +1,21 @@ (ns status-im.chat.models.message (:require [re-frame.core :as re-frame] - [status-im.multiaccounts.model :as multiaccounts.model] - [status-im.ethereum.json-rpc :as json-rpc] - [status-im.chat.db :as chat.db] - [status-im.waku.core :as waku] [status-im.chat.models :as chat-model] [status-im.chat.models.loading :as chat-loading] - [status-im.chat.models.message-list :as message-list] [status-im.chat.models.message-content :as message-content] + [status-im.chat.models.message-list :as message-list] [status-im.constants :as constants] - [status-im.contact.db :as contact.db] [status-im.data-store.messages :as data-store.messages] - [status-im.ui.screens.chat.state :as view.state] + [status-im.ethereum.json-rpc :as json-rpc] + [status-im.multiaccounts.model :as multiaccounts.model] [status-im.transport.message.protocol :as protocol] - [status-im.utils.datetime :as time] + [status-im.ui.screens.chat.state :as view.state] [status-im.utils.fx :as fx] + [status-im.waku.core :as waku] [taoensso.timbre :as log])) (defn- prepare-message - [{:keys [content content-type] :as message} chat-id current-chat?] + [{:keys [content content-type] :as message} current-chat?] (cond-> message current-chat? (assoc :seen true) @@ -56,7 +53,7 @@ (let [current-public-key (multiaccounts.model/current-public-key cofx) message-to-be-removed (when replace (get-in db [:chats chat-id :messages replace])) - prepared-message (prepare-message message chat-id seen-by-user?)] + prepared-message (prepare-message message seen-by-user?)] (fx/merge cofx (when message-to-be-removed (hide-message chat-id message-to-be-removed)) @@ -100,13 +97,14 @@ (get-in db [:chats chat-id :messages message-id])) (defn- earlier-than-deleted-at? - [{:keys [db]} {:keys [chat-id clock-value message-id from]}] + [{:keys [db]} {:keys [chat-id clock-value]}] (let [{:keys [deleted-at-clock-value]} (get-in db [:chats chat-id])] (>= deleted-at-clock-value clock-value))) -(defn extract-chat-id [cofx {:keys [chat-id from message-type]}] +(defn extract-chat-id "Validate and return a valid chat-id" + [cofx {:keys [chat-id from message-type]}] (cond (and (= constants/message-type-private-group message-type) (and (get-in cofx [:db :chats chat-id :contacts from]) @@ -200,9 +198,6 @@ (chat-model/join-time-messages-checked-for-chats (keys grouped-messages))))))) ;;;; Send message - -(def ^:private transport-keys [:content :content-type :message-type :clock-value :timestamp :name]) - (fx/defn update-message-status [{:keys [db] :as cofx} chat-id message-id status] (fx/merge cofx diff --git a/src/status_im/chat/models/message_content.cljs b/src/status_im/chat/models/message_content.cljs index d7c0400df1..7c5817ad69 100644 --- a/src/status_im/chat/models/message_content.cljs +++ b/src/status_im/chat/models/message_content.cljs @@ -1,34 +1,14 @@ (ns status-im.chat.models.message-content - (:require [clojure.string :as string] - [status-im.utils.platform :as platform] - [status-im.constants :as constants])) + (:require [status-im.constants :as constants])) (def stylings [[:bold constants/regx-bold] [:italic constants/regx-italic] [:backquote constants/regx-backquote]]) -(def ^:private actions [[:link constants/regx-url] - [:tag constants/regx-tag] - [:mention constants/regx-mention]]) - -(def blank " ") - -(defn- blank-string [size] - (.repeat ^js blank size)) - (defn should-collapse? [text line-count] (or (<= constants/chars-collapse-threshold (count text)) (<= constants/lines-collapse-threshold (inc line-count)))) -(defn- sorted-ranges [{:keys [metadata text]} metadata-keys] - (->> (if metadata-keys - (select-keys metadata metadata-keys) - metadata) - (reduce-kv (fn [acc type ranges] - (reduce #(assoc %1 %2 type) acc ranges)) - {}) - (sort-by ffirst))) - (defn emoji-only-content? "Determines if text is just an emoji" [{:keys [text response-to]}] diff --git a/src/status_im/chat/models/message_list.cljs b/src/status_im/chat/models/message_list.cljs index 6252d48a89..836f6e08d3 100644 --- a/src/status_im/chat/models/message_list.cljs +++ b/src/status_im/chat/models/message_list.cljs @@ -1,11 +1,7 @@ (ns status-im.chat.models.message-list - (:require - ["functional-red-black-tree" :as rb-tree] - [taoensso.timbre :as log] - [status-im.constants :as constants] - [status-im.utils.fx :as fx] - [status-im.chat.db :as chat.db] - [status-im.utils.datetime :as time])) + (:require [status-im.constants :as constants] + [status-im.utils.datetime :as time] + ["functional-red-black-tree" :as rb-tree])) (defn- add-datemark [{:keys [whisper-timestamp] :as msg}] (assoc msg :datemark (time/day-relative whisper-timestamp))) @@ -46,8 +42,7 @@ (defn display-photo? "We display photos for other users, and not in 1-to-1 chats" - [{:keys [system-message? one-to-one? - outgoing message-type]}] + [{:keys [system-message? one-to-one? outgoing]}] (or system-message? (and (not outgoing) diff --git a/src/status_im/chat/models/message_list_test.cljs b/src/status_im/chat/models/message_list_test.cljs index 6a53f4d669..0ce4e88c57 100644 --- a/src/status_im/chat/models/message_list_test.cljs +++ b/src/status_im/chat/models/message_list_test.cljs @@ -1,10 +1,7 @@ (ns status-im.chat.models.message-list-test (:require [cljs.test :refer-macros [deftest is testing]] - [status-im.constants :as const] - [taoensso.tufte :as tufte :refer-macros (defnp p profiled profile)] - [status-im.chat.models.loading :as l] - - [status-im.chat.models.message-list :as s])) + [status-im.chat.models.message-list :as s] + [taoensso.tufte :as tufte :refer-macros [defnp profile]])) (deftest message-stream-tests (testing "building the list" diff --git a/src/status_im/chat/models/message_test.cljs b/src/status_im/chat/models/message_test.cljs index 1132873cc7..0513bd9346 100644 --- a/src/status_im/chat/models/message_test.cljs +++ b/src/status_im/chat/models/message_test.cljs @@ -1,15 +1,13 @@ (ns status-im.chat.models.message-test (:require [cljs.test :refer-macros [deftest is testing]] - [status-im.utils.gfycat.core :as gfycat] - [status-im.utils.identicon :as identicon] - [status-im.constants :as constants] [status-im.chat.models.loading :as chat-loading] - [status-im.utils.datetime :as time] - [status-im.transport.message.protocol :as protocol] - [status-im.chat.models.message-list :as models.message-list] - [status-im.ui.screens.chat.state :as view.state] [status-im.chat.models.message :as message] - [status-im.utils.datetime :as time])) + [status-im.chat.models.message-list :as models.message-list] + [status-im.constants :as constants] + [status-im.ui.screens.chat.state :as view.state] + [status-im.utils.datetime :as time] + [status-im.utils.gfycat.core :as gfycat] + [status-im.utils.identicon :as identicon])) (deftest add-received-message-test (with-redefs [message/add-message (constantly :added)] @@ -90,36 +88,36 @@ (deftest message-loaded? (testing "it returns false when it's not in loaded message" - (is (not (message/message-loaded? {:db {:chats {"a" {}}}} - {:message-id "message-id" - :from "a" - :clock-value 1 - :chat-id "a"})))) + (is (not (#'status-im.chat.models.message/message-loaded? {:db {:chats {"a" {}}}} + {:message-id "message-id" + :from "a" + :clock-value 1 + :chat-id "a"})))) (testing "it returns true when it's already in the loaded message" - (is (message/message-loaded? {:db {:chats {"a" {:messages {"message-id" {}}}}}} - {:message-id "message-id" - :from "a" - :clock-value 1 - :chat-id "a"})))) + (is (#'status-im.chat.models.message/message-loaded? {:db {:chats {"a" {:messages {"message-id" {}}}}}} + {:message-id "message-id" + :from "a" + :clock-value 1 + :chat-id "a"})))) (deftest earlier-than-deleted-at? (testing "it returns true when the clock-value is the same as the deleted-clock-value in chat" - (is (message/earlier-than-deleted-at? {:db {:chats {"a" {:deleted-at-clock-value 1}}}} - {:message-id "message-id" - :from "a" - :clock-value 1 - :chat-id "a"}))) + (is (#'status-im.chat.models.message/earlier-than-deleted-at? {:db {:chats {"a" {:deleted-at-clock-value 1}}}} + {:message-id "message-id" + :from "a" + :clock-value 1 + :chat-id "a"}))) (testing "it returns false when the clock-value is greater than the deleted-clock-value in chat" - (is (not (message/earlier-than-deleted-at? {:db {:chats {"a" {:deleted-at-clock-value 1}}}} - {:message-id "message-id" - :from "a" - :clock-value 2 - :chat-id "a"})))) + (is (not (#'status-im.chat.models.message/earlier-than-deleted-at? {:db {:chats {"a" {:deleted-at-clock-value 1}}}} + {:message-id "message-id" + :from "a" + :clock-value 2 + :chat-id "a"})))) (testing "it returns true when the clock-value is less than the deleted-clock-value in chat" - (is (message/earlier-than-deleted-at? {:db {:chats {"a" {:deleted-at-clock-value 1}}}} - {:message-id "message-id" - :from "a" - :clock-value 0 - :chat-id "a"})))) + (is (#'status-im.chat.models.message/earlier-than-deleted-at? {:db {:chats {"a" {:deleted-at-clock-value 1}}}} + {:message-id "message-id" + :from "a" + :clock-value 0 + :chat-id "a"})))) (deftest add-own-received-message (let [db {:multiaccount {:public-key "me"} diff --git a/src/status_im/commands/core.cljs b/src/status_im/commands/core.cljs index 5565ef67d9..8c32bfabcd 100644 --- a/src/status_im/commands/core.cljs +++ b/src/status_im/commands/core.cljs @@ -1,11 +1,9 @@ (ns status-im.commands.core - (:require - [re-frame.core :as re-frame] - [status-im.ethereum.core :as ethereum] - [status-im.waku.core :as waku] - [status-im.utils.config :as config] - [status-im.ethereum.json-rpc :as json-rpc] - [status-im.utils.fx :as fx])) + (:require [re-frame.core :as re-frame] + [status-im.ethereum.core :as ethereum] + [status-im.ethereum.json-rpc :as json-rpc] + [status-im.utils.fx :as fx] + [status-im.waku.core :as waku])) (fx/defn handle-prepare-accept-request-address-for-transaction {:events [::prepare-accept-request-address-for-transaction]} diff --git a/src/status_im/constants.cljs b/src/status_im/constants.cljs index 080469c126..540d5e86c3 100644 --- a/src/status_im/constants.cljs +++ b/src/status_im/constants.cljs @@ -7,25 +7,25 @@ (def ms-in-bg-for-require-bioauth 5000) -(def ^:const content-type-text 1) -(def ^:const content-type-sticker 2) -(def ^:const content-type-status 3) -(def ^:const content-type-emoji 4) -(def ^:const content-type-command 5) -(def ^:const content-type-system-text 6) +(def content-type-text 1) +(def content-type-sticker 2) +(def content-type-status 3) +(def content-type-emoji 4) +(def content-type-command 5) +(def content-type-system-text 6) -(def ^:const message-type-one-to-one 1) -(def ^:const message-type-public-group 2) -(def ^:const message-type-private-group 3) -(def ^:const message-type-private-group-system-message 4) +(def message-type-one-to-one 1) +(def message-type-public-group 2) +(def message-type-private-group 3) +(def message-type-private-group-system-message 4) -(def ^:const command-state-request-address-for-transaction 1) -(def ^:const command-state-request-address-for-transaction-declined 2) -(def ^:const command-state-request-address-for-transaction-accepted 3) -(def ^:const command-state-request-transaction 4) -(def ^:const command-state-request-transaction-declined 5) -(def ^:const command-state-transaction-pending 6) -(def ^:const command-state-transaction-sent 7) +(def command-state-request-address-for-transaction 1) +(def command-state-request-address-for-transaction-declined 2) +(def command-state-request-address-for-transaction-accepted 3) +(def command-state-request-transaction 4) +(def command-state-request-transaction-declined 5) +(def command-state-transaction-pending 6) +(def command-state-transaction-sent 7) (def desktop-content-types #{content-type-text content-type-emoji content-type-status}) @@ -196,64 +196,64 @@ ;; Used to generate topic for contact discoveries (def contact-discovery "contact-discovery") -(def ^:const send-transaction-failed-parse-response 1) -(def ^:const send-transaction-failed-parse-params 2) -(def ^:const send-transaction-no-account-selected 3) -(def ^:const send-transaction-invalid-tx-sender 4) -(def ^:const send-transaction-err-decrypt 5) +(def send-transaction-failed-parse-response 1) +(def send-transaction-failed-parse-params 2) +(def send-transaction-no-account-selected 3) +(def send-transaction-invalid-tx-sender 4) +(def send-transaction-err-decrypt 5) -(def ^:const web3-send-transaction "eth_sendTransaction") -(def ^:const web3-personal-sign "personal_sign") -(def ^:const web3-sign-typed-data "eth_signTypedData") -(def ^:const web3-sign-typed-data-v3 "eth_signTypedData_v3") +(def web3-send-transaction "eth_sendTransaction") +(def web3-personal-sign "personal_sign") +(def web3-sign-typed-data "eth_signTypedData") +(def web3-sign-typed-data-v3 "eth_signTypedData_v3") -(def ^:const web3-get-logs "eth_getLogs") -(def ^:const web3-transaction-receipt "eth_getTransactionReceipt") -(def ^:const web3-new-filter "eth_newFilter") -(def ^:const web3-new-pending-transaction-filter "eth_newPendingTransactionFilter") -(def ^:const web3-new-block-filter "eth_newBlockFilter") -(def ^:const web3-uninstall-filter "eth_uninstallFilter") -(def ^:const web3-get-filter-changes "eth_getFilterChanges") +(def web3-get-logs "eth_getLogs") +(def web3-transaction-receipt "eth_getTransactionReceipt") +(def web3-new-filter "eth_newFilter") +(def web3-new-pending-transaction-filter "eth_newPendingTransactionFilter") +(def web3-new-block-filter "eth_newBlockFilter") +(def web3-uninstall-filter "eth_uninstallFilter") +(def web3-get-filter-changes "eth_getFilterChanges") -(def ^:const web3-shh-post "shh_post") -(def ^:const web3-shh-new-identity "shh_newIdentity") -(def ^:const web3-shh-has-identity "shh_hasIdentity") -(def ^:const web3-shh-new-group "shh_newGroup") -(def ^:const web3-shh-add-to-group "shh_addToGroup") -(def ^:const web3-shh-new-filter "shh_newFilter") -(def ^:const web3-shh-uninstall-filter "shh_uninstallFilter") -(def ^:const web3-shh-get-filter-changes "shh_getFilterChanges") -(def ^:const web3-shh-get-messages "shh_getMessages") +(def web3-shh-post "shh_post") +(def web3-shh-new-identity "shh_newIdentity") +(def web3-shh-has-identity "shh_hasIdentity") +(def web3-shh-new-group "shh_newGroup") +(def web3-shh-add-to-group "shh_addToGroup") +(def web3-shh-new-filter "shh_newFilter") +(def web3-shh-uninstall-filter "shh_uninstallFilter") +(def web3-shh-get-filter-changes "shh_getFilterChanges") +(def web3-shh-get-messages "shh_getMessages") ;; Keycard ns -(def ^:const web3-keycard-sign-typed-data "keycard_signTypedData") +(def web3-keycard-sign-typed-data "keycard_signTypedData") (defn web3-sign-message? [method] (#{web3-sign-typed-data web3-sign-typed-data-v3 web3-personal-sign web3-keycard-sign-typed-data} method)) -(def ^:const status-create-address "status_createaddress") +(def status-create-address "status_createaddress") ; BIP44 Wallet Root Key, the extended key from which any wallet can be derived -(def ^:const path-wallet-root "m/44'/60'/0'/0") +(def path-wallet-root "m/44'/60'/0'/0") ; EIP1581 Root Key, the extended key from which any whisper key/encryption key can be derived -(def ^:const path-eip1581 "m/43'/60'/1581'") +(def path-eip1581 "m/43'/60'/1581'") ; BIP44-0 Wallet key, the default wallet key -(def ^:const path-default-wallet (str path-wallet-root "/0")) +(def path-default-wallet (str path-wallet-root "/0")) ; EIP1581 Chat Key 0, the default whisper key -(def ^:const path-whisper (str path-eip1581 "/0'/0")) +(def path-whisper (str path-eip1581 "/0'/0")) -(def ^:const path-default-wallet-keyword (keyword path-default-wallet)) -(def ^:const path-whisper-keyword (keyword path-whisper)) -(def ^:const path-wallet-root-keyword (keyword path-wallet-root)) -(def ^:const path-eip1581-keyword (keyword path-eip1581)) +(def path-default-wallet-keyword (keyword path-default-wallet)) +(def path-whisper-keyword (keyword path-whisper)) +(def path-wallet-root-keyword (keyword path-wallet-root)) +(def path-eip1581-keyword (keyword path-eip1581)) ;; (ethereum/sha3 "Transfer(address,address,uint256)") -(def ^:const event-transfer-hash "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") +(def event-transfer-hash "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") -(def ^:const method-id-transfer "0xa9059cbb") -(def ^:const method-id-approve "0x095ea7b3") -(def ^:const method-id-approve-and-call "0xcae9ca51") +(def method-id-transfer "0xa9059cbb") +(def method-id-approve "0x095ea7b3") +(def method-id-approve-and-call "0xcae9ca51") (def regx-emoji #"^((?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])\uFE0F|[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])+$") (def regx-rtl-characters #"[^\u0591-\u06EF\u06FA-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]*?[\u0591-\u06EF\u06FA-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]") @@ -266,21 +266,21 @@ (def regx-universal-link #"((^https?://join.status.im/)|(^status-im://))[\x00-\x7F]+$") (def regx-deep-link #"((^ethereum:.*)|(^status-im://[\x00-\x7F]+$))") -(def ^:const lines-collapse-threshold 20) -(def ^:const chars-collapse-threshold 600) -(def ^:const desktop-msg-chars-hard-limit 10000) +(def lines-collapse-threshold 20) +(def chars-collapse-threshold 600) +(def desktop-msg-chars-hard-limit 10000) -(def ^:const dapp-permission-contact-code "contact-code") -(def ^:const dapp-permission-web3 "web3") -(def ^:const dapp-permission-qr-code "qr-code") -(def ^:const api-response "api-response") -(def ^:const api-request "api-request") -(def ^:const history-state-changed "history-state-changed") -(def ^:const debug-metrics "debug_metrics") -(def ^:const web3-send-async-read-only "web3-send-async-read-only") -(def ^:const web3-send-async-callback "web3-send-async-callback") -(def ^:const scan-qr-code "scan-qr-code") +(def dapp-permission-contact-code "contact-code") +(def dapp-permission-web3 "web3") +(def dapp-permission-qr-code "qr-code") +(def api-response "api-response") +(def api-request "api-request") +(def history-state-changed "history-state-changed") +(def debug-metrics "debug_metrics") +(def web3-send-async-read-only "web3-send-async-read-only") +(def web3-send-async-callback "web3-send-async-callback") +(def scan-qr-code "scan-qr-code") ;;ipfs -(def ^:const ipfs-proto-code "e3") -(def ^:const swarm-proto-code "e4") +(def ipfs-proto-code "e3") +(def swarm-proto-code "e4") diff --git a/src/status_im/contact/block.cljs b/src/status_im/contact/block.cljs index 5dc8a3e153..353496d2a7 100644 --- a/src/status_im/contact/block.cljs +++ b/src/status_im/contact/block.cljs @@ -1,14 +1,9 @@ (ns status-im.contact.block (:require [re-frame.core :as re-frame] - [status-im.chat.models :as chat.models] - [status-im.chat.models.loading :as chat.models.loading] [status-im.chat.models.message-list :as message-list] - - [status-im.chat.models.message :as chat.models.message] [status-im.contact.db :as contact.db] [status-im.data-store.chats :as chats-store] [status-im.data-store.contacts :as contacts-store] - [status-im.i18n :as i18n] [status-im.navigation :as navigation] [status-im.utils.fx :as fx])) diff --git a/src/status_im/contact/core.cljs b/src/status_im/contact/core.cljs index 4525446fcc..916cf80b29 100644 --- a/src/status_im/contact/core.cljs +++ b/src/status_im/contact/core.cljs @@ -1,23 +1,18 @@ (ns status-im.contact.core - (:require - [re-frame.core :as re-frame] - [taoensso.timbre :as log] - [status-im.multiaccounts.update.core :as multiaccounts.update] - [status-im.waku.core :as waku] - [status-im.multiaccounts.model :as multiaccounts.model] - [status-im.transport.filters.core :as transport.filters] - [status-im.contact.db :as contact.db] - [status-im.ethereum.core :as ethereum] - [status-im.ethereum.json-rpc :as json-rpc] - [status-im.data-store.contacts :as contacts-store] - [status-im.mailserver.core :as mailserver] - [status-im.transport.message.protocol :as protocol] - [status-im.tribute-to-talk.db :as tribute-to-talk] - [status-im.tribute-to-talk.whitelist :as whitelist] - [status-im.navigation :as navigation] - [status-im.utils.config :as config] - [status-im.utils.fx :as fx] - [status-im.utils.datetime :as time])) + (:require [re-frame.core :as re-frame] + [status-im.contact.db :as contact.db] + [status-im.data-store.contacts :as contacts-store] + [status-im.ethereum.json-rpc :as json-rpc] + [status-im.mailserver.core :as mailserver] + [status-im.multiaccounts.model :as multiaccounts.model] + [status-im.multiaccounts.update.core :as multiaccounts.update] + [status-im.transport.filters.core :as transport.filters] + [status-im.tribute-to-talk.db :as tribute-to-talk] + [status-im.tribute-to-talk.whitelist :as whitelist] + [status-im.navigation :as navigation] + [status-im.utils.fx :as fx] + [status-im.waku.core :as waku] + [taoensso.timbre :as log])) (fx/defn load-contacts {:events [::contacts-loaded]} @@ -41,7 +36,7 @@ (transport.filters/load-filters)))) (defn build-contact - [{{:keys [chats multiaccount] + [{{:keys [multiaccount] :contacts/keys [contacts]} :db} public-key] (cond-> (contact.db/public-key->contact contacts public-key) (= public-key (:public-key multiaccount)) diff --git a/src/status_im/contact/core_test.cljs b/src/status_im/contact/core_test.cljs index 2037a4f5f8..8848cbf651 100644 --- a/src/status_im/contact/core_test.cljs +++ b/src/status_im/contact/core_test.cljs @@ -1,9 +1,7 @@ (ns status-im.contact.core-test (:require [cljs.test :refer-macros [deftest is testing]] - [status-im.ethereum.json-rpc :as json-rpc] - [status-im.utils.gfycat.core :as gfycat] - [status-im.utils.identicon :as identicon] - [status-im.contact.core :as model])) + [status-im.contact.core :as model] + [status-im.ethereum.json-rpc :as json-rpc])) (def public-key "0x04fcf40c526b09ff9fb22f4a5dbd08490ef9b64af700870f8a0ba2133f4251d5607ed83cd9047b8c2796576bc83fa0de23a13a4dced07654b8ff137fe744047917") @@ -57,8 +55,7 @@ public-key 1 {:name "new-name" - :profile-image "new-image"}) - contact (get-in actual [:db :contacts/contacts public-key])] + :profile-image "new-image"})] (testing "it does nothing" (is (nil? actual))))) (testing "timestamp is less than last-updated" @@ -72,8 +69,7 @@ public-key 0 {:name "new-name" - :profile-image "new-image"}) - contact (get-in actual [:db :contacts/contacts public-key])] + :profile-image "new-image"})] (testing "it does nothing" (is (nil? actual)))))) (testing "backward compatibility" diff --git a/src/status_im/contact/db.cljs b/src/status_im/contact/db.cljs index f649b026fc..84c3c7f31d 100644 --- a/src/status_im/contact/db.cljs +++ b/src/status_im/contact/db.cljs @@ -1,9 +1,9 @@ (ns status-im.contact.db - (:require [clojure.set :as cset] + (:require [clojure.set :as clojure.set] + [clojure.string :as clojure.string] [status-im.ethereum.core :as ethereum] [status-im.utils.gfycat.core :as gfycat] - [status-im.utils.identicon :as identicon] - status-im.utils.db)) + [status-im.utils.identicon :as identicon])) (defn public-key->new-contact [public-key] (let [alias (gfycat/generate-gfy public-key)] @@ -53,8 +53,8 @@ [members admins contacts {:keys [public-key] :as current-account}] (let [current-contact (-> current-account (select-keys [:name :preferred-name :public-key :photo-path]) - (cset/rename-keys {:name :alias - :preferred-name :name})) + (clojure.set/rename-keys {:name :alias + :preferred-name :name})) all-contacts (assoc contacts public-key current-contact)] (->> members (map #(or (get all-contacts %) diff --git a/src/status_im/core.cljs b/src/status_im/core.cljs index 2c021dfb96..90688b6100 100644 --- a/src/status_im/core.cljs +++ b/src/status_im/core.cljs @@ -1,23 +1,22 @@ (ns status-im.core - (:require [re-frame.core :as re-frame] - [status-im.utils.error-handler :as error-handler] - [status-im.utils.platform :as platform] - [status-im.ui.screens.views :as views] - [status-im.ui.components.react :as react] - [reagent.core :as reagent] - status-im.utils.db - status-im.db + (:require status-im.utils.db status-im.subs status-im.events ["react-native-languages" :default react-native-languages] ["react-native-shake" :as react-native-shake] ["react-native-screens" :refer (enableScreens)] - [status-im.utils.logging.core :as utils.logs] ["react-native" :as rn] - [status-im.utils.snoopy :as snoopy] - [status-im.i18n :as i18n] + [re-frame.core :as re-frame] [re-frame.interop :as interop] - [reagent.impl.batching :as batching])) + [reagent.core :as reagent] + [reagent.impl.batching :as batching] + [status-im.i18n :as i18n] + [status-im.ui.components.react :as react] + [status-im.ui.screens.views :as views] + [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])) (set! interop/next-tick js/setTimeout) (set! batching/fake-raf #(js/setTimeout % 0)) @@ -46,7 +45,7 @@ (defn app-state-change-handler [state] (re-frame/dispatch [:app-state-change state])) -(defn root [props] +(defn root [_] (reagent/create-class {:component-did-mount (fn [this] diff --git a/src/status_im/data_store/chats.cljs b/src/status_im/data_store/chats.cljs index e6d7572b04..cb736fc4df 100644 --- a/src/status_im/data_store/chats.cljs +++ b/src/status_im/data_store/chats.cljs @@ -1,30 +1,15 @@ (ns status-im.data-store.chats - (:require [goog.object :as object] - [re-frame.core :as re-frame] + (:require [clojure.set :as clojure.set] [status-im.data-store.messages :as messages] - [status-im.waku.core :as waku] - [status-im.utils.config :as config] - [status-im.utils.fx :as fx] [status-im.ethereum.json-rpc :as json-rpc] - [status-im.ethereum.core :as ethereum] - [taoensso.timbre :as log] - [status-im.utils.clocks :as utils.clocks] - [status-im.utils.core :as utils])) + [status-im.utils.fx :as fx] + [status-im.waku.core :as waku] + [taoensso.timbre :as log])) (def one-to-one-chat-type 1) (def public-chat-type 2) (def private-group-chat-type 3) -(defn- event->string - "Transform an event in an a vector with keys in alphabetical order, to compute - a predictable id" - [event] - (js/JSON.stringify - (clj->js - (mapv - #(vector % (get event %)) - (sort (keys event)))))) - (defn type->rpc [{:keys [public? group-chat] :as chat}] (assoc chat :chatType (cond public? public-chat-type diff --git a/src/status_im/data_store/chats_test.cljs b/src/status_im/data_store/chats_test.cljs index 8f20ad85f2..692a48e2e7 100644 --- a/src/status_im/data_store/chats_test.cljs +++ b/src/status_im/data_store/chats_test.cljs @@ -1,6 +1,5 @@ (ns status-im.data-store.chats-test (:require [cljs.test :refer-macros [deftest is testing]] - [status-im.utils.random :as utils.random] [status-im.data-store.chats :as chats])) (deftest ->to-rpc @@ -46,7 +45,7 @@ :active true :timestamp 2}] (testing "marshaling chat" - (is (= expected-chat (-> (chats/->rpc chat) + (is (= expected-chat (-> (#'status-im.data-store.chats/->rpc chat) (update :members #(into #{} %)))))))) (deftest normalize-chat-test diff --git a/src/status_im/data_store/contacts.cljs b/src/status_im/data_store/contacts.cljs index 311f5e5b58..ca994cf1b0 100644 --- a/src/status_im/data_store/contacts.cljs +++ b/src/status_im/data_store/contacts.cljs @@ -1,12 +1,10 @@ (ns status-im.data-store.contacts - (:require [re-frame.core :as re-frame] - [status-im.utils.fx :as fx] - [status-im.utils.config :as config] - [status-im.waku.core :as waku] - [status-im.data-store.chats :as data-store.chats] + (:require [clojure.set :as clojure.set] [status-im.ethereum.json-rpc :as json-rpc] - [taoensso.timbre :as log] - [status-im.utils.types :as types])) + [status-im.utils.fx :as fx] + [status-im.utils.types :as types] + [status-im.waku.core :as waku] + [taoensso.timbre :as log])) (defn deserialize-tribute-to-talk [t] (if (seq t) diff --git a/src/status_im/data_store/mailservers.cljs b/src/status_im/data_store/mailservers.cljs index ff65cd357d..6bfd966655 100644 --- a/src/status_im/data_store/mailservers.cljs +++ b/src/status_im/data_store/mailservers.cljs @@ -1,6 +1,5 @@ (ns status-im.data-store.mailservers - (:require [re-frame.core :as re-frame] - [status-im.ethereum.json-rpc :as json-rpc] + (:require [status-im.ethereum.json-rpc :as json-rpc] [status-im.utils.fx :as fx] [taoensso.timbre :as log])) diff --git a/src/status_im/data_store/messages.cljs b/src/status_im/data_store/messages.cljs index 4e0c39a7ae..93e9928988 100644 --- a/src/status_im/data_store/messages.cljs +++ b/src/status_im/data_store/messages.cljs @@ -1,16 +1,9 @@ (ns status-im.data-store.messages (:require [clojure.set :as clojure.set] - [re-frame.core :as re-frame] - [status-im.utils.fx :as fx] - [clojure.string :as string] - [taoensso.timbre :as log] - [re-frame.core :as re-frame] - [status-im.waku.core :as waku] - [status-im.utils.types :as utils.types] - [status-im.utils.config :as config] [status-im.ethereum.json-rpc :as json-rpc] - [status-im.constants :as constants] - [status-im.utils.core :as utils])) + [status-im.utils.fx :as fx] + [status-im.waku.core :as waku] + [taoensso.timbre :as log])) (defn ->rpc [{:keys [content] :as message}] (cond-> message diff --git a/src/status_im/desktop/core.cljs b/src/status_im/desktop/core.cljs index 4ac7fd42db..ff79ab702e 100644 --- a/src/status_im/desktop/core.cljs +++ b/src/status_im/desktop/core.cljs @@ -6,7 +6,6 @@ [status-im.ui.screens.views :as views] [status-im.ui.components.react :as react] [status-im.core :as core] - [status-im.utils.snoopy :as snoopy] [status-im.ui.screens.desktop.views :as desktop-views] [status-im.desktop.deep-links :as deep-links] [status-im.utils.config :as config])) @@ -14,7 +13,7 @@ (defn app-state-change-handler [state] (re-frame/dispatch [:app-state-change state])) -(defn app-root [props] +(defn app-root [_] (if config/mobile-ui-for-desktop? (reagent/create-class {:component-did-mount @@ -31,8 +30,8 @@ (re-frame/dispatch [:set-initial-props (reagent/props this)]) ;(shortcuts/register-default-shortcuts) (deep-links/add-event-listener)) - :reagent-render (fn [props] + :reagent-render (fn [_] desktop-views/main)}))) (defn init [] - (core/init)) + (core/init app-root)) diff --git a/src/status_im/ens/core.cljs b/src/status_im/ens/core.cljs index 2952b14725..c8b77f529b 100644 --- a/src/status_im/ens/core.cljs +++ b/src/status_im/ens/core.cljs @@ -1,8 +1,7 @@ (ns status-im.ens.core + (:refer-clojure :exclude [name]) (:require [clojure.string :as string] [re-frame.core :as re-frame] - [status-im.utils.datetime :as datetime] - [status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.ethereum.abi-spec :as abi-spec] [status-im.ethereum.contracts :as contracts] [status-im.ethereum.core :as ethereum] @@ -10,13 +9,13 @@ [status-im.ethereum.ens :as ens] [status-im.ethereum.resolver :as resolver] [status-im.ethereum.stateofus :as stateofus] + [status-im.multiaccounts.update.core :as multiaccounts.update] + [status-im.signing.core :as signing] [status-im.navigation :as navigation] + [status-im.utils.datetime :as datetime] [status-im.utils.fx :as fx] [status-im.utils.money :as money] - [status-im.signing.core :as signing] - [status-im.multiaccounts.update.core :as multiaccounts.update] - [status-im.utils.random :as random]) - (:refer-clojure :exclude [name])) + [status-im.utils.random :as random])) (defn fullname [custom-domain? username] (if custom-domain? diff --git a/src/status_im/ethereum/abi_spec.cljs b/src/status_im/ethereum/abi_spec.cljs index a13b8cbf84..4cc410607b 100644 --- a/src/status_im/ethereum/abi_spec.cljs +++ b/src/status_im/ethereum/abi_spec.cljs @@ -47,7 +47,7 @@ (let [hex-x (str "0x" x)] (try (.hexToNumber utils hex-x) - (catch :default err + (catch :default _ (.hexToNumberString utils hex-x)))))) (defn is-hex? [value] @@ -90,8 +90,7 @@ ;; bytes: enc(X) is the sequence of bytes in X padded with trailing ;; zero-bytes to a length of 32 bytes. (defmethod enc :bytes - [{:keys [value size dynamic?] - :or {size 256}}] + [{:keys [value dynamic?]}] ;; in the examples of the abi specifications strings are passed for ;; bytes parameters, in our ens resolver we pass encoded bytes directly ;; for namehash, this handles both cases by checking if the value is already @@ -114,17 +113,15 @@ ;; fixedx: enc(X) is enc(X * 10**N) where X * 10**N is ;; interpreted as a int256. (defmethod enc :fixed - [{:keys [value size power] - :or {size 128 - power 18}}] + [{:keys [value power] + :or {power 18}}] (enc {:type :int :value (* value (Math/pow 10 power))})) ;; ufixed: as in the ufixed128x18 case (defmethod enc :ufixed - [{:keys [value size power] - :or {size 128 - power 18}}] + [{:keys [value power] + :or {power 18}}] (enc {:type :uint :value (* value (Math/pow 10 power))})) @@ -137,7 +134,7 @@ ;; i.e. it is encoded as if it were an array of static size k, ;; prefixed with the number of elements. (defmethod enc :array - [{:keys [value dynamic? array-of] :as x}] + [{:keys [value dynamic? array-of]}] (str (when dynamic? (enc {:type :int :value (count value)})) @@ -174,7 +171,7 @@ (conj acc (assoc x :head enc-x))]))) [0 []] value) - [_ heads tails] (reduce (fn [[len heads tails] {:keys [head tail] :as x}] + [_ heads tails] (reduce (fn [[len heads tails] {:keys [head tail]}] (if tail [(+ len (/ (count tail) 2)) (conj heads (enc {:type :int :value len})) @@ -228,7 +225,7 @@ [(count m) m])) (defn tokenise [code] - (if (seq code) + (when (seq code) (if-let [[len token] (or (string code) (single-char code) (number code))] @@ -273,12 +270,12 @@ (apply str (take 10 (ethereum/sha3 signature)))) (defn encode [method params] - (let [method-id (signature->method-id method)] - (let [params (map #(assoc %1 :value %2) - (parse-params method) - params)] - (str method-id (enc {:type :tuple - :value params}))))) + (let [method-id (signature->method-id method) + params (map #(assoc %1 :value %2) + (parse-params method) + params)] + (str method-id (enc {:type :tuple + :value params})))) ;; ======= decode diff --git a/src/status_im/ethereum/core.cljs b/src/status_im/ethereum/core.cljs index 41f7bcc99c..3f97af209d 100644 --- a/src/status_im/ethereum/core.cljs +++ b/src/status_im/ethereum/core.cljs @@ -11,12 +11,12 @@ (defn utf8-to-hex [s] (try (.utf8ToHex utils (str s)) - (catch :default err nil))) + (catch :default _ nil))) (defn hex-to-utf8 [s] (try (.hexToUtf8 utils s) - (catch :default err nil))) + (catch :default _ nil))) ;; IDs standardized in https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md#list-of-chain-ids @@ -75,7 +75,7 @@ (when s (string/replace s hex-prefix ""))) -(def ^:const public-key-length 128) +(def public-key-length 128) (defn coordinates [public-key] (when-let [hex (naked-address public-key)] @@ -137,10 +137,10 @@ (when normalized-key (subs (sha3 normalized-key) 26)))) -(def ^:const bytes32-length 66) ; length of '0x' + 64 hex values. (a 32bytes value has 64 nibbles) +(def bytes32-length 66) ; length of '0x' + 64 hex values. (a 32bytes value has 64 nibbles) (defn hex->text - "Converts a hexstring to UTF8 text. If the data received is 32 bytes long, + "Converts a hexstring to UTF8 text. If the data received is 32 bytes long, return the value unconverted" [data] (if (= bytes32-length (count (normalized-hex data))) diff --git a/src/status_im/ethereum/eip681.cljs b/src/status_im/ethereum/eip681.cljs index bba5dc85bc..89047d21df 100644 --- a/src/status_im/ethereum/eip681.cljs +++ b/src/status_im/ethereum/eip681.cljs @@ -5,7 +5,6 @@ e.g. ethereum:0x1234@1/transfer?to=0x5678&value=1e18&gas=5000" (:require [clojure.string :as string] - [re-frame.core :as re-frame] [status-im.ethereum.core :as ethereum] [status-im.ethereum.ens :as ens] [status-im.ethereum.tokens :as tokens] @@ -57,7 +56,7 @@ (when authority-path (let [[_ raw-address chain-id function-name] (re-find authority-path-pattern authority-path)] (when (or (ethereum/address? raw-address) - (if (string/starts-with? raw-address "pay-") + (when (string/starts-with? raw-address "pay-") (let [pay-address (string/replace-first raw-address "pay-" "")] (or (ens/is-valid-eth-name? pay-address) (ethereum/address? pay-address))))) @@ -74,16 +73,18 @@ (ethereum/chain-keyword->chain-id :mainnet))} arguments)))))))))))) -(defn parse-eth-value [s] +(defn parse-eth-value "Takes a map as returned by `parse-uri` and returns value as BigNumber" + [s] (when (string? s) (let [eth? (string/ends-with? s "ETH") ^js n (money/bignumber (string/replace s "ETH" ""))] (if eth? (.times n 1e18) n)))) -(defn extract-request-details [{:keys [value address function-name function-arguments] :as details} all-tokens] +(defn extract-request-details "Return a map encapsulating request details (with keys `value`, `address` and `symbol`) from a parsed URI. Supports ethereum and erc20 token." + [{:keys [value address function-name function-arguments] :as details} all-tokens] (when address (merge details (case function-name diff --git a/src/status_im/ethereum/eip681_test.cljs b/src/status_im/ethereum/eip681_test.cljs index 8fe2513d60..a8189b8a61 100644 --- a/src/status_im/ethereum/eip681_test.cljs +++ b/src/status_im/ethereum/eip681_test.cljs @@ -1,5 +1,5 @@ (ns status-im.ethereum.eip681-test - (:require [cljs.test :refer-macros [deftest is testing]] + (:require [cljs.test :refer-macros [deftest is]] [status-im.ethereum.eip681 :as eip681] [status-im.utils.money :as money])) diff --git a/src/status_im/ethereum/ens_test.cljs b/src/status_im/ethereum/ens_test.cljs index 9f4271a192..4a50be5a25 100644 --- a/src/status_im/ethereum/ens_test.cljs +++ b/src/status_im/ethereum/ens_test.cljs @@ -1,5 +1,5 @@ (ns status-im.ethereum.ens-test - (:require [cljs.test :refer-macros [deftest is testing]] + (:require [cljs.test :refer-macros [deftest is]] [status-im.ethereum.ens :as ens])) (deftest namehash diff --git a/src/status_im/ethereum/json_rpc.cljs b/src/status_im/ethereum/json_rpc.cljs index 7927f3ba3f..1bf2efaec3 100644 --- a/src/status_im/ethereum/json_rpc.cljs +++ b/src/status_im/ethereum/json_rpc.cljs @@ -2,13 +2,12 @@ (:require [clojure.string :as string] [re-frame.core :as re-frame] [status-im.ethereum.abi-spec :as abi-spec] - [status-im.utils.config :as config] [status-im.ethereum.decode :as decode] [status-im.native-module.core :as status] [status-im.utils.money :as money] [status-im.utils.types :as types] - [taoensso.timbre :as log] - [status-im.utils.utils :as utils])) + [status-im.utils.utils :as utils] + [taoensso.timbre :as log])) (def json-rpc-api {"eth_call" {} @@ -197,10 +196,10 @@ (defn call [{:keys [method params on-success] :as arg}] (if-let [method-options (json-rpc-api method)] - (let [{:keys [id on-result subscription?] + (let [params (or params []) + {:keys [id on-result subscription?] :or {on-result identity - id 1 - params []}} method-options + id 1}} method-options on-error (or (on-error-retry call arg) #(log/warn :json-rpc/error method :error % :params params))] (if (nil? method) diff --git a/src/status_im/ethereum/mnemonic_test.cljs b/src/status_im/ethereum/mnemonic_test.cljs index 51ad91742a..431d8b5f74 100644 --- a/src/status_im/ethereum/mnemonic_test.cljs +++ b/src/status_im/ethereum/mnemonic_test.cljs @@ -1,7 +1,7 @@ (ns status-im.ethereum.mnemonic-test - (:require [cljs.test :refer-macros [deftest is testing]] - [status-im.ethereum.mnemonic :as mnemonic] - [clojure.string :as string])) + (:require [cljs.test :refer-macros [deftest is]] + [clojure.string :as string] + [status-im.ethereum.mnemonic :as mnemonic])) (deftest valid-length? (is (not (mnemonic/valid-length? "rate rate"))) diff --git a/src/status_im/ethereum/stateofus_test.cljs b/src/status_im/ethereum/stateofus_test.cljs index 26a72d9e8f..8c68fa162e 100644 --- a/src/status_im/ethereum/stateofus_test.cljs +++ b/src/status_im/ethereum/stateofus_test.cljs @@ -1,5 +1,5 @@ (ns status-im.ethereum.stateofus-test - (:require [cljs.test :refer-macros [deftest is testing]] + (:require [cljs.test :refer-macros [deftest is]] [status-im.ethereum.stateofus :as stateofus])) (deftest valid-username? diff --git a/src/status_im/ethereum/transactions/core.cljs b/src/status_im/ethereum/transactions/core.cljs index 491b42a4ae..10d2d48301 100644 --- a/src/status_im/ethereum/transactions/core.cljs +++ b/src/status_im/ethereum/transactions/core.cljs @@ -1,16 +1,13 @@ (ns status-im.ethereum.transactions.core (:require [re-frame.core :as re-frame] - [status-im.constants :as constants] [status-im.ethereum.decode :as decode] [status-im.ethereum.eip55 :as eip55] [status-im.ethereum.encode :as encode] [status-im.ethereum.json-rpc :as json-rpc] - [status-im.ethereum.core :as ethereum] - [status-im.ethereum.tokens :as tokens] [status-im.utils.fx :as fx] - [status-im.utils.money :as money] [status-im.wallet.core :as wallet] - [taoensso.timbre :as log])) + [taoensso.timbre :as log] + [cljs.spec.alpha :as spec])) (def confirmations-count-threshold 12) @@ -38,8 +35,8 @@ (defn- parse-token-transfer [chain-tokens contract] - (let [{:keys [nft? symbol] :as token} (get chain-tokens contract - default-erc20-token)] + (let [{:keys [symbol] :as token} (get chain-tokens contract + default-erc20-token)] {:symbol symbol :token token ;; NOTE(goranjovic) - just a flag we need when we merge this entry @@ -50,8 +47,8 @@ (defn enrich-transfer [chain-tokens - {:keys [address blockNumber timestamp type transaction receipt from txStatus - txHash gasPrice gasUsed contract value gasLimit input nonce to type id] :as transfer}] + {:keys [address blockNumber timestamp from txStatus txHash gasPrice + gasUsed contract value gasLimit input nonce to type id]}] (let [erc20? (= type "erc20") failed? (= txStatus "0x0")] (merge {:address (eip55/address->checksum address) @@ -251,8 +248,8 @@ limit-per-address] :as params :or {limit default-transfers-limit}}] - {:pre [(cljs.spec.alpha/valid? - (cljs.spec.alpha/coll-of string?) + {:pre [(spec/valid? + (spec/coll-of string?) addresses)]} (log/debug "[transactions] get-transfers" "addresses" addresses diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index f095f5882f..622b7c3c73 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -1,52 +1,39 @@ (ns status-im.events (:require [clojure.string :as string] [re-frame.core :as re-frame] - [status-im.multiaccounts.core :as multiaccounts] - [status-im.data-store.messages :as data-store.messages] - [status-im.data-store.chats :as data-store.chats] - [status-im.multiaccounts.create.core :as multiaccounts.create] - [status-im.multiaccounts.login.core :as multiaccounts.login] - [status-im.multiaccounts.logout.core :as multiaccounts.logout] - [status-im.multiaccounts.recover.core :as multiaccounts.recover] - [status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.bootnodes.core :as bootnodes] [status-im.browser.core :as browser] [status-im.browser.permissions :as browser.permissions] - [status-im.chat.db :as chat.db] [status-im.chat.models :as chat] [status-im.chat.models.input :as chat.input] [status-im.chat.models.loading :as chat.loading] [status-im.chat.models.message :as chat.message] + [status-im.chat.models.message-seen :as message-seen] [status-im.contact.block :as contact.block] [status-im.contact.core :as contact] + [status-im.data-store.chats :as data-store.chats] + [status-im.data-store.messages :as data-store.messages] [status-im.ethereum.core :as ethereum] - [status-im.ethereum.ens :as ethereum.ens] [status-im.ethereum.subscriptions :as ethereum.subscriptions] - [status-im.ethereum.transactions.core :as ethereum.transactions] [status-im.fleet.core :as fleet] [status-im.group-chats.core :as group-chats] - [status-im.signing.keycard :as signing.keycard] [status-im.i18n :as i18n] [status-im.init.core :as init] [status-im.log-level.core :as log-level] - status-im.waku.core - [status-im.utils.universal-links.core :as universal-links] - [status-im.mailserver.core :as mailserver] [status-im.mailserver.constants :as mailserver.constants] + [status-im.mailserver.core :as mailserver] [status-im.mailserver.topics :as mailserver.topics] - [status-im.node.core :as node] + [status-im.multiaccounts.core :as multiaccounts] + [status-im.multiaccounts.login.core :as multiaccounts.login] + [status-im.multiaccounts.logout.core :as multiaccounts.logout] + [status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.pairing.core :as pairing] [status-im.privacy-policy.core :as privacy-policy] - [status-im.protocol.core :as protocol] [status-im.qr-scanner.core :as qr-scanner] - [status-im.search.core :as search] [status-im.signals.core :as signals] [status-im.stickers.core :as stickers] [status-im.transport.core :as transport] [status-im.transport.message.core :as transport.message] - status-im.wallet.choose-recipient.core - status-im.wallet.collectibles.core - status-im.wallet.accounts.core [status-im.ui.components.bottom-sheet.core :as bottom-sheet] [status-im.ui.components.react :as react] [status-im.ui.screens.add-new.new-chat.db :as new-chat.db] @@ -54,18 +41,19 @@ :as currency-settings.models] [status-im.navigation :as navigation] - [status-im.utils.build :as build] - [status-im.utils.config :as config] [status-im.utils.fx :as fx] [status-im.utils.handlers :as handlers] [status-im.utils.logging.core :as logging] - [status-im.utils.utils :as utils] + [status-im.utils.universal-links.core :as universal-links] [status-im.wallet.core :as wallet] [status-im.wallet.custom-tokens.core :as custom-tokens] [status-im.wallet.db :as wallet.db] [taoensso.timbre :as log] - [status-im.utils.money :as money] - [status-im.chat.models.message-seen :as message-seen] + status-im.waku.core + status-im.wallet.choose-recipient.core + status-im.wallet.collectibles.core + status-im.wallet.accounts.core + status-im.multiaccounts.biometric.core status-im.hardwallet.core status-im.popover.core [status-im.hardwallet.core :as hardwallet] @@ -75,6 +63,7 @@ [status-im.native-module.core :as status] [status-im.ui.components.permissions :as permissions] [status-im.utils.http :as http] + [status-im.utils.utils :as utils] status-im.ui.screens.add-new.new-chat.events status-im.ui.screens.group.chat-settings.events status-im.ui.screens.group.events @@ -245,7 +234,7 @@ (handlers/register-handler-fx :mailserver.ui/retry-request-pressed - (fn [cofx [_ args]] + (fn [cofx [_ _]] (mailserver/retry-next-messages-request cofx))) (handlers/register-handler-fx @@ -357,7 +346,7 @@ (handlers/register-handler-fx :log-level.ui/logging-enabled-confirmed - (fn [cofx [_ enabled]] + (fn [_ [_ _]] ;;FIXME desktop only #_(log-level/save-logging-enabled cofx enabled))) @@ -797,7 +786,7 @@ (handlers/register-handler-fx :group-chats.ui/leave-chat-pressed - (fn [_ [_ chat-id group?]] + (fn [_ [_ chat-id _]] {:ui/show-confirmation {:title (i18n/label :t/leave-confirmation) :content (i18n/label :t/leave-chat-confirmation) :confirm-button-text (i18n/label :t/leave) @@ -811,7 +800,7 @@ (handlers/register-handler-fx :transport/send-status-message-error - (fn [{:keys [db] :as cofx} [_ err]] + (fn [_ [_ err]] (log/error :send-status-message-error err))) (fx/defn handle-update [cofx {:keys [chats messages] :as response}] @@ -885,7 +874,7 @@ (handlers/register-handler-fx :contact.ui/start-group-chat-pressed - (fn [{:keys [db] :as cofx} _] + (fn [cofx _] (contact/open-contact-toggle-list cofx))) (handlers/register-handler-fx @@ -1147,17 +1136,16 @@ (handlers/register-handler-fx :wallet-send-request - (fn [{:keys [db] :as cofx} [_ public-key amount symbol decimals]] + (fn [cofx [_ public-key _ _ _]] (assert public-key) - (let [request-command (get-in db [:id->command ["request" #{:personal-chats}]])] - (fx/merge cofx - (navigation/navigate-back) - (chat/start-chat public-key nil) - ;; TODO send - #_(commands.sending/send public-key - request-command - {:asset (name symbol) - :amount (str (money/internal->formatted amount symbol decimals))}))))) + (fx/merge cofx + (navigation/navigate-back) + (chat/start-chat public-key nil) + ;; TODO send + #_(commands.sending/send public-key + request-command + {:asset (name symbol) + :amount (str (money/internal->formatted amount symbol decimals))})))) (handlers/register-handler-fx :identicon-generated @@ -1349,7 +1337,7 @@ ;; NOTE: Will be removed with the keycard PR (handlers/register-handler-fx :screens/on-will-focus - (fn [{:keys [db] :as cofx} [_ view-id]] + (fn [cofx [_ view-id]] (fx/merge cofx #(case view-id :keycard-settings (hardwallet/settings-screen-did-load %) diff --git a/src/status_im/fleet/core.cljs b/src/status_im/fleet/core.cljs index 71e1a31362..b1271a4646 100644 --- a/src/status_im/fleet/core.cljs +++ b/src/status_im/fleet/core.cljs @@ -1,11 +1,10 @@ (ns status-im.fleet.core (:require [re-frame.core :as re-frame] - [status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.constants :as constants] [status-im.i18n :as i18n] + [status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.node.core :as node] [status-im.utils.config :as config] - [status-im.utils.types :as types] [status-im.utils.fx :as fx])) (defn current-fleet-sub diff --git a/src/status_im/fleet/core_test.cljs b/src/status_im/fleet/core_test.cljs index deac112585..362e48854e 100644 --- a/src/status_im/fleet/core_test.cljs +++ b/src/status_im/fleet/core_test.cljs @@ -1,8 +1,7 @@ (ns status-im.fleet.core-test (:require [cljs.test :refer-macros [deftest is testing]] [status-im.constants :as constants] - [status-im.fleet.core :as fleet] - [status-im.node.core :as node])) + [status-im.fleet.core :as fleet])) #_(deftest fleets-test (testing "not passing any extra fleet" diff --git a/src/status_im/group_chats/core.cljs b/src/status_im/group_chats/core.cljs index a935ec5cb1..6bd89e3cda 100644 --- a/src/status_im/group_chats/core.cljs +++ b/src/status_im/group_chats/core.cljs @@ -1,33 +1,18 @@ (ns status-im.group-chats.core (:refer-clojure :exclude [remove]) - (:require [clojure.set :as clojure.set] - [clojure.spec.alpha :as spec] - [clojure.string :as string] - [status-im.ethereum.json-rpc :as json-rpc] + (:require [clojure.spec.alpha :as spec] [re-frame.core :as re-frame] - [status-im.utils.config :as config] - [status-im.constants :as constants] - [status-im.chat.models.message-content :as message-content] - [status-im.navigation :as navigation] - [status-im.data-store.chats :as data-store.chats] - [status-im.data-store.messages :as data-store.messages] - [status-im.multiaccounts.core :as multiaccounts] - [status-im.multiaccounts.model :as multiaccounts.model] - [status-im.utils.pairing :as pairing.utils] - [status-im.waku.core :as waku] [status-im.chat.models :as models.chat] [status-im.chat.models.message :as models.message] - [status-im.contact.core :as models.contact] - [status-im.transport.filters.core :as transport.filters] + [status-im.data-store.chats :as data-store.chats] + [status-im.data-store.messages :as data-store.messages] + [status-im.ethereum.json-rpc :as json-rpc] [status-im.group-chats.db :as group-chats.db] - [status-im.i18n :as i18n] - [status-im.native-module.core :as native-module] - [status-im.transport.message.protocol :as protocol] - [status-im.utils.clocks :as utils.clocks] + [status-im.multiaccounts.model :as multiaccounts.model] + [status-im.transport.filters.core :as transport.filters] + [status-im.navigation :as navigation] [status-im.utils.fx :as fx] - [status-im.mailserver.core :as mailserver] - [status-im.mailserver.topics :as mailserver.topics] - [taoensso.timbre :as log])) + [status-im.waku.core :as waku])) (fx/defn remove-member "Format group update message and sign membership" @@ -119,4 +104,3 @@ ::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "changeGroupChatName") :params [nil chat-id new-name] :on-success #(re-frame/dispatch [::chat-updated %])}]})) - diff --git a/src/status_im/group_chats/db.cljs b/src/status_im/group_chats/db.cljs index 26d594854c..b7eb21f81d 100644 --- a/src/status_im/group_chats/db.cljs +++ b/src/status_im/group_chats/db.cljs @@ -4,7 +4,7 @@ (def members-added-type 3) (defn joined? - [public-key {:keys [members-joined] :as chat}] + [public-key {:keys [members-joined]}] (contains? members-joined public-key)) (defn invited? diff --git a/src/status_im/hardwallet/card.cljs b/src/status_im/hardwallet/card.cljs index d2b1061e29..4cc0fdac7a 100644 --- a/src/status_im/hardwallet/card.cljs +++ b/src/status_im/hardwallet/card.cljs @@ -1,14 +1,12 @@ (ns status-im.hardwallet.card - (:require - [status-im.hardwallet.keycard :as keycard] - [status-im.hardwallet.real-keycard :as real-keycard] - [status-im.hardwallet.simulated-keycard :as simulated-keycard] - [status-im.hardwallet.ios-keycard :as ios-keycard] - [taoensso.timbre :as log] - [re-frame.core :as re-frame] - [status-im.utils.config :as config] - [status-im.utils.platform :as platform] - ["react-native" :as react-native])) + (:require [re-frame.core :as re-frame] + [status-im.hardwallet.ios-keycard :as ios-keycard] + [status-im.hardwallet.keycard :as keycard] + [status-im.hardwallet.real-keycard :as real-keycard] + [status-im.hardwallet.simulated-keycard :as simulated-keycard] + [status-im.utils.config :as config] + [status-im.utils.platform :as platform] + [taoensso.timbre :as log])) (defonce card (if config/keycard-test-menu-enabled? (simulated-keycard/SimulatedKeycard.) @@ -392,7 +390,7 @@ (error-object->map response)]))})) (defn sign-typed-data - [{:keys [hash] :as args}] + [{:keys [hash]}] (log/info "[keycard] sign-typed-data") (keycard/sign-typed-data card diff --git a/src/status_im/hardwallet/common.cljs b/src/status_im/hardwallet/common.cljs index 396aa9472b..1efff71212 100644 --- a/src/status_im/hardwallet/common.cljs +++ b/src/status_im/hardwallet/common.cljs @@ -1,18 +1,16 @@ (ns status-im.hardwallet.common (:require [clojure.string :as string] [re-frame.core :as re-frame] - [status-im.ui.screens.keycard.keycard-interaction :as keycard-sheet] [status-im.ethereum.core :as ethereum] + [status-im.hardwallet.nfc :as nfc] [status-im.i18n :as i18n] [status-im.navigation :as navigation] - [status-im.utils.config :as config] - [status-im.utils.fx :as fx] - [status-im.utils.platform :as platform] - [status-im.utils.types :as types] - [taoensso.timbre :as log] [status-im.ui.components.bottom-sheet.events :as bottom-sheet] + [status-im.ui.screens.keycard.keycard-interaction :as keycard-sheet] + [status-im.utils.fx :as fx] [status-im.utils.keychain.core :as keychain] - [status-im.hardwallet.nfc :as nfc])) + [status-im.utils.types :as types] + [taoensso.timbre :as log])) (def default-pin "000000") diff --git a/src/status_im/hardwallet/core.cljs b/src/status_im/hardwallet/core.cljs index 3af277baca..633efe48bc 100644 --- a/src/status_im/hardwallet/core.cljs +++ b/src/status_im/hardwallet/core.cljs @@ -1,24 +1,19 @@ (ns status-im.hardwallet.core - (:require [status-im.multiaccounts.create.core :as multiaccounts.create] + (:require [status-im.hardwallet.change-pin :as change-pin] + [status-im.hardwallet.common :as common] + [status-im.hardwallet.login :as login] + [status-im.hardwallet.mnemonic :as mnemonic] + [status-im.hardwallet.onboarding :as onboarding] + [status-im.hardwallet.recovery :as recovery] + [status-im.hardwallet.sign :as sign] + [status-im.hardwallet.wallet :as wallet] [status-im.i18n :as i18n] + [status-im.multiaccounts.recover.core :as multiaccounts.recover] + [status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.navigation :as navigation] [status-im.utils.datetime :as utils.datetime] [status-im.utils.fx :as fx] - [status-im.hardwallet.login :as login] - [status-im.hardwallet.sign :as sign] - [status-im.hardwallet.change-pin :as change-pin] - [status-im.hardwallet.mnemonic :as mnemonic] - [status-im.hardwallet.recovery :as recovery] - [status-im.hardwallet.onboarding :as onboarding] - [status-im.hardwallet.common :as common] - status-im.hardwallet.unpair - status-im.hardwallet.export-key - status-im.hardwallet.delete-key - [status-im.hardwallet.wallet :as wallet] - [taoensso.timbre :as log] - status-im.hardwallet.fx - [status-im.multiaccounts.update.core :as multiaccounts.update] - [status-im.multiaccounts.recover.core :as multiaccounts.recover])) + [taoensso.timbre :as log])) (fx/defn show-keycard-has-multiaccount-alert [{:keys [db] :as cofx}] diff --git a/src/status_im/hardwallet/core_test.cljs b/src/status_im/hardwallet/core_test.cljs index 77394b68c8..04ae70a024 100644 --- a/src/status_im/hardwallet/core_test.cljs +++ b/src/status_im/hardwallet/core_test.cljs @@ -1,6 +1,4 @@ -(ns status-im.hardwallet.core-test - (:require [cljs.test :refer-macros [deftest is testing]] - [status-im.hardwallet.core :as hardwallet])) +(ns status-im.hardwallet.core-test) ;;TODO re-enable after fixing hardwallet flow #_(deftest process-pin-input diff --git a/src/status_im/hardwallet/simulated_keycard.cljs b/src/status_im/hardwallet/simulated_keycard.cljs index b9c4c403e8..90396e9338 100644 --- a/src/status_im/hardwallet/simulated_keycard.cljs +++ b/src/status_im/hardwallet/simulated_keycard.cljs @@ -1,12 +1,11 @@ (ns status-im.hardwallet.simulated-keycard - (:require [status-im.hardwallet.keycard :as keycard] - [status-im.utils.utils :as utils] + (:require [re-frame.db :as re-frame.db] [status-im.constants :as constants] - [taoensso.timbre :as log] [status-im.ethereum.core :as ethereum] + [status-im.hardwallet.keycard :as keycard] [status-im.native-module.core :as status] [status-im.utils.types :as types] - [re-frame.db :as re-frame.db])) + [status-im.utils.utils :as utils])) (def initial-state {:card-connected? false diff --git a/src/status_im/i18n_resources.cljs b/src/status_im/i18n_resources.cljs index edc4deea30..4c0806c2ff 100644 --- a/src/status_im/i18n_resources.cljs +++ b/src/status_im/i18n_resources.cljs @@ -18,4 +18,4 @@ (into {}))) ;; API compatibility -(defn load-language [lang]) +(defn load-language [_]) diff --git a/src/status_im/i18n_test.cljs b/src/status_im/i18n_test.cljs index 852baa6750..b4b1192484 100644 --- a/src/status_im/i18n_test.cljs +++ b/src/status_im/i18n_test.cljs @@ -1035,7 +1035,7 @@ (defn locale->checkpoint [locale] (let [locale-labels (locale->labels locale) checkpoint (->> checkpoints-def - (filter (fn [[checkpoint checkpoint-labels]] + (filter (fn [[_ checkpoint-labels]] (set/subset? checkpoint-labels locale-labels))) ffirst)] checkpoint)) diff --git a/src/status_im/init/core.cljs b/src/status_im/init/core.cljs index 975b72dcf6..45dd03b465 100644 --- a/src/status_im/init/core.cljs +++ b/src/status_im/init/core.cljs @@ -8,13 +8,14 @@ [status-im.ui.components.colors :as colors] [status-im.db :refer [app-db]] [status-im.utils.fx :as fx] - [status-im.utils.platform :as platform] [status-im.utils.theme :as theme])) (fx/defn initialize-app-db "Initialize db to initial state" - [{{:keys [hardwallet initial-props desktop/desktop - supported-biometric-auth network/type app-active-since]} :db now :now}] + [{{:keys [hardwallet initial-props supported-biometric-auth app-active-since] + :desktop/keys [desktop] + :network/keys [type]} :db + now :now}] {:db (assoc app-db :initial-props initial-props :desktop/desktop (merge desktop (:desktop/desktop app-db)) diff --git a/src/status_im/ios/platform.cljs b/src/status_im/ios/platform.cljs index 2a0a32a973..85c6a59997 100644 --- a/src/status_im/ios/platform.cljs +++ b/src/status_im/ios/platform.cljs @@ -6,9 +6,9 @@ (def xs-height 896) (defn iphone-x-dimensions? [] - (let [{:keys [width height]} (-> Dimensions - (.get "window") - (js->clj :keywordize-keys true))] + (let [{:keys [height]} (-> Dimensions + (.get "window") + (js->clj :keywordize-keys true))] (or (= height x-height) (= height xs-height)))) (def platform-specific diff --git a/src/status_im/ipfs/core.cljs b/src/status_im/ipfs/core.cljs index 2a505a82f7..e73fb0bdc2 100644 --- a/src/status_im/ipfs/core.cljs +++ b/src/status_im/ipfs/core.cljs @@ -4,8 +4,8 @@ ;; we currently use an ipfs gateway but this detail is not relevant ;; outside of this namespace -(def ^:const ipfs-add-url "https://ipfs.infura.io:5001/api/v0/add?cid-version=1") -(def ^:const ipfs-cat-url "https://ipfs.infura.io/ipfs/") +(def ipfs-add-url "https://ipfs.infura.io:5001/api/v0/add?cid-version=1") +(def ipfs-cat-url "https://ipfs.infura.io/ipfs/") (fx/defn cat [cofx {:keys [hash on-success on-failure]}] diff --git a/src/status_im/mailserver/core.cljs b/src/status_im/mailserver/core.cljs index 53e3571491..85f6a097de 100644 --- a/src/status_im/mailserver/core.cljs +++ b/src/status_im/mailserver/core.cljs @@ -1,17 +1,17 @@ (ns ^{:doc "Mailserver events and API"} status-im.mailserver.core (:require [clojure.string :as string] + [clojure.set :as clojure.set] [re-frame.core :as re-frame] [status-im.data-store.mailservers :as data-store.mailservers] [status-im.ethereum.json-rpc :as json-rpc] - [status-im.waku.core :as waku] - [status-im.node.core :as node] [status-im.i18n :as i18n] [status-im.mailserver.constants :as constants] [status-im.mailserver.topics :as mailserver.topics] [status-im.multiaccounts.model :as multiaccounts.model] [status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.native-module.core :as status] + [status-im.node.core :as node] [status-im.transport.utils :as transport.utils] [status-im.ui.screens.mobile-network-settings.utils :as @@ -23,6 +23,7 @@ [status-im.utils.platform :as platform] [status-im.utils.random :as rand] [status-im.utils.utils :as utils] + [status-im.waku.core :as waku] [taoensso.timbre :as log])) ;; How do mailserver work ? @@ -73,9 +74,7 @@ (defn get-selected-mailserver "Use the preferred mailserver if set & exists" [db] - (let [current-fleet (node/current-fleet-key db) - current-id (:mailserver/current-id db) - preference (preferred-mailserver-id db)] + (let [preference (preferred-mailserver-id db)] (when (and preference (fetch db preference)) preference))) @@ -320,7 +319,7 @@ adjusted-from)) (defn chats->never-synced-public-chats [chats] - (into {} (filter (fn [[k v]] (:might-have-join-time-messages? v)) chats))) + (into {} (filter (fn [[_ v]] (:might-have-join-time-messages? v)) chats))) (fx/defn handle-request-success [{{:keys [chats] :as db} :db} {:keys [request-id topics]}] @@ -396,7 +395,7 @@ (defn get-mailserver-when-ready "return the mailserver if the mailserver is ready" - [{:keys [db] :as cofx}] + [{:keys [db]}] (let [{:keys [sym-key-id] :as mailserver} (fetch-current db) mailserver-state (:mailserver/state db)] (when (and (= :connected mailserver-state) @@ -686,7 +685,7 @@ #(log/error "failed to save chat request range" %)}) (vals updated-ranges))}))) -(defn prepare-new-gaps [new-gaps ranges {:keys [from to] :as req} chat-ids] +(defn prepare-new-gaps [new-gaps ranges {:keys [from to]} chat-ids] (into {} (comp diff --git a/src/status_im/mailserver/core_test.cljs b/src/status_im/mailserver/core_test.cljs index 2817228d21..26833c62b2 100644 --- a/src/status_im/mailserver/core_test.cljs +++ b/src/status_im/mailserver/core_test.cljs @@ -2,9 +2,9 @@ (:require [cljs.test :refer-macros [deftest is testing]] [clojure.string :as string] [status-im.ethereum.json-rpc :as json-rpc] - [status-im.transport.utils :as utils] - [status-im.mailserver.core :as mailserver] [status-im.mailserver.constants :as constants] + [status-im.mailserver.core :as mailserver] + [status-im.transport.utils :as utils] [status-im.utils.random :as rand])) (def enode "enode://08d8eb6177b187049f6c97ed3f6c74fbbefb94c7ad10bafcaf4b65ce89c314dcfee0a8bc4e7a5b824dfa08b45b360cc78f34f0aff981f8386caa07652d2e601b@163.172.177.138:40404") @@ -101,12 +101,12 @@ (is (= {:address "enode://some-id@206.189.56.154:30504" :password "the-password" :user-defined true} - (mailserver/address->mailserver address))))) + (#'status-im.mailserver.core/address->mailserver address))))) (testing "without password" (let [address "enode://some-id@206.189.56.154:30504"] (is (= {:address "enode://some-id@206.189.56.154:30504" :user-defined true} - (mailserver/address->mailserver address)))))) + (#'status-im.mailserver.core/address->mailserver address)))))) (deftest set-input (testing "it validates names" @@ -638,181 +638,180 @@ first))))))) (deftest check-existing-gaps - (let [] - (testing "no gaps" - (is (= {} - (mailserver/check-existing-gaps - :chat-id - nil - {:from 1 - :to 2})))) - (testing "request before gaps" - (is (= {} - (mailserver/check-existing-gaps - :chat-id - {:g1 {:from 10 - :to 20 - :id :g1} - :g2 {:from 30 - :to 40 - :id :g2} - :g3 {:from 50 - :to 60 - :id :g3}} - {:from 1 - :to 2})))) - (testing "request between gaps" - (is (= {} - (mailserver/check-existing-gaps - :chat-id - {:g1 {:from 10 - :to 20 - :id :g1} - :g2 {:from 30 - :to 40 - :id :g2} - :g3 {:from 50 - :to 60 - :id :g3}} - {:from 22 - :to 28})))) - (testing "request between gaps" - (is (= {} - (mailserver/check-existing-gaps - :chat-id - {:g1 {:from 10 - :to 20 - :id :g1} - :g2 {:from 30 - :to 40 - :id :g2} - :g3 {:from 50 - :to 60 - :id :g3}} - {:from 22 - :to 28})))) - (testing "request after gaps" - (is (= {} - (mailserver/check-existing-gaps - :chat-id - {:g1 {:from 10 - :to 20 - :id :g1} - :g2 {:from 30 - :to 40 - :id :g2} - :g3 {:from 50 - :to 60 - :id :g3}} - {:from 70 - :to 80})))) - (testing "request covers all gaps" - (is (= {:deleted-gaps [:g3 :g2 :g1]} - (mailserver/check-existing-gaps - :chat-id - {:g1 {:from 10 - :to 20 - :id :g1} - :g2 {:from 30 - :to 40 - :id :g2} - :g3 {:from 50 - :to 60 - :id :g3}} - {:from 10 - :to 60})))) - (testing "request splits gap in two" - (is (= {:deleted-gaps [:g1] - :new-gaps [{:chat-id :chat-id :from 10 :to 12} - {:chat-id :chat-id :from 18 :to 20}]} - (mailserver/check-existing-gaps - :chat-id - {:g1 {:from 10 - :to 20 - :id :g1} - :g2 {:from 30 - :to 40 - :id :g2} - :g3 {:from 50 - :to 60 - :id :g3}} - {:from 12 - :to 18})))) - (testing "request partially covers one gap #1" - (is (= {:updated-gaps {:g1 {:from 15 - :to 20 - :id :g1}}} - (mailserver/check-existing-gaps - :chat-id - {:g1 {:from 10 - :to 20 - :id :g1} - :g2 {:from 30 - :to 40 - :id :g2} - :g3 {:from 50 - :to 60 - :id :g3}} - {:from 8 - :to 15})))) - (testing "request partially covers one gap #2" - (is (= {:updated-gaps {:g1 {:from 10 - :to 15 - :id :g1}}} - (mailserver/check-existing-gaps - :chat-id - {:g1 {:from 10 - :to 20 - :id :g1} - :g2 {:from 30 - :to 40 - :id :g2} - :g3 {:from 50 - :to 60 - :id :g3}} - {:from 15 - :to 25})))) - (testing "request partially covers two gaps #2" - (is (= {:updated-gaps {:g1 {:from 10 - :to 15 - :id :g1} - :g2 {:from 35 - :to 40 - :id :g2}}} - (mailserver/check-existing-gaps - :chat-id - {:g1 {:from 10 - :to 20 - :id :g1} - :g2 {:from 30 - :to 40 - :id :g2} - :g3 {:from 50 - :to 60 - :id :g3}} - {:from 15 - :to 35})))) - (testing "request covers one gap and two other partially" - (is (= {:updated-gaps {:g1 {:from 10 - :to 15 - :id :g1} - :g3 {:from 55 - :to 60 - :id :g3}} - :deleted-gaps [:g2]} - (mailserver/check-existing-gaps - :chat-id - {:g1 {:from 10 - :to 20 - :id :g1} - :g2 {:from 30 - :to 40 - :id :g2} - :g3 {:from 50 - :to 60 - :id :g3}} - {:from 15 - :to 55})))))) + (testing "no gaps" + (is (= {} + (mailserver/check-existing-gaps + :chat-id + nil + {:from 1 + :to 2})))) + (testing "request before gaps" + (is (= {} + (mailserver/check-existing-gaps + :chat-id + {:g1 {:from 10 + :to 20 + :id :g1} + :g2 {:from 30 + :to 40 + :id :g2} + :g3 {:from 50 + :to 60 + :id :g3}} + {:from 1 + :to 2})))) + (testing "request between gaps" + (is (= {} + (mailserver/check-existing-gaps + :chat-id + {:g1 {:from 10 + :to 20 + :id :g1} + :g2 {:from 30 + :to 40 + :id :g2} + :g3 {:from 50 + :to 60 + :id :g3}} + {:from 22 + :to 28})))) + (testing "request between gaps" + (is (= {} + (mailserver/check-existing-gaps + :chat-id + {:g1 {:from 10 + :to 20 + :id :g1} + :g2 {:from 30 + :to 40 + :id :g2} + :g3 {:from 50 + :to 60 + :id :g3}} + {:from 22 + :to 28})))) + (testing "request after gaps" + (is (= {} + (mailserver/check-existing-gaps + :chat-id + {:g1 {:from 10 + :to 20 + :id :g1} + :g2 {:from 30 + :to 40 + :id :g2} + :g3 {:from 50 + :to 60 + :id :g3}} + {:from 70 + :to 80})))) + (testing "request covers all gaps" + (is (= {:deleted-gaps [:g3 :g2 :g1]} + (mailserver/check-existing-gaps + :chat-id + {:g1 {:from 10 + :to 20 + :id :g1} + :g2 {:from 30 + :to 40 + :id :g2} + :g3 {:from 50 + :to 60 + :id :g3}} + {:from 10 + :to 60})))) + (testing "request splits gap in two" + (is (= {:deleted-gaps [:g1] + :new-gaps [{:chat-id :chat-id :from 10 :to 12} + {:chat-id :chat-id :from 18 :to 20}]} + (mailserver/check-existing-gaps + :chat-id + {:g1 {:from 10 + :to 20 + :id :g1} + :g2 {:from 30 + :to 40 + :id :g2} + :g3 {:from 50 + :to 60 + :id :g3}} + {:from 12 + :to 18})))) + (testing "request partially covers one gap #1" + (is (= {:updated-gaps {:g1 {:from 15 + :to 20 + :id :g1}}} + (mailserver/check-existing-gaps + :chat-id + {:g1 {:from 10 + :to 20 + :id :g1} + :g2 {:from 30 + :to 40 + :id :g2} + :g3 {:from 50 + :to 60 + :id :g3}} + {:from 8 + :to 15})))) + (testing "request partially covers one gap #2" + (is (= {:updated-gaps {:g1 {:from 10 + :to 15 + :id :g1}}} + (mailserver/check-existing-gaps + :chat-id + {:g1 {:from 10 + :to 20 + :id :g1} + :g2 {:from 30 + :to 40 + :id :g2} + :g3 {:from 50 + :to 60 + :id :g3}} + {:from 15 + :to 25})))) + (testing "request partially covers two gaps #2" + (is (= {:updated-gaps {:g1 {:from 10 + :to 15 + :id :g1} + :g2 {:from 35 + :to 40 + :id :g2}}} + (mailserver/check-existing-gaps + :chat-id + {:g1 {:from 10 + :to 20 + :id :g1} + :g2 {:from 30 + :to 40 + :id :g2} + :g3 {:from 50 + :to 60 + :id :g3}} + {:from 15 + :to 35})))) + (testing "request covers one gap and two other partially" + (is (= {:updated-gaps {:g1 {:from 10 + :to 15 + :id :g1} + :g3 {:from 55 + :to 60 + :id :g3}} + :deleted-gaps [:g2]} + (mailserver/check-existing-gaps + :chat-id + {:g1 {:from 10 + :to 20 + :id :g1} + :g2 {:from 30 + :to 40 + :id :g2} + :g3 {:from 50 + :to 60 + :id :g3}} + {:from 15 + :to 55}))))) (defn rand-guid [] (let [gap-id (atom 0)] diff --git a/src/status_im/mailserver/topics.cljs b/src/status_im/mailserver/topics.cljs index 19b441d457..3476fda576 100644 --- a/src/status_im/mailserver/topics.cljs +++ b/src/status_im/mailserver/topics.cljs @@ -1,6 +1,7 @@ (ns ^{:doc "Mailserver events and API"} status-im.mailserver.topics - (:require [status-im.ethereum.json-rpc :as json-rpc] + (:require [clojure.set :as clojure.set] + [status-im.ethereum.json-rpc :as json-rpc] [status-im.mailserver.constants :as constants] [status-im.utils.fx :as fx] [taoensso.timbre :as log])) @@ -130,7 +131,7 @@ Returns those topic that had chat-id but the member is not there anymore" [topics chat-id members] (reduce - (fn [acc {:keys [discovery? chat-ids] :as topic}] + (fn [acc {:keys [chat-ids] :as topic}] (cond (some chat-ids members) (update acc :modified conj (assoc topic diff --git a/src/status_im/mailserver/topics_test.cljs b/src/status_im/mailserver/topics_test.cljs index 25dc87b29f..d4d2a90528 100644 --- a/src/status_im/mailserver/topics_test.cljs +++ b/src/status_im/mailserver/topics_test.cljs @@ -1,9 +1,7 @@ (ns status-im.mailserver.topics-test (:require [cljs.test :refer-macros [deftest is testing]] - [status-im.transport.utils :as utils] [status-im.mailserver.constants :as c] - [status-im.mailserver.topics :as t] - [status-im.utils.random :as rand])) + [status-im.mailserver.topics :as t])) (def now-s 100000) diff --git a/src/status_im/multiaccounts/biometric/core.cljs b/src/status_im/multiaccounts/biometric/core.cljs index 6feee8f367..a8b6ce56fe 100644 --- a/src/status_im/multiaccounts/biometric/core.cljs +++ b/src/status_im/multiaccounts/biometric/core.cljs @@ -1,18 +1,14 @@ (ns status-im.multiaccounts.biometric.core - (:require - [status-im.utils.fx :as fx] - [status-im.utils.types :as types] - [clojure.string :as string] - [status-im.popover.core :as popover] - [status-im.native-module.core :as status] - [status-im.utils.platform :as platform] - [status-im.ui.components.colors :as colors] - [status-im.i18n :as i18n] - [re-frame.core :as re-frame] - [status-im.ethereum.json-rpc :as json-rpc] - [status-im.utils.keychain.core :as keychain] - [taoensso.timbre :as log] - ["react-native-touch-id" :default touchid])) + (:require [re-frame.core :as re-frame] + [status-im.i18n :as i18n] + [status-im.native-module.core :as status] + [status-im.popover.core :as popover] + [status-im.ui.components.colors :as colors] + [status-im.utils.fx :as fx] + [status-im.utils.keychain.core :as keychain] + [status-im.utils.platform :as platform] + [taoensso.timbre :as log] + ["react-native-touch-id" :default touchid])) ;; currently, for android, react-native-touch-id ;; is not returning supported biometric type diff --git a/src/status_im/multiaccounts/core.cljs b/src/status_im/multiaccounts/core.cljs index 9b62270cc7..0b15e18aec 100644 --- a/src/status_im/multiaccounts/core.cljs +++ b/src/status_im/multiaccounts/core.cljs @@ -8,7 +8,6 @@ [status-im.ui.components.colors :as colors] [status-im.utils.fx :as fx] [status-im.utils.gfycat.core :as gfycat] - status-im.utils.handlers [status-im.utils.identicon :as identicon] [status-im.utils.theme :as theme])) @@ -40,11 +39,6 @@ (fn [flag] (native-module/set-blank-preview-flag flag))) -(defn- chat-send? [transaction] - (and (seq transaction) - (not (:in-progress? transaction)) - (:from-chat? transaction))) - (fx/defn confirm-wallet-set-up [cofx] (multiaccounts.update/multiaccount-update cofx diff --git a/src/status_im/multiaccounts/create/core.cljs b/src/status_im/multiaccounts/create/core.cljs index c193c7c1b4..4cd29fbe1d 100644 --- a/src/status_im/multiaccounts/create/core.cljs +++ b/src/status_im/multiaccounts/create/core.cljs @@ -5,24 +5,21 @@ [status-im.data-store.settings :as data-store.settings] [status-im.ethereum.core :as ethereum] [status-im.ethereum.eip55 :as eip55] - [taoensso.timbre :as log] - [status-im.i18n :as i18n] [status-im.hardwallet.nfc :as nfc] + [status-im.i18n :as i18n] [status-im.multiaccounts.db :as db] [status-im.native-module.core :as status] [status-im.node.core :as node] + [status-im.ui.components.bottom-sheet.core :as bottom-sheet] [status-im.ui.components.colors :as colors] [status-im.navigation :as navigation] [status-im.utils.fx :as fx] - [status-im.utils.gfycat.core :as gfycat] - [status-im.utils.identicon :as identicon] + [status-im.utils.platform :as platform] [status-im.utils.security :as security] [status-im.utils.signing-phrase.core :as signing-phrase] [status-im.utils.types :as types] [status-im.utils.utils :as utils] - [status-im.utils.platform :as platform] - [status-im.ui.components.bottom-sheet.core :as bottom-sheet] - [status-im.constants :as const])) + [taoensso.timbre :as log])) (def step-kw-to-num {:generate-key 1 diff --git a/src/status_im/multiaccounts/login/core.cljs b/src/status_im/multiaccounts/login/core.cljs index 1762701d99..5c2c5b30b2 100644 --- a/src/status_im/multiaccounts/login/core.cljs +++ b/src/status_im/multiaccounts/login/core.cljs @@ -1,14 +1,20 @@ (ns status-im.multiaccounts.login.core (:require [re-frame.core :as re-frame] [status-im.chat.models.loading :as chat.loading] + [status-im.chat.models.message-seen :as message-seen] [status-im.contact.core :as contact] + [status-im.data-store.settings :as data-store.settings] [status-im.ethereum.core :as ethereum] + [status-im.ethereum.eip55 :as eip55] [status-im.ethereum.json-rpc :as json-rpc] [status-im.fleet.core :as fleet] [status-im.i18n :as i18n] + [status-im.multiaccounts.biometric.core :as biometric] + [status-im.multiaccounts.core :as multiaccounts] [status-im.native-module.core :as status] [status-im.node.core :as node] [status-im.notifications.core :as notifications] + [status-im.popover.core :as popover] [status-im.protocol.core :as protocol] [status-im.stickers.core :as stickers] [status-im.ui.screens.mobile-network-settings.events :as mobile-network] @@ -16,27 +22,21 @@ [status-im.utils.config :as config] [status-im.utils.fx :as fx] [status-im.utils.handlers :as handlers] + [status-im.utils.identicon :as identicon] [status-im.utils.keychain.core :as keychain] [status-im.utils.platform :as platform] [status-im.utils.security :as security] [status-im.utils.types :as types] [status-im.utils.utils :as utils] [status-im.wallet.core :as wallet] - [taoensso.timbre :as log] - [status-im.multiaccounts.biometric.core :as biometric] - [status-im.utils.identicon :as identicon] - [status-im.ethereum.eip55 :as eip55] - [status-im.popover.core :as popover] - [status-im.multiaccounts.core :as multiaccounts] - [status-im.data-store.settings :as data-store.settings] [status-im.wallet.prices :as prices] - [status-im.chat.models.message-seen :as message-seen])) + [taoensso.timbre :as log])) (def rpc-endpoint "https://goerli.infura.io/v3/f315575765b14720b32382a61a89341a") (def contract-address "0xfbf4c8e2B41fAfF8c616a0E49Fb4365a5355Ffaf") (def contract-fleet? #{:eth.contract}) -(defn fetch-nodes [current-fleet resolve reject] +(defn fetch-nodes [current-fleet resolve _] (let [default-nodes (-> (node/fleets {}) (get-in [:eth.staging :mail]) vals)] @@ -47,7 +47,7 @@ rpc-endpoint contract-address (handlers/response-handler resolve - (fn [error] + (fn [_] (log/warn "could not fetch nodes from contract defaulting to eth.staging") (resolve default-nodes))))) (resolve default-nodes)))) @@ -171,7 +171,7 @@ (.then (fn [[accounts custom-tokens]] (callback accounts (mapv #(update % :symbol keyword) custom-tokens)))) - (.catch (fn [error] + (.catch (fn [_] (log/error "Failed to initialize wallet")))))) (fx/defn initialize-appearance [cofx] @@ -180,8 +180,9 @@ (fx/defn get-settings-callback {:events [::get-settings-callback]} [{:keys [db] :as cofx} settings] - (let [{:keys [address notifications-enabled? - networks/current-network networks/networks] :as settings} + (let [{:keys [address notifications-enabled?] + :networks/keys [current-network networks] + :as settings} (data-store.settings/rpc->settings settings) multiaccount (dissoc settings :networks/current-network :networks/networks) network-id (str (get-in networks [current-network :config :NetworkId]))] diff --git a/src/status_im/multiaccounts/login/flow_test.cljs b/src/status_im/multiaccounts/login/flow_test.cljs index c118f8cb95..bf1bbf30ca 100644 --- a/src/status_im/multiaccounts/login/flow_test.cljs +++ b/src/status_im/multiaccounts/login/flow_test.cljs @@ -5,8 +5,8 @@ (:require [cljs.test :refer-macros [deftest is testing]] [status-im.ethereum.core :as ethereum] [status-im.ethereum.json-rpc :as json-rpc] - [status-im.multiaccounts.login.core :as login.core] - [status-im.multiaccount.login.data-test :as data])) + [status-im.multiaccount.login.data-test :as data] + [status-im.multiaccounts.login.core :as login.core])) (deftest on-password-input-submitted (testing @@ -28,9 +28,7 @@ :password "password"} :multiaccount data/multiaccount} cofx {:db db} - login-result "{\"error\":\"\"}" efx (login.core/multiaccount-login-success cofx) - new-db (:db efx) json-rpc (into #{} (map :method (::json-rpc/call efx)))] ;; TODO: Account is now cleared only after all sign in fx are executed. ;; (testing ":accounts/login cleared." diff --git a/src/status_im/multiaccounts/logout/core.cljs b/src/status_im/multiaccounts/logout/core.cljs index 2f6f1c42d5..2b40c4f1cc 100644 --- a/src/status_im/multiaccounts/logout/core.cljs +++ b/src/status_im/multiaccounts/logout/core.cljs @@ -6,7 +6,6 @@ [status-im.native-module.core :as status] [status-im.transport.core :as transport] [status-im.utils.fx :as fx] - [status-im.navigation :as navigation] [status-im.utils.keychain.core :as keychain])) (fx/defn logout-method diff --git a/src/status_im/multiaccounts/update/core.cljs b/src/status_im/multiaccounts/update/core.cljs index d98c4eaf59..19477b4d0e 100644 --- a/src/status_im/multiaccounts/update/core.cljs +++ b/src/status_im/multiaccounts/update/core.cljs @@ -1,10 +1,6 @@ (ns status-im.multiaccounts.update.core - (:require [status-im.contact.db :as contact.db] - [status-im.utils.config :as config] - [status-im.ethereum.json-rpc :as json-rpc] - [status-im.transport.message.protocol :as protocol] + (:require [status-im.ethereum.json-rpc :as json-rpc] [status-im.utils.fx :as fx] - [status-im.utils.types :as types] [taoensso.timbre :as log])) (fx/defn send-multiaccount-update [{:keys [db] :as cofx}] diff --git a/src/status_im/multiaccounts/update/publisher.cljs b/src/status_im/multiaccounts/update/publisher.cljs index e3f6a7a875..1d70183ea9 100644 --- a/src/status_im/multiaccounts/update/publisher.cljs +++ b/src/status_im/multiaccounts/update/publisher.cljs @@ -1,20 +1,14 @@ (ns status-im.multiaccounts.update.publisher - (:require [taoensso.timbre :as log] - [re-frame.core :as re-frame] - [status-im.waku.core :as waku] - [status-im.utils.config :as config] - [status-im.constants :as constants] - [status-im.multiaccounts.update.core :as multiaccounts] + (:require [re-frame.core :as re-frame] [status-im.ethereum.json-rpc :as json-rpc] - [status-im.pairing.core :as pairing] - [status-im.transport.shh :as shh])) + [status-im.waku.core :as waku] + [taoensso.timbre :as log])) ;; Publish updates every 48 hours (def publish-updates-interval (* 48 60 60 1000)) (defn publish-update! [{:keys [db now] :as cofx}] - (let [my-public-key (get-in db [:multiaccount :public-key]) - peers-count (:peers-count db) + (let [peers-count (:peers-count db) last-updated (get-in db [:multiaccount :last-updated])] @@ -23,7 +17,7 @@ (< publish-updates-interval (- now last-updated))) (let [multiaccount (:multiaccount db) - {:keys [name preferred-name photo-path address]} multiaccount] + {:keys [name preferred-name photo-path]} multiaccount] (log/debug "sending contact updates") (json-rpc/call {:method (json-rpc/call-ext-method (waku/enabled? cofx) "sendContactUpdates") diff --git a/src/status_im/native_module/core.cljs b/src/status_im/native_module/core.cljs index bc531b36d0..8ad515f811 100644 --- a/src/status_im/native_module/core.cljs +++ b/src/status_im/native_module/core.cljs @@ -1,6 +1,5 @@ (ns status-im.native-module.core - (:require [clojure.string :as string] - [re-frame.core :as re-frame] + (:require [re-frame.core :as re-frame] [status-im.utils.db :as utils.db] [status-im.ui.components.react :as react] [status-im.utils.platform :as platform] diff --git a/src/status_im/network/core_test.cljs b/src/status_im/network/core_test.cljs index 2fdf533907..42874af068 100644 --- a/src/status_im/network/core_test.cljs +++ b/src/status_im/network/core_test.cljs @@ -1,8 +1,7 @@ (ns status-im.network.core-test (:require [cljs.test :refer-macros [deftest is testing]] [status-im.ethereum.json-rpc :as json-rpc] - [status-im.network.core :as network.core] - [reagent.core :as reagent])) + [status-im.network.core :as network.core])) (deftest valid-rpc-url-test (testing "nil?" diff --git a/src/status_im/network/net_info.cljs b/src/status_im/network/net_info.cljs index a879c388ab..8a588825ab 100644 --- a/src/status_im/network/net_info.cljs +++ b/src/status_im/network/net_info.cljs @@ -1,12 +1,8 @@ (ns status-im.network.net-info - (:require [taoensso.timbre :as log] - [status-im.utils.platform :as platform] - [re-frame.core :as re-frame] - [status-im.utils.fx :as fx] - [status-im.mailserver.core :as mailserver] - [status-im.chaos-mode.core :as chaos-mode] + (:require [re-frame.core :as re-frame] [status-im.native-module.core :as status] [status-im.ui.screens.mobile-network-settings.events :as mobile-network] + [status-im.utils.fx :as fx] [status-im.wallet.core :as wallet] ["@react-native-community/netinfo" :default net-info])) diff --git a/src/status_im/network/ui/edit_network/views.cljs b/src/status_im/network/ui/edit_network/views.cljs index 0e9055acaa..cd7a8c15b4 100644 --- a/src/status_im/network/ui/edit_network/views.cljs +++ b/src/status_im/network/ui/edit_network/views.cljs @@ -1,18 +1,16 @@ (ns status-im.network.ui.edit-network.views - (:require-macros [status-im.utils.views :as views]) - (:require - [re-frame.core :as re-frame] - [status-im.ui.components.react :as react] - [status-im.i18n :as i18n] - [status-im.ui.components.styles :as components.styles] - [status-im.ui.components.common.common :as components.common] - [status-im.ui.components.toolbar.view :as toolbar] - [status-im.ui.components.list.views :as list] - [status-im.ui.components.text-input.view :as text-input] - [status-im.network.core :as network] - [status-im.network.ui.edit-network.styles :as styles] - [clojure.string :as string] - [status-im.ui.components.topbar :as topbar])) + (:require [clojure.string :as string] + [re-frame.core :as re-frame] + [status-im.i18n :as i18n] + [status-im.network.core :as network] + [status-im.network.ui.edit-network.styles :as styles] + [status-im.ui.components.common.common :as components.common] + [status-im.ui.components.list.views :as list] + [status-im.ui.components.react :as react] + [status-im.ui.components.styles :as components.styles] + [status-im.ui.components.text-input.view :as text-input] + [status-im.ui.components.topbar :as topbar]) + (:require-macros [status-im.utils.views :as views])) (defn- render-network-type [manage-network type] (let [name (case type diff --git a/src/status_im/network/ui/network_details/views.cljs b/src/status_im/network/ui/network_details/views.cljs index 5ea37295d8..44203eecb4 100644 --- a/src/status_im/network/ui/network_details/views.cljs +++ b/src/status_im/network/ui/network_details/views.cljs @@ -1,15 +1,14 @@ (ns status-im.network.ui.network-details.views - (:require-macros [status-im.utils.views :as views]) (:require [re-frame.core :as re-frame] - [status-im.ui.components.toolbar.view :as toolbar] - [status-im.ui.components.react :as react] [status-im.i18n :as i18n] - [status-im.ui.components.styles :as components.styles] - [status-im.ui.components.common.common :as components.common] - [status-im.network.ui.styles :as st] [status-im.network.core :as network] + [status-im.network.ui.styles :as st] [status-im.network.ui.views :as network-settings] - [status-im.ui.components.topbar :as topbar])) + [status-im.ui.components.common.common :as components.common] + [status-im.ui.components.react :as react] + [status-im.ui.components.styles :as components.styles] + [status-im.ui.components.topbar :as topbar]) + (:require-macros [status-im.utils.views :as views])) (views/defview network-details [] (views/letsubs [{:keys [networks/selected-network]} [:get-screen-params] diff --git a/src/status_im/node/core.cljs b/src/status_im/node/core.cljs index 8840b5e4bc..cf54c5b20d 100644 --- a/src/status_im/node/core.cljs +++ b/src/status_im/node/core.cljs @@ -1,14 +1,13 @@ (ns status-im.node.core (:require [re-frame.core :as re-frame] [status-im.constants :as constants] + [status-im.ethereum.ens :as ens] [status-im.ethereum.json-rpc :as json-rpc] [status-im.native-module.core :as status] [status-im.utils.config :as config] [status-im.utils.fx :as fx] [status-im.utils.platform :as utils.platform] - [status-im.utils.types :as types] - [taoensso.timbre :as log] - [status-im.ethereum.ens :as ens])) + [status-im.utils.types :as types])) (defn- add-custom-bootnodes [config network all-bootnodes] (let [bootnodes (as-> all-bootnodes $ @@ -101,7 +100,7 @@ current-fleet (assoc :NoDiscovery false - :Rendezvous (not (empty? rendezvous-nodes)) + :Rendezvous (seq rendezvous-nodes) :ClusterConfig {:Enabled true :Fleet (name current-fleet-key) :BootNodes diff --git a/src/status_im/pairing/core.cljs b/src/status_im/pairing/core.cljs index b9c4430f3a..1ae2fdedb6 100644 --- a/src/status_im/pairing/core.cljs +++ b/src/status_im/pairing/core.cljs @@ -1,22 +1,13 @@ -(ns status-im.pairing.core (:require [clojure.string :as string] - [re-frame.core :as re-frame] - [status-im.chat.models :as models.chat] - [status-im.waku.core :as waku] - [status-im.contact.core :as contact] - [status-im.contact.db :as contact.db] - [taoensso.timbre :as log] - [status-im.ethereum.json-rpc :as json-rpc] - [status-im.i18n :as i18n] - [status-im.multiaccounts.model :as multiaccounts.model] - [status-im.multiaccounts.update.core :as multiaccounts.update] - [status-im.transport.message.protocol :as protocol] - [status-im.navigation :as navigation] - [status-im.utils.config :as config] - [status-im.utils.fx :as fx] - [status-im.utils.identicon :as identicon] - [status-im.utils.pairing :as pairing.utils] - [status-im.utils.platform :as utils.platform] - [status-im.utils.types :as types])) +(ns status-im.pairing.core + (:require [re-frame.core :as re-frame] + [status-im.ethereum.json-rpc :as json-rpc] + [status-im.i18n :as i18n] + [status-im.navigation :as navigation] + [status-im.utils.config :as config] + [status-im.utils.fx :as fx] + [status-im.utils.platform :as utils.platform] + [status-im.waku.core :as waku] + [taoensso.timbre :as log])) (defn enable-installation-rpc [waku-enabled? installation-id on-success on-failure] (json-rpc/call {:method (json-rpc/call-ext-method waku-enabled? "enableInstallation") diff --git a/src/status_im/privacy_policy/core.cljs b/src/status_im/privacy_policy/core.cljs index c3a95561a3..0e8c522708 100644 --- a/src/status_im/privacy_policy/core.cljs +++ b/src/status_im/privacy_policy/core.cljs @@ -3,7 +3,7 @@ [status-im.ui.components.react :as react] [status-im.utils.fx :as fx])) -(def ^:const privacy-policy-link "https://www.iubenda.com/privacy-policy/45710059") +(def privacy-policy-link "https://www.iubenda.com/privacy-policy/45710059") (defn open-privacy-policy-link! [] (.openURL ^js react/linking privacy-policy-link)) diff --git a/src/status_im/protocol/core.cljs b/src/status_im/protocol/core.cljs index 2b8cbd1af3..525e283996 100644 --- a/src/status_im/protocol/core.cljs +++ b/src/status_im/protocol/core.cljs @@ -21,7 +21,7 @@ [db mailserver-topics] (assoc db :mailserver/topics - (reduce (fn [acc {:keys [topic chat-ids] + (reduce (fn [acc {:keys [topic] :as mailserver-topic}] (assoc acc topic (update mailserver-topic :chat-ids diff --git a/src/status_im/reloader.cljs b/src/status_im/reloader.cljs index ea4e48e8c3..e219b90d3c 100644 --- a/src/status_im/reloader.cljs +++ b/src/status_im/reloader.cljs @@ -31,7 +31,7 @@ (reset! label "building") (reset! visible true)) -(defn reload-view [cnt] +(defn reload-view [_] (fn [cnt] (when @timeout (js/clearTimeout @timeout)) (when (not= @cnt-prev cnt) diff --git a/src/status_im/signals/core.cljs b/src/status_im/signals/core.cljs index 9e99f63732..74404daf92 100644 --- a/src/status_im/signals/core.cljs +++ b/src/status_im/signals/core.cljs @@ -2,14 +2,11 @@ (:require [status-im.ethereum.subscriptions :as ethereum.subscriptions] [status-im.i18n :as i18n] [status-im.mailserver.core :as mailserver] - [clojure.string :as string] [status-im.multiaccounts.login.core :as login] [status-im.multiaccounts.model :as multiaccounts.model] - [status-im.pairing.core :as pairing] [status-im.transport.filters.core :as transport.filters] [status-im.transport.message.core :as transport.message] [status-im.utils.fx :as fx] - [status-im.utils.types :as types] [taoensso.timbre :as log])) (fx/defn status-node-started diff --git a/src/status_im/signing/core.cljs b/src/status_im/signing/core.cljs index 5c1197182a..baacb4ea31 100644 --- a/src/status_im/signing/core.cljs +++ b/src/status_im/signing/core.cljs @@ -2,28 +2,24 @@ (:require [clojure.string :as string] [re-frame.core :as re-frame] [status-im.constants :as constants] - [status-im.utils.config :as config] - [status-im.waku.core :as waku] [status-im.ethereum.abi-spec :as abi-spec] - [status-im.ethereum.json-rpc :as json-rpc] [status-im.ethereum.core :as ethereum] [status-im.ethereum.eip55 :as eip55] + [status-im.ethereum.json-rpc :as json-rpc] [status-im.ethereum.tokens :as tokens] - [status-im.i18n :as i18n] - [status-im.signing.keycard :as signing.keycard] - [status-im.native-module.core :as status] - [status-im.utils.fx :as fx] [status-im.hardwallet.common :as hardwallet.common] - [status-im.hardwallet.sign :as hardwallet.sign] + [status-im.i18n :as i18n] + [status-im.native-module.core :as status] [status-im.signing.keycard :as signing.keycard] + [status-im.utils.fx :as fx] [status-im.utils.hex :as utils.hex] [status-im.utils.money :as money] [status-im.utils.security :as security] [status-im.utils.types :as types] [status-im.utils.utils :as utils] - [taoensso.timbre :as log] - [re-frame.core :as re-frame.core] - [status-im.wallet.prices :as prices])) + [status-im.waku.core :as waku] + [status-im.wallet.prices :as prices] + [taoensso.timbre :as log])) (re-frame/reg-fx :signing/send-transaction-fx @@ -269,7 +265,7 @@ {:data data :on-completed (fn [hash] - (re-frame.core/dispatch + (re-frame/dispatch [:hardwallet/sign-message {:tx-hash transaction-hash :message-id message-id diff --git a/src/status_im/signing/gas.cljs b/src/status_im/signing/gas.cljs index 4b2014df0b..750a1b4974 100644 --- a/src/status_im/signing/gas.cljs +++ b/src/status_im/signing/gas.cljs @@ -1,10 +1,10 @@ (ns status-im.signing.gas - (:require [status-im.utils.money :as money] - [status-im.utils.fx :as fx] + (:require [re-frame.core :as re-frame] + [status-im.ethereum.json-rpc :as json-rpc] [status-im.i18n :as i18n] [status-im.ui.components.bottom-sheet.core :as bottom-sheet] - [re-frame.core :as re-frame] - [status-im.ethereum.json-rpc :as json-rpc])) + [status-im.utils.fx :as fx] + [status-im.utils.money :as money])) (def min-gas-price-wei ^js (money/bignumber 1)) @@ -40,10 +40,11 @@ gas (get-in edit [:gas :value-number])] (assoc edit :max-fee (calculate-max-fee gas gasPrice)))) -(defn build-edit [edit-value key value] +(defn build-edit "Takes the previous edit, either :gas or :gas-price and a value as string. Wei for gas, and gwei for gas price. Validates them and sets max fee" + [edit-value key value] (let [^js bn-value (money/bignumber value) error-label-key (get-error-label-key key bn-value) data (if error-label-key diff --git a/src/status_im/signing/keycard.cljs b/src/status_im/signing/keycard.cljs index ad60496f04..c7c8e2c799 100644 --- a/src/status_im/signing/keycard.cljs +++ b/src/status_im/signing/keycard.cljs @@ -1,10 +1,9 @@ (ns status-im.signing.keycard (:require [re-frame.core :as re-frame] - [status-im.utils.fx :as fx] - [status-im.native-module.core :as status] - [status-im.utils.types :as types] [status-im.ethereum.abi-spec :as abi-spec] - [status-im.ethereum.core :as ethereum] + [status-im.native-module.core :as status] + [status-im.utils.fx :as fx] + [status-im.utils.types :as types] [taoensso.timbre :as log])) (re-frame/reg-fx diff --git a/src/status_im/stickers/core.cljs b/src/status_im/stickers/core.cljs index 3af10138e1..8df651d9f7 100644 --- a/src/status_im/stickers/core.cljs +++ b/src/status_im/stickers/core.cljs @@ -1,22 +1,22 @@ (ns status-im.stickers.core (:require [cljs.reader :as edn] + [clojure.set :as clojure.set] + [clojure.string :as string] [re-frame.core :as re-frame] - [status-im.multiaccounts.core :as multiaccounts] [status-im.ethereum.abi-spec :as abi-spec] [status-im.ethereum.contracts :as contracts] [status-im.ethereum.core :as ethereum] [status-im.ethereum.json-rpc :as json-rpc] [status-im.navigation :as navigation] - [status-im.utils.fx :as fx] - [status-im.utils.utils :as utils] + [status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.signing.core :as signing] [status-im.utils.contenthash :as contenthash] - [status-im.multiaccounts.update.core :as multiaccounts.update] - [clojure.string :as string])) + [status-im.utils.fx :as fx] + [status-im.utils.utils :as utils])) (defn pack-data-callback [id] - (fn [[category owner mintable timestamp price contenthash]] + (fn [[_ _ _ _ price contenthash]] (when-let [url (contenthash/url contenthash)] (re-frame/dispatch [:stickers/load-pack url id price])))) @@ -202,4 +202,4 @@ {}))))) (fx/defn pack-owned [{db :db} id] - {:db (update db :stickers/packs-owned conj id)}) \ No newline at end of file + {:db (update db :stickers/packs-owned conj id)}) diff --git a/src/status_im/subs.cljs b/src/status_im/subs.cljs index 17980859ff..6e38ebd955 100644 --- a/src/status_im/subs.cljs +++ b/src/status_im/subs.cljs @@ -1,15 +1,14 @@ (ns status-im.subs (:require [cljs.spec.alpha :as spec] [clojure.string :as string] - [taoensso.timbre :as log] [re-frame.core :as re-frame] [status-im.browser.core :as browser] - [status-im.chat.constants :as chat.constants] [status-im.chat.db :as chat.db] [status-im.chat.models :as chat.models] [status-im.chat.models.message-list :as models.message-list] [status-im.constants :as constants] [status-im.contact.db :as contact.db] + [status-im.ens.core :as ens] [status-im.ethereum.core :as ethereum] [status-im.ethereum.stateofus :as stateofus] [status-im.ethereum.tokens :as tokens] @@ -17,41 +16,34 @@ [status-im.fleet.core :as fleet] [status-im.group-chats.db :as group-chats.db] [status-im.i18n :as i18n] - [status-im.multiaccounts.model :as multiaccounts.model] [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.pairing.core :as pairing] - [status-im.tribute-to-talk.core :as tribute-to-talk] + [status-im.signing.gas :as signing.gas] + #_[status-im.tribute-to-talk.core :as tribute-to-talk] [status-im.tribute-to-talk.db :as tribute-to-talk.db] - [status-im.tribute-to-talk.whitelist :as whitelist] - [status-im.ui.components.tabbar.styles :as tabs.styles] [status-im.ui.components.colors :as colors] - [status-im.ui.components.toolbar.styles :as toolbar.styles] + [status-im.ui.components.tabbar.styles :as tabs.styles] [status-im.ui.screens.add-new.new-public-chat.db :as db] - [status-im.ui.screens.chat.stickers.styles :as stickers.styles] [status-im.ui.screens.mobile-network-settings.utils :as mobile-network-utils] - [status-im.wallet.utils :as wallet.utils] [status-im.utils.build :as build] [status-im.utils.config :as config] [status-im.utils.datetime :as datetime] - [status-im.utils.hex :as utils.hex] - [status-im.utils.identicon :as identicon] + [status-im.utils.gfycat.core :as gfycat] [status-im.utils.money :as money] [status-im.utils.platform :as platform] [status-im.utils.security :as security] [status-im.utils.universal-links.core :as links] - [status-im.wallet.core :as wallet] [status-im.wallet.db :as wallet.db] - [status-im.signing.gas :as signing.gas] - [status-im.utils.gfycat.core :as gfycat] + [status-im.wallet.utils :as wallet.utils] status-im.ui.screens.keycard.subs status-im.ui.screens.hardwallet.settings.subs status-im.ui.screens.hardwallet.pin.subs - status-im.ui.screens.hardwallet.setup.subs - [status-im.ens.core :as ens])) + status-im.ui.screens.hardwallet.setup.subs)) ;; TOP LEVEL =========================================================================================================== @@ -210,9 +202,7 @@ :intro-wizard :<- [:intro-wizard-state] :<- [:dimensions/window] - (fn [[wizard-state - {:keys [width height] :as dimensions} - view-id]] + (fn [[wizard-state {:keys [width height]}]] (assoc wizard-state :view-height height :view-width width))) @@ -404,7 +394,7 @@ (re-frame/reg-sub :get-app-short-version - (fn [db] app-short-version)) + (fn [_] app-short-version)) (re-frame/reg-sub :get-app-node-version @@ -1434,12 +1424,12 @@ (re-frame/reg-sub :wallet.transactions.details/current-transaction - (fn [[_ hash address] _] + (fn [[_ _ address] _] [(re-frame/subscribe [:wallet.transactions/transactions address]) (re-frame/subscribe [:ethereum/native-currency]) (re-frame/subscribe [:ethereum/chain-keyword])]) (fn [[transactions native-currency chain-keyword] [_ hash _]] - (let [{:keys [gas-used gas-price hash timestamp type token value] + (let [{:keys [gas-used gas-price hash timestamp type] :as transaction} (get transactions hash) native-currency-text (name (or (:symbol-display native-currency) @@ -1696,7 +1686,7 @@ (fn [[_ chat-id] _] [(re-frame/subscribe [:chats/chat chat-id]) (re-frame/subscribe [:contacts/contacts-by-chat filter chat-id])]) - (fn [[chat contacts] [_ chat-id]] + (fn [[chat contacts] [_ _]] (when (and chat (not (:group-chat chat))) (if (pos? (count contacts)) (multiaccounts/displayed-photo (first contacts)) @@ -1929,8 +1919,8 @@ :as settings} {:keys [step editing? state error] :or {step :intro} - screen-snt-amount :snt-amount - screen-message :message} prices currency]] + screen-snt-amount :snt-amount} + prices currency]] (let [fiat-value (if snt-amount (money/fiat-amount-value snt-amount @@ -2012,7 +2002,7 @@ (re-frame/reg-sub :ens/confirmation-screen :<- [:ens/registration] - (fn [{:keys [username state] :as ens}] + (fn [{:keys [username state]}] {:state state :username username})) @@ -2080,7 +2070,7 @@ (not (.eq bn (.round bn decimals))))) (defn get-amount-error [amount decimals] - (when (and (not (empty? amount)) decimals) + (when (and (seq amount) decimals) (let [normalized-amount (money/normalize amount) value (money/bignumber normalized-amount)] (cond diff --git a/src/status_im/subs_test.cljs b/src/status_im/subs_test.cljs index 1efbba0e18..dca3aedd3a 100644 --- a/src/status_im/subs_test.cljs +++ b/src/status_im/subs_test.cljs @@ -1,10 +1,6 @@ (ns status-im.subs-test (:require [cljs.test :refer [deftest is testing]] - reagent.core - [day8.re-frame.test :refer [run-test-sync]] - status-im.db - status-im.subs - [status-im.subs :as subs])) + status-im.subs)) (def transactions [{:timestamp "1505912551000"} {:timestamp "1505764322000"} @@ -21,6 +17,6 @@ {:timestamp "1505750000000"})})) (deftest group-transactions-by-date - "Check if transactions are sorted by date" - (is (= (subs/group-transactions-by-date transactions) - grouped-transactions))) + (testing "Check if transactions are sorted by date" + (is (= (#'status-im.subs/group-transactions-by-date transactions) + grouped-transactions)))) diff --git a/src/status_im/transport/core.cljs b/src/status_im/transport/core.cljs index 317e4c29db..8dbd861319 100644 --- a/src/status_im/transport/core.cljs +++ b/src/status_im/transport/core.cljs @@ -1,20 +1,17 @@ (ns ^{:doc "API to init and stop whisper messaging"} status-im.transport.core - (:require - [re-frame.core :as re-frame] - [status-im.ethereum.json-rpc :as json-rpc] - [status-im.waku.core :as waku] - [status-im.native-module.core :as status] - [status-im.mailserver.core :as mailserver] - [status-im.transport.message.core :as message] - [status-im.transport.filters.core :as transport.filters] - [status-im.pairing.core :as pairing] - [status-im.utils.publisher :as publisher] - [status-im.utils.fx :as fx] - [status-im.utils.handlers :as handlers] - [taoensso.timbre :as log] - status-im.transport.shh - [status-im.utils.config :as config])) + (:require [re-frame.core :as re-frame] + [status-im.ethereum.json-rpc :as json-rpc] + [status-im.mailserver.core :as mailserver] + [status-im.native-module.core :as status] + [status-im.pairing.core :as pairing] + [status-im.utils.config :as config] + [status-im.utils.fx :as fx] + [status-im.utils.handlers :as handlers] + [status-im.utils.publisher :as publisher] + status-im.transport.shh + [status-im.waku.core :as waku] + [taoensso.timbre :as log])) (defn set-node-info [{:keys [db]} node-info] {:db (assoc db :node-info node-info)}) diff --git a/src/status_im/transport/core_test.cljs b/src/status_im/transport/core_test.cljs index 9e7c6fbc6d..8be7d492f8 100644 --- a/src/status_im/transport/core_test.cljs +++ b/src/status_im/transport/core_test.cljs @@ -1,9 +1,8 @@ (ns status-im.transport.core-test (:require [cljs.test :refer-macros [deftest is testing]] - [status-im.utils.fx :as fx] [status-im.protocol.core :as protocol] - [status-im.transport.core :as transport] - [status-im.transport.message.core :as message])) + [status-im.transport.message.core :as message] + [status-im.utils.fx :as fx])) (deftest init-whisper (let [cofx {:db {:multiaccount {:public-key "1"}}}] diff --git a/src/status_im/transport/filters/core.cljs b/src/status_im/transport/filters/core.cljs index b5fdb8cc85..7d987aeeda 100644 --- a/src/status_im/transport/filters/core.cljs +++ b/src/status_im/transport/filters/core.cljs @@ -1,19 +1,16 @@ (ns status-im.transport.filters.core "This namespace is used to handle filters loading and unloading from statusgo" - (:require - [taoensso.timbre :as log] - [re-frame.core :as re-frame] - [clojure.string :as string] - [status-im.contact.db :as contact.db] - [status-im.waku.core :as waku] - [status-im.ethereum.json-rpc :as json-rpc] - [status-im.utils.fx :as fx] - [status-im.utils.config :as config] - [status-im.utils.handlers :as handlers] - [status-im.mailserver.topics :as mailserver.topics] - [status-im.mailserver.core :as mailserver] - [status-im.multiaccounts.model :as multiaccounts.model] - [status-im.transport.utils :as utils])) + (:require [clojure.string :as string] + [re-frame.core :as re-frame] + [status-im.contact.db :as contact.db] + [status-im.ethereum.json-rpc :as json-rpc] + [status-im.mailserver.core :as mailserver] + [status-im.mailserver.topics :as mailserver.topics] + [status-im.multiaccounts.model :as multiaccounts.model] + [status-im.utils.fx :as fx] + [status-im.utils.handlers :as handlers] + [status-im.waku.core :as waku] + [taoensso.timbre :as log])) (defn is-public-key? [k] (string/starts-with? k "0x")) @@ -88,7 +85,7 @@ (defn loaded? "Given a filter, check if we already loaded it" - [db {:keys [filter-id] :as f}] + [db {:keys [filter-id]}] (get-in db [:filter/filters filter-id])) (def not-loaded? @@ -143,8 +140,7 @@ "Returns all the non-negotiated filters matching chat-id" [db chat-id] (filter - (fn [{:keys [negotiated? - filter-id] :as f}] + (fn [{:keys [negotiated?] :as f}] (and (= chat-id (:chat-id f)) (not negotiated?))) @@ -152,7 +148,8 @@ ;; Filter requests -(defn- ->remove-filter-request [{:keys [id filter-id filter]}] +(defn- ->remove-filter-request + [{:keys [id filter-id]}] {:chatId id :filterId filter-id}) @@ -184,8 +181,8 @@ (mapcat ->filter-request))) (defn- contacts->filter-requests - [contacts] "Convert added contacts to filter requests" + [contacts] (->> contacts (filter contact.db/added?) (map #(hash-map :chat-id (:public-key %))) @@ -329,13 +326,13 @@ (handlers/register-handler-fx :filters.callback/filters-added - (fn [{:keys [db] :as cofx} [_ filters]] + (fn [cofx [_ filters]] (log/debug "PERF" :filters.callback/filters-added) (handle-filters-added cofx filters))) (handlers/register-handler-fx :filters.callback/filters-removed - (fn [{:keys [db] :as cofx} [_ filters]] + (fn [cofx [_ filters]] (handle-filters-removed cofx filters))) (re-frame/reg-fx diff --git a/src/status_im/transport/filters/core_test.cljs b/src/status_im/transport/filters/core_test.cljs index 4a2262e760..ff121719fe 100644 --- a/src/status_im/transport/filters/core_test.cljs +++ b/src/status_im/transport/filters/core_test.cljs @@ -59,21 +59,21 @@ (is (= [{:ChatID "0xchat-id" :OneToOne true :Identity "chat-id"}] - (transport.filters/chats->filter-requests [{:is-active true - :group-chat false - :chat-id "0xchat-id"}])))) + (#'status-im.transport.filters.core/chats->filter-requests [{:is-active true + :group-chat false + :chat-id "0xchat-id"}])))) (testing "a malformed one to one chat" (is (= [] - (transport.filters/chats->filter-requests [{:is-active true - :group-chat false - :chat-id "malformed"}])))) + (#'status-im.transport.filters.core/chats->filter-requests [{:is-active true + :group-chat false + :chat-id "malformed"}])))) (testing "a single public chat" (is (= [{:ChatID "chat-id" :OneToOne false}] - (transport.filters/chats->filter-requests [{:is-active true - :group-chat true - :public? true - :chat-id "chat-id"}])))) + (#'status-im.transport.filters.core/chats->filter-requests [{:is-active true + :group-chat true + :public? true + :chat-id "chat-id"}])))) (testing "a single group chat" (is (= [{:ChatID "0xchat-id-2" :OneToOne true @@ -81,20 +81,20 @@ {:ChatID "0xchat-id-1" :OneToOne true :Identity "chat-id-1"}] - (transport.filters/chats->filter-requests [{:is-active true - :group-chat true - :members-joined #{"0xchat-id-1" "0xchat-id-2"} - :chat-id "chat-id"}]))))) + (#'status-im.transport.filters.core/chats->filter-requests [{:is-active true + :group-chat true + :members-joined #{"0xchat-id-1" "0xchat-id-2"} + :chat-id "chat-id"}]))))) (deftest contacts->filters (testing "converting contacts to filters" (is (= [{:ChatID "0xchat-id-2" :OneToOne true :Identity "chat-id-2"}] - (transport.filters/contacts->filter-requests [{:system-tags #{} - :public-key "0xchat-id-1"} - {:system-tags #{:contact/added} - :public-key "0xchat-id-2"}]))))) + (#'status-im.transport.filters.core/contacts->filter-requests [{:system-tags #{} + :public-key "0xchat-id-1"} + {:system-tags #{:contact/added} + :public-key "0xchat-id-2"}]))))) (deftest load-member (testing "it returns fx for a member" diff --git a/src/status_im/transport/message/protocol.cljs b/src/status_im/transport/message/protocol.cljs index 652b29b98b..3d0afc7774 100644 --- a/src/status_im/transport/message/protocol.cljs +++ b/src/status_im/transport/message/protocol.cljs @@ -2,7 +2,6 @@ status-im.transport.message.protocol (:require [re-frame.core :as re-frame] [status-im.ethereum.json-rpc :as json-rpc] - [status-im.utils.config :as config] [status-im.utils.fx :as fx] [taoensso.timbre :as log])) diff --git a/src/status_im/transport/shh.cljs b/src/status_im/transport/shh.cljs index 630bde6810..46a1cf9ea5 100644 --- a/src/status_im/transport/shh.cljs +++ b/src/status_im/transport/shh.cljs @@ -1,11 +1,8 @@ (ns ^{:doc "Whisper API and events for managing keys and posting messages"} status-im.transport.shh (:require [re-frame.core :as re-frame] - [status-im.ethereum.core :as ethereum] - [status-im.transport.utils :as transport.utils] - [status-im.utils.config :as config] - [taoensso.timbre :as log] - [status-im.ethereum.json-rpc :as json-rpc])) + [status-im.ethereum.json-rpc :as json-rpc] + [taoensso.timbre :as log])) (defn generate-sym-key-from-password [waku-enabled? {:keys [password on-success on-error]}] diff --git a/src/status_im/tribute_to_talk/core.cljs b/src/status_im/tribute_to_talk/core.cljs index cb742b4c9a..df94676be5 100644 --- a/src/status_im/tribute_to_talk/core.cljs +++ b/src/status_im/tribute_to_talk/core.cljs @@ -2,19 +2,18 @@ (:refer-clojure :exclude [remove]) (:require [clojure.string :as string] [re-frame.core :as re-frame] - [status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.contact.core :as contact] [status-im.ethereum.contracts :as contracts] [status-im.ethereum.core :as ethereum] [status-im.ethereum.json-rpc :as json-rpc] [status-im.ethereum.transactions.core :as transactions] + [status-im.multiaccounts.update.core :as multiaccounts.update] + [status-im.signing.core :as signing] [status-im.tribute-to-talk.db :as tribute-to-talk.db] [status-im.tribute-to-talk.whitelist :as whitelist] [status-im.navigation :as navigation] [status-im.utils.fx :as fx] - [status-im.utils.money :as money] - [taoensso.timbre :as log] - [status-im.signing.core :as signing])) + [taoensso.timbre :as log])) (defn add-transaction-hash [message db] diff --git a/src/status_im/tribute_to_talk/db.cljs b/src/status_im/tribute_to_talk/db.cljs index 558467b23b..4608bca924 100644 --- a/src/status_im/tribute_to_talk/db.cljs +++ b/src/status_im/tribute_to_talk/db.cljs @@ -21,7 +21,7 @@ (.fromWei utils s))) (defn tribute-status - [{:keys [system-tags tribute-to-talk] :as contact}] + [{:keys [system-tags tribute-to-talk]}] (let [{:keys [snt-amount transaction-hash]} tribute-to-talk] (cond (contains? system-tags :tribute-to-talk/paid) :paid (not (nil? transaction-hash)) :pending @@ -44,7 +44,7 @@ (and (= (to-wei converted-snt-amount) snt-amount) (< 0 (js/parseFloat converted-snt-amount) max-snt-amount))) - (catch :default err nil)))) + (catch :default _ nil)))) (defn get-settings [db] diff --git a/src/status_im/ui/components/bottom_panel/views.cljs b/src/status_im/ui/components/bottom_panel/views.cljs index 819ee6a28b..daa49cc13f 100644 --- a/src/status_im/ui/components/bottom_panel/views.cljs +++ b/src/status_im/ui/components/bottom_panel/views.cljs @@ -1,10 +1,10 @@ (ns status-im.ui.components.bottom-panel.views - (:require-macros [status-im.utils.views :as views]) - (:require [status-im.ui.components.react :as react] - [status-im.ui.components.animation :as anim] + (:require ["react-native" :refer [BackHandler]] [reagent.core :as reagent] + [status-im.ui.components.animation :as anim] [status-im.ui.components.colors :as colors] - ["react-native" :refer (BackHandler)])) + [status-im.ui.components.react :as react]) + (:require-macros [status-im.utils.views :as views])) (def back-listener (atom nil)) @@ -42,7 +42,7 @@ :duration 500 :useNativeDriver true})]))) -(defn bottom-panel [obj render window-height] +(defn bottom-panel [_ render window-height] (let [bottom-anim-value (anim/create-value window-height) alpha-value (anim/create-value 0) clear-timeout (atom nil) diff --git a/src/status_im/ui/components/button/haptic.cljs b/src/status_im/ui/components/button/haptic.cljs index ed84953d53..0c865f24be 100644 --- a/src/status_im/ui/components/button/haptic.cljs +++ b/src/status_im/ui/components/button/haptic.cljs @@ -1,5 +1,5 @@ (ns status-im.ui.components.button.haptic - (:require [oops.core :refer [oget ocall]] + (:require [oops.core :refer [ocall]] [react-native-haptic-feedback :default react-native-haptic-feedback])) (def haptic-methods diff --git a/src/status_im/ui/components/chat_icon/screen.cljs b/src/status_im/ui/components/chat_icon/screen.cljs index 47672457ff..1a7f131dc1 100644 --- a/src/status_im/ui/components/chat_icon/screen.cljs +++ b/src/status_im/ui/components/chat_icon/screen.cljs @@ -6,8 +6,7 @@ [status-im.ui.components.colors :as colors] [status-im.ui.components.react :as react] [status-im.ui.screens.chat.photos :as photos] - [status-im.utils.platform :as platform]) - (:require-macros [status-im.utils.views :refer [defview letsubs]])) + [status-im.utils.platform :as platform])) ;;TODO REWORK THIS NAMESPACE @@ -151,4 +150,4 @@ (multiaccounts/displayed-name multiaccount) color edit? - size {}])) \ No newline at end of file + size {}])) diff --git a/src/status_im/ui/components/checkbox/view.cljs b/src/status_im/ui/components/checkbox/view.cljs index 3be6c64ac9..153c1aaf3c 100644 --- a/src/status_im/ui/components/checkbox/view.cljs +++ b/src/status_im/ui/components/checkbox/view.cljs @@ -7,8 +7,7 @@ (defn checkbox "react/check-box is currently not available on iOS, use it once it is available on all platforms" - [{:keys [on-value-change checked? accessibility-label - disabled? style icon-style] + [{:keys [on-value-change checked? accessibility-label style] :or {accessibility-label :checkbox}}] [(if on-value-change react/touchable-highlight react/view) (merge {:style (merge diff --git a/src/status_im/ui/components/connectivity/view.cljs b/src/status_im/ui/components/connectivity/view.cljs index ab1a920322..45efc1dbb4 100644 --- a/src/status_im/ui/components/connectivity/view.cljs +++ b/src/status_im/ui/components/connectivity/view.cljs @@ -1,16 +1,17 @@ (ns status-im.ui.components.connectivity.view - (:require-macros [status-im.utils.views :refer [defview letsubs] :as views]) - (:require [reagent.core :as reagent] - [re-frame.core :as re-frame] - [status-im.ui.components.react :as react] - [status-im.ui.components.connectivity.styles :as styles] + (:require [re-frame.core :as re-frame] + [reagent.core :as reagent] [status-im.i18n :as i18n] - [status-im.ui.components.colors :as colors] [status-im.ui.components.animation :as animation] - [status-im.utils.utils :as utils] + [status-im.ui.components.colors :as colors] + [status-im.ui.components.connectivity.styles :as styles] + [status-im.ui.components.react :as react] [status-im.utils.datetime :as datetime] [status-im.utils.platform :as platform] - [taoensso.timbre :as log])) + [status-im.utils.utils :as utils] + [taoensso.timbre :as log]) + (:require-macros + [status-im.utils.views :as views :refer [defview letsubs]])) (def connectivity-bar-height 36) (def neg-connectivity-bar-height (- connectivity-bar-height)) @@ -78,9 +79,11 @@ (def to-hide? (reagent/atom false)) -(defn manage-visibility [connected? animate? anim-opacity anim-y status-hidden] +(defn manage-visibility "status-hidden is a per-view state, while to-hide? is a global state common to -all connectivity views (we have at least one view in home and one in chat)" + all connectivity views (we have at least one view in home and one in chat)" + [connected? animate? anim-opacity anim-y status-hidden] + (if connected? (if animate? (when (and @to-hide? (not @status-hidden)) diff --git a/src/status_im/ui/components/copyable_text.cljs b/src/status_im/ui/components/copyable_text.cljs index 66c0a4c2ef..82b43e4d74 100644 --- a/src/status_im/ui/components/copyable_text.cljs +++ b/src/status_im/ui/components/copyable_text.cljs @@ -3,8 +3,7 @@ [status-im.i18n :as i18n] [status-im.ui.components.animation :as animation] [status-im.ui.components.colors :as colors] - [status-im.ui.components.react :as react] - [status-im.ui.components.typography :as typography])) + [status-im.ui.components.react :as react])) (defn hide-cue-atom [anim-opacity anim-y cue-atom] (animation/start @@ -79,8 +78,8 @@ :font-size 14}} (i18n/label :sharing-copied-to-clipboard)]]]) -(defn copyable-text-view [{:keys [label container-style]} - content] +(defn copyable-text-view + [{:keys [label container-style]} content] (let [cue-atom (reagent/atom false) width (reagent/atom 0) height (reagent/atom 0) diff --git a/src/status_im/ui/components/list/views.cljs b/src/status_im/ui/components/list/views.cljs index 93cfa56564..bf0b24cd83 100644 --- a/src/status_im/ui/components/list/views.cljs +++ b/src/status_im/ui/components/list/views.cljs @@ -21,17 +21,15 @@ (:require [clojure.string :as string] [reagent.core :as reagent] [status-im.i18n :as i18n] - [status-im.ui.components.animation :as animation] [status-im.ui.components.checkbox.view :as checkbox] [status-im.ui.components.colors :as colors] [status-im.ui.components.icons.vector-icons :as vector-icons] [status-im.ui.components.list-item.views :as list-item] [status-im.ui.components.list.styles :as styles] + [status-im.ui.components.radio :as radio] [status-im.ui.components.react :as react] [status-im.utils.platform :as platform] - [status-im.ui.components.radio :as radio] - ["react-native" :as react-native]) - (:require-macros [status-im.utils.views :as views])) + ["react-native" :as react-native])) (def flat-list-class (reagent/adapt-react-class (.-FlatList react-native))) (def section-list-class (reagent/adapt-react-class (.-SectionList react-native))) @@ -116,12 +114,11 @@ ;;TODO DEPRECATED, use status-im.ui.components.list-item.views (defn big-list-item - [{:keys [style text text-color text-style subtext value action-fn active? destructive? hide-chevron? + [{:keys [style text text-style subtext action-fn active? hide-chevron? accessory-value text-color new? activity-indicator - accessibility-label icon icon-color image-source icon-content] + accessibility-label icon icon-color image-source] :or {icon-color colors/blue text-color colors/black - value "" active? true style {}}}] {:pre [text diff --git a/src/status_im/ui/components/permissions.cljs b/src/status_im/ui/components/permissions.cljs index 468585ae4f..cb85e58401 100644 --- a/src/status_im/ui/components/permissions.cljs +++ b/src/status_im/ui/components/permissions.cljs @@ -12,10 +12,10 @@ (and (= (count permission-vals) 1) (not (#{"denied" "never_ask_again"} (first permission-vals)))))) -(defn request-permissions [{:keys [permissions on-allowed on-denied] - :or {on-allowed #() - on-denied #()} - :as options}] +(defn request-permissions + [{:keys [permissions on-allowed on-denied] + :or {on-allowed #() + on-denied #()}}] (if platform/android? (let [permissions (mapv #(get permissions-map %) permissions)] (-> (.requestMultiple PermissionsAndroid (clj->js permissions)) diff --git a/src/status_im/ui/components/react.cljs b/src/status_im/ui/components/react.cljs index 480b80c45b..a7d3b0e8a4 100644 --- a/src/status_im/ui/components/react.cljs +++ b/src/status_im/ui/components/react.cljs @@ -1,19 +1,16 @@ (ns status-im.ui.components.react - (:require-macros [status-im.utils.views :as views]) (:require [reagent.core :as reagent] - [status-im.ui.components.styles :as styles] - [status-im.utils.utils :as utils] - [status-im.utils.core :as utils.core] - [status-im.utils.platform :as platform] [status-im.i18n :as i18n] + [status-im.ui.components.colors :as colors] + [status-im.ui.components.typography :as typography] + [status-im.utils.platform :as platform] + [status-im.utils.utils :as utils] ["react-native" :as react-native :refer (Keyboard)] ["react-native-image-crop-picker" :default image-picker] - ["react-native-gesture-handler" :refer (TouchableWithoutFeedback)] ["react-native-safe-area-context" :as safe-area-context :refer (SafeAreaView SafeAreaProvider SafeAreaConsumer)] - ["@react-native-community/clipboard" :default Clipboard] - [status-im.ui.components.colors :as colors] - [status-im.ui.components.typography :as typography])) + ["@react-native-community/clipboard" :default Clipboard]) + (:require-macros [status-im.utils.views :as views])) (def native-modules (.-NativeModules react-native)) (def device-event-emitter (.-DeviceEventEmitter react-native)) @@ -129,7 +126,7 @@ (def text-input-refs (atom {})) (defn text-input - [options text] + [options _] (let [render-fn (fn [options text] [text-input-class (merge @@ -237,4 +234,4 @@ (def safe-area-provider (reagent/adapt-react-class SafeAreaProvider)) (def safe-area-consumer (reagent/adapt-react-class SafeAreaConsumer)) -(def safe-area-view (reagent/adapt-react-class SafeAreaView)) \ No newline at end of file +(def safe-area-view (reagent/adapt-react-class SafeAreaView)) diff --git a/src/status_im/ui/components/search_input/view.cljs b/src/status_im/ui/components/search_input/view.cljs index 812011f694..26ae5c893e 100644 --- a/src/status_im/ui/components/search_input/view.cljs +++ b/src/status_im/ui/components/search_input/view.cljs @@ -1,11 +1,10 @@ (ns status-im.ui.components.search-input.view - (:require-macros [status-im.utils.views :refer [defview letsubs]]) (:require [reagent.core :as reagent] [status-im.i18n :as i18n] - [status-im.ui.components.react :as react] [status-im.ui.components.colors :as colors] - [status-im.ui.components.search-input.styles :as styles] - [status-im.ui.components.icons.vector-icons :as icons])) + [status-im.ui.components.icons.vector-icons :as icons] + [status-im.ui.components.react :as react] + [status-im.ui.components.search-input.styles :as styles])) (defn search-input [{:keys [search-active?]}] (let [input-ref (atom nil) diff --git a/src/status_im/ui/components/svgimage.cljs b/src/status_im/ui/components/svgimage.cljs index 755c170f86..13c6fc8ec3 100644 --- a/src/status_im/ui/components/svgimage.cljs +++ b/src/status_im/ui/components/svgimage.cljs @@ -1,7 +1,6 @@ (ns status-im.ui.components.svgimage (:require [status-im.ui.components.react :as react] [reagent.core :as reagent] - [status-im.utils.platform :as platform] [status-im.utils.http :as http] [status-im.ui.components.webview :as components.webview])) diff --git a/src/status_im/ui/components/tabbar/styles.cljs b/src/status_im/ui/components/tabbar/styles.cljs index e9b4cde995..9e9d4c7f2f 100644 --- a/src/status_im/ui/components/tabbar/styles.cljs +++ b/src/status_im/ui/components/tabbar/styles.cljs @@ -1,8 +1,7 @@ (ns status-im.ui.components.tabbar.styles (:require [status-im.ui.components.animation :as animation] [status-im.ui.components.colors :as colors] - [status-im.utils.platform :as platform] - [status-im.utils.styles :as styles])) + [status-im.utils.platform :as platform])) (def tabs-height (cond diff --git a/src/status_im/ui/components/toolbar/actions.cljs b/src/status_im/ui/components/toolbar/actions.cljs index e25a4628d5..7c69b8e1d3 100644 --- a/src/status_im/ui/components/toolbar/actions.cljs +++ b/src/status_im/ui/components/toolbar/actions.cljs @@ -1,7 +1,5 @@ (ns status-im.ui.components.toolbar.actions - (:require [re-frame.core :as re-frame] - [status-im.ui.components.toolbar.styles :as styles] - [status-im.ui.components.colors :as colors])) + (:require [re-frame.core :as re-frame])) (defn opts [options] {:icon :main-icons/more @@ -23,4 +21,4 @@ :accessibility-label :done-button}) (def default-close - (close default-handler)) \ No newline at end of file + (close default-handler)) diff --git a/src/status_im/ui/components/toolbar/view.cljs b/src/status_im/ui/components/toolbar/view.cljs index 6f17d2cf7c..dd6b29d483 100644 --- a/src/status_im/ui/components/toolbar/view.cljs +++ b/src/status_im/ui/components/toolbar/view.cljs @@ -1,17 +1,12 @@ (ns status-im.ui.components.toolbar.view - (:require-macros [status-im.utils.views :refer [defview letsubs]]) (:require [re-frame.core :as re-frame] - [status-im.i18n :as i18n] + [status-im.ui.components.colors :as colors] [status-im.ui.components.icons.vector-icons :as vector-icons] [status-im.ui.components.list-selection :as list-selection] [status-im.ui.components.react :as react] - [status-im.ui.components.styles :as components.styles] [status-im.ui.components.toolbar.actions :as actions] [status-im.ui.components.toolbar.styles :as styles] - [status-im.utils.platform :as platform] - [status-im.utils.core :as utils] - [status-im.ui.components.colors :as colors] - [status-im.ui.components.common.common :as components.common])) + [status-im.utils.core :as utils])) ;; Navigation item @@ -152,4 +147,4 @@ :height styles/toolbar-height :justify-content :center :align-items :center} - action-items]])) \ No newline at end of file + action-items]])) diff --git a/src/status_im/ui/components/tooltip/views.cljs b/src/status_im/ui/components/tooltip/views.cljs index 9dad6748a8..f15fc386da 100644 --- a/src/status_im/ui/components/tooltip/views.cljs +++ b/src/status_im/ui/components/tooltip/views.cljs @@ -1,12 +1,11 @@ (ns status-im.ui.components.tooltip.views - (:require-macros [status-im.utils.views :as views]) (:require [status-im.ui.components.animation :as animation] - [status-im.ui.components.tooltip.animations :as animations] - [status-im.ui.components.react :as react] - [status-im.ui.components.icons.vector-icons :as vector-icons] - [status-im.ui.components.tooltip.styles :as styles] [status-im.ui.components.colors :as colors] - [reagent.core :as reagent])) + [status-im.ui.components.icons.vector-icons :as vector-icons] + [status-im.ui.components.react :as react] + [status-im.ui.components.tooltip.animations :as animations] + [status-im.ui.components.tooltip.styles :as styles]) + (:require-macros [status-im.utils.views :as views])) (views/defview tooltip [label & [{:keys [bottom-value color font-size container-style] :or {bottom-value 30 color colors/white font-size 15}} diff --git a/src/status_im/ui/components/typography.cljs b/src/status_im/ui/components/typography.cljs index a0d3f6b1d1..04088b08f3 100644 --- a/src/status_im/ui/components/typography.cljs +++ b/src/status_im/ui/components/typography.cljs @@ -1,6 +1,6 @@ (ns status-im.ui.components.typography - (:require [status-im.utils.platform :as platform] - [status-im.ui.components.colors :as colors])) + (:require [status-im.ui.components.colors :as colors] + [status-im.utils.platform :as platform])) (def default-font-family "Inter") (defn default-style [] @@ -29,7 +29,7 @@ (defn get-style [{:keys [typography] :as style}] {:pre [(or (nil? typography) (contains? typography-styles typography))]} - (let [{:keys [font-weight font-style font-size line-height] + (let [{:keys [font-weight font-style] :as style} (merge (default-style) (get typography-styles @@ -55,7 +55,7 @@ (defn get-nested-style [{:keys [typography] :as style}] {:pre [(or (nil? typography) (contains? typography-styles typography))]} - (let [{:keys [font-weight font-style font-size] :as style} + (let [{:keys [font-weight font-style] :as style} (merge (get typography-styles typography) (dissoc style :typography))] diff --git a/src/status_im/ui/components/webview.cljs b/src/status_im/ui/components/webview.cljs index 71b96d5566..36ad1aea8c 100644 --- a/src/status_im/ui/components/webview.cljs +++ b/src/status_im/ui/components/webview.cljs @@ -1,18 +1,16 @@ (ns status-im.ui.components.webview (:require [reagent.core :as reagent] - [reagent.core :as reagent.core] - [status-im.utils.platform :as platform] [status-im.utils.config :as config] - ["react-native" :as react-native] + [status-im.utils.platform :as platform] ["react-native-webview" :default rn-webview])) (def webview-class (reagent/adapt-react-class rn-webview)) -(defn webview [{:keys [dapp? dapp-name] :as opts}] +(defn webview [{:keys [dapp?] :as opts}] (if (and config/cached-webviews-enabled? platform/android? dapp?) - (reagent.core/create-class - (let [dapp-name-sent? (reagent.core/atom false)] + (reagent/create-class + (let [dapp-name-sent? (reagent/atom false)] {:component-did-mount (fn [] ;; unfortunately it's impossible to pass some initial params diff --git a/src/status_im/ui/screens/about_app/views.cljs b/src/status_im/ui/screens/about_app/views.cljs index 05e4462c8a..2e5ad80fa0 100644 --- a/src/status_im/ui/screens/about_app/views.cljs +++ b/src/status_im/ui/screens/about_app/views.cljs @@ -1,15 +1,14 @@ (ns status-im.ui.screens.about-app.views - (:require-macros [status-im.utils.views :as views]) (:require [re-frame.core :as re-frame] - [status-im.i18n :as i18n] [status-im.ui.components.colors :as colors] [status-im.ui.components.copyable-text :as copyable-text] [status-im.ui.components.icons.vector-icons :as vector-icons] - [status-im.ui.components.list.views :as list] [status-im.ui.components.list-item.views :as list-item] + [status-im.ui.components.list.views :as list] [status-im.ui.components.react :as react] - [status-im.ui.screens.about-app.styles :as styles] - [status-im.ui.components.topbar :as topbar])) + [status-im.ui.components.topbar :as topbar] + [status-im.ui.screens.about-app.styles :as styles]) + (:require-macros [status-im.utils.views :as views])) (defn- data [app-version node-version] [{:type :small diff --git a/src/status_im/ui/screens/add_new/new_chat/views.cljs b/src/status_im/ui/screens/add_new/new_chat/views.cljs index 83ed9ce9d6..71e09a9caf 100644 --- a/src/status_im/ui/screens/add_new/new_chat/views.cljs +++ b/src/status_im/ui/screens/add_new/new_chat/views.cljs @@ -1,19 +1,19 @@ (ns status-im.ui.screens.add-new.new-chat.views - (:require-macros [status-im.utils.views :as views]) (:require [re-frame.core :as re-frame] [status-im.i18n :as i18n] + [status-im.multiaccounts.core :as multiaccounts] + [status-im.ui.components.chat-icon.screen :as chat-icon] [status-im.ui.components.colors :as colors] [status-im.ui.components.icons.vector-icons :as vector-icons] + [status-im.ui.components.list-item.views :as list-item] [status-im.ui.components.list.views :as list] [status-im.ui.components.react :as react] - [status-im.ui.screens.add-new.styles :as add-new.styles] - [status-im.ui.screens.add-new.new-chat.styles :as styles] - [status-im.ui.components.list-item.views :as list-item] - [status-im.ui.components.chat-icon.screen :as chat-icon] - [status-im.multiaccounts.core :as multiaccounts] [status-im.ui.components.topbar :as topbar] + [status-im.ui.screens.add-new.new-chat.styles :as styles] + [status-im.ui.screens.add-new.styles :as add-new.styles] [status-im.utils.debounce :as debounce] - [status-im.utils.utils :as utils])) + [status-im.utils.utils :as utils]) + (:require-macros [status-im.utils.views :as views])) (defn- render-row [row _ _] [list-item/list-item diff --git a/src/status_im/ui/screens/add_new/new_public_chat/view.cljs b/src/status_im/ui/screens/add_new/new_public_chat/view.cljs index 037d9ee201..22f74f7d96 100644 --- a/src/status_im/ui/screens/add_new/new_public_chat/view.cljs +++ b/src/status_im/ui/screens/add_new/new_public_chat/view.cljs @@ -1,22 +1,18 @@ (ns status-im.ui.screens.add-new.new-public-chat.view (:require [re-frame.core :as re-frame] [status-im.i18n :as i18n] + [status-im.i18n-resources :as i18n-resources] + [status-im.react-native.resources :as resources] + [status-im.ui.components.colors :as colors] [status-im.ui.components.react :as react] [status-im.ui.components.styles :as common.styles] [status-im.ui.components.text-input.view :as text-input.view] - [status-im.ui.components.toolbar.view :as toolbar] [status-im.ui.components.tooltip.views :as tooltip] + [status-im.ui.components.topbar :as topbar] [status-im.ui.screens.add-new.new-public-chat.db :as db] [status-im.ui.screens.add-new.new-public-chat.styles :as styles] - [status-im.ui.screens.add-new.styles :as add-new.styles] - status-im.utils.db - [status-im.react-native.resources :as resources] - [status-im.ui.components.colors :as colors] - [status-im.i18n-resources :as i18n-resources] - [status-im.ui.components.topbar :as topbar]) - (:require-macros - [status-im.utils.slurp :refer [slurp]] - [status-im.utils.views :as views])) + [status-im.ui.screens.add-new.styles :as add-new.styles]) + (:require-macros [status-im.utils.views :as views])) (defn- start-chat [topic] (re-frame/dispatch [:chat.ui/start-public-chat topic {:navigation-reset? true}]) @@ -80,4 +76,4 @@ [chat-name-input topic error]] [react/view {:flex-direction :row :flex-wrap :wrap :margin-top 24 :padding-horizontal 12} (for [chat default-public-chats] - (render-topic chat))]]])) \ No newline at end of file + (render-topic chat))]]])) diff --git a/src/status_im/ui/screens/advanced_settings/views.cljs b/src/status_im/ui/screens/advanced_settings/views.cljs index e8d75313f4..460c5966a1 100644 --- a/src/status_im/ui/screens/advanced_settings/views.cljs +++ b/src/status_im/ui/screens/advanced_settings/views.cljs @@ -1,17 +1,16 @@ (ns status-im.ui.screens.advanced-settings.views - (:require-macros [status-im.utils.views :as views]) (:require [re-frame.core :as re-frame] [status-im.ui.components.colors :as colors] [status-im.ui.components.list.views :as list] [status-im.ui.components.react :as react] - [status-im.ui.components.topbar :as topbar])) + [status-im.ui.components.topbar :as topbar]) + (:require-macros [status-im.utils.views :as views])) (defn- normal-mode-settings-data [{:keys [network-name current-log-level waku-enabled waku-bloom-filter-mode - current-fleet - dev-mode?]}] + current-fleet]}] [{:type :small :title :t/network :accessibility-label :network-button diff --git a/src/status_im/ui/screens/bootnodes_settings/edit_bootnode/views.cljs b/src/status_im/ui/screens/bootnodes_settings/edit_bootnode/views.cljs index 97577a18c8..dbcc555de5 100644 --- a/src/status_im/ui/screens/bootnodes_settings/edit_bootnode/views.cljs +++ b/src/status_im/ui/screens/bootnodes_settings/edit_bootnode/views.cljs @@ -1,21 +1,20 @@ (ns status-im.ui.screens.bootnodes-settings.edit-bootnode.views - (:require-macros [status-im.utils.views :as views]) - (:require - [re-frame.core :as re-frame] - [status-im.ui.components.react :as react] - [status-im.i18n :as i18n] - [status-im.utils.utils :as utils] - [status-im.ui.components.styles :as components.styles] - [status-im.ui.components.common.common :as components.common] - [status-im.ui.components.colors :as colors] - [status-im.ui.components.icons.vector-icons :as vector-icons] - [status-im.ui.components.toolbar.view :as toolbar] - [status-im.ui.components.text-input.view :as text-input] - [status-im.ui.screens.bootnodes-settings.edit-bootnode.styles :as styles] - [status-im.utils.platform :as platform] - [status-im.ui.components.tooltip.views :as tooltip] - [clojure.string :as string] - [status-im.ui.components.topbar :as topbar])) + (:require [clojure.string :as string] + [re-frame.core :as re-frame] + [status-im.i18n :as i18n] + [status-im.ui.components.colors :as colors] + [status-im.ui.components.common.common :as components.common] + [status-im.ui.components.icons.vector-icons :as vector-icons] + [status-im.ui.components.react :as react] + [status-im.ui.components.styles :as components.styles] + [status-im.ui.components.text-input.view :as text-input] + [status-im.ui.components.tooltip.views :as tooltip] + [status-im.ui.components.topbar :as topbar] + [status-im.ui.screens.bootnodes-settings.edit-bootnode.styles + :as + styles] + [status-im.utils.platform :as platform]) + (:require-macros [status-im.utils.views :as views])) (defn delete-button [id] [react/touchable-highlight {:on-press #(re-frame/dispatch [:bootnodes.ui/delete-pressed id])} diff --git a/src/status_im/ui/screens/browser/open_dapp/views.cljs b/src/status_im/ui/screens/browser/open_dapp/views.cljs index 4e37ea3665..4bb28aff4b 100644 --- a/src/status_im/ui/screens/browser/open_dapp/views.cljs +++ b/src/status_im/ui/screens/browser/open_dapp/views.cljs @@ -1,18 +1,16 @@ (ns status-im.ui.screens.browser.open-dapp.views - (:require - [re-frame.core :as re-frame] - [status-im.i18n :as i18n] - [status-im.ui.components.colors :as colors] - [status-im.ui.components.react :as react] - [status-im.ui.screens.browser.open-dapp.styles :as styles] - [status-im.ui.components.list.views :as list] - [status-im.ui.components.common.common :as components.common] - [status-im.ui.screens.wallet.components.views :as components] - [status-im.react-native.resources :as resources] - [status-im.ui.components.list-item.views :as list-item] - [status-im.ui.components.icons.vector-icons :as vector-icons] - [status-im.ui.components.icons.vector-icons :as icons] - [status-im.ui.screens.browser.accounts :as accounts]) + (:require [re-frame.core :as re-frame] + [status-im.i18n :as i18n] + [status-im.react-native.resources :as resources] + [status-im.ui.components.colors :as colors] + [status-im.ui.components.common.common :as components.common] + [status-im.ui.components.icons.vector-icons :as icons] + [status-im.ui.components.list-item.views :as list-item] + [status-im.ui.components.list.views :as list] + [status-im.ui.components.react :as react] + [status-im.ui.screens.browser.accounts :as accounts] + [status-im.ui.screens.browser.open-dapp.styles :as styles] + [status-im.ui.screens.wallet.components.views :as components]) (:require-macros [status-im.utils.views :as views])) (defn hide-sheet-and-dispatch [event] @@ -43,7 +41,7 @@ :title name :subtitle (or url :t/dapp) :icon [react/view (styles/browser-icon-container) - [vector-icons/icon :main-icons/browser {:color colors/gray}]]}]) + [icons/icon :main-icons/browser {:color colors/gray}]]}]) (def dapp-image-data {:image (resources/get-image :dapp-store) :width 768 :height 333}) (defn dapp-image [] [components.common/image-contain nil dapp-image-data]) diff --git a/src/status_im/ui/screens/browser/styles.cljs b/src/status_im/ui/screens/browser/styles.cljs index dddc6c5237..3215d6b0d2 100644 --- a/src/status_im/ui/screens/browser/styles.cljs +++ b/src/status_im/ui/screens/browser/styles.cljs @@ -1,6 +1,5 @@ (ns status-im.ui.screens.browser.styles - (:require [status-im.ui.components.colors :as colors] - [status-im.utils.styles :as styles])) + (:require [status-im.ui.components.colors :as colors])) (def browser {:flex 1}) diff --git a/src/status_im/ui/screens/browser/views.cljs b/src/status_im/ui/screens/browser/views.cljs index 07bc51a1ad..56ca3e02ec 100644 --- a/src/status_im/ui/screens/browser/views.cljs +++ b/src/status_im/ui/screens/browser/views.cljs @@ -1,10 +1,10 @@ (ns status-im.ui.screens.browser.views - (:require [cljs.tools.reader.edn :as edn] - [re-frame.core :as re-frame] + (:require [re-frame.core :as re-frame] [reagent.core :as reagent] [status-im.browser.core :as browser] - [status-im.ethereum.core :as ethereum] + [status-im.browser.webview-ref :as webview-ref] [status-im.i18n :as i18n] + [status-im.ui.components.chat-icon.screen :as chat-icon] [status-im.ui.components.colors :as colors] [status-im.ui.components.connectivity.view :as connectivity] [status-im.ui.components.icons.vector-icons :as icons] @@ -14,17 +14,14 @@ [status-im.ui.components.toolbar.view :as toolbar.view] [status-im.ui.components.tooltip.views :as tooltip] [status-im.ui.components.webview :as components.webview] + [status-im.ui.screens.browser.accounts :as accounts] [status-im.ui.screens.browser.permissions.views :as permissions.views] [status-im.ui.screens.browser.site-blocked.views :as site-blocked.views] [status-im.ui.screens.browser.styles :as styles] - [status-im.utils.http :as http] - [status-im.utils.js-resources :as js-res] - [status-im.ui.components.chat-icon.screen :as chat-icon] - [status-im.ui.screens.browser.accounts :as accounts] [status-im.utils.debounce :as debounce] - [status-im.browser.webview-ref :as webview-ref]) - (:require-macros - [status-im.utils.views :as views])) + [status-im.utils.http :as http] + [status-im.utils.js-resources :as js-res]) + (:require-macros [status-im.utils.views :as views])) (defn toolbar-content [url url-original {:keys [secure?]} url-editing?] (let [url-text (atom url)] @@ -105,7 +102,7 @@ ;; should-component-update is called only when component's props are changed, ;; that's why it can't be used in `browser`, because `url` comes from subs (views/defview browser-component - [{:keys [webview error? url browser browser-id unsafe? can-go-back? + [{:keys [error? url browser browser-id unsafe? can-go-back? can-go-forward? resolving? network-id url-original show-permission show-tooltip dapp? name dapps-account]}] {:should-component-update (fn [_ _ args] diff --git a/src/status_im/ui/screens/chat/message/command.cljs b/src/status_im/ui/screens/chat/message/command.cljs index b1af047cb7..702222f445 100644 --- a/src/status_im/ui/screens/chat/message/command.cljs +++ b/src/status_im/ui/screens/chat/message/command.cljs @@ -1,14 +1,14 @@ (ns status-im.ui.screens.chat.message.command (:require [re-frame.core :as re-frame] [status-im.commands.core :as commands] - [status-im.ui.components.react :as react] - [status-im.ui.components.colors :as colors] - [status-im.i18n :as i18n] [status-im.constants :as constants] - [status-im.utils.money :as money] [status-im.ethereum.transactions.core :as transactions] + [status-im.i18n :as i18n] [status-im.ui.components.chat-icon.screen :as chat-icon] - [status-im.ui.components.icons.vector-icons :as vector-icons])) + [status-im.ui.components.colors :as colors] + [status-im.ui.components.icons.vector-icons :as vector-icons] + [status-im.ui.components.react :as react] + [status-im.utils.money :as money])) (defn- final-status? [command-state] (or (= command-state constants/command-state-request-address-for-transaction-declined) @@ -56,7 +56,7 @@ :t/address-received)))]]) (defn- command-final-status - [command-state direction transaction-type] + [command-state _ transaction-type] [react/view {:style {:flex-direction :row :height 28 :align-items :center diff --git a/src/status_im/ui/screens/chat/message/message.cljs b/src/status_im/ui/screens/chat/message/message.cljs index c16bf8dae1..e1e48d0b5b 100644 --- a/src/status_im/ui/screens/chat/message/message.cljs +++ b/src/status_im/ui/screens/chat/message/message.cljs @@ -1,19 +1,19 @@ (ns status-im.ui.screens.chat.message.message (:require [re-frame.core :as re-frame] [status-im.constants :as constants] - [status-im.utils.http :as http] [status-im.i18n :as i18n] [status-im.ui.components.colors :as colors] - [status-im.utils.security :as security] [status-im.ui.components.icons.vector-icons :as vector-icons] [status-im.ui.components.react :as react] - [status-im.ui.screens.chat.sheets :as sheets] + [status-im.ui.screens.chat.message.command :as message.command] [status-im.ui.screens.chat.photos :as photos] + [status-im.ui.screens.chat.sheets :as sheets] [status-im.ui.screens.chat.styles.message.message :as style] [status-im.ui.screens.chat.utils :as chat.utils] [status-im.utils.contenthash :as contenthash] + [status-im.utils.http :as http] [status-im.utils.platform :as platform] - [status-im.ui.screens.chat.message.command :as message.command]) + [status-im.utils.security :as security]) (:require-macros [status-im.utils.views :refer [defview letsubs]])) (defview mention-element [from] @@ -37,7 +37,7 @@ appender]) (defview quoted-message - [message-id {:keys [from text]} outgoing current-public-key] + [_ {:keys [from text]} outgoing current-public-key] (letsubs [{:keys [ens-name alias]} [:contacts/contact-name-by-identity from]] [react/view {:style (style/quoted-message-container outgoing)} [react/view {:style style/quoted-message-author-container} @@ -166,7 +166,7 @@ [render-parsed-text message (:parsed-text content)]]]) (defn emoji-message - [{:keys [content current-public-key alias outgoing] :as message}] + [{:keys [content current-public-key outgoing] :as message}] (let [response-to (:response-to content)] [message-bubble-wrapper message [react/view {:style (style/style-message-text outgoing)} diff --git a/src/status_im/ui/screens/chat/stickers/styles.cljs b/src/status_im/ui/screens/chat/stickers/styles.cljs index 3872e3649a..dd82c0e52c 100644 --- a/src/status_im/ui/screens/chat/stickers/styles.cljs +++ b/src/status_im/ui/screens/chat/stickers/styles.cljs @@ -1,5 +1,4 @@ -(ns status-im.ui.screens.chat.stickers.styles - (:require [status-im.utils.platform :as platform])) +(ns status-im.ui.screens.chat.stickers.styles) (def stickers-panel {:flex 1 :margin 5 :flex-direction :row :justify-content :space-between :flex-wrap :wrap}) @@ -11,4 +10,4 @@ :width icon-size :border-radius (/ icon-size 2) :align-items :center - :justify-content :center}) \ No newline at end of file + :justify-content :center}) diff --git a/src/status_im/ui/screens/chat/stickers/views.cljs b/src/status_im/ui/screens/chat/stickers/views.cljs index 2fb4feb35e..dd039780a8 100644 --- a/src/status_im/ui/screens/chat/stickers/views.cljs +++ b/src/status_im/ui/screens/chat/stickers/views.cljs @@ -45,7 +45,7 @@ [react/view {:width window-width :flex 1} [react/scroll-view [react/view {:style styles/stickers-panel} - (for [{:keys [hash pack] :as sticker} stickers] + (for [{:keys [hash] :as sticker} stickers] ^{:key (str hash)} [react/touchable-highlight {:style {:height 75 :width 75 :margin 5} :on-press #(re-frame/dispatch [:chat/send-sticker sticker])} diff --git a/src/status_im/ui/screens/chat/styles/message/message.cljs b/src/status_im/ui/screens/chat/styles/message/message.cljs index c6f66a9c03..22f727dba7 100644 --- a/src/status_im/ui/screens/chat/styles/message/message.cljs +++ b/src/status_im/ui/screens/chat/styles/message/message.cljs @@ -4,8 +4,7 @@ [status-im.ui.components.react :as react] [status-im.ui.screens.chat.styles.photos :as photos] [status-im.utils.platform :as platform] - [status-im.ui.components.typography :as typography] - [status-im.utils.styles :as styles])) + [status-im.ui.components.typography :as typography])) (defn style-message-text [outgoing] @@ -25,7 +24,7 @@ :align-items :center}) (defn message-body - [{:keys [outgoing] :as message}] + [{:keys [outgoing]}] (let [align (if outgoing :flex-end :flex-start) direction (if outgoing :row-reverse :row)] {:flex-direction direction diff --git a/src/status_im/ui/screens/chat/ttt.cljs b/src/status_im/ui/screens/chat/ttt.cljs index 953595e679..9fdd377591 100644 --- a/src/status_im/ui/screens/chat/ttt.cljs +++ b/src/status_im/ui/screens/chat/ttt.cljs @@ -1,10 +1,13 @@ + (ns status-im.ui.screens.chat.ttt - (:require [status-im.ui.screens.chat.styles.main :as style] - [status-im.ui.components.react :as react] - [status-im.ui.screens.profile.tribute-to-talk.views :as tribute-to-talk.views] + (:require [re-frame.core :as re-frame] [status-im.i18n :as i18n] [status-im.ui.components.colors :as colors] - [re-frame.core :as re-frame])) + [status-im.ui.components.react :as react] + [status-im.ui.screens.chat.styles.main :as style] + [status-im.ui.screens.profile.tribute-to-talk.views + :as + tribute-to-talk.views])) (defn tribute-to-talk-header [name] @@ -31,8 +34,8 @@ :align-self (if snt-amount :flex-start :flex-end)}}]) (defn one-to-one-chat-description-container - [{:keys [chat-id name contact show-input? tribute-to-talk] - :tribute-to-talk/keys [my-message received? message tribute-status + [{:keys [chat-id name] + :tribute-to-talk/keys [received? tribute-status tribute-label snt-amount on-share-my-profile fiat-amount fiat-currency token]}] (case tribute-status @@ -69,7 +72,7 @@ (:paid :none) [react/view - ;[intro-header contact] + ;[intro-header contact] (when (= tribute-status :paid) [pay-to-chat-messages snt-amount chat-id tribute-status tribute-label fiat-amount fiat-currency token]) @@ -89,4 +92,4 @@ :tribute-to-talk-tribute-received2 :tribute-to-talk-contact-received-your-tribute))]]])])) - ;[intro-header contact])) \ No newline at end of file + ;[intro-header contact])) diff --git a/src/status_im/ui/screens/currency_settings/models_test.cljs b/src/status_im/ui/screens/currency_settings/models_test.cljs index 8eb916684f..c9f5869ee7 100644 --- a/src/status_im/ui/screens/currency_settings/models_test.cljs +++ b/src/status_im/ui/screens/currency_settings/models_test.cljs @@ -1,5 +1,5 @@ (ns status-im.ui.screens.currency-settings.models-test - (:require [cljs.test :refer-macros [deftest is testing]] + (:require [cljs.test :refer-macros [deftest is]] [status-im.ui.screens.currency-settings.models :as models])) (deftest get-currency diff --git a/src/status_im/ui/screens/currency_settings/views.cljs b/src/status_im/ui/screens/currency_settings/views.cljs index 7d0185aaa9..f32ecdd5d4 100644 --- a/src/status_im/ui/screens/currency_settings/views.cljs +++ b/src/status_im/ui/screens/currency_settings/views.cljs @@ -5,7 +5,6 @@ [status-im.ui.components.react :as react] [status-im.ui.components.icons.vector-icons :as vector-icons] [status-im.ui.components.list.views :as list] - [status-im.ui.screens.profile.components.views :as profile.components] [status-im.ui.screens.currency-settings.styles :as styles] [status-im.ui.components.topbar :as topbar] [status-im.ui.components.search-input.view :as search-input])) @@ -47,4 +46,4 @@ (sort #(compare (:code %1) (:code %2)))) :key-fn :code :render-fn (render-currency currency-id) - :keyboardShouldPersistTaps :always}]]])) \ No newline at end of file + :keyboardShouldPersistTaps :always}]]])) diff --git a/src/status_im/ui/screens/dapps_permissions/views.cljs b/src/status_im/ui/screens/dapps_permissions/views.cljs index a4e55e5e11..2249fa5111 100644 --- a/src/status_im/ui/screens/dapps_permissions/views.cljs +++ b/src/status_im/ui/screens/dapps_permissions/views.cljs @@ -3,11 +3,9 @@ (:require [re-frame.core :as re-frame] [status-im.i18n :as i18n] [status-im.ui.components.react :as react] - [status-im.ui.components.toolbar.view :as toolbar] [status-im.ui.components.list.views :as list] [status-im.ui.components.colors :as colors] [status-im.ui.screens.dapps-permissions.styles :as styles] - [status-im.constants :as constants] [status-im.ui.components.common.common :as components.common] [status-im.ui.components.icons.vector-icons :as icons] [status-im.ui.components.topbar :as topbar])) diff --git a/src/status_im/ui/screens/desktop/views.cljs b/src/status_im/ui/screens/desktop/views.cljs index 677c7794de..55be906e8b 100644 --- a/src/status_im/ui/screens/desktop/views.cljs +++ b/src/status_im/ui/screens/desktop/views.cljs @@ -1,31 +1,30 @@ (ns status-im.ui.screens.desktop.views - (:require-macros [status-im.utils.views :as views]) - (:require [status-im.ui.screens.desktop.main.views :as main.views] + (:require #_[status-im.i18n :as i18n] [status-im.ui.components.react :as react] + [status-im.ui.screens.desktop.main.views :as main.views] + [status-im.ui.screens.group.views + :refer + [add-participants-toggle-list contact-toggle-list new-group]] [status-im.ui.screens.intro.views :as intro.views] - [status-im.ui.screens.group.views :refer [contact-toggle-list - new-group - add-participants-toggle-list]] - [status-im.ui.screens.profile.group-chat.views :refer [group-chat-profile]] [status-im.ui.screens.multiaccounts.login.views :as login.views] - [status-im.ui.screens.multiaccounts.recover.views :as recover.views] [status-im.ui.screens.multiaccounts.views :as multiaccounts.views] - [status-im.utils.platform :as platform] - [status-im.i18n :as i18n] - [taoensso.timbre :as log] - [status-im.utils.utils :as utils])) + [status-im.ui.screens.profile.group-chat.views + :refer + [group-chat-profile]] + #_[status-im.utils.utils :as utils]) + (:require-macros [status-im.utils.views :as views])) (enable-console-print!) (views/defview main [] (views/letsubs [view-id [:view-id] - version [:get-app-version]] + #_#_version [:get-app-version]] {:component-did-mount (fn [] - (.getValue rn-dependencies/desktop-config "desktop-alpha-warning-shown-for-version" - #(when-not (= %1 version) - (.setValue ^js rn-dependencies/desktop-config "desktop-alpha-warning-shown-for-version" version) - (utils/show-popup nil (i18n/label :desktop-alpha-release-warning)))))} + #_(.getValue rn-dependencies/desktop-config "desktop-alpha-warning-shown-for-version" + #(when-not (= %1 version) + (.setValue ^js rn-dependencies/desktop-config "desktop-alpha-warning-shown-for-version" version) + (utils/show-popup nil (i18n/label :desktop-alpha-release-warning)))))} (let [component (case view-id :intro intro.views/intro diff --git a/src/status_im/ui/screens/ens/views.cljs b/src/status_im/ui/screens/ens/views.cljs index c23a359acf..ffd399cc3f 100644 --- a/src/status_im/ui/screens/ens/views.cljs +++ b/src/status_im/ui/screens/ens/views.cljs @@ -1,29 +1,27 @@ (ns status-im.ui.screens.ens.views (:require [re-frame.core :as re-frame] [reagent.core :as reagent] + [status-im.constants :as constants] [status-im.ens.core :as ens] [status-im.ethereum.core :as ethereum] - [status-im.constants :as constants] [status-im.ethereum.ens :as ethereum.ens] [status-im.ethereum.stateofus :as stateofus] [status-im.i18n :as i18n] + [status-im.multiaccounts.core :as multiaccounts] [status-im.react-native.resources :as resources] [status-im.ui.components.checkbox.view :as checkbox] [status-im.ui.components.colors :as colors] [status-im.ui.components.common.common :as components.common] [status-im.ui.components.icons.vector-icons :as vector-icons] + [status-im.ui.components.list-item.views :as list-item] [status-im.ui.components.list.views :as list] [status-im.ui.components.radio :as radio] [status-im.ui.components.react :as react] - [status-im.ui.components.toolbar.actions :as actions] - [status-im.ui.components.toolbar.view :as toolbar] + [status-im.ui.components.topbar :as topbar] [status-im.ui.screens.chat.message.message :as message] - [status-im.ui.screens.profile.components.views :as profile.components] - [status-im.ui.components.list-item.views :as list-item] [status-im.ui.screens.chat.photos :as photos] - [status-im.multiaccounts.core :as multiaccounts] - [status-im.utils.debounce :as debounce] - [status-im.ui.components.topbar :as topbar]) + [status-im.ui.screens.profile.components.views :as profile.components] + [status-im.utils.debounce :as debounce]) (:require-macros [status-im.utils.views :as views])) (defn- button @@ -179,9 +177,9 @@ [react/text ""])))) (defn- username-input - [username state placeholder] + [_ _ _] (let [input-ref (atom nil)] - (fn [username state placeholder] + (fn [_ state placeholder] [react/view {:flex-direction :row :justify-content :center} ;;NOTE required so that the keyboards shows up when navigating ;;back from checkout screen @@ -476,7 +474,7 @@ ;;; NAME DETAILS SCREEN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(def ^:const release-instructions-link "https://our.status.im/managing-your-ens-name-in-v1/") +(def release-instructions-link "https://our.status.im/managing-your-ens-name-in-v1/") (defn open-release-instructions-link! [] (.openURL ^js react/linking release-instructions-link)) @@ -626,7 +624,7 @@ [name-item {:name name :hide-chevron? true :action action}]] [radio/radio (= name preferred-name)]]]))]]]]) -(defn- registered [names {:keys [preferred-name public-key name] :as account} show?] +(defn- registered [names {:keys [preferred-name public-key] :as account} _] [react/view {:style {:flex 1}} [react/scroll-view [react/view {:style {:margin-top 8}} diff --git a/src/status_im/ui/screens/fleet_settings/views.cljs b/src/status_im/ui/screens/fleet_settings/views.cljs index e0391bd915..37f5618f78 100644 --- a/src/status_im/ui/screens/fleet_settings/views.cljs +++ b/src/status_im/ui/screens/fleet_settings/views.cljs @@ -1,14 +1,12 @@ (ns status-im.ui.screens.fleet-settings.views (:require [re-frame.core :as re-frame] - [status-im.i18n :as i18n] + [status-im.node.core :as node] [status-im.ui.components.icons.vector-icons :as vector-icons] [status-im.ui.components.list.views :as list] [status-im.ui.components.react :as react] - [status-im.ui.components.toolbar.view :as toolbar] + [status-im.ui.components.topbar :as topbar] [status-im.ui.screens.fleet-settings.styles :as styles] - [status-im.node.core :as node] - [status-im.utils.platform :as platform] - [status-im.ui.components.topbar :as topbar]) + [status-im.utils.platform :as platform]) (:require-macros [status-im.utils.views :as views])) (defn- fleet-icon [current?] diff --git a/src/status_im/ui/screens/group/chat_settings/events.cljs b/src/status_im/ui/screens/group/chat_settings/events.cljs index 50b429de4c..08a47b66e5 100644 --- a/src/status_im/ui/screens/group/chat_settings/events.cljs +++ b/src/status_im/ui/screens/group/chat_settings/events.cljs @@ -1,11 +1,7 @@ (ns status-im.ui.screens.group.chat-settings.events - (:require [re-frame.core :as re-frame] - [status-im.i18n :as i18n] - [status-im.chat.models.message :as models.message] - [status-im.navigation :as navigation] - [status-im.utils.handlers :as handlers] - [status-im.data-store.chats :as chats-store] - [status-im.utils.fx :as fx])) + (:require [status-im.navigation :as navigation] + [status-im.utils.fx :as fx] + [status-im.utils.handlers :as handlers])) (handlers/register-handler-fx :show-group-chat-profile @@ -15,4 +11,3 @@ (assoc :new-chat-name (get-in db [:chats chat-id :name])) (assoc :current-chat-id chat-id))} (navigation/navigate-to-cofx :group-chat-profile nil)))) - diff --git a/src/status_im/ui/screens/group/styles.cljs b/src/status_im/ui/screens/group/styles.cljs index c99ffe684e..ae65a987cc 100644 --- a/src/status_im/ui/screens/group/styles.cljs +++ b/src/status_im/ui/screens/group/styles.cljs @@ -1,8 +1,5 @@ (ns status-im.ui.screens.group.styles - (:require [status-im.ui.components.colors :as colors] - [status-im.ui.components.styles :as components.styles] - [status-im.utils.styles :as styles] - [status-im.utils.platform :as platform])) + (:require [status-im.ui.components.colors :as colors])) (def group-container {:flex 1 diff --git a/src/status_im/ui/screens/group/views.cljs b/src/status_im/ui/screens/group/views.cljs index 2c12462d1c..1be0813ee9 100644 --- a/src/status_im/ui/screens/group/views.cljs +++ b/src/status_im/ui/screens/group/views.cljs @@ -1,32 +1,31 @@ (ns status-im.ui.screens.group.views - (:require-macros [status-im.utils.views :as views]) (:require [cljs.spec.alpha :as spec] [clojure.string :as string] [re-frame.core :as re-frame] [reagent.core :as reagent] - [status-im.i18n :as i18n] - [status-im.ui.components.styles :as components.styles] [status-im.constants :as constants] + [status-im.i18n :as i18n] [status-im.ui.components.button :as button] - [status-im.ui.components.list-selection :as list-selection] - [status-im.ui.components.common.common :as components.common] + [status-im.ui.components.chat-icon.screen :as chat-icon] [status-im.ui.components.checkbox.view :as checkbox] - [status-im.ui.components.button :as button] - [status-im.utils.debounce :as debounce] - [status-im.ui.components.keyboard-avoid-presentation :as kb-presentation] [status-im.ui.components.colors :as colors] - [status-im.ui.components.react :as react] + [status-im.ui.components.contact.contact :as contact] + [status-im.ui.components.keyboard-avoid-presentation + :as + kb-presentation] + [status-im.ui.components.list-item.views :as list-item] + [status-im.ui.components.list-selection :as list-selection] [status-im.ui.components.list.views :as list] + [status-im.ui.components.react :as react] + [status-im.ui.components.search-input.view :as search] + [status-im.ui.components.toolbar :as bottom-toolbar] [status-im.ui.components.toolbar.view :as toolbar] [status-im.ui.components.topbar :as topbar] - [status-im.ui.components.toolbar :as bottom-toolbar] - [status-im.ui.components.search-input.view :as search] - [status-im.utils.platform :as platform] - [status-im.ui.components.chat-icon.screen :as chat-icon] - [status-im.ui.components.list-item.views :as list-item] - [status-im.ui.components.contact.contact :as contact] [status-im.ui.screens.add-new.styles :as add-new.styles] - [status-im.ui.screens.group.styles :as styles])) + [status-im.ui.screens.group.styles :as styles] + [status-im.utils.debounce :as debounce] + [status-im.utils.platform :as platform]) + (:require-macros [status-im.utils.views :as views])) (defn- render-contact [row] [list-item/list-item @@ -206,9 +205,9 @@ ;; Add participants to existing group chat (views/defview add-participants-toggle-list [] - (views/letsubs [contacts [:contacts/all-contacts-not-in-current-chat] - {:keys [name] :as current-chat} [:chats/current-chat] - selected-contacts-count [:selected-participants-count]] + (views/letsubs [contacts [:contacts/all-contacts-not-in-current-chat] + current-chat [:chats/current-chat] + selected-contacts-count [:selected-participants-count]] (let [current-participants-count (count (:contacts current-chat))] [kb-presentation/keyboard-avoiding-view {:style styles/group-container} [toolbar/toolbar {:border-bottom-color colors/white} diff --git a/src/status_im/ui/screens/hardwallet/authentication_method/views.cljs b/src/status_im/ui/screens/hardwallet/authentication_method/views.cljs index c968153c19..44001971e1 100644 --- a/src/status_im/ui/screens/hardwallet/authentication_method/views.cljs +++ b/src/status_im/ui/screens/hardwallet/authentication_method/views.cljs @@ -1,15 +1,16 @@ (ns status-im.ui.screens.hardwallet.authentication-method.views (:require [re-frame.core :as re-frame] - [status-im.ui.screens.hardwallet.authentication-method.styles :as styles] + [status-im.i18n :as i18n] + [status-im.react-native.resources :as resources] + [status-im.ui.components.colors :as colors] + [status-im.ui.components.common.common :as common] [status-im.ui.components.icons.vector-icons :as vector-icons] [status-im.ui.components.react :as react] - [status-im.ui.components.toolbar.view :as toolbar] [status-im.ui.components.styles :as components.styles] - [status-im.ui.components.common.common :as common] - [status-im.i18n :as i18n] - [status-im.ui.components.colors :as colors] - [status-im.react-native.resources :as resources] - [status-im.ui.components.topbar :as topbar])) + [status-im.ui.components.topbar :as topbar] + [status-im.ui.screens.hardwallet.authentication-method.styles + :as + styles])) (defn authentication-method-row [{:keys [title on-press icon]}] [react/touchable-highlight {:on-press on-press} diff --git a/src/status_im/ui/screens/hardwallet/pin/views.cljs b/src/status_im/ui/screens/hardwallet/pin/views.cljs index a8e83b5bed..e30b2b061b 100644 --- a/src/status_im/ui/screens/hardwallet/pin/views.cljs +++ b/src/status_im/ui/screens/hardwallet/pin/views.cljs @@ -10,7 +10,7 @@ [status-im.utils.platform :as platform] [status-im.ui.components.topbar :as topbar])) -(def ^:const default-pin-retries-number 3) +(def default-pin-retries-number 3) (defn numpad-button [n step enabled? small-screen?] [react/touchable-highlight diff --git a/src/status_im/ui/screens/hardwallet/setup/subs.cljs b/src/status_im/ui/screens/hardwallet/setup/subs.cljs index b1885c5219..655607fcf6 100644 --- a/src/status_im/ui/screens/hardwallet/setup/subs.cljs +++ b/src/status_im/ui/screens/hardwallet/setup/subs.cljs @@ -1,5 +1,6 @@ (ns status-im.ui.screens.hardwallet.setup.subs - (:require [re-frame.core :as re-frame])) + (:require [re-frame.core :as re-frame] + [clojure.string :as string])) (re-frame/reg-sub :hardwallet-setup-step diff --git a/src/status_im/ui/screens/home/styles.cljs b/src/status_im/ui/screens/home/styles.cljs index f528ae5290..f99f837d02 100644 --- a/src/status_im/ui/screens/home/styles.cljs +++ b/src/status_im/ui/screens/home/styles.cljs @@ -1,7 +1,5 @@ (ns status-im.ui.screens.home.styles - (:require [status-im.ui.components.colors :as colors] - [status-im.utils.platform :as platform] - [status-im.ui.components.tabbar.styles :as tabs.styles])) + (:require [status-im.ui.components.colors :as colors])) (def last-message-container {:flex-shrink 1}) diff --git a/src/status_im/ui/screens/home/views/inner_item.cljs b/src/status_im/ui/screens/home/views/inner_item.cljs index ca1f602c5a..707fcb23ab 100644 --- a/src/status_im/ui/screens/home/views/inner_item.cljs +++ b/src/status_im/ui/screens/home/views/inner_item.cljs @@ -3,16 +3,15 @@ [re-frame.core :as re-frame] [status-im.constants :as constants] [status-im.i18n :as i18n] - [status-im.ui.components.chat-icon.screen :as chat-icon.screen] - [status-im.ui.screens.chat.sheets :as sheets] - [status-im.ui.components.list-item.views :as list-item] [status-im.ui.components.badge :as badge] + [status-im.ui.components.chat-icon.screen :as chat-icon.screen] + [status-im.ui.components.list-item.views :as list-item] [status-im.ui.components.react :as react] + [status-im.ui.screens.chat.sheets :as sheets] [status-im.ui.screens.home.styles :as styles] [status-im.utils.contenthash :as contenthash] [status-im.utils.core :as utils] - [status-im.utils.datetime :as time]) - (:require-macros [status-im.utils.views :refer [defview letsubs]])) + [status-im.utils.datetime :as time])) (defn message-content-text [{:keys [content content-type]}] [react/view styles/last-message-container diff --git a/src/status_im/ui/screens/intro/views.cljs b/src/status_im/ui/screens/intro/views.cljs index 8360fdab1d..a40a52e6ff 100644 --- a/src/status_im/ui/screens/intro/views.cljs +++ b/src/status_im/ui/screens/intro/views.cljs @@ -1,30 +1,28 @@ (ns status-im.ui.screens.intro.views - (:require-macros [status-im.utils.views :refer [defview letsubs]]) - (:require [status-im.ui.components.react :as react] - [re-frame.core :as re-frame] - [status-im.react-native.resources :as resources] - [status-im.privacy-policy.core :as privacy-policy] - [status-im.utils.utils :as utils] - [status-im.multiaccounts.create.core :refer [step-kw-to-num]] - [status-im.ui.components.icons.vector-icons :as vector-icons] - [status-im.utils.identicon :as identicon] - [status-im.ui.components.radio :as radio] - [status-im.ui.components.text-input.view :as text-input] - [taoensso.timbre :as log] - [status-im.utils.gfycat.core :as gfy] - [status-im.ui.components.colors :as colors] + (:require [re-frame.core :as re-frame] [reagent.core :as r] + [status-im.constants :as constants] + [status-im.i18n :as i18n] + [status-im.multiaccounts.create.core :refer [step-kw-to-num]] + [status-im.privacy-policy.core :as privacy-policy] + [status-im.react-native.resources :as resources] + [status-im.ui.components.colors :as colors] [status-im.ui.components.common.common :as components.common] + [status-im.ui.components.icons.vector-icons :as vector-icons] + [status-im.ui.components.radio :as radio] + [status-im.ui.components.react :as react] + [status-im.ui.components.text-input.view :as text-input] + [status-im.ui.components.topbar :as topbar] [status-im.ui.screens.intro.styles :as styles] + [status-im.utils.config :as config] + [status-im.utils.gfycat.core :as gfy] + [status-im.utils.identicon :as identicon] [status-im.utils.platform :as platform] [status-im.utils.security :as security] - [status-im.i18n :as i18n] - [status-im.constants :as constants] - [status-im.utils.config :as config] - [status-im.utils.platform :as platform] - [status-im.ui.components.topbar :as topbar])) + [status-im.utils.utils :as utils]) + (:require-macros [status-im.utils.views :refer [defview letsubs]])) -(defn dots-selector [{:keys [on-press n selected color]}] +(defn dots-selector [{:keys [n selected color]}] [react/view {:style (styles/dot-selector n)} (doall (for [i (range n)] @@ -62,8 +60,7 @@ :justify-content :flex-end :align-items :center :padding-horizontal 32}} - (let [margin 32 - size (min @width @height) #_(- (min @width @height) #_(* 2 margin))] + (let [size (min @width @height) #_(- (min @width @height) #_(* 2 margin))] [react/view {:style {:flex 1} :on-layout (fn [^js e] (reset! height (-> e .-nativeEvent .-layout .-height)))} @@ -186,7 +183,7 @@ (i18n/label desc)]] [radio/radio selected?]]]])) -(defn select-key-storage [{:keys [selected-storage-type view-height]}] +(defn select-key-storage [{:keys [selected-storage-type]}] (let [storage-types [{:type :default :icon :main-icons/mobile :icon-width 24 @@ -252,7 +249,7 @@ (defn bottom-bar [{:keys [step weak-password? encrypt-with-password? forward-action next-button-disabled? - processing? existing-account?] :as wizard-state}] + processing? existing-account?]}] [react/view {:style {:margin-bottom (if (or (#{:choose-key :select-key-storage :enter-phrase :recovery-success} step) (and (#{:create-code :confirm-code} step) diff --git a/src/status_im/ui/screens/keycard/components/keycard_animation.cljs b/src/status_im/ui/screens/keycard/components/keycard_animation.cljs index 837f15be9d..22d952c1cc 100644 --- a/src/status_im/ui/screens/keycard/components/keycard_animation.cljs +++ b/src/status_im/ui/screens/keycard/components/keycard_animation.cljs @@ -1,12 +1,11 @@ (ns status-im.ui.screens.keycard.components.keycard-animation - (:require [status-im.ui.components.react :as react] - [reagent.core :as reagent] - [status-im.ui.components.icons.vector-icons :as vector-icons] - [status-im.ui.components.animation :as animation] + (:require [reagent.core :as reagent] [status-im.hardwallet.card :as keycard-nfc] [status-im.react-native.resources :as resources] + [status-im.ui.components.animation :as animation] [status-im.ui.components.colors :as colors] - [taoensso.timbre :as log])) + [status-im.ui.components.icons.vector-icons :as vector-icons] + [status-im.ui.components.react :as react])) (defn circle [{:keys [animation-value color size]}] [react/animated-view @@ -225,9 +224,6 @@ (js/setTimeout #(when (= @state :error) (restart)) 3000)) -(defn on-success [{:keys [state]}] - (reset! state :success)) - (defn on-connect [{:keys [state card small indicator medium big card-scale phone]}] @@ -295,8 +291,6 @@ :small animation-small :medium animation-medium :big animation-big})) - on-success #(on-success - {:state state}) on-error #(do (on-card-disconnected) (on-error diff --git a/src/status_im/ui/screens/keycard/onboarding/views.cljs b/src/status_im/ui/screens/keycard/onboarding/views.cljs index 86f8733070..163b47d1cd 100644 --- a/src/status_im/ui/screens/keycard/onboarding/views.cljs +++ b/src/status_im/ui/screens/keycard/onboarding/views.cljs @@ -1,21 +1,20 @@ (ns status-im.ui.screens.keycard.onboarding.views - (:require-macros [status-im.utils.views :refer [defview letsubs]]) - (:require [status-im.ui.components.react :as react] - [status-im.ui.screens.keycard.styles :as styles] - [status-im.ui.screens.keycard.views :as views] + (:require [re-frame.core :as re-frame] [status-im.hardwallet.onboarding :as hardwallet.onboarding] - [status-im.ui.components.toolbar.view :as toolbar] - [status-im.ui.components.colors :as colors] - [status-im.ui.components.icons.vector-icons :as vector-icons] [status-im.i18n :as i18n] - [re-frame.core :as re-frame] [status-im.react-native.resources :as resources] + [status-im.ui.components.colors :as colors] [status-im.ui.components.common.common :as components.common] + [status-im.ui.components.icons.vector-icons :as vector-icons] + [status-im.ui.components.react :as react] [status-im.ui.components.styles :as components.styles] [status-im.ui.components.text-input.view :as text-input] + [status-im.ui.components.toolbar.view :as toolbar] [status-im.ui.components.tooltip.views :as tooltip] + [status-im.ui.components.topbar :as topbar] [status-im.ui.screens.hardwallet.pin.views :as pin.views] - [status-im.ui.components.topbar :as topbar])) + [status-im.ui.screens.keycard.styles :as styles]) + (:require-macros [status-im.utils.views :refer [defview letsubs]])) (defview intro [] (letsubs [flow [:hardwallet-flow]] @@ -318,7 +317,7 @@ (letsubs [word [:hardwallet-recovery-phrase-word] input-word [:hardwallet-recovery-phrase-input-word] error [:hardwallet-recovery-phrase-confirm-error]] - (let [{:keys [word idx]} word] + (let [{:keys [idx]} word] [react/view styles/container [toolbar/toolbar {:transparent? true} diff --git a/src/status_im/ui/screens/keycard/recovery/views.cljs b/src/status_im/ui/screens/keycard/recovery/views.cljs index f3fddd3f3b..055b483fd2 100644 --- a/src/status_im/ui/screens/keycard/recovery/views.cljs +++ b/src/status_im/ui/screens/keycard/recovery/views.cljs @@ -1,24 +1,22 @@ (ns status-im.ui.screens.keycard.recovery.views - (:require-macros [status-im.utils.views :refer [defview letsubs]]) - (:require [status-im.multiaccounts.recover.core :as multiaccounts.recover] - [status-im.ui.components.react :as react] + (:require [re-frame.core :as re-frame] [status-im.hardwallet.recovery :as hardwallet.recovery] - [status-im.ui.screens.keycard.styles :as styles] - [status-im.ui.screens.keycard.views :as views] - [status-im.ui.components.toolbar.view :as toolbar] - [status-im.ui.components.colors :as colors] - [status-im.ui.components.icons.vector-icons :as vector-icons] [status-im.i18n :as i18n] - [re-frame.core :as re-frame] [status-im.react-native.resources :as resources] + [status-im.ui.components.colors :as colors] [status-im.ui.components.common.common :as components.common] + [status-im.ui.components.icons.vector-icons :as vector-icons] + [status-im.ui.components.react :as react] [status-im.ui.components.text-input.view :as text-input] - [status-im.utils.gfycat.core :as gfy] - [status-im.utils.identicon :as identicon] - [status-im.utils.core :as utils.core] - [status-im.ui.screens.hardwallet.pin.views :as pin.views] + [status-im.ui.components.toolbar.view :as toolbar] [status-im.ui.components.tooltip.views :as tooltip] - [status-im.ui.components.topbar :as topbar])) + [status-im.ui.components.topbar :as topbar] + [status-im.ui.screens.hardwallet.pin.views :as pin.views] + [status-im.ui.screens.keycard.styles :as styles] + [status-im.utils.core :as utils.core] + [status-im.utils.gfycat.core :as gfy] + [status-im.utils.identicon :as identicon]) + (:require-macros [status-im.utils.views :refer [defview letsubs]])) (defn intro [] [react/view styles/container diff --git a/src/status_im/ui/screens/keycard/styles.cljs b/src/status_im/ui/screens/keycard/styles.cljs index f64555e986..84b4d01da5 100644 --- a/src/status_im/ui/screens/keycard/styles.cljs +++ b/src/status_im/ui/screens/keycard/styles.cljs @@ -1,5 +1,4 @@ -(ns status-im.ui.screens.keycard.styles - (:require [status-im.ui.components.colors :as colors])) +(ns status-im.ui.screens.keycard.styles) (def container {:flex 1 diff --git a/src/status_im/ui/screens/keycard/views.cljs b/src/status_im/ui/screens/keycard/views.cljs index 92e7631f96..184fdb6cd5 100644 --- a/src/status_im/ui/screens/keycard/views.cljs +++ b/src/status_im/ui/screens/keycard/views.cljs @@ -1,20 +1,18 @@ (ns status-im.ui.screens.keycard.views - (:require-macros [status-im.utils.views :refer [defview letsubs]]) - (:require [status-im.multiaccounts.core :as multiaccounts] - [status-im.ui.components.react :as react] - [status-im.ui.components.toolbar.view :as toolbar] - [status-im.ui.screens.keycard.styles :as styles] + (:require [re-frame.core :as re-frame] + [reagent.core :as reagent] [status-im.i18n :as i18n] - [status-im.ui.components.colors :as colors] + [status-im.multiaccounts.core :as multiaccounts] [status-im.react-native.resources :as resources] - [re-frame.core :as re-frame] + [status-im.ui.components.colors :as colors] [status-im.ui.components.icons.vector-icons :as vector-icons] - [status-im.ui.screens.hardwallet.pin.views :as pin.views] - [status-im.utils.core :as utils.core] [status-im.ui.components.list-item.views :as list-item] - [status-im.ui.screens.chat.photos :as photos] + [status-im.ui.components.react :as react] [status-im.ui.components.topbar :as topbar] - [reagent.core :as reagent])) + [status-im.ui.screens.chat.photos :as photos] + [status-im.ui.screens.hardwallet.pin.views :as pin.views] + [status-im.ui.screens.keycard.styles :as styles]) + (:require-macros [status-im.utils.views :refer [defview letsubs]])) ;; NOTE(Ferossgp): Seems like it should be in popover (defn blank [] @@ -213,7 +211,7 @@ enter-step [:hardwallet/pin-enter-step] status [:hardwallet/pin-status] error-label [:hardwallet/pin-error-label] - {:keys [key-uid name] :as account} [:multiaccounts/login] + {:keys [name] :as account} [:multiaccounts/login] small-screen? [:dimensions/small-screen?] retry-counter [:hardwallet/retry-counter]] [react/view styles/container diff --git a/src/status_im/ui/screens/mobile_network_settings/view.cljs b/src/status_im/ui/screens/mobile_network_settings/view.cljs index 3744135d8a..9b7c787588 100644 --- a/src/status_im/ui/screens/mobile_network_settings/view.cljs +++ b/src/status_im/ui/screens/mobile_network_settings/view.cljs @@ -6,7 +6,6 @@ [re-frame.core :as re-frame] status-im.ui.screens.mobile-network-settings.events [status-im.ui.screens.profile.components.views :as profile.components] - [status-im.utils.platform :as platform] [status-im.ui.screens.mobile-network-settings.sheets :as sheets] [status-im.ui.components.topbar :as topbar])) diff --git a/src/status_im/ui/screens/offline_messaging_settings/edit_mailserver/views.cljs b/src/status_im/ui/screens/offline_messaging_settings/edit_mailserver/views.cljs index 74de6bce1d..8cbc54f24b 100644 --- a/src/status_im/ui/screens/offline_messaging_settings/edit_mailserver/views.cljs +++ b/src/status_im/ui/screens/offline_messaging_settings/edit_mailserver/views.cljs @@ -4,13 +4,10 @@ [re-frame.core :as re-frame] [status-im.ui.components.react :as react] [status-im.i18n :as i18n] - [status-im.utils.utils :as utils] [status-im.ui.components.colors :as colors] [status-im.ui.components.icons.vector-icons :as vector-icons] [status-im.ui.components.styles :as components.styles] [status-im.ui.components.common.common :as components.common] - [status-im.ui.components.toolbar.view :as toolbar] - [status-im.ui.components.list.views :as list] [status-im.ui.components.text-input.view :as text-input] [status-im.ui.screens.offline-messaging-settings.edit-mailserver.styles :as styles] [status-im.ui.components.tooltip.views :as tooltip] diff --git a/src/status_im/ui/screens/profile/components/views.cljs b/src/status_im/ui/screens/profile/components/views.cljs index c763b0842a..1ffcfd6116 100644 --- a/src/status_im/ui/screens/profile/components/views.cljs +++ b/src/status_im/ui/screens/profile/components/views.cljs @@ -2,7 +2,6 @@ (:require [clojure.string :as string] [status-im.i18n :as i18n] [status-im.ui.components.colors :as colors] - [status-im.ui.components.common.common :as common] [status-im.ui.components.icons.vector-icons :as vector-icons] [status-im.ui.components.react :as react] [status-im.ui.screens.profile.components.styles :as styles])) diff --git a/src/status_im/ui/screens/profile/contact/views.cljs b/src/status_im/ui/screens/profile/contact/views.cljs index fd08ee9246..2dc240a56b 100644 --- a/src/status_im/ui/screens/profile/contact/views.cljs +++ b/src/status_im/ui/screens/profile/contact/views.cljs @@ -1,19 +1,18 @@ (ns status-im.ui.screens.profile.contact.views - (:require [re-frame.core :as re-frame] - [reagent.core :as reagent] + (:require [quo.core :as quo] + [re-frame.core :as re-frame] [status-im.i18n :as i18n] - [status-im.ui.components.list.views :as list] - [status-im.utils.utils :as utils] - [status-im.ui.components.icons.vector-icons :as icons] - [status-im.ui.components.react :as react] - [status-im.ui.screens.profile.contact.styles :as styles] - [status-im.ui.components.list-item.views :as list-item] - [status-im.ui.components.chat-icon.screen :as chat-icon] - [status-im.ui.screens.profile.components.sheets :as sheets] - [status-im.ui.components.profile-header.view :as profile-header] - [status-im.utils.gfycat.core :as gfy] [status-im.multiaccounts.core :as multiaccounts] - [quo.core :as quo]) + [status-im.ui.components.chat-icon.screen :as chat-icon] + [status-im.ui.components.icons.vector-icons :as icons] + [status-im.ui.components.list-item.views :as list-item] + [status-im.ui.components.list.views :as list] + [status-im.ui.components.profile-header.view :as profile-header] + [status-im.ui.components.react :as react] + [status-im.ui.screens.profile.components.sheets :as sheets] + [status-im.ui.screens.profile.contact.styles :as styles] + [status-im.utils.gfycat.core :as gfy] + [status-im.utils.utils :as utils]) (:require-macros [status-im.utils.views :as views])) (defn actions @@ -25,7 +24,7 @@ :accessibility-label :start-conversation-button} (not (#{:none :paid} tribute-status)) (assoc :subtext tribute-label))] - ;;TODO hide temporary for v1 + ;;TODO hide temporary for v1 #_{:label (i18n/label :t/send-transaction) :icon :main-icons/send :action #(re-frame/dispatch [:profile/send-transaction public-key]) @@ -35,11 +34,11 @@ :icon :main-icons/remove-contact :accessibility-label :in-contacts-button :action #(re-frame/dispatch [:contact.ui/remove-contact-pressed contact])}] - ;; TODO sheets temporary disabled - ;:action #(re-frame/dispatch [:bottom-sheet/show-sheet - ; {:content sheets/remove-contact - ; :content-height 150} - ; contact]) + ;; TODO sheets temporary disabled + ;:action #(re-frame/dispatch [:bottom-sheet/show-sheet + ; {:content sheets/remove-contact + ; :content-height 150} + ; contact]) [{:label (i18n/label :t/add-to-contacts) :icon :main-icons/add-contact :accessibility-label :add-to-contacts-button diff --git a/src/status_im/ui/screens/profile/group_chat/views.cljs b/src/status_im/ui/screens/profile/group_chat/views.cljs index c5dc6c97f5..d0ca92a586 100644 --- a/src/status_im/ui/screens/profile/group_chat/views.cljs +++ b/src/status_im/ui/screens/profile/group_chat/views.cljs @@ -1,22 +1,22 @@ (ns status-im.ui.screens.profile.group-chat.views - (:require-macros [status-im.utils.views :refer [defview letsubs]]) - (:require [status-im.utils.platform :as platform] + (:require [quo.core :as quo] + [re-frame.core :as re-frame] [status-im.constants :as constants] - [status-im.ui.components.react :as react] - [status-im.ui.screens.profile.components.styles :as profile.components.styles] - [status-im.ui.screens.profile.components.views :as profile.components] + [status-im.i18n :as i18n] + [status-im.multiaccounts.core :as multiaccounts] + [status-im.ui.components.chat-icon.screen :as chat-icon] [status-im.ui.components.contact.contact :as contact] [status-im.ui.components.icons.vector-icons :as vector-icons] + [status-im.ui.components.list-item.views :as list-item] [status-im.ui.components.list.views :as list] - [status-im.ui.components.chat-icon.screen :as chat-icon] - [status-im.ui.screens.chat.sheets :as chat.sheets] - [status-im.multiaccounts.core :as multiaccounts] - [status-im.ui.components.colors :as colors] - [re-frame.core :as re-frame] - [status-im.i18n :as i18n] - [quo.core :as quo] [status-im.ui.components.profile-header.view :as profile-header] - [status-im.ui.components.list-item.views :as list-item])) + [status-im.ui.components.react :as react] + [status-im.ui.screens.chat.sheets :as chat.sheets] + [status-im.ui.screens.profile.components.styles + :as + profile.components.styles] + [status-im.utils.platform :as platform]) + (:require-macros [status-im.utils.views :refer [defview letsubs]])) (defn member-sheet [chat-id member us-admin?] [react/view diff --git a/src/status_im/ui/screens/profile/user/styles.cljs b/src/status_im/ui/screens/profile/user/styles.cljs index 4249b7901d..4f4b5aed60 100644 --- a/src/status_im/ui/screens/profile/user/styles.cljs +++ b/src/status_im/ui/screens/profile/user/styles.cljs @@ -1,6 +1,5 @@ -(ns status-im.ui.screens.profile.user.styles - (:require [status-im.ui.components.colors :as colors])) +(ns status-im.ui.screens.profile.user.styles) (def share-link-button {:margin-top 12 - :margin-bottom 8}) \ No newline at end of file + :margin-bottom 8}) diff --git a/src/status_im/ui/screens/routing/core.cljs b/src/status_im/ui/screens/routing/core.cljs index b19c4dcb62..7e8e2abfd2 100644 --- a/src/status_im/ui/screens/routing/core.cljs +++ b/src/status_im/ui/screens/routing/core.cljs @@ -1,15 +1,15 @@ (ns status-im.ui.screens.routing.core - (:require [reagent.core :as reagent] + (:require ["react" :refer (useCallback useEffect)] + ["react-native" :refer (BackHandler)] + ["@react-navigation/native" :refer (NavigationContainer StackActions CommonActions useFocusEffect) :as react-navigation] + ["@react-navigation/stack" :refer (createStackNavigator TransitionPresets)] + ["@react-navigation/bottom-tabs" :refer (createBottomTabNavigator)] + [reagent.core :as reagent] [status-im.ui.components.colors :as colors] [re-frame.core :as re-frame] [taoensso.timbre :as log] [status-im.utils.platform :as platform] [status-im.ui.components.react :as react] - ["react" :refer (useCallback useEffect)] - ["react-native" :refer (BackHandler)] - ["@react-navigation/native" :refer (NavigationContainer StackActions CommonActions useFocusEffect) :as react-navigation] - ["@react-navigation/stack" :refer (createStackNavigator TransitionPresets)] - ["@react-navigation/bottom-tabs" :refer (createBottomTabNavigator)] [oops.core :refer [ocall oget]])) (def navigation-container (reagent/adapt-react-class NavigationContainer)) diff --git a/src/status_im/ui/screens/wallet/account/views.cljs b/src/status_im/ui/screens/wallet/account/views.cljs index cae8321850..02645c2f9a 100644 --- a/src/status_im/ui/screens/wallet/account/views.cljs +++ b/src/status_im/ui/screens/wallet/account/views.cljs @@ -1,22 +1,22 @@ (ns status-im.ui.screens.wallet.account.views - (:require-macros [status-im.utils.views :as views]) - (:require [status-im.ui.components.react :as react] - [status-im.ui.components.colors :as colors] - [re-frame.core :as re-frame] - [status-im.ui.screens.wallet.accounts.views :as accounts] - [status-im.ui.screens.wallet.accounts.sheets :as sheets] + (:require [re-frame.core :as re-frame] [reagent.core :as reagent] - [status-im.ui.components.list.views :as list] - [status-im.i18n :as i18n] - [status-im.ui.components.icons.vector-icons :as icons] - [status-im.ui.screens.wallet.account.styles :as styles] - [status-im.ui.screens.wallet.transactions.views :as history] [status-im.ethereum.core :as ethereum] + [status-im.i18n :as i18n] + [status-im.ui.components.animation :as animation] + [status-im.ui.components.colors :as colors] + [status-im.ui.components.icons.vector-icons :as icons] [status-im.ui.components.list-item.views :as list-item] - [status-im.utils.money :as money] - [status-im.wallet.utils :as wallet.utils] + [status-im.ui.components.list.views :as list] + [status-im.ui.components.react :as react] [status-im.ui.components.topbar :as topbar] - [status-im.ui.components.animation :as animation])) + [status-im.ui.screens.wallet.account.styles :as styles] + [status-im.ui.screens.wallet.accounts.sheets :as sheets] + [status-im.ui.screens.wallet.accounts.views :as accounts] + [status-im.ui.screens.wallet.transactions.views :as history] + [status-im.utils.money :as money] + [status-im.wallet.utils :as wallet.utils]) + (:require-macros [status-im.utils.views :as views])) (def state (reagent/atom {:tab :assets})) diff --git a/src/status_im/ui/screens/wallet/accounts/views.cljs b/src/status_im/ui/screens/wallet/accounts/views.cljs index d94fbcff7c..67196ea1b2 100644 --- a/src/status_im/ui/screens/wallet/accounts/views.cljs +++ b/src/status_im/ui/screens/wallet/accounts/views.cljs @@ -2,7 +2,6 @@ (:require [quo.animated :as reanimated] [quo.core :as quo] [re-frame.core :as re-frame] - [reagent.core :as reagent] [status-im.i18n :as i18n] [status-im.ui.components.chat-icon.screen :as chat-icon] [status-im.ui.components.colors :as colors] diff --git a/src/status_im/ui/screens/wallet/transactions/styles.cljs b/src/status_im/ui/screens/wallet/transactions/styles.cljs index 1f9e9b4c36..fa5cf56ca6 100644 --- a/src/status_im/ui/screens/wallet/transactions/styles.cljs +++ b/src/status_im/ui/screens/wallet/transactions/styles.cljs @@ -1,6 +1,5 @@ (ns status-im.ui.screens.wallet.transactions.styles (:require [status-im.ui.components.colors :as colors] - [status-im.utils.platform :as platform] [status-im.utils.styles :as styles])) (def forward @@ -137,4 +136,4 @@ (def details-separator {:background-color colors/black-transparent :height 1 - :margin-vertical 10}) \ No newline at end of file + :margin-vertical 10}) diff --git a/src/status_im/ui/screens/wallet/transactions/views.cljs b/src/status_im/ui/screens/wallet/transactions/views.cljs index 760df52f81..65b6db6479 100644 --- a/src/status_im/ui/screens/wallet/transactions/views.cljs +++ b/src/status_im/ui/screens/wallet/transactions/views.cljs @@ -9,7 +9,6 @@ [status-im.ui.components.toolbar.actions :as actions] [status-im.ui.components.toolbar.view :as toolbar-old] [status-im.ui.screens.wallet.transactions.styles :as styles] - [status-im.ui.components.topbar :as topbar] [status-im.ui.components.toolbar :as toolbar]) (:require-macros [status-im.utils.views :refer [defview letsubs]])) diff --git a/src/status_im/utils/async_test.cljs b/src/status_im/utils/async_test.cljs index ff5cb13ab0..74d06eab33 100644 --- a/src/status_im/utils/async_test.cljs +++ b/src/status_im/utils/async_test.cljs @@ -13,10 +13,10 @@ (async/put! input 1) (async/put! input 2) (async/put! input 3) - (interceptor get-coeffect get-effect]] + [re-frame.interceptor :refer [->interceptor get-coeffect]] [taoensso.timbre :as log])) (defn- parse-json diff --git a/src/status_im/utils/keychain/core.cljs b/src/status_im/utils/keychain/core.cljs index ee2daef6cd..8a3ffcffd9 100644 --- a/src/status_im/utils/keychain/core.cljs +++ b/src/status_im/utils/keychain/core.cljs @@ -51,7 +51,7 @@ ;; Note that the password won't be stored if the device isn't locked by a passcode. #js {:accessible (enum-val "ACCESSIBLE" "WHEN_PASSCODE_SET_THIS_DEVICE_ONLY")}) -(def ^:const keychain-secure-hardware +(def keychain-secure-hardware ;; (Android) Requires storing the encryption key for the entry in secure hardware ;; or StrongBox (see https://developer.android.com/training/articles/keystore#ExtractionPrevention) "SECURE_HARDWARE") @@ -109,10 +109,10 @@ (.then callback)) (callback))) ;; no-op for Desktop -(def ^:const auth-method-password "password") -(def ^:const auth-method-biometric "biometric") -(def ^:const auth-method-biometric-prepare "biometric-prepare") -(def ^:const auth-method-none "none") +(def auth-method-password "password") +(def auth-method-biometric "biometric") +(def auth-method-biometric-prepare "biometric-prepare") +(def auth-method-none "none") (re-frame/reg-fx :keychain/get-auth-method diff --git a/src/status_im/utils/multihash.cljs b/src/status_im/utils/multihash.cljs index 8cbc2a280f..a0fdbb1725 100644 --- a/src/status_im/utils/multihash.cljs +++ b/src/status_im/utils/multihash.cljs @@ -5,7 +5,7 @@ [alphabase.bytes :as bytes] [alphabase.hex :as hex])) -(def ^:const algorithm-codes +(def algorithm-codes "Map of information about the available content hashing algorithms." {:sha1 0x11 :sha2-256 0x12 @@ -182,4 +182,4 @@ {:type :multihash/bad-input}))) (let [digest (bytes/byte-array length)] (bytes/copy encoded 2 digest 0 length) - (create code digest)))) \ No newline at end of file + (create code digest)))) diff --git a/src/status_im/utils/prices_test.cljs b/src/status_im/utils/prices_test.cljs index 6037ea1367..342a9b75a0 100644 --- a/src/status_im/utils/prices_test.cljs +++ b/src/status_im/utils/prices_test.cljs @@ -3,12 +3,12 @@ [status-im.utils.prices :as prices])) (deftest test-format-price-resp-mainnet - (is (= (prices/format-price-resp + (is (= (#'status-im.utils.prices/format-price-resp "{\"RAW\":{\"ETH\":{\"USD\":{\"TYPE\":\"5\",\"MARKET\":\"CCCAGG\",\"FROMSYMBOL\":\"ETH\",\"TOSYMBOL\":\"USD\",\"FLAGS\":\"4\",\"PRICE\":677.91,\"LASTUPDATE\":1525241472,\"LASTVOLUME\":0.69661268,\"LASTVOLUMETO\":472.0874471092,\"LASTTRADEID\":\"1525241472.6714\",\"VOLUMEDAY\":109859.96594606241,\"VOLUMEDAYTO\":73924561.52673237,\"VOLUME24HOUR\":408811.69032152055,\"VOLUME24HOURTO\":270617692.0100031,\"OPENDAY\":670.81,\"HIGHDAY\":681.06,\"LOWDAY\":662.13,\"OPEN24HOUR\":658.68,\"HIGH24HOUR\":681.67,\"LOW24HOUR\":638.25,\"LASTMARKET\":\"Kraken\",\"CHANGE24HOUR\":19.230000000000018,\"CHANGEPCT24HOUR\":2.919475314264896,\"CHANGEDAY\":7.100000000000023,\"CHANGEPCTDAY\":1.0584219078427608,\"SUPPLY\":99176837.749,\"MKTCAP\":67232970078.42458,\"TOTALVOLUME24H\":1308785.4697758215,\"TOTALVOLUME24HTO\":880718916.8398683}},\"SNT\":{\"USD\":{\"TYPE\":\"5\",\"MARKET\":\"CCCAGG\",\"FROMSYMBOL\":\"SNT\",\"TOSYMBOL\":\"USD\",\"FLAGS\":\"1\",\"PRICE\":0.1562,\"LASTUPDATE\":1525241236,\"LASTVOLUME\":582.07218,\"LASTVOLUMETO\":90.919674516,\"LASTTRADEID\":\"237582608\",\"VOLUMEDAY\":259125.16382211001,\"VOLUMEDAYTO\":40450.5318867195,\"VOLUME24HOUR\":1451022.9449243098,\"VOLUME24HOURTO\":223465.71221695316,\"OPENDAY\":0.1573,\"HIGHDAY\":0.1592,\"LOWDAY\":0.1532,\"OPEN24HOUR\":0.15,\"HIGH24HOUR\":0.1657,\"LOW24HOUR\":0.1481,\"LASTMARKET\":\"Bitfinex\",\"CHANGE24HOUR\":0.006200000000000011,\"CHANGEPCT24HOUR\":4.133333333333341,\"CHANGEDAY\":-0.0010999999999999899,\"CHANGEPCTDAY\":-0.6993006993006928,\"SUPPLY\":6804870174.87817,\"MKTCAP\":1062920721.3159702,\"TOTALVOLUME24H\":239970152.87898657,\"TOTALVOLUME24HTO\":37480153.807917476}}},\"DISPLAY\":{\"ETH\":{\"USD\":{\"FROMSYMBOL\":\"Ξ\",\"TOSYMBOL\":\"$\",\"MARKET\":\"CryptoCompare Index\",\"PRICE\":\"$ 677.91\",\"LASTUPDATE\":\"Just now\",\"LASTVOLUME\":\"Ξ 0.6966\",\"LASTVOLUMETO\":\"$ 472.09\",\"LASTTRADEID\":\"1525241472.6714\",\"VOLUMEDAY\":\"Ξ 109,860.0\",\"VOLUMEDAYTO\":\"$ 73,924,561.5\",\"VOLUME24HOUR\":\"Ξ 408,811.7\",\"VOLUME24HOURTO\":\"$ 270,617,692.0\",\"OPENDAY\":\"$ 670.81\",\"HIGHDAY\":\"$ 681.06\",\"LOWDAY\":\"$ 662.13\",\"OPEN24HOUR\":\"$ 658.68\",\"HIGH24HOUR\":\"$ 681.67\",\"LOW24HOUR\":\"$ 638.25\",\"LASTMARKET\":\"Kraken\",\"CHANGE24HOUR\":\"$ 19.23\",\"CHANGEPCT24HOUR\":\"2.92\",\"CHANGEDAY\":\"$ 7.10\",\"CHANGEPCTDAY\":\"1.06\",\"SUPPLY\":\"Ξ 99,176,837.7\",\"MKTCAP\":\"$ 67.23 B\",\"TOTALVOLUME24H\":\"Ξ 1,308.79 K\",\"TOTALVOLUME24HTO\":\"$ 880.72 M\"}},\"SNT\":{\"USD\":{\"FROMSYMBOL\":\"SNT\",\"TOSYMBOL\":\"$\",\"MARKET\":\"CryptoCompare Index\",\"PRICE\":\"$ 0.1562\",\"LASTUPDATE\":\"3 min ago\",\"LASTVOLUME\":\"SNT 582.07\",\"LASTVOLUMETO\":\"$ 90.92\",\"LASTTRADEID\":\"237582608\",\"VOLUMEDAY\":\"SNT 259,125.2\",\"VOLUMEDAYTO\":\"$ 40,450.5\",\"VOLUME24HOUR\":\"SNT 1,451,022.9\",\"VOLUME24HOURTO\":\"$ 223,465.7\",\"OPENDAY\":\"$ 0.1573\",\"HIGHDAY\":\"$ 0.1592\",\"LOWDAY\":\"$ 0.1532\",\"OPEN24HOUR\":\"$ 0.1500\",\"HIGH24HOUR\":\"$ 0.1657\",\"LOW24HOUR\":\"$ 0.1481\",\"LASTMARKET\":\"Bitfinex\",\"CHANGE24HOUR\":\"$ 0.0062\",\"CHANGEPCT24HOUR\":\"4.13\",\"CHANGEDAY\":\"$ -0.0011\",\"CHANGEPCTDAY\":\"-0.70\",\"SUPPLY\":\"SNT 6,804,870,174.9\",\"MKTCAP\":\"$ 1,062.92 M\",\"TOTALVOLUME24H\":\"SNT 239.97 M\",\"TOTALVOLUME24HTO\":\"$ 37.48 M\"}}}}" true) {:ETH {:USD {:from "ETH", :to "USD", :price 677.91, :last-day 658.68}} :SNT {:USD {:from "SNT", :to "USD", :price 0.1562, :last-day 0.15}}}))) (deftest test-format-price-resp-non-mainnet - (is (= (prices/format-price-resp + (is (= (#'status-im.utils.prices/format-price-resp "{\"RAW\":{\"SNT\":{\"USD\":{\"TYPE\":\"5\",\"MARKET\":\"CCCAGG\",\"FROMSYMBOL\":\"SNT\",\"TOSYMBOL\":\"USD\",\"FLAGS\":\"4\",\"PRICE\":0.03511847069999999,\"LASTUPDATE\":1539953131,\"LASTVOLUME\":0,\"LASTVOLUMETO\":0,\"LASTTRADEID\":0,\"VOLUMEDAY\":0,\"VOLUMEDAYTO\":0,\"VOLUME24HOUR\":45900.43172688,\"VOLUME24HOURTO\":1645.4590651064077,\"OPENDAY\":0.0357005448,\"HIGHDAY\":0.0358298946,\"LOWDAY\":0.034924446,\"OPEN24HOUR\":0.0360239193,\"HIGH24HOUR\":0.03621794399999999,\"LOW24HOUR\":0.0348597711,\"LASTMARKET\":\"IDAX\",\"CHANGE24HOUR\":-0.0009054486000000112,\"CHANGEPCT24HOUR\":-2.5134649910233704,\"CHANGEDAY\":-0.0005820741000000101,\"CHANGEPCTDAY\":-1.630434782608724,\"SUPPLY\":6804870174.87817,\"MKTCAP\":238976633.8537628,\"TOTALVOLUME24H\":53502856.59548309,\"TOTALVOLUME24HTO\":1878972.0078131626}}},\"DISPLAY\":{\"SNT\":{\"USD\":{\"FROMSYMBOL\":\"SNT\",\"TOSYMBOL\":\"$\",\"MARKET\":\"CryptoCompare Index\",\"PRICE\":\"$ 0.03512\",\"LASTUPDATE\":\"Just now\",\"LASTVOLUME\":\"SNT 0\",\"LASTVOLUMETO\":\"$ 0\",\"LASTTRADEID\":0,\"VOLUMEDAY\":\"SNT 0\",\"VOLUMEDAYTO\":\"$ 0\",\"VOLUME24HOUR\":\"SNT 45,900.4\",\"VOLUME24HOURTO\":\"$ 1,645.46\",\"OPENDAY\":\"$ 0.03570\",\"HIGHDAY\":\"$ 0.03583\",\"LOWDAY\":\"$ 0.03492\",\"OPEN24HOUR\":\"$ 0.03602\",\"HIGH24HOUR\":\"$ 0.03622\",\"LOW24HOUR\":\"$ 0.03486\",\"LASTMARKET\":\"IDAX\",\"CHANGE24HOUR\":\"$ -0.00091\",\"CHANGEPCT24HOUR\":\"-2.51\",\"CHANGEDAY\":\"$ -0.00058\",\"CHANGEPCTDAY\":\"-1.63\",\"SUPPLY\":\"SNT 6,804,870,174.9\",\"MKTCAP\":\"$ 238.98 M\",\"TOTALVOLUME24H\":\"SNT 53.50 M\",\"TOTALVOLUME24HTO\":\"$ 1,878.97 K\"}}}}" false) {:ETH {:USD {:from "ETH", :to "USD", :price 0.03511847069999999, :last-day 0.0360239193}}}))) diff --git a/src/status_im/utils/signing_phrase/core_test.cljs b/src/status_im/utils/signing_phrase/core_test.cljs index 19cdf7808b..b9c6bb7873 100644 --- a/src/status_im/utils/signing_phrase/core_test.cljs +++ b/src/status_im/utils/signing_phrase/core_test.cljs @@ -1,5 +1,5 @@ (ns status-im.utils.signing-phrase.core-test - (:require [cljs.test :refer-macros [deftest is testing]] + (:require [cljs.test :refer-macros [deftest is]] [status-im.utils.signing-phrase.core :refer [generate]] [clojure.string :as string])) diff --git a/src/status_im/utils/transducers_test.cljs b/src/status_im/utils/transducers_test.cljs index f6610ae4ee..57fd28291d 100644 --- a/src/status_im/utils/transducers_test.cljs +++ b/src/status_im/utils/transducers_test.cljs @@ -2,21 +2,21 @@ (:require [cljs.test :refer-macros [deftest is testing]] [status-im.utils.transducers :as transducers])) -(def ^:private preview-call-1 +(def preview-call-1 {:jail-id 1 :path [:preview] :params {:chat-id 1} :callback (fn [] [[:msg-id 1]])}) -(def ^:private preview-call-2 +(def preview-call-2 {:jail-id 1 :path [:preview] :params {:chat-id 1} :callback (fn [] [[:msg-id 2]])}) -(def ^:private jail-calls +(def jail-calls '({:jail-id 1 :path [:suggestions] :params {:arg 0}} diff --git a/src/status_im/utils/universal_links/core.cljs b/src/status_im/utils/universal_links/core.cljs index 20408d8957..a6568b72ce 100644 --- a/src/status_im/utils/universal_links/core.cljs +++ b/src/status_im/utils/universal_links/core.cljs @@ -9,7 +9,6 @@ [status-im.ethereum.ens :as ens] [status-im.ethereum.core :as ethereum] [status-im.utils.security :as security] - [status-im.ui.components.list-selection :as list-selection] [status-im.ui.components.react :as react] [status-im.ui.screens.add-new.new-chat.db :as new-chat.db] [status-im.navigation :as navigation] diff --git a/src/status_im/utils/varint_test.cljs b/src/status_im/utils/varint_test.cljs index a91638b375..1fb25777e9 100644 --- a/src/status_im/utils/varint_test.cljs +++ b/src/status_im/utils/varint_test.cljs @@ -1,5 +1,5 @@ (ns status-im.utils.varint-test - (:require [cljs.test :refer-macros [deftest is testing]] + (:require [cljs.test :refer-macros [deftest is]] [status-im.utils.varint :as varint])) (deftest encode diff --git a/src/status_im/wallet/db_test.cljs b/src/status_im/wallet/db_test.cljs index 21c8d5e11f..6764e293a9 100644 --- a/src/status_im/wallet/db_test.cljs +++ b/src/status_im/wallet/db_test.cljs @@ -6,18 +6,18 @@ (deftest test-too-precise-amount? (testing "try both decimal and scientific or hex format" - (is (= false (wallet.db/too-precise-amount? "100" 2))) - (is (= false (wallet.db/too-precise-amount? "100" 0))) - (is (= true (wallet.db/too-precise-amount? "100.1" 0))) - (is (= false (wallet.db/too-precise-amount? "100.23" 2))) - (is (= true (wallet.db/too-precise-amount? "100.233" 2))) - (is (= true (wallet.db/too-precise-amount? "100.0000000000000000001" 18))) - (is (= false (wallet.db/too-precise-amount? "100.000000000000000001" 18))) - (is (= false (wallet.db/too-precise-amount? "1e-18" 18))) - (is (= true (wallet.db/too-precise-amount? "1e-19" 18))) - (is (= true (wallet.db/too-precise-amount? "0xa.a" 2))) ;; 0xa.a is 10.625 - (is (= false (wallet.db/too-precise-amount? "0xa.a" 3))) - (is (= false (wallet.db/too-precise-amount? "1000" 3))))) + (is (= false (#'status-im.wallet.db/too-precise-amount? "100" 2))) + (is (= false (#'status-im.wallet.db/too-precise-amount? "100" 0))) + (is (= true (#'status-im.wallet.db/too-precise-amount? "100.1" 0))) + (is (= false (#'status-im.wallet.db/too-precise-amount? "100.23" 2))) + (is (= true (#'status-im.wallet.db/too-precise-amount? "100.233" 2))) + (is (= true (#'status-im.wallet.db/too-precise-amount? "100.0000000000000000001" 18))) + (is (= false (#'status-im.wallet.db/too-precise-amount? "100.000000000000000001" 18))) + (is (= false (#'status-im.wallet.db/too-precise-amount? "1e-18" 18))) + (is (= true (#'status-im.wallet.db/too-precise-amount? "1e-19" 18))) + (is (= true (#'status-im.wallet.db/too-precise-amount? "0xa.a" 2))) ;; 0xa.a is 10.625 + (is (= false (#'status-im.wallet.db/too-precise-amount? "0xa.a" 3))) + (is (= false (#'status-im.wallet.db/too-precise-amount? "1000" 3))))) (defn- equal-results? [a b] (and (= (:error a) (:error b)) diff --git a/src/status_im/wallet/subs_test.cljs b/src/status_im/wallet/subs_test.cljs index 8c3e77768f..1a1cc6f1c2 100644 --- a/src/status_im/wallet/subs_test.cljs +++ b/src/status_im/wallet/subs_test.cljs @@ -4,14 +4,15 @@ [status-im.subs :as s])) (deftest test-balance-total-value - (is (= (s/get-balance-total-value {:ETH (money/bignumber 1000000000000000000) - :SNT (money/bignumber 100000000000000000000) - :AST (money/bignumber 10000)} - {:ETH {:USD {:from "ETH", :to "USD", :price 677.91, :last-day 658.688}} - :SNT {:USD {:from "SNT", :to "USD", :price 0.1562, :last-day 0.15}} - :AST {:USD {:from "AST", :to "USD", :price 4, :last-day 3}}} - :USD - {:ETH 18 - :SNT 18 - :AST 4}) + (is (= (#'status-im.subs/get-balance-total-value + {:ETH (money/bignumber 1000000000000000000) + :SNT (money/bignumber 100000000000000000000) + :AST (money/bignumber 10000)} + {:ETH {:USD {:from "ETH", :to "USD", :price 677.91, :last-day 658.688}} + :SNT {:USD {:from "SNT", :to "USD", :price 0.1562, :last-day 0.15}} + :AST {:USD {:from "AST", :to "USD", :price 4, :last-day 3}}} + :USD + {:ETH 18 + :SNT 18 + :AST 4}) 697.53))) diff --git a/src/status_im/wallet/transactions_test.cljs b/src/status_im/wallet/transactions_test.cljs index cee3c2ef59..775728ea2e 100644 --- a/src/status_im/wallet/transactions_test.cljs +++ b/src/status_im/wallet/transactions_test.cljs @@ -1,18 +1,6 @@ (ns status-im.wallet.transactions-test (:require [cljs.test :refer-macros [deftest is]] - [goog.Uri :as goog-uri] - [status-im.ethereum.transactions.core :as transactions] - [status-im.utils.http :as http])) - -(defn- uri-query-data [uri] - (let [uri' (goog-uri/parse uri) - accum (atom {})] - (.forEach (.getQueryData uri') - #(swap! accum assoc (keyword %2) %1)) - {:scheme (.getScheme uri') - :domain (.getDomain uri') - :path (.getPath uri') - :query @accum})) + [status-im.ethereum.transactions.core :as transactions])) (deftest get-transaction-details-url (is (= "https://etherscan.io/tx/asdfasdf"