From 81257b815a01966711e64b2cc902f9d0226d3c48 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Tue, 27 Dec 2016 17:16:53 +0200 Subject: [PATCH] unused symbols --- env/dev/env/android_test/main.cljs | 2 +- src/status_im/accounts/handlers.cljs | 2 +- src/status_im/accounts/login/handlers.cljs | 2 +- src/status_im/accounts/screen.cljs | 6 +- src/status_im/android/core.cljs | 2 +- src/status_im/chat/handlers.cljs | 11 ++-- src/status_im/chat/handlers/console.cljs | 2 +- src/status_im/chat/handlers/faucet.cljs | 2 +- .../chat/handlers/receive_message.cljs | 2 +- src/status_im/chat/handlers/requests.cljs | 2 +- src/status_im/chat/handlers/send_message.cljs | 6 +- src/status_im/chat/screen.cljs | 2 +- src/status_im/chat/styles/plain_message.cljs | 2 +- src/status_im/chat/subs.cljs | 5 +- src/status_im/chat/views/emoji.cljs | 1 - src/status_im/chat/views/message.cljs | 8 +-- src/status_im/chat/views/message_input.cljs | 14 ++--- src/status_im/chat/views/plain_message.cljs | 8 +-- src/status_im/chat/views/request_message.cljs | 4 +- src/status_im/chat/views/response.cljs | 4 +- src/status_im/chat/views/suggestions.cljs | 2 +- src/status_im/commands/handlers/jail.cljs | 2 +- src/status_im/commands/handlers/loading.cljs | 12 ++-- .../components/carousel/carousel.cljs | 14 +---- src/status_im/components/carousel/styles.cljs | 2 +- src/status_im/components/drawer/view.cljs | 3 +- .../components/selectable_field/view.cljs | 2 +- src/status_im/components/tabs/tabs.cljs | 4 +- src/status_im/components/text_field/view.cljs | 60 ++----------------- src/status_im/components/toolbar/view.cljs | 1 - src/status_im/data_store/messages.cljs | 2 +- src/status_im/data_store/realm/chats.cljs | 6 +- src/status_im/data_store/realm/commands.cljs | 2 +- src/status_im/data_store/realm/core.cljs | 5 +- .../realm/schemas/account/v1/chat.cljs | 2 +- .../schemas/account/v1/chat_contact.cljs | 4 +- .../realm/schemas/account/v1/command.cljs | 4 +- .../realm/schemas/account/v1/contact.cljs | 2 +- .../realm/schemas/account/v1/discover.cljs | 2 +- .../realm/schemas/account/v1/kv_store.cljs | 4 +- .../realm/schemas/account/v1/message.cljs | 2 +- .../schemas/account/v1/pending_message.cljs | 4 +- .../schemas/account/v1/processed_message.cljs | 2 +- .../realm/schemas/account/v1/request.cljs | 4 +- .../realm/schemas/account/v1/tag.cljs | 4 +- .../realm/schemas/account/v1/user_status.cljs | 4 +- .../realm/schemas/base/v1/account.cljs | 2 +- .../realm/schemas/base/v1/kv_store.cljs | 4 +- src/status_im/discover/handlers.cljs | 2 +- src/status_im/group_settings/handlers.cljs | 2 +- src/status_im/handlers.cljs | 4 +- src/status_im/protocol/discoveries.cljs | 2 +- src/status_im/protocol/handlers.cljs | 15 ++--- src/status_im/transactions/handlers.cljs | 2 +- 54 files changed, 98 insertions(+), 177 deletions(-) diff --git a/env/dev/env/android_test/main.cljs b/env/dev/env/android_test/main.cljs index 8599609053..062e01f015 100644 --- a/env/dev/env/android_test/main.cljs +++ b/env/dev/env/android_test/main.cljs @@ -17,5 +17,5 @@ :heads-up-display false :jsload-callback #(swap! cnt inc)) -(core/init :test) +(core/init) ;(init-stubs) diff --git a/src/status_im/accounts/handlers.cljs b/src/status_im/accounts/handlers.cljs index d668d863f2..3cee34ce33 100644 --- a/src/status_im/accounts/handlers.cljs +++ b/src/status_im/accounts/handlers.cljs @@ -89,7 +89,7 @@ :check-status-change (u/side-effect! (fn [{:keys [current-account-id accounts]} [_ status]] - (let [{old-status :status :as account} (get accounts current-account-id) + (let [{old-status :status} (get accounts current-account-id) status-updated? (and (not= status nil) (not= status old-status))] (when status-updated? diff --git a/src/status_im/accounts/login/handlers.cljs b/src/status_im/accounts/login/handlers.cljs index 581bbe22c0..6175c3fa2a 100644 --- a/src/status_im/accounts/login/handlers.cljs +++ b/src/status_im/accounts/login/handlers.cljs @@ -34,7 +34,7 @@ (register-handler :change-account (u/side-effect! - (fn [db [_ address new-account? callback]] + (fn [_ [_ address new-account? callback]] (data-store/change-account address new-account? #(callback % address new-account?))))) diff --git a/src/status_im/accounts/screen.cljs b/src/status_im/accounts/screen.cljs index 5600b9c58e..bf765d262a 100644 --- a/src/status_im/accounts/screen.cljs +++ b/src/status_im/accounts/screen.cljs @@ -37,11 +37,7 @@ (defn render-row [row _ _] (list-item [account-view row])) -(defn render-separator [_ row-id _] - (list-item [view {:style st/row-separator - :key row-id}])) - -(defn create-account [event] +(defn create-account [_] (dispatch-sync [:reset-app]) ; add accounts screen to history ( maybe there is a better way ? ) (dispatch [:navigate-to-clean :accounts]) diff --git a/src/status_im/android/core.cljs b/src/status_im/android/core.cljs index 05d6af3f55..81dbb8dc1f 100644 --- a/src/status_im/android/core.cljs +++ b/src/status_im/android/core.cljs @@ -123,7 +123,7 @@ :contact-list-modal contact-list)] [component])]])]))))}))) -(defn init [& [env]] +(defn init [] (status/call-module status/init-jail) (dispatch-sync [:reset-app]) (.registerComponent app-registry "StatusIm" #(r/reactify-component app-root)) diff --git a/src/status_im/chat/handlers.cljs b/src/status_im/chat/handlers.cljs index a4df2c3b46..8a3c4d2852 100644 --- a/src/status_im/chat/handlers.cljs +++ b/src/status_im/chat/handlers.cljs @@ -95,7 +95,7 @@ (register-handler :start-cancel-command (after #(dispatch [:set-soft-input-mode :resize])) (u/side-effect! - (fn [db _] + (fn [] (dispatch [:animate-cancel-command]) (dispatch [:cancel-command])))) @@ -326,10 +326,9 @@ chats (->> loaded-chats (map (fn [{:keys [chat-id] :as chat}] - (let [last-message (messages/get-last-message db chat-id)] + (let [last-message (messages/get-last-message chat-id)] [chat-id (assoc chat :last-message last-message)]))) - (into (priority-map-by compare-chats)))) - ids (set (keys chats'))] + (into (priority-map-by compare-chats))))] (-> db (assoc :chats chats') @@ -571,7 +570,7 @@ (u/side-effect! send-seen!)) (defn send-clock-value-request! - [{:keys [web3 current-public-key]} [_ {:keys [message-id from] :as message}]] + [{:keys [web3 current-public-key]} [_ {:keys [message-id from]}]] (protocol/send-clock-value-request! {:web3 web3 :message {:from current-public-key :to from @@ -593,7 +592,7 @@ (let [clock-value (+ last-clock-value i 1)] (messages/update (assoc message :clock-value clock-value)) (send-clock-value! db to message-id clock-value)))) - (fn [db [_ _ i {:keys [message-id] :as message} last-clock-value]] + (fn [db [_ _ i {:keys [message-id]} last-clock-value]] (assoc-in db [:message-extras message-id :clock-value] (+ last-clock-value i 1)))) (register-handler :send-clock-value! diff --git a/src/status_im/chat/handlers/console.cljs b/src/status_im/chat/handlers/console.cljs index b17282beb1..851d98fdd0 100644 --- a/src/status_im/chat/handlers/console.cljs +++ b/src/status_im/chat/handlers/console.cljs @@ -47,7 +47,7 @@ (register-handler :console-respond-command (u/side-effect! - (fn [_ [_ {:keys [command] :as parameters}]] + (fn [_ [_ {:keys [command]}]] (let [{:keys [command handler-data]} command] (when command (let [{:keys [name]} command] diff --git a/src/status_im/chat/handlers/faucet.cljs b/src/status_im/chat/handlers/faucet.cljs index 93449f24a6..8e36a1192e 100644 --- a/src/status_im/chat/handlers/faucet.cljs +++ b/src/status_im/chat/handlers/faucet.cljs @@ -35,7 +35,7 @@ (defmulti open-faucet (fn [_ _ {:keys [type]}] type)) (defmethod open-faucet :api - [faucet-name current-address {:keys [api-url]}] + [_ current-address {:keys [api-url]}] (let [api-url (gstring/format api-url current-address)] (http-get api-url #(received-message (label :t/faucet-success)) diff --git a/src/status_im/chat/handlers/receive_message.cljs b/src/status_im/chat/handlers/receive_message.cljs index b5d9f9e1cc..85f62ba427 100644 --- a/src/status_im/chat/handlers/receive_message.cljs +++ b/src/status_im/chat/handlers/receive_message.cljs @@ -48,7 +48,7 @@ (not= from current-identity) (or (not exists?) active?)) (let [group-chat? (not (nil? group-id)) - previous-message (messages/get-last-message db chat-id') + previous-message (messages/get-last-message chat-id') message' (assoc (->> message (cu/check-author-direction previous-message) (check-preview)) diff --git a/src/status_im/chat/handlers/requests.cljs b/src/status_im/chat/handlers/requests.cljs index 6aa15d962b..7669d36ebb 100644 --- a/src/status_im/chat/handlers/requests.cljs +++ b/src/status_im/chat/handlers/requests.cljs @@ -6,7 +6,7 @@ [taoensso.timbre :as log])) (defn store-request! - [{:keys [new-request] :as db}] + [{:keys [new-request]}] (requests/save new-request)) (defn add-request diff --git a/src/status_im/chat/handlers/send_message.cljs b/src/status_im/chat/handlers/send_message.cljs index 204666679e..cb4ea593b7 100644 --- a/src/status_im/chat/handlers/send_message.cljs +++ b/src/status_im/chat/handlers/send_message.cljs @@ -210,7 +210,7 @@ (register-handler ::send-dapp-message (u/side-effect! - (fn [db [_ chat-id {:keys [content] :as message}]] + (fn [db [_ chat-id {:keys [content]}]] (let [data (get-in db [:local-storage chat-id]) path [:functions :message-handler] @@ -226,7 +226,7 @@ (register-handler ::received-dapp-message (u/side-effect! - (fn [{:keys [current-chat-id] :as db} [_ chat-id {:keys [returned] :as message}]] + (fn [_ [_ chat-id {:keys [returned]}]] (let [{:keys [data messages err]} returned content (if err err @@ -257,7 +257,7 @@ :as db} [_ {{:keys [message-type] :as message} :message chat-id :chat-id}]] - (let [{:keys [dapp?] :as contact} (get-in db [:contacts chat-id])] + (let [{:keys [dapp?]} (get-in db [:contacts chat-id])] (if dapp? (dispatch [::send-dapp-message chat-id message]) (when message diff --git a/src/status_im/chat/screen.cljs b/src/status_im/chat/screen.cljs index ff41bac0c6..cb3d6b064b 100644 --- a/src/status_im/chat/screen.cljs +++ b/src/status_im/chat/screen.cljs @@ -119,7 +119,7 @@ [add-contact-bar]]) (defn get-intro-status-message [all-messages] - (let [{:keys [timestamp content-type] :as last-message} (last all-messages)] + (let [{:keys [timestamp content-type]} (last all-messages)] (when (not= content-type content-type-status) {:message-id "intro-status" :content-type content-type-status diff --git a/src/status_im/chat/styles/plain_message.cljs b/src/status_im/chat/styles/plain_message.cljs index c75f57e953..cf4a26b090 100644 --- a/src/status_im/chat/styles/plain_message.cljs +++ b/src/status_im/chat/styles/plain_message.cljs @@ -3,7 +3,7 @@ [status-im.chat.constants :refer [max-input-height min-input-height]])) -(defn message-input-button-touchable [width content-height] +(defn message-input-button-touchable [width] {:width width :flex 1}) diff --git a/src/status_im/chat/subs.cljs b/src/status_im/chat/subs.cljs index 24e97eafe9..b921d42977 100644 --- a/src/status_im/chat/subs.cljs +++ b/src/status_im/chat/subs.cljs @@ -1,7 +1,6 @@ (ns status-im.chat.subs (:require-macros [reagent.ratom :refer [reaction]]) (:require [re-frame.core :refer [register-sub dispatch subscribe path]] - [status-im.utils.platform :refer [ios?]] [status-im.models.commands :as commands] [status-im.data-store.chats :as chats] [status-im.constants :refer [response-suggesstion-resize-duration]] @@ -9,7 +8,7 @@ [status-im.chat.views.plain-message :as plain-message] [status-im.chat.views.command :as command] [status-im.constants :refer [content-type-status]] - [status-im.utils.platform :refer [platform-specific]])) + [status-im.utils.platform :refer [platform-specific ios?]])) (register-sub :chat-properties (fn [db [_ properties]] @@ -251,7 +250,7 @@ :else 0))))) (register-sub :max-layout-height - (fn [db [_ status-bar]] + (fn [_ [_ status-bar]] (let [layout-height (subscribe [:get :layout-height]) input-margin (subscribe [:input-margin]) status-bar-height (get-in platform-specific [:component-styles :status-bar status-bar :height])] diff --git a/src/status_im/chat/views/emoji.cljs b/src/status_im/chat/views/emoji.cljs index f987a10b12..1388cd79b1 100644 --- a/src/status_im/chat/views/emoji.cljs +++ b/src/status_im/chat/views/emoji.cljs @@ -1,7 +1,6 @@ (ns status-im.chat.views.emoji (:require-macros [status-im.utils.views :refer [defview]]) (:require [re-frame.core :refer [subscribe dispatch]] - [reagent.core :as r] [status-im.components.react :refer [view text icon diff --git a/src/status_im/chat/views/message.cljs b/src/status_im/chat/views/message.cljs index 86e016beb5..ee6a444aff 100644 --- a/src/status_im/chat/views/message.cljs +++ b/src/status_im/chat/views/message.cljs @@ -41,9 +41,7 @@ (let [{:keys [chat-id group-chat name color]} (subscribe [:chat-properties [:chat-id :group-chat :name :color]]) members (subscribe [:current-chat-contacts])] (fn [{:keys [messages-count content datemark]}] - (let [{:keys [photo-path - status - last-online]} (if @group-chat + (let [{:keys [status]} (if @group-chat {:photo-path nil :status nil :last-online 0} @@ -354,7 +352,7 @@ {:component-did-update on-update :reagent-render - (fn [message & children] + (fn [_ & children] @layout-height [animated-view {:style (st/message-animated-container anim-value)} (into [view {:style (st/message-container window-width) @@ -377,7 +375,7 @@ :from from :message-id message-id}]))) :reagent-render - (fn [{:keys [outgoing group-chat clock-value] :as message}] + (fn [{:keys [outgoing group-chat] :as message}] [message-container message [view (let [incoming-group (and group-chat (not outgoing))] diff --git a/src/status_im/chat/views/message_input.cljs b/src/status_im/chat/views/message_input.cljs index 49ad30f116..74ab74cd59 100644 --- a/src/status_im/chat/views/message_input.cljs +++ b/src/status_im/chat/views/message_input.cljs @@ -28,14 +28,10 @@ :editable (not disable?) :on-submit-editing plain-message/send}) -(defn on-press-commands-handler - [{:keys [suggestions-trigger]}] - #(dispatch [:send-command!])) - -(defn command-input-options [command icon-width disable?] +(defn command-input-options [icon-width disable?] {:style (st-response/command-input icon-width disable?) :on-change-text (when-not disable? command/set-input-message) - :on-submit-editing (on-press-commands-handler command)}) + :on-submit-editing #(dispatch [:send-command!])}) (defview message-input [input-options set-layout-size] [input-message [:get-chat-input-text] @@ -59,12 +55,12 @@ :default-value (or input-message "")} input-options)]) -(defview command-input [input-options {:keys [fullscreen] :as command}] +(defview command-input [input-options {:keys [fullscreen]}] [input-command [:get-chat-command-content] icon-width [:command-icon-width] disable? [:get :disable-input]] [text-input (merge - (command-input-options command icon-width disable?) + (command-input-options icon-width disable?) {:auto-focus (not fullscreen) :blur-on-submit false :accessibility-label :input @@ -106,7 +102,7 @@ (when (or (and @command? (not (str/blank? @input-command))) @valid-plain-message?) (let [on-press (if @command? - (on-press-commands-handler @command) + #(dispatch [:send-command!]) plain-message/send)] [send-button {:on-press #(do (dispatch [:set-chat-ui-props :show-emoji? false]) (on-press %))}])) diff --git a/src/status_im/chat/views/plain_message.cljs b/src/status_im/chat/views/plain_message.cljs index d744fce3eb..d8f9628786 100644 --- a/src/status_im/chat/views/plain_message.cljs +++ b/src/status_im/chat/views/plain_message.cljs @@ -38,7 +38,7 @@ :delay delay}) #(dispatch [:set :disable-input false]))))) -(defn commands-button [height on-press] +(defn commands-button [_ _] (let [command? (subscribe [:command?]) requests (subscribe [:get-requests]) suggestions (subscribe [:get-suggestions]) @@ -61,7 +61,7 @@ (dispatch [:switch-command-suggestions!]) (on-press)) :disabled @command?} - [animated-view {:style (st/message-input-button-touchable container-width height)} + [animated-view {:style (st/message-input-button-touchable container-width)} (when-not @command? [animated-view {:style (st/message-input-button buttons-scale @@ -84,7 +84,7 @@ (when (and @command? (.-finished e)) (anim/set-value width 0.1))))))) -(defn smile-button [height] +(defn smile-button [_] (let [command? (subscribe [:command?]) buttons-scale (anim/create-value (if @command? 1 0)) container-width (anim/create-value (if @command? 0.1 56)) @@ -102,6 +102,6 @@ [touchable-highlight {:on-press #(do (dispatch [:toggle-chat-ui-props :show-emoji?]) (dismiss-keyboard!)) :disabled @command?} - [animated-view {:style (st/message-input-button-touchable container-width height)} + [animated-view {:style (st/message-input-button-touchable container-width)} [animated-view {:style (st/message-input-button buttons-scale 16)} [icon :smile st/smile-icon]]]])}))) diff --git a/src/status_im/chat/views/request_message.cljs b/src/status_im/chat/views/request_message.cljs index 77acdd7b43..18cb9bb2bc 100644 --- a/src/status_im/chat/views/request_message.cljs +++ b/src/status_im/chat/views/request_message.cljs @@ -45,7 +45,7 @@ (anim/start (button-animation val min-scale loop? answered?))))) -(defn request-button [message-id command status-initialized? top-offset?] +(defn request-button [message-id _ _ top-offset?] (let [scale-anim-val (anim/create-value min-scale) answered? (subscribe [:is-request-answered? message-id]) loop? (r/atom true) @@ -71,7 +71,7 @@ [icon command-icon st/command-request-image])]]))}))) (defn message-content-command-request - [{:keys [message-id content from incoming-group]}] + [{:keys [message-id _ _ _]}] (let [top-offset (r/atom {:specified? false}) commands-atom (subscribe [:get-responses]) answered? (subscribe [:is-request-answered? message-id]) diff --git a/src/status_im/chat/views/response.cljs b/src/status_im/chat/views/response.cljs index cc1cc5f1ae..c6b09d141d 100644 --- a/src/status_im/chat/views/response.cljs +++ b/src/status_im/chat/views/response.cljs @@ -61,7 +61,7 @@ layout-height :fix-response-height) command (subscribe [:get-chat-command])] - (fn [response-height] + (fn [_] (if (= :response (:type @command)) [view (merge (drag/pan-handlers pan-responder) {:style (st/request-info (:color @command))}) @@ -86,7 +86,7 @@ :duration 300})) (anim/set-value val to-value)))))) -(defn container [response-height & children] +(defn container [response-height & _] (let [;; todo to-response-height, cur-response-height must be specific ;; for each chat to-response-height (subscribe [:response-height :default]) diff --git a/src/status_im/chat/views/suggestions.cljs b/src/status_im/chat/views/suggestions.cljs index 29dbf771fa..007a13bd3f 100644 --- a/src/status_im/chat/views/suggestions.cljs +++ b/src/status_im/chat/views/suggestions.cljs @@ -101,7 +101,7 @@ (anim/start (anim/spring val {:toValue to-value})) (anim/set-value val to-value)))))) -(defn container [h & elements] +(defn container [h & _] (let [;; todo to-response-height, cur-response-height must be specific ;; for each chat to-response-height (subscribe [:command-suggestions-height]) diff --git a/src/status_im/commands/handlers/jail.cljs b/src/status_im/commands/handlers/jail.cljs index 6386ebe724..6ce7a405be 100644 --- a/src/status_im/commands/handlers/jail.cljs +++ b/src/status_im/commands/handlers/jail.cljs @@ -57,7 +57,7 @@ (defn suggestions-events-handler! [{:keys [current-chat-id] :as db} [[n data]]] (log/debug "Suggestion event: " data) - (let [{:keys [dapp?] :as contact} (get-in db [:contacts current-chat-id]) + (let [{:keys [dapp?]} (get-in db [:contacts current-chat-id]) command? (= :command (:type (cm/get-chat-command db)))] (case (keyword n) :set-value (if command? diff --git a/src/status_im/commands/handlers/loading.cljs b/src/status_im/commands/handlers/loading.cljs index b36dd22311..3db3ae0eae 100644 --- a/src/status_im/commands/handlers/loading.cljs +++ b/src/status_im/commands/handlers/loading.cljs @@ -27,7 +27,7 @@ (dispatch [::fetch-commands! identity]))) (defn fetch-commands! - [db [{:keys [whisper-identity dapp? dapp-url]}]] + [_ [{:keys [whisper-identity dapp? dapp-url]}]] (when true ;-let [url (get-in db [:chats identity :dapp-url])] (cond @@ -168,12 +168,12 @@ (u/side-effect! (fn [{:keys [chats]}] (doseq [[id {:keys [name photo-path public-key add-chat? - dapp? dapp-url dapp-hash] :as contact}] js-res/default-contacts] - (let [id (clojure.core/name id)] - (when-not (chats id) + dapp? dapp-url dapp-hash]}] js-res/default-contacts] + (let [id' (clojure.core/name id)] + (when-not (chats id') (when add-chat? - (dispatch [:add-chat id {:name (:en name)}])) - (dispatch [:add-contacts [{:whisper-identity id + (dispatch [:add-chat id' {:name (:en name)}])) + (dispatch [:add-contacts [{:whisper-identity id' :name (:en name) :photo-path photo-path :public-key public-key diff --git a/src/status_im/components/carousel/carousel.cljs b/src/status_im/components/carousel/carousel.cljs index 5d6681d1b0..bef7f195d5 100644 --- a/src/status_im/components/carousel/carousel.cljs +++ b/src/status_im/components/carousel/carousel.cljs @@ -129,12 +129,6 @@ (when (pos? initial-page) (go-to-page component initial-page)))) -(defn component-will-update [component new-argv] - (log/debug "component-will-update: ")) - -(defn component-did-update [component old-argv] - (log/debug "component-did-update")) - (defn component-will-receive-props [component new-argv] (let [props (rc/extract-props new-argv)] (log/debug "component-will-receive-props: props=" props) @@ -163,7 +157,6 @@ (let [page-width (get-page-width data) page-style (get-page-style data) gap (get-gap data) - sneak (get-sneak data) count (get-count data)] (doall (map-indexed (fn [index child] (let [page-index index @@ -180,11 +173,10 @@ (let [starting-position (atom 0) component (reagent.core/current-component) state (reagent.core/state component) - sneak (get-sneak state) gap (get-gap state)] (log/debug "reagent-render: " data state) [view {:style st/scroll-view-container} - [scroll-view {:contentContainerStyle (st/content-container sneak gap) + [scroll-view {:contentContainerStyle (st/content-container gap) :automaticallyAdjustContentInsets false :bounces false :decelerationRate 0.9 @@ -197,12 +189,10 @@ :ref #(set! (.-scrollView component) %)} (get-pages component state children)]])) -(defn carousel [data children] +(defn carousel [_ _] (let [component-data {:component-did-mount component-did-mount :component-will-mount component-will-mount :component-will-receive-props component-will-receive-props - :component-will-update component-will-update - :component-did-update component-did-update :display-name "carousel" :reagent-render reagent-render}] (reagent.core/create-class component-data))) diff --git a/src/status_im/components/carousel/styles.cljs b/src/status_im/components/carousel/styles.cljs index 4c4e84cabd..81d80efeac 100644 --- a/src/status_im/components/carousel/styles.cljs +++ b/src/status_im/components/carousel/styles.cljs @@ -3,7 +3,7 @@ (def scroll-view-container {:flex 1}) -(defn content-container [sneak gap] +(defn content-container [gap] {:paddingLeft (quot gap 2) :paddingRight (quot gap 2)}) diff --git a/src/status_im/components/drawer/view.cljs b/src/status_im/components/drawer/view.cljs index 4ce3d389d6..5f7c366931 100644 --- a/src/status_im/components/drawer/view.cljs +++ b/src/status_im/components/drawer/view.cljs @@ -56,8 +56,7 @@ status-text (r/atom nil)] (fn [] (let [{:keys [name photo-path status]} @account - {new-name :name - new-status :status} @profile] + {new-name :name} @profile] [view st/drawer-menu [touchable-without-feedback {:on-press #(dismiss-keyboard!)} [view st/drawer-menu diff --git a/src/status_im/components/selectable_field/view.cljs b/src/status_im/components/selectable_field/view.cljs index 64598295dc..cd4ef52494 100644 --- a/src/status_im/components/selectable_field/view.cljs +++ b/src/status_im/components/selectable_field/view.cljs @@ -14,7 +14,7 @@ (r/set-state component {:focused? true})) (defn- on-selection-change - [event component] + [event _] (let [selection (.-selection (.-nativeEvent event)) start (.-start selection) end (.-end selection)] diff --git a/src/status_im/components/tabs/tabs.cljs b/src/status_im/components/tabs/tabs.cljs index 27e7310aab..192694708d 100644 --- a/src/status_im/components/tabs/tabs.cljs +++ b/src/status_im/components/tabs/tabs.cljs @@ -31,7 +31,7 @@ (anim/timing val {:toValue to-value :duration 300}))))))) -(defn tabs-container [& children] +(defn tabs-container [& _] (let [chats-scrolled? (subscribe [:get :chats-scrolled?]) tabs-bar-value (subscribe [:animations :tabs-bar-value]) shadows? (get-in platform-specific [:tabs :tab-shadows?]) @@ -52,7 +52,7 @@ :pointerEvents (if @chats-scrolled? :none :auto)}] children))}))) -(defn tabs [{:keys [tab-list selected-view-id prev-view-id swiper]}] +(defn tabs [{:keys [tab-list selected-view-id prev-view-id]}] [tabs-container [view st/tabs-inner-container (doall (map-indexed #(create-tab %1 %2 selected-view-id prev-view-id) tab-list))]]) diff --git a/src/status_im/components/text_field/view.cljs b/src/status_im/components/text_field/view.cljs index 3a9c6402f6..f586bf42d5 100644 --- a/src/status_im/components/text_field/view.cljs +++ b/src/status_im/components/text_field/view.cljs @@ -50,7 +50,7 @@ ; Invoked once before the component is mounted. The return value will be used ; as the initial value of this.state. -(defn get-initial-state [component] +(defn get-initial-state [_] {:has-focus false :float-label? false :label-top 0 @@ -62,7 +62,7 @@ ; rendering occurs. If you call setState within this method, render() will see ; the updated state and will be executed only once despite the state change. (defn component-will-mount [component] - (let [{:keys [value] :as props} (r/props component) + (let [{:keys [value]} (r/props component) data {:label-top (anim/create-value (if (s/blank? value) (:label-bottom config) (:label-top config))) @@ -73,50 +73,6 @@ ;(log/debug "component-will-mount") (r/set-state component data))) -; Invoked once, only on the client (not on the server), immediately after the -; initial rendering occurs. At this point in the lifecycle, you can access any -; refs to your children (e.g., to access the underlying DOM representation). -; The componentDidMount() method of child components is invoked before that of -; parent components. -(defn component-did-mount [component] - (let [props (r/props component)] - ;(log/debug "component-did-mount:") - )) - -; Invoked when a component is receiving new props. This method is not called for -; the initial render. Use this as an opportunity to react to a prop transition -; before render() is called by updating the state using this.setState(). -; The old props can be accessed via this.props. Calling this.setState() within -; this function will not trigger an additional render. -(defn component-will-receive-props [component new-props] - ;(log/debug "component-will-receive-props: new-props=" new-props) - ) - -; Invoked before rendering when new props or state are being received. This method -; is not called for the initial render or when forceUpdate is used. Use this as -; an opportunity to return false when you're certain that the transition to the -; new props and state will not require a component update. -; If shouldComponentUpdate returns false, then render() will be completely skipped -; until the next state change. In addition, componentWillUpdate and -; componentDidUpdate will not be called. -(defn should-component-update [component next-props next-state] - ;(log/debug "should-component-update: " next-props next-state) - true) - -; Invoked immediately before rendering when new props or state are being received. -; This method is not called for the initial render. Use this as an opportunity -; to perform preparation before an update occurs. -(defn component-will-update [component next-props next-state] - ;(log/debug "component-will-update: " next-props next-state) - ) - -; Invoked immediately after the component's updates are flushed to the DOM. -; This method is not called for the initial render. Use this as an opportunity -; to operate on the DOM when the component has been updated. -(defn component-did-update [component prev-props prev-state] - ;(log/debug "component-did-update: " prev-props prev-state) - ) - (defn on-input-focus [{:keys [component animation onFocus]}] (do (log/debug "input focused") @@ -136,10 +92,9 @@ (defn get-width [event] (.-width (.-layout (.-nativeEvent event)))) -(defn reagent-render [data children] +(defn reagent-render [_ _] (let [component (r/current-component) - {:keys [has-focus - float-label? + {:keys [float-label? label-top label-font-size line-width @@ -189,14 +144,9 @@ [animated-view {:style (st/underline focus-line-color line-width)}]] [text {:style (st/error-text error-color)} error]])) -(defn text-field [data children] +(defn text-field [_ _] (let [component-data {:get-initial-state get-initial-state :component-will-mount component-will-mount - :component-did-mount component-did-mount - :component-will-receive-props component-will-receive-props - :should-component-update should-component-update - :component-will-update component-will-update - :component-did-update component-did-update :display-name "text-field" :reagent-render reagent-render}] ;(log/debug "Creating text-field component: " data) diff --git a/src/status_im/components/toolbar/view.cljs b/src/status_im/components/toolbar/view.cljs index 3e16b1c35a..8997450515 100644 --- a/src/status_im/components/toolbar/view.cljs +++ b/src/status_im/components/toolbar/view.cljs @@ -57,7 +57,6 @@ (dispatch [:set-in [:toolbar-search :text] nil]))) (defn- toolbar-with-search-content [{:keys [show-search? - search-key search-placeholder title on-search-submit]}] diff --git a/src/status_im/data_store/messages.cljs b/src/status_im/data_store/messages.cljs index 5801eaca81..381a91bb12 100644 --- a/src/status_im/data_store/messages.cljs +++ b/src/status_im/data_store/messages.cljs @@ -84,7 +84,7 @@ message)))))) (defn get-last-message - [db chat-id] + [chat-id] (if-let [{:keys [content-type] :as message} (data-store/get-last-message chat-id)] (if (command-type? content-type) (clojure.core/update message :content str-to-map) diff --git a/src/status_im/data_store/realm/chats.cljs b/src/status_im/data_store/realm/chats.cljs index d90b04e6e5..50a30047cc 100644 --- a/src/status_im/data_store/realm/chats.cljs +++ b/src/status_im/data_store/realm/chats.cljs @@ -64,14 +64,14 @@ (defn has-contact? [chat-id identity] (let [contacts (get-contacts chat-id) - contact (.find contacts (fn [object index collection] + contact (.find contacts (fn [object _ _] (= identity (aget object "identity"))))] (if contact true false))) (defn- save-contacts [identities contacts added-at] (doseq [contact-identity identities] - (if-let [contact (.find contacts (fn [object index collection] + (if-let [contact (.find contacts (fn [object _ _] (= contact-identity (aget object "identity"))))] (doto contact (aset "is-in-chat" true) @@ -89,7 +89,7 @@ (defn- delete-contacts [identities contacts] (doseq [contact-identity identities] - (when-let [contact (.find contacts (fn [object index collection] + (when-let [contact (.find contacts (fn [object _ _] (= contact-identity (aget object "identity"))))] (realm/delete @realm/account-realm contact)))) diff --git a/src/status_im/data_store/realm/commands.cljs b/src/status_im/data_store/realm/commands.cljs index 187da5172f..2353cbca33 100644 --- a/src/status_im/data_store/realm/commands.cljs +++ b/src/status_im/data_store/realm/commands.cljs @@ -4,7 +4,7 @@ (defn get-by-chat-id [chat-id] (realm/get-one-by-field-clj @realm/account-realm :command - :chat-id identity)) + :chat-id chat-id)) (defn save [command] diff --git a/src/status_im/data_store/realm/core.cljs b/src/status_im/data_store/realm/core.cljs index 486e3ed763..374b714ac0 100644 --- a/src/status_im/data_store/realm/core.cljs +++ b/src/status_im/data_store/realm/core.cljs @@ -152,10 +152,9 @@ (:type field-def) field-def))) -(defmulti to-query (fn [realm schema-name operator field value] - operator)) +(defmulti to-query (fn [_ _ operator _ _] operator)) -(defmethod to-query :eq [schema schema-name operator field value] +(defmethod to-query :eq [schema schema-name _ field value] (let [value (to-string value) field-type (field-type schema schema-name field) escaped-value (when value (str/replace (str value) #"\"" "\\\"")) diff --git a/src/status_im/data_store/realm/schemas/account/v1/chat.cljs b/src/status_im/data_store/realm/schemas/account/v1/chat.cljs index 6223b65c64..c84f57c819 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/chat.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/chat.cljs @@ -36,5 +36,5 @@ :contact-info {:type :string :optional true}}}) -(defn migration [old-realm new-realm] +(defn migration [_ _] (log/debug "migrating chat schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v1/chat_contact.cljs b/src/status_im/data_store/realm/schemas/account/v1/chat_contact.cljs index 49fccbe81f..aa671873a5 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/chat_contact.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/chat_contact.cljs @@ -6,5 +6,5 @@ :is-in-chat {:type "bool" :default true}}}) -(defn migration [old-realm new-realm] - (log/debug "migrating chat-contact schema")) \ No newline at end of file +(defn migration [_ _] + (log/debug "migrating chat-contact schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v1/command.cljs b/src/status_im/data_store/realm/schemas/account/v1/command.cljs index b731766c0c..cfbab8f882 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/command.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/command.cljs @@ -6,5 +6,5 @@ :properties {:chat-id "string" :file "string"}}) -(defn migration [old-realm new-realm] - (log/debug "migrating command schema")) \ No newline at end of file +(defn migration [_ _] + (log/debug "migrating command schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v1/contact.cljs b/src/status_im/data_store/realm/schemas/account/v1/contact.cljs index d49edcbf74..929c807f89 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/contact.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/contact.cljs @@ -22,5 +22,5 @@ :dapp-hash {:type :int :optional true}}}) -(defn migration [old-realm new-realm] +(defn migration [_ _] (log/debug "migrating contact schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v1/discover.cljs b/src/status_im/data_store/realm/schemas/account/v1/discover.cljs index 7f96cc846c..e11ddaf18f 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/discover.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/discover.cljs @@ -12,5 +12,5 @@ :objectType "tag"} :created-at {:type "int" :default 0}}}) -(defn migration [old-realm new-realm] +(defn migration [_ _] (log/debug "migrating discover schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v1/kv_store.cljs b/src/status_im/data_store/realm/schemas/account/v1/kv_store.cljs index 011a1ac552..7b5fd9a5cc 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/kv_store.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/kv_store.cljs @@ -6,5 +6,5 @@ :properties {:key "string" :value "string"}}) -(defn migration [old-realm new-realm] - (log/debug "migrating kv-store schema")) \ No newline at end of file +(defn migration [_ _] + (log/debug "migrating kv-store schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v1/message.cljs b/src/status_im/data_store/realm/schemas/account/v1/message.cljs index c724cdc9a4..46851001c2 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/message.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/message.cljs @@ -32,5 +32,5 @@ :show? {:type :bool :default true}}}) -(defn migration [old-realm new-realm] +(defn migration [_ _] (log/debug "migrating message schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v1/pending_message.cljs b/src/status_im/data_store/realm/schemas/account/v1/pending_message.cljs index de046ef935..bc5e7e87c5 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/pending_message.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/pending_message.cljs @@ -18,5 +18,5 @@ :attempts :int :was-sent? :bool}}) -(defn migration [old-realm new-realm] - (log/debug "migrating pending-message schema")) \ No newline at end of file +(defn migration [_ _] + (log/debug "migrating pending-message schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v1/processed_message.cljs b/src/status_im/data_store/realm/schemas/account/v1/processed_message.cljs index a6ce431abf..46a5209ec2 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/processed_message.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/processed_message.cljs @@ -9,5 +9,5 @@ :optional true} :ttl :int}}) -(defn migration [old-realm new-realm] +(defn migration [_ _] (log/debug "migrating processed-message schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v1/request.cljs b/src/status_im/data_store/realm/schemas/account/v1/request.cljs index 832b79d9dc..f2fa9bd054 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/request.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/request.cljs @@ -9,5 +9,5 @@ :default "open"} :added :date}}) -(defn migration [old-realm new-realm] - (log/debug "migrating request schema")) \ No newline at end of file +(defn migration [_ _] + (log/debug "migrating request schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v1/tag.cljs b/src/status_im/data_store/realm/schemas/account/v1/tag.cljs index 6f081b9df6..571263e3b7 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/tag.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/tag.cljs @@ -6,5 +6,5 @@ :properties {:name "string" :count {:type "int" :optional true :default 0}}}) -(defn migration [old-realm new-realm] - (log/debug "migrating tag schema")) \ No newline at end of file +(defn migration [_ _] + (log/debug "migrating tag schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v1/user_status.cljs b/src/status_im/data_store/realm/schemas/account/v1/user_status.cljs index ae388e4b56..2b8fcb2d8f 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/user_status.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/user_status.cljs @@ -8,5 +8,5 @@ :default ""} :status "string"}}) -(defn migration [old-realm new-realm] - (log/debug "migrating user-status schema")) \ No newline at end of file +(defn migration [_ _] + (log/debug "migrating user-status schema")) diff --git a/src/status_im/data_store/realm/schemas/base/v1/account.cljs b/src/status_im/data_store/realm/schemas/base/v1/account.cljs index ddd68ba18f..19d34561b6 100644 --- a/src/status_im/data_store/realm/schemas/base/v1/account.cljs +++ b/src/status_im/data_store/realm/schemas/base/v1/account.cljs @@ -19,5 +19,5 @@ :default false} :network :string}}) -(defn migration [old-realm new-realm] +(defn migration [_ _] (log/debug "migrating account schema")) diff --git a/src/status_im/data_store/realm/schemas/base/v1/kv_store.cljs b/src/status_im/data_store/realm/schemas/base/v1/kv_store.cljs index 8bc17ec68c..4830de1110 100644 --- a/src/status_im/data_store/realm/schemas/base/v1/kv_store.cljs +++ b/src/status_im/data_store/realm/schemas/base/v1/kv_store.cljs @@ -6,5 +6,5 @@ :properties {:key "string" :value "string"}}) -(defn migration [old-realm new-realm] - (log/debug "migrating kv-store schema")) \ No newline at end of file +(defn migration [_ _] + (log/debug "migrating kv-store schema")) diff --git a/src/status_im/discover/handlers.cljs b/src/status_im/discover/handlers.cljs index fc483e140f..3e2a783242 100644 --- a/src/status_im/discover/handlers.cljs +++ b/src/status_im/discover/handlers.cljs @@ -54,7 +54,7 @@ (register-handler :status-received (u/side-effect! - (fn [{:keys [discoveries] :as db} [_ {:keys [from payload]}]] + (fn [{:keys [discoveries]} [_ {:keys [from payload]}]] (when (and (not (discoveries/exists? (:message-id payload))) (not (get discoveries (:message-id payload)))) (let [{:keys [message-id status hashtags profile]} payload diff --git a/src/status_im/group_settings/handlers.cljs b/src/status_im/group_settings/handlers.cljs index c475bdade5..bb6e411c00 100644 --- a/src/status_im/group_settings/handlers.cljs +++ b/src/status_im/group_settings/handlers.cljs @@ -75,7 +75,7 @@ remove-identities selected-participants)) (defn remove-members-from-chat! - [{:keys [current-chat-id selected-participants] :as db} _] + [{:keys [current-chat-id selected-participants]} _] (chats/remove-contacts current-chat-id selected-participants)) (defn notify-about-removing! diff --git a/src/status_im/handlers.cljs b/src/status_im/handlers.cljs index 48337c6507..c11993f295 100644 --- a/src/status_im/handlers.cljs +++ b/src/status_im/handlers.cljs @@ -106,7 +106,7 @@ (.addEntropy (.. ecc -sjcl -random))) (dispatch [:crypt-initialized])))))))) -(defn node-started [db result] +(defn node-started [_ _] (log/debug "Started Node") (enet/get-network #(dispatch [:set :network %]))) @@ -131,7 +131,7 @@ (register-handler :status-module-initialized! (after (u/side-effect! - (fn [db] + (fn [_] (status/module-initialized!)))) (fn [db] (assoc db :status-module-initialized? true))) diff --git a/src/status_im/protocol/discoveries.cljs b/src/status_im/protocol/discoveries.cljs index 2432f44988..9bffca3120 100644 --- a/src/status_im/protocol/discoveries.cljs +++ b/src/status_im/protocol/discoveries.cljs @@ -47,7 +47,7 @@ (l/message-listener (dissoc options :identity)))) (defn stop-watching-user! - [{:keys [web3 identity] :as options}] + [{:keys [web3 identity]}] (f/remove-filter! web3 {:from identity diff --git a/src/status_im/protocol/handlers.cljs b/src/status_im/protocol/handlers.cljs index b16ad3c288..6c4718a694 100644 --- a/src/status_im/protocol/handlers.cljs +++ b/src/status_im/protocol/handlers.cljs @@ -281,9 +281,8 @@ (messages/update message))))))) (defn save-message-clock-value! - [{:keys [message-extras] :as db} - [_ {:keys [from] - {:keys [message-id clock-value]} :payload}]] + [{:keys [message-extras]} + [_ {{:keys [message-id clock-value]} :payload}]] (when-let [{old-clock-value :clock-value :as message} (merge (messages/get-by-id message-id) (get message-extras message-id))] @@ -330,7 +329,7 @@ (register-handler :message-clock-value-request (u/side-effect! - (fn [db [_ {:keys [from] {:keys [message-id]} :payload}]] + (fn [_ [_ {:keys [from] {:keys [message-id]} :payload}]] (let [{:keys [chat-id]} (messages/get-by-id message-id) message-overhead (chats/get-message-overhead chat-id) last-clock-value (messages/get-last-clock-value chat-id)] @@ -346,11 +345,9 @@ (register-handler :message-clock-value (after save-message-clock-value!) (fn [{:keys [message-extras] :as db} - [_ {:keys [from] - {:keys [message-id clock-value]} :payload}]] - (if-let [{old-clock-value :clock-value - :as message} (merge (messages/get-by-id message-id) - (get message-extras message-id))] + [_ {{:keys [message-id clock-value]} :payload}]] + (if-let [{old-clock-value :clock-value} (merge (messages/get-by-id message-id) + (get message-extras message-id))] (if (> clock-value old-clock-value) (assoc-in db [:message-extras message-id] {:clock-value clock-value :show? true}) diff --git a/src/status_im/transactions/handlers.cljs b/src/status_im/transactions/handlers.cljs index e270a54cd0..1c50d39096 100644 --- a/src/status_im/transactions/handlers.cljs +++ b/src/status_im/transactions/handlers.cljs @@ -69,7 +69,7 @@ (register-handler ::discard-transaction (u/side-effect! - (fn [db [_ id]] + (fn [_ [_ id]] (status/discard-transaction id)))) (register-handler ::remove-transactions